THREESCALE-10236 Custom CA certificate support for operator deployment#1181
Draft
borisurbanik wants to merge 7 commits into
Draft
THREESCALE-10236 Custom CA certificate support for operator deployment#1181borisurbanik wants to merge 7 commits into
borisurbanik wants to merge 7 commits into
Conversation
Implements openspec task ca-client-configuration. - Add PortaClientFromURLWithTLSConfig to pkg/controller/helper/threescale_api.go: when tlsConfig is non-nil it is used directly as the transport TLS config; when nil, delegates to PortaClientFromURL unchanged. - Add three test cases to threescale_api_test.go covering: nil+insecureSkipVerify=false rejects untrusted cert, custom CA succeeds, nil+insecureSkipVerify=true accepts cert.
…e API calls - Add PortaClientWithTLSConfig convenience wrapper to pkg/controller/helper/threescale_api.go - Add CAProvider field to all 11 capabilities reconciler structs - Replace PortaClient call sites in 9 controllers with CAProvider.TLSConfig() + PortaClientWithTLSConfig - Rewrite TenantReconciler.setupPortaClient to use url.Parse + PortaClientFromURLWithTLSConfig - Construct a single shared *CAProvider in main.go and inject into all 11 reconcilers - Add per-controller unit tests verifying invalid CA bundle surfaces as a status condition
Replace the one-shot loaded flag with a ResourceVersion-keyed cache. TLSConfig re-parses only when the ConfigMap version changes; the Get is served from the controller-runtime in-memory cache so there is no extra network cost per reconcile. Thread ctx through the helper methods in each capabilities controller so the Get can be cancelled with the reconcile context. Adds TestCAProvider_AutoReload (no Reload needed after cm update) and TestCAProvider_CacheHit (same pointer returned on cache hit).
Introduce cacheEntry struct holding config, cachedErr and resourceVersion together. All three fields are now read and written as a single value under the mutex, eliminating the possibility of a partial read across the three fields. loadFromConfigMap becomes a pure function returning a cacheEntry instead of a method that mutates shared state while the caller holds the write lock. Remove concurrency tests that used time.Sleep-bounded loops; drop the now-unused sync and time imports.
|
Skipping CI for Draft Pull Request. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1181 +/- ##
==========================================
+ Coverage 42.67% 47.52% +4.84%
==========================================
Files 204 205 +1
Lines 20899 21101 +202
==========================================
+ Hits 8919 10028 +1109
+ Misses 11212 10079 -1133
- Partials 768 994 +226
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP
The 3scale operator connects to the 3scale Admin API (and, via the Tenant controller, the Master API) to reconcile capabilities CRs (Backend, Product, Application, ActiveDoc, etc.). These connections use HTTPS.
In environments where 3scale is deployed with internal or self-signed CA, the operator's HTTP client rejects the connection because the CA is not in the system trust store. The existing workarounds — the
insecure_skip_verifyannotation and patching the operator Subscription to mount a CA viaSSL_CERT_FILE(Red Hat Solution 7049968) — are either insecure or fragile (overwritten on upgrades).Customers need a way to provide a custom CA bundle so the operator can trust internal CAs without disabling verification.
Sources of 3scale connections (each with different credential configuration):
providerAccountRef: the CR references a Secret containingadminURLandtoken.threescale-provider-accountsecret: a well-known Secret name. Same schema as source 1 but discovered by convention.system-seed.masterCredentialsRefsecret (defaulting tosystem-seed) containing master API credentials.