Skip to content
This repository was archived by the owner on Nov 1, 2022. It is now read-only.

Support FluxHelmRelease resources in fluxd #1111

Merged
merged 4 commits into from
Jun 6, 2018

Conversation

squaremo
Copy link
Member

@squaremo squaremo commented May 31, 2018

This adds support for treating FluxHelmRelease releases as workloads (i.e., things that refer to images and result in pods being created). They will appear in ListImages and ListServices API results, and can be updated and automated like other workloads.

Fixes #985.

Tamara Kaufler and others added 3 commits May 30, 2018 15:44
This commit adds support for interpreting `FluxHelmRelease`s with a
single image, provided in the field `Spec.Values.Image` -- i.e., the
simplest of many different ways of providing image refs to a chart.

The manifest update mechanism is stubbed out for now.
This mainly consists of making sure
cluster/kubernetes/resource.FluxHelmRelease implements
resource.Workload, and bumping the version of kubeyaml to a release
that can update FluxHelmRelease resources. That enables all the
requisite machinery, including verifying releases.

An incidental change: throwing away the (`error`) return value of
SetContainer when verifying hid a problem; so, don't ignore it.
 - FluxHelmRelease test case
 - kubeyaml preserves quotes better now, so we can remove some of the
   test case cookery
 - use a specific version of kubeyaml from quay.io, instead of
   relying on there being a latest, library image
@squaremo
Copy link
Member Author

squaremo commented Jun 1, 2018

Hmm that scheme of naming the container for the path is not great -- for one thing, it could have slashes, and container names are dns_labels I think. Either giving it a hard-wired name (suggestive of the format), or at least using the basename of the path, would be better.

Copy link
Contributor

@awh awh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, modulo @squaremo's comment about the container name

func (fhr FluxHelmRelease) Containers() []resource.Container {
values := fhr.Spec.Values
if imgInfo, ok := values["image"]; ok {
imgInfoStr := imgInfo.(string)

This comment was marked as abuse.

@squaremo squaremo force-pushed the feature/985-support-fluxhelmrelease branch from 9d49804 to 90a54f7 Compare June 5, 2018 16:13
@squaremo
Copy link
Member Author

squaremo commented Jun 5, 2018

giving it a hard-wired name (suggestive of the format)

I came up with chart-values-image. That is suggestive of the format, but only if you know what the format is ... Just image would be less mysterious (but still mysterious).

I don't think there's any such name that's going to be entirely self-explanatory. It would be nice to synthesise a name that's meaningful to the chart, but we don't have the chart to hand, and using the path seems unreliable (what if someone supplies "." as the chart path?).

@squaremo
Copy link
Member Author

squaremo commented Jun 5, 2018

giving it a hard-wired name (suggestive of the format)

I came up with chart-values-image. That is suggestive of the format, but only if you know what the format is ... Just image would be less mysterious (but still mysterious).

Settled on chart-image. Less weirdly specific; indicates how the image value is used. I need to build it into kubeyaml before this will work though.

When interpreting FluxHelmRelease (FHR) resources as workloads, we
have to synthesise a set of (zero or one) containers from the
information given in each FHR. The simplest way to do this is to
expect a field in the `values` for the release, called `image`, giving
an image ref to be interpolated into the chart's templates
somewhere (we don't care where).

Rather than trying to come up with a way to derive a container name
particular to the release, or chart, or chart release, this commit
just hard-codes the name to something indicating the meaning of the
value. This requires a compensating change to kubeyaml (which is
include in quay.io/squaremo/kubeyaml:0.3.1).

Additional: use type test rather than type assertion, so it will
return `nil` rather than exploding.
@squaremo squaremo force-pushed the feature/985-support-fluxhelmrelease branch from 90a54f7 to 3f7b0bb Compare June 5, 2018 16:51
@squaremo
Copy link
Member Author

squaremo commented Jun 6, 2018

I need to build it into kubeyaml before this will work though.

(built into kubeyaml 0.3.1, which is used in the most recent commit)

@awh
Copy link
Contributor

awh commented Jun 6, 2018

👍

@squaremo squaremo merged commit 4fd139b into master Jun 6, 2018
@squaremo squaremo deleted the feature/985-support-fluxhelmrelease branch June 6, 2018 10:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants