Skip to content
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

✨clusterctl: improve support for air-gapped environments all image overrides #2586

Conversation

fabriziopandini
Copy link
Member

What this PR does / why we need it:
This PR is a follow up of #2558 designed to improve clusterctl support for air-gapped environments by supporting the following image override config:

images:
  all:
    repository: us.gcr.io/myRepo/cluster-api

Thus allowing to use upstream manifest for air-gapped environments without requiring manual modifications to components yaml for all the providers.

The real change is really simple, but unfortunately, it requires refactoring the signature of a method that is used in many places.
For helping reviewers to better understand the above point, the refactor and the real change are in separate commits.

/area clusterctl
/assign @vincepri
/assign @ncdc

@k8s-ci-robot k8s-ci-robot added area/clusterctl Issues or PRs related to clusterctl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 9, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 9, 2020
@@ -199,6 +199,14 @@ func NewComponents(provider config.Provider, version string, rawyaml []byte, con
return nil, errors.Wrap(err, "failed to parse yaml")
}

// apply image overrides, if defined
objs, err = util.FixImages(objs, func(image string) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

For deployments that have multiple images, such as capa-controller-manager:

  • gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1
  • us.gcr.io/k8s-artifacts-prod/cluster-api-aws/cluster-api-aws-controller:v0.5.0-rc.1

I think FixImages() would potentially set the same tag for both images, if you specified a tag in the image meta in the config?

Copy link
Member Author

Choose a reason for hiding this comment

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

@ncdc the PR is not designed to prevent for user misconfigurations, but for making it really easier to address the main use case to change the image repository for all the images.

Then, if the need arises, we can introduce fine-grained configuration at image level of more sophisticated config validation

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fair. I just wanted to confirm this is the behavior. Let's make sure the image config section is very well documented. Basically users can't set the tag on anything other than cert-manager; otherwise, they'll mess up their cluster. Right?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, that's right (assuming all the providers have more than 1 cimage)
I'm starting to work on a PR for documenting air-gapped support/the config, II will take care of documenting this properly

Copy link
Member Author

Choose a reason for hiding this comment

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

xref #2595

@ncdc
Copy link
Contributor

ncdc commented Mar 9, 2020

LGTM. @vincepri PTAL

Copy link
Member

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

/lgtm
/milestone v0.3.0

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 9, 2020
@k8s-ci-robot k8s-ci-robot added this to the v0.3.0 milestone Mar 9, 2020
@fabriziopandini
Copy link
Member Author

failures seem unrelated to this PR
/test pull-cluster-api-test

@k8s-ci-robot k8s-ci-robot merged commit 5154da4 into kubernetes-sigs:master Mar 9, 2020
@fabriziopandini fabriziopandini deleted the clusterctl-all-image-overrides branch March 10, 2020 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/clusterctl Issues or PRs related to clusterctl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants