-
Notifications
You must be signed in to change notification settings - Fork 5
feat: support a CA bundle for the control plane connection #447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
867db94
8090806
256b91c
6d905a8
b4bd118
9961216
c30f670
0f58726
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,7 +84,11 @@ type ADCServerOpts struct { | |
| LabelSelector map[string]string `json:"labelSelector,omitempty"` | ||
| IncludeResourceType []string `json:"includeResourceType,omitempty"` | ||
| TlsSkipVerify *bool `json:"tlsSkipVerify,omitempty"` | ||
| CacheKey string `json:"cacheKey"` | ||
| // CaCert is the PEM-encoded CA certificate (or bundle) the ADC server verifies | ||
| // the control plane against. Older ADC servers ignore it, and omitempty keeps | ||
| // requests without a CA bundle byte for byte what they were. | ||
| CaCert string `json:"caCert,omitempty"` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P1] Ship an ADC version that honors |
||
| CacheKey string `json:"cacheKey"` | ||
| // BypassCache is only accepted by the /sync task of ADC >= 0.27.0. Both ADC task | ||
| // schemas reject unknown fields, so omitempty is what keeps every other request -- | ||
| // /validate, and every sync that is not recovering from a rejection -- byte for byte | ||
|
|
@@ -103,6 +107,7 @@ func (r ADCServerRequest) MarshalLog() any { | |
| "labelSelector": r.Task.Opts.LabelSelector, | ||
| "includeResourceType": r.Task.Opts.IncludeResourceType, | ||
| "tlsSkipVerify": r.Task.Opts.TlsSkipVerify, | ||
| "hasCaCert": r.Task.Opts.CaCert != "", | ||
| "cacheKey": r.Task.Opts.CacheKey, | ||
| "config": r.Task.Config.MarshalLog(), | ||
| } | ||
|
|
@@ -244,7 +249,7 @@ func (e *HTTPADCExecutor) runHTTPSyncForSingleServer(ctx context.Context, server | |
| } | ||
|
|
||
| // Build HTTP request | ||
| req, err := e.buildHTTPRequest(ctx, serverAddr, config, labels, types, resources, http.MethodPut, pathSync) | ||
| req, err := e.buildHTTPRequest(ctx, serverAddr, config, labels, types, resources, pathSync) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to build HTTP request: %w", err) | ||
| } | ||
|
|
@@ -278,7 +283,7 @@ func (e *HTTPADCExecutor) runHTTPValidateForSingleServer(ctx context.Context, se | |
| return fmt.Errorf("failed to load resources from file %s: %w", filePath, err) | ||
| } | ||
|
|
||
| req, err := e.buildHTTPRequest(ctx, serverAddr, config, labels, types, resources, http.MethodPut, pathValidate) | ||
| req, err := e.buildHTTPRequest(ctx, serverAddr, config, labels, types, resources, pathValidate) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to build validate request: %w", err) | ||
| } | ||
|
|
@@ -349,7 +354,7 @@ func (e *HTTPADCExecutor) loadResourcesFromFile(filePath string) (*adctypes.Reso | |
| } | ||
|
|
||
| // buildHTTPRequest builds the HTTP request for ADC Server | ||
| func (e *HTTPADCExecutor) buildHTTPRequest(ctx context.Context, serverAddr string, config adctypes.Config, labels map[string]string, types []string, resources *adctypes.Resources, method string, path string) (*http.Request, error) { | ||
| func (e *HTTPADCExecutor) buildHTTPRequest(ctx context.Context, serverAddr string, config adctypes.Config, labels map[string]string, types []string, resources *adctypes.Resources, path string) (*http.Request, error) { | ||
| // Prepare request body | ||
| tlsVerify := config.TlsVerify | ||
| bypassCache := path == pathSync && config.BypassCache | ||
|
|
@@ -362,6 +367,7 @@ func (e *HTTPADCExecutor) buildHTTPRequest(ctx context.Context, serverAddr strin | |
| LabelSelector: labels, | ||
| IncludeResourceType: types, | ||
| TlsSkipVerify: ptr.To(!tlsVerify), | ||
| CaCert: config.CaCert, | ||
| CacheKey: config.Name, | ||
| BypassCache: bypassCache, | ||
| }, | ||
|
|
@@ -385,10 +391,11 @@ func (e *HTTPADCExecutor) buildHTTPRequest(ctx context.Context, serverAddr strin | |
| "labelSelector", labels, | ||
| "includeResourceType", types, | ||
| "tlsSkipVerify", !tlsVerify, | ||
| "hasCaCert", config.CaCert != "", | ||
| ) | ||
|
|
||
| // Create HTTP request | ||
| req, err := http.NewRequestWithContext(ctx, method, e.serverURL+path, bytes.NewBuffer(jsonData)) | ||
| req, err := http.NewRequestWithContext(ctx, http.MethodPut, e.serverURL+path, bytes.NewBuffer(jsonData)) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to create HTTP request: %w", err) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: api7/api7-ingress-controller
Length of output: 10521
🏁 Script executed:
Repository: api7/api7-ingress-controller
Length of output: 11607
Handle Windows ADC archives in the download rule.
CI intentionally uses
ADC_VERSION=devin the E2E workflows. Thev0.29.0Linux and macOS assets match the.tar.gzdownload rule, but its Windows assets use.zip. If Windows is supported, select the correct archive format and extraction command.🤖 Prompt for AI Agents