-
Notifications
You must be signed in to change notification settings - Fork 4k
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
helm: enable clusterapi namespace autodiscovery #5762
helm: enable clusterapi namespace autodiscovery #5762
Conversation
/assign @elmiko for a first pass to make sure I'm doing something sane here |
thanks @jackfrancis , just starting to take a look |
On the other hand maybe just passing in On a cluster I have running right now:
I've got a cluster in that namespace, and its $ k get clusters -n capz-e2e-3dyctz
NAME PHASE AGE VERSION
capz-e2e-3dyctz-ha Provisioned 22m
$ k get machinedeployment/capz-e2e-3dyctz-ha-md-0 -n capz-e2e-3dyctz -o yaml | grep 'autoscaler'
cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size: "500"
cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: "1" However, the cluster-autoscaler logs suggest that the machines in the above
If it's not clear, I was expecting Thanks! |
c81107a
to
249a822
Compare
Nevermind! I was using the wrong |
249a822
to
87d1b3a
Compare
If you do not configure node group auto discovery, cluster autoscaler will attempt | ||
to match nodes against any scalable resources found in any namespace and belonging | ||
to any Cluster. | ||
You must configure node group auto discovery to inform cluster autoscaler which cluster in which to find for scalable node groups. |
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.
@elmiko FYI, I think this original statement is not correct. If you don't provide autoDiscovery
configuration via the helm chart, you get an error.
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.
ack, i have a feeling there might a bug around the autodiscovery mechanisms. it probably bears some investigation.
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.
looking at this https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller.go#L419 it leads me to believe that if unconfigured then it should be watching everything. but perhaps the permissions for the rbac are not allowing it?
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 haven't attempted to get further beyond the helm chart validation, so I haven't actually tried to get it to work using the runtime.
But because we can only pass in one kubeconfig, and that kubeconfig is only going to work with a single cluster (thinking of kubeconfig-incluster
context here, so CA is installed on the mgmt cluster and managing a remote workload cluster) why would you pass in a specific workload cluster kubeconfig secret but not declare the specific workload cluster that that secret pairs with?
Maybe this scenario makes sense for a self-managed CAPI cluster? (CAPI control plane installed onto the workload cluster)
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.
why would you pass in a specific workload cluster kubeconfig secret but not declare the specific workload cluster that that secret pairs with?
+1, seems like it should be specified explicitly
87d1b3a
to
6e22e2b
Compare
6e22e2b
to
f43baf9
Compare
@@ -1,4 +1,4 @@ | |||
{{- if or .Values.autoDiscovery.clusterName .Values.autoscalingGroups -}} | |||
{{- if or ( or .Values.autoDiscovery.clusterName .Values.autoDiscovery.namespace .Values.autoDiscovery.labels ) .Values.autoscalingGroups }} |
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 was a bug, AFAICT this condition needs to be the same condition that encapsulates the main template matter in the deployment template. (See L1 in charts/cluster-autoscaler/templates/deployment.yaml
below)
@@ -109,21 +109,52 @@ Return true if the priority expander is enabled | |||
{{- end -}} | |||
|
|||
{{/* | |||
Return the autodiscoveryparameters for clusterapi. | |||
autoDiscovery.clusterName for clusterapi. |
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.
Sorry for the gnarly diff in this file. Essentially with the introduction of namespace
to the combinatorics below, it made sense to decompose this a bit. Not a non-horrible way to do this using go templates, at least I couldn't figure out one.
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.
Yeah, I don't think I've ever seen a nice way to do this, but this is at least an easier to grok end result.
not sure why the helm docs CI is complaining (I did make changes there but I think that should be allowed) |
Ah, that's something I've been meaning to update the docs on as it keeps on catching people out, the helm-docs action generates the README.md from the README.md.gotmpl, so changes to the text portions need to be made there. |
f43baf9
to
45472cd
Compare
@gjtempleton thanks for the pro tip, done! |
@gjtempleton I wonder if this change in my PR that merged yesterday (which passed CI) is throwing a wrench in this PR? |
Please rebase the PR. |
45472cd
to
bb49bdb
Compare
bb49bdb
to
fdb0840
Compare
@mwielgus rebased, thx for the nudge @gjtempleton can't seem to figure out how to make |
@jackfrancis the fact the README.md hasn't been regenerated with new variable in the values file included in it is causing the failing test:
|
f9c7359
to
59fa7d6
Compare
@gjtempleton |
59fa7d6
to
e154d5f
Compare
@jackfrancis happy to help get this merged, is a rebase and review all that's needed? |
@jackfrancis, Please rebase the PR so that it will merge. |
e154d5f
to
dfcf7d6
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.
One nit, one query.
@@ -8,7 +8,7 @@ To verify that cluster-autoscaler has started, run: | |||
|
|||
############################################################################## | |||
#### ERROR: You must specify values for either #### | |||
#### autoDiscovery.clusterName or autoscalingGroups[] #### | |||
#### autoDiscovery or autoscalingGroups[] #### |
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.
Nit, whitespace:
#### autoDiscovery or autoscalingGroups[] #### | |
#### autoDiscovery or autoscalingGroups[] #### |
Return labels, including instance and name. | ||
*/}} | ||
{{- define "cluster-autoscaler.labels" -}} | ||
{{ include "cluster-autoscaler.instance-name" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service | quote }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} |
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.
Are we meaning to dump this or is this a rebase artefact?
@@ -109,21 +109,52 @@ Return true if the priority expander is enabled | |||
{{- end -}} | |||
|
|||
{{/* | |||
Return the autodiscoveryparameters for clusterapi. | |||
autoDiscovery.clusterName for clusterapi. |
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.
Yeah, I don't think I've ever seen a nice way to do this, but this is at least an easier to grok end result.
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
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jackfrancis, mwielgus 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 |
What type of PR is this?
What this PR does / why we need it:
This PR enables usage of the clusterapi provider's
namespace
node autodiscovery configuration in the helm chart, by filtering forMachines
byCluster
namespace (Machine
andCluster
are Cluster API CRDs that represent a node and a Kubernetes cluster, respectively).I've reworked the combinatoric helm template foo a bit so hopefully it's a bit easier to wrangle going forward (I think there's no way to avoid it being sort of horrible).
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: