Skip to content

Proposal: helm commandeer #2730

@thomastaylor312

Description

@thomastaylor312

EDIT: This has been superseded by another idea

Problem

Many users want to be able to "adopt" currently running pods, services, etc. into a new or existing chart. One example of this is self-hosted Kubernetes control plane components (apiserver, DNS, etc.) after they have been bootstrapped by something like bootkube.

Proposed solution

I propose we add a new commandeer (to stick with a naval theme, we can go with adopt if people find it too confusing) subcommand to Helm. The reason behind this is we don't want to add additional complexity and flags to an already large flag set on install, update, and rollback. The command would take a defined chart (e.g. helm commandeer <chart_name>) with matching manifests and use these to "commandeer" the objects into a chart manifest. Future iterations of the feature could add the ability to pass specific names of resources you want to commandeer.

Behavior

The passed chart would be rendered like a normal install or upgrade before moving on to a "capture" step. The "capture" step would use the object GroupVersionKind, namespace, and name to find a match in the already existing objects. For safety sake, if any of the rendered manifests do not exactly match a resource, the "capture" step will fail. There will also be an --override flag and an --ignore-match flag to help configure this behavior. The --override flag will make it so as long as the Kind and name match, it will accept the match. The --ignore-match flag will drop any non-matching manifest from the final chart.

The last step will be a merge patch of the new manifest with the existing one. Once these are merged and sent to the API, the new chart will be saved into storage. So the tl;dr is below

  1. Render chart
  2. Capture resources using GroupVersionKind, namespace, and name
  3. Merge manifests
  4. Save new chart

The --into flag

We also want to have the ability to adopt resources into a currently installed chart (e.g. bringing resources into an umbrella chart). This will be done with the --into flag, which will take a release name as an argument. All of the same steps will be followed to adopt resources with the exception that existing resource will remain the same. This is a purely additive operation

Open questions

  • Should the --override flag force resources in the chart that don't have a match to be created anyway?
  • Is --ignore-match something people will actually use?
  • Do we need something like a --replace flag where the new manifest completely replaces the existing one?
  • Is this too complex for a first pass and should we just stick with specifying resource names to commandeer?

Other notes

I will update this proposal with suggestions from the comments so as to not have multiple proposal versions clogging up the issue

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions