refactor: dedup k8s config onto app.K8sConfig and remove redundant manager config section#7526
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors service configs to remove duplicate per-service KubernetesConfig structs by promoting flytestdlib/app.K8sConfig into the shared, config-loadable type used across manager, actions, and secret.
Changes:
- Added
json/pflagtags toflytestdlib/app.K8sConfigso it can be loaded from config and used for flag generation. - Updated
managerandactionsto useapp.K8sConfigdirectly and pass it straight intoInitKubernetesClient. - Updated
secretto embedapp.K8sConfig(json:",squash") alongsideClusterName, and added a decode test verifying squash behavior.
Reviewed changes
Copilot reviewed 8 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
flytestdlib/app/k8s.go |
Adds json/pflag tags to K8sConfig so it can serve as the shared config section type. |
manager/config/config.go |
Replaces local KubernetesConfig with app.K8sConfig in manager config. |
manager/config/config_flags.go |
Aligns generated flags/help text with app.K8sConfig tags. |
manager/config/config_flags_test.go |
Updates flag tests for the manager config changes. |
manager/cmd/main.go |
Simplifies k8s client init by passing cfg.Kubernetes directly. |
actions/config/config.go |
Replaces local KubernetesConfig with app.K8sConfig in actions config. |
actions/config/config_flags.go |
Exposes additional k8s flags now available via app.K8sConfig. |
actions/config/config_flags_test.go |
Updates/adds flag tests for the actions config changes. |
actions/cmd/main.go |
Simplifies k8s client init by passing cfg.Kubernetes directly. |
secret/config/config.go |
Embeds app.K8sConfig with json:",squash" and keeps ClusterName as secret-specific. |
secret/config/config_flags.go |
Regenerates flags for secret config (notably emits kubernetes.K8sConfig.* paths). |
secret/config/config_flags_test.go |
Updates secret flag tests to match the regenerated flag names. |
secret/config/squash_decode_test.go |
Adds a test proving json:",squash" decoding works for the embedded app.K8sConfig. |
secret/cmd/main.go |
Simplifies k8s client init to pass the embedded config directly. |
Files not reviewed (6)
- actions/config/config_flags.go: Generated file
- actions/config/config_flags_test.go: Generated file
- manager/config/config_flags.go: Generated file
- manager/config/config_flags_test.go: Generated file
- secret/config/config_flags.go: Generated file
- secret/config/config_flags_test.go: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
manager, actions, and secret each defined their own KubernetesConfig for the `kubernetes` config section. Promote flytestdlib/app.K8sConfig (the InitKubernetesClient input, already imported by every service) to the canonical config-loadable type: - app.K8sConfig: add json/pflag tags so it can back a config section. - manager, actions, secret: use app.K8sConfig directly as the `kubernetes` field; main.go passes cfg.Kubernetes straight to InitKubernetesClient (drops the convert step). actions gains qps/burst/timeout (InitKubernetesClient guards zero values, so no behavior change). - secret: its cluster-identity ClusterName is a service setting, not a k8s-client one, so it moves from secret.kubernetes.clusterName to a top-level secret.clusterName. All three then reuse app.K8sConfig with full pflag coverage. Schema change: secret.kubernetes.clusterName -> secret.clusterName (chart values.yaml updated to match). Signed-off-by: Kevin Su <pingsutw@gmail.com> Signed-off-by: Kevin Su <pingsutw@apache.org>
d343072 to
c279fe3
Compare
…etes config The unified binary's manager package duplicated config (server listen address, shared k8s client settings) that already lives in the runs and actions services. Remove the manager config section entirely and rewire manager/cmd to reuse runs.Server for the HTTP listen address and actions.Kubernetes for the shared k8s client. The dead Executor.HealthProbePort field is dropped (never read). The manager's previous k8s client tuning (QPS=1000, Burst=2000, Timeout=30s) is preserved on the actions Kubernetes config so the shared client behaves identically. Signed-off-by: Kevin Su <pingsutw@apache.org>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 15 changed files in this pull request and generated 2 comments.
Files not reviewed (4)
- actions/config/config_flags.go: Generated file
- actions/config/config_flags_test.go: Generated file
- secret/config/config_flags.go: Generated file
- secret/config/config_flags_test.go: Generated file
Move server config under runs.server and the shared k8s client config under actions.kubernetes, matching the removal of the manager config section. Drop the dead executor.healthProbePort and fix the webhook namespace comment to reference actions.kubernetes.namespace. Signed-off-by: Kevin Su <pingsutw@apache.org>
Signed-off-by: Kevin Su <pingsutw@apache.org>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 17 changed files in this pull request and generated 1 comment.
Files not reviewed (4)
- actions/config/config_flags.go: Generated file
- actions/config/config_flags_test.go: Generated file
- secret/config/config_flags.go: Generated file
- secret/config/config_flags_test.go: Generated file
| Kubernetes: app.K8sConfig{ | ||
| Namespace: "flyte", | ||
| QPS: 1000, | ||
| Burst: 2000, | ||
| Timeout: "30s", | ||
| }, |
Restore the previous schema where the secret service's cluster name lives under the kubernetes section (secret.kubernetes.clusterName) instead of a top-level secret.clusterName. Move ClusterName onto app.K8sConfig and read it via cfg.Kubernetes.ClusterName. Regenerate config_flags and update the chart values default accordingly. Signed-off-by: Kevin Su <pingsutw@apache.org>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 16 changed files in this pull request and generated 2 comments.
Files not reviewed (4)
- actions/config/config_flags.go: Generated file
- actions/config/config_flags_test.go: Generated file
- secret/config/config_flags.go: Generated file
- secret/config/config_flags_test.go: Generated file
| secret: | ||
| clusterName: flyte-devbox | ||
| kubernetes: | ||
| burst: 200 | ||
| clusterName: flyte-devbox | ||
| kubeconfig: "" |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Kevin Su <pingsutw@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 16 changed files in this pull request and generated 3 comments.
Files not reviewed (4)
- actions/config/config_flags.go: Generated file
- actions/config/config_flags_test.go: Generated file
- secret/config/config_flags.go: Generated file
- secret/config/config_flags_test.go: Generated file
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Kevin Su <pingsutw@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 16 changed files in this pull request and generated 2 comments.
Files not reviewed (4)
- actions/config/config_flags.go: Generated file
- actions/config/config_flags_test.go: Generated file
- secret/config/config_flags.go: Generated file
- secret/config/config_flags_test.go: Generated file
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Kevin Su <pingsutw@gmail.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 16 changed files in this pull request and generated 3 comments.
Files not reviewed (4)
- actions/config/config_flags.go: Generated file
- actions/config/config_flags_test.go: Generated file
- secret/config/config_flags.go: Generated file
- secret/config/config_flags_test.go: Generated file
Tracking issue
N/A — internal config cleanup.
Why are the changes needed?
Two related sources of config duplication in the v2 services:
manager,actions, andsecreteach defined their own near-duplicateKubernetesConfigstruct for theirkubernetesconfig section, even thoughflytestdlib/app.K8sConfig(the input toInitKubernetesClient) alreadydefines that exact shape.
managerpackage then carried a wholemanagerconfig section(
server,kubernetes,executor.healthProbePort) that just duplicatedconfig already owned by the
runsandactionsservices. The unified binarylistens on the run service's port and shares the actions service's k8s client,
so a separate
managersection was redundant.What changes were proposed in this pull request?
Promote
app.K8sConfigto the shared, config-loadable type:flytestdlib/app/k8s.go— addjson/pflagtags toK8sConfig. It alsocarries
ClusterName(used by the secret service for status reporting), so thesecret section keeps its previous
secret.kubernetes.clusterNameshape.manager/actions/secret— useapp.K8sConfigdirectly as thekubernetesfield and delete their localKubernetesConfig;main.gopassescfg.Kubernetesstraight toInitKubernetesClient(no convert step).Remove the
managerconfig section entirely:manager/config/(config.go+ generatedconfig_flags).manager/cmd/main.gonow reusesruns.Serverfor the HTTP listen address andactions.Kubernetesfor the shared k8s client, instead of a manager-specificsection.
Executor.HealthProbePortfield (defined but never read) is dropped.qps=1000,burst=2000,timeout=30s) is preserved by setting it on theactionskubernetesdefaults, so the shared client behaves identically.
manager/config.yamlupdated to match:serverunderruns.server,kubernetesunderactions.kubernetes.Schema change
The
managerconfig section is removed; the unified binary readsruns.serverand
actions.kubernetesinstead. The secret section is unchanged(
secret.kubernetes.*includingclusterName).How was this patch tested?
go build ./...,go vet,gofmtclean.config_flagsfor the affected sections; all flags present(
kubernetes.{namespace,kubeconfig,qps,burst,timeout,clusterName});go test ./secret/... ./actions/config/... ./manager/...passes.helm templaterenders the secret section withkubernetes.*(includingclusterName) for the client config.Labels
changed
Check all the applicable boxes