-
Notifications
You must be signed in to change notification settings - Fork 247
[Experimental] Support copying user resources to downstream clusters #4236
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
[Experimental] Support copying user resources to downstream clusters #4236
Conversation
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.
Just minor things and my main concern would be the CreateOrUpdate call with a "does nothing" MutateFn.
|
|
||
| secrets := corev1.SecretList{} | ||
|
|
||
| // XXX: should we log instead of erroring? |
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.
yup, I also wonder if we should log instead...
We can keep it with error for now, the resource was created by the BundleDeployment so I guess it should behave like any other BundleDeployment
That file and its contents were unused.
Bundle deployment options, therefore also bundles and HelmOps, can specify resources, pointed to by name and kind, to be copied from the bundle's namespace to each downstream cluster.
As a first step towards making downstream resources available in downstream clusters, the Fleet controller now copies secrets and config maps referenced in a bundle options' `DownstreamResources` field into the upstream namespace for each targeted downstream cluster. Future commits will deal with the agent copying those resources from that upstream namespace to the right namespaces in each downstream cluster, enabling deployments to use those resources.
The agent is now able to read a bundle deployment's `DownstreamResources` field and to copy the corresponding resources into the target namespace for the Helm release created when installing the bundle deployment. Upon deletion of the bundle deployment, the agent will delete those resources, unless `keepResources` is set to `true` on the bundle deployment.
Copying a secret or a config map into a downstream cluster's upstream namespace should now succeed even if that config map or secret already exists, in which case Fleet will update it.
This introduces a new environment variable, named `EXPERIMENTAL_COPY_RESOURCES_DOWNSTREAM`. That variable is set to `false` by default, disabling logic around copy of bundle resources downstream. That logic will only be enabled when the Fleet chart is installed with that environment variable set to `true`.
Label `fleet.cattle.io/bundledeployment` is used from three different locations, granting the use of a constant.
f4ea0b7 to
ff9e190
Compare
Changes to resources referenced through `downstreamResources` still does not trigger a reconcile of the corresponding bundle deployment. However, when such changes are made, the next reconcile of the bundle leads to those resources being updated downstream. The Fleet agent detects updates to those resources, and force-redeploys the bundle deployment to take them into account.
ff9e190 to
cc6acdb
Compare
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.
LGTM, thanks for the changes!
A new experimental feature, gated behind environment variable
EXPERIMENTAL_COPY_RESOURCES_DOWNSTREAM, enables Fleet to copy resources from the upstream cluster to all downstream clusters.This introduces a new
DownstreamResourcesfield in bundle deployment options, which can be populated directly from a HelmOp'sspec. Resources to be copied can be referenced through that field by name and kind, e.g.:An important use case for this could be
valuesFrom, which have requested secrets and/or config maps to be created directly on downstream clusters so far. This feature would eliminate that need.Restrictions:
downstreamResourcesmust live in the same namespace as the HelmOp resource.When referencing resources to be copied downstream, and the feature is enabled:
keepResourcesis set totrueon the bundle deployment.Limitations:
downstreamResourcesfor changes. This could be part of a future iteration of this feature, but in the meantime, changes to secrets and config maps referenced for downstream copy will only be applied when a bundle is updated.Refers to #3617.
Additional Information
Checklist
fleet-docs repository: Document propagation of resources to downstream clusters fleet-docs#362