-
Notifications
You must be signed in to change notification settings - Fork 25
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
Automatic installation of Calico on workload clusters #14
Automatic installation of Calico on workload clusters #14
Conversation
|
Welcome @hama-25179! |
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.
Thanks for you contributions! Please sign the CLA when you have time in order to contribute to K8s open source projects.
config/samples/calico-cni.yaml
Outdated
# matchLabels: | ||
# calicoCNI: enabled | ||
# Target all workload clusters. | ||
matchExpressions: |
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.
The prototype at the moment doesn't actually support matchExpressions
as it only passes in the value of matchLabels
. I think it would make sense to do so but need to verify that it would work with the client as I'm passing in the fields individually. Would you mind opening an issue to log that we want to add support for the other label selector fields?
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.
I see. I'll open the issue.
Since the goal is to target all workload clusters, should I change it to the following instead of using matchExpressions
?
(This one is much simpler)
# Target all workload clusters.
matchLabels: {}
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.
I created the issue #15.
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.
Thanks for opening the issue! And let me double check about that -- I'm not certain if an empty label selector would select all clusters or no clusters.
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.
I have confirmed that if the "HelmChartProxy" matchlabels setting is set to empty, the matching is unconditional.
Since it is a rather common Kubernetes setting to set the label selector to an empty setting for unconditional matching, I'd like to change the setting.
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.
Sure, I think that seems reasonable. Just to clarify, you're suggesting that empty labels should select everything like a wildcard or * sign?
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.
That is correct.
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.
Also, the URL for calico helm repo seems to have changed, so I updated the YAML.
(I intended to fix it in a222e9c)
# Check and create directories. | ||
[ -d "${CAPI_DIR}" ] && [ ! -d "${TILTD_DIR}" ] && mkdir -p ${TILTD_DIR} | ||
|
||
# Generate the calico_tiltfile. |
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.
This file seems reasonable to me and I'll test it out on my end when I have some time. I wonder if we should instead set up a separate Tiltfile for CAAPH instead and include this in there instead.
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.
Is my understanding correct that prepare the Tiltfile in advance and copy it to tilt.d
directory?.
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.
So the Tiltfile is where we would run tilt up
from. Currently, we're running it from a clone of the Cluster API repo, but for other providers like Cluster API Provider for Azure, it has its own Tiltfile and doesn't require CAPI to be present.
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.
It might be worth bringing up in the CAPI office hours on how we could handle that.
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.
I'm with you. Let us discuss it during the CAPI office hours.
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.
@hama-25179 I tested it out and it seems to work, just make sure you run chmod +x setup-calico-autoinstallation.sh
and commit that to the branch.
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.
Thank you for testing. I set executable permission to the script.
As for CLA, it will take a little more time for our company procedural reasons. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: hama-25179 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
docs/development.md
Outdated
### Automatically install calico in workload clusters with Tilt | ||
|
||
Automatically install [calico](https://projectcalico.docs.tigera.io/about/about-calico) in workload clusters using the [yaml manifest](https://github.com/Jont828/cluster-api-addon-provider-helm/blob/main/config/samples/calico-cni.yaml) provided by CAAPH. |
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.
should the link point to the kubernetes-sigs repo now?
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.
Thank you for pointing that out.
I corrected the link point.
Also I corrected the link for calico. (for inaccessible)
@hama-25179 I tried running off of your branch and had some issues. I've opened #24 so that the empty label selector you added here will allow it to select all workload clusters, and to fix some typos with the webhook. PTAL and once that merges we can rebase your current PR. |
@hama-25179 I merged the PR to change the label selector as well as some of the CI tests. Can you rebase and try it out to make sure it still works? |
@Jont828 I have checked again, there are no problems.
|
/ok-to-test |
I set it at 10 min to match the sync period for the CAPI controller but since it's a CLI flag you should be able to override it with something like this. IMO we could probably reduce the sync period for development at least though.
|
@hama-25179 This looks good to me! Could you squash your commits before I merge? |
Add a calico auto-install configuration to the development docs. Modify a HelmChartProxy manifest of calico to target all workload clusters. Create a shell script to register HelmChartProxy manifest of calico as a Tilt resource.
8a45c80
to
43b63fe
Compare
What this PR does / why we need it:
If CNI is not installed, the sample HelmChartProxy of nginx-ingress will not work, so I want to install CNI automatically.
Registering HelmChartProxy of calico as a Tilt resource, developers will no longer have to worry about CNI.
Additions and modifications
develop.md
: Add a calico auto-install configuration to the development docs.calico-cni.yaml
: Modify a HelmChartProxy manifest of calico to target all workload clusters.setup-calico-autoinstallation.sh
: Create a shell script to register HelmChartProxy manifest of calico as a Tilt resource.Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #8