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

Update cluster-controller to v0.1.0 #1444

Merged
merged 2 commits into from
Jun 2, 2022

Conversation

michaelmdresser
Copy link
Contributor

@michaelmdresser michaelmdresser commented May 27, 2022

What does this PR change?

  • Updates cluster-controller to v0.1.0, which includes v2 of cluster-turndown
  • Updates the turndown CRD to match v2 of cluster-turndown

This includes a BREAKING CHANGE to the cluster-turndown functionality
that is wrapped by cluster-controller. The breaking changes are
summarized in https://github.com/kubecost/cluster-turndown/releases/tag/v2.0.0
and should be featured prominently in release notes.

The breaking change is necessary because we aren't allowed to use *.k8s.io to namespace our CRDs. See the notes in kubecost/cluster-turndown#44 for a further explanation and references.

Does this PR rely on any other PRs?

How does this PR impact users? (This is the kind of thing that goes in release notes!)

  • Updates cluster-controller to v0.1.0.
  • Removes apiextensions.k8s.io/v1beta1 CRD turndownschedules.kubecost.k8s.io
  • Introduces apiextensions.k8s.io/v1 CRD turndownschedules.kubecost.com as replacement.
  • ⚠️ Breaking change for users of the alpha feature "Cluster Turndown" contained in the Cluster Controller. If you have Cluster Controller enabled (--set clusterController.enabled=true), please visit the migration guide to check if you have existing resources that must be migrated to maintain expected functionality.

Links to Issues or ZD tickets this PR addresses or fixes

How was this PR tested?

Deployed this version of the Helm chart with --set clusterController.enabled=true. Saw the turndownschedules.kubecost.com CRD with kubectl get crd. Saw the cluster-controller Pod start and observed clean logs:

→ k logs -n kubecost -l app=kubecost-cluster-controller --tail=-1 -f
W0527 17:34:20.783003 1013105 gcp.go:120] WARNING: the gcp auth plugin is deprecated in v1.22+, unavailable in v1.25+; use gcloud instead.
To learn more, consult https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke
I0527 21:33:57.166819       1 main.go:110] Initializing turndown and cluster editing (nodes) component. Failure will not crash the program.
I0527 21:33:57.167151       1 main.go:115] Running on node: gke-michael-dev-pool-5-1acb2061-g3l8
I0527 21:33:57.194580       1 validator.go:41] Validating Provider...
I0527 21:33:57.198575       1 namedlogger.go:24] [GKEClusterProvider] Loading node pools for: [ProjectID: guestbook-227502, Zone: us-east4-b, ClusterID: michael-dev]
I0527 21:33:57.353038       1 schedulecontroller.go:110] Starting TurndownSchedule controller

I did not test using turndown functionality.

Have you made an update to documentation?

This includes a BREAKING CHANGE to the cluster-turndown functionality
that is wrapped by cluster-controller. The breaking changes are
summarized in
https://github.com/kubecost/cluster-turndown/releases/tag/v2.0.0 and
should be featured prominently in release notes.
v2 of turndown changes the namespacing of the turndown resources to match
K8s API policy. See discussion and references in
kubecost/cluster-turndown#44 for more detail.

The new CRD YAML is copied from cluster-turndown v2.0.1
@michaelmdresser michaelmdresser marked this pull request as ready for review May 27, 2022 21:39
@michaelmdresser
Copy link
Contributor Author

This is a more permanent fix to the patch we made here: #1429

@michaelmdresser
Copy link
Contributor Author

@AjayTripathy do we have any policy for making breaking changes like this?

- tds
scope: Cluster
{{ else }}
apiVersion: apiextensions.k8s.io/v1beta1
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a min k8s version we support/guarantee to run on? 1.16 was the first version that beta was added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think there's some minimum, but I don't know what it is. @AjayTripathy may know more.

I don't think we've ever guaranteed a supported version of K8s for cluster-controller (and turndown) because they're perpetually in alpha/beta.

We have to make this change because v1beta1 is being removed and K8s now explicitly disallows *.k8s.io from being used to namespace non-K8s CRDs. The cluster-turndown PR links to sources: kubecost/cluster-turndown#44.

We could maintain a sort of backwards-compatibility in the Helm chart if we made K8s versions < 1.22 use cluster-controller:v0.6.0 and the v1beta1 CRD.

@michaelmdresser
Copy link
Contributor Author

We decided to not write migration code due to time constraints and instead provide a migration guide, which has been written and included in this PR's associated docs PR: kubecost/docs#246.

I did a wide range of testing on GKE clusters with v1.21 of K8s and v1.22 of K8s to check the behavior of having a simultaneous definition of turndownschedules.kubecost.k8s.io and turndownschedules.kubecost.com, resulting in the very easy migration path provided in the guide. I will happily share my notes if anyone has questions.

@michaelmdresser
Copy link
Contributor Author

michaelmdresser commented Jun 2, 2022

Full migration guide testing notes are attached to the docs PR.

@michaelmdresser michaelmdresser merged commit 5871b08 into develop Jun 2, 2022
@michaelmdresser michaelmdresser deleted the mmd/update-cluster-controller-v0.1.0 branch June 2, 2022 20:19
@AjayTripathy
Copy link
Contributor

Sorry for the late response here. I feel a migration guide + support should be sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants