-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #246 from kubecost/mmd/update-cluster-controller-s…
…caledown Update cluster controller docs with more detail about turndown and breaking changes
- Loading branch information
Showing
2 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
v1.94+ TurndownSchedule migration guide | ||
======================================= | ||
|
||
In v1.94 of Kubecost, the `turndownschedules.kubecost.k8s.io/v1alpha1` Custom Resource Definition (CRD) was [moved](https://github.com/kubecost/cost-analyzer-helm-chart/pull/1444) to `turndownschedules.kubecost.com/v1alpha1` to adhere to [Kubernetes policy for CRD domain namespacing](https://github.com/kubernetes/enhancements/pull/1111). This is a breaking change for users of Cluster Controller's turndown functionality. Please follow this guide for a successful migration of your turndown schedule resources. | ||
|
||
> As part of this change, the CRD was updated to use `apiextensions.k8s.io/v1` because `v1beta1` was removed in K8s v1.22. If using Kubecost v1.94+, Cluster Controller's turndown functionality will not work on K8s versions before the introduction of `apiextensions.k8s.io/v1`. | ||
# Situation 1: You have deployed cluster controller but don't use turndown | ||
|
||
In this situation, you've deployed Kubecost's Cluster Controller at some point | ||
using `--set clusterController.enabled=true`, but you don't use the turndown functionality. | ||
|
||
That means that this command should return one line: | ||
|
||
kubectl get crd turndownschedules.kubecost.k8s.io | ||
|
||
And this command should return no resources: | ||
|
||
kubectl get turndownschedules.kubecost.k8s.io | ||
|
||
This situation is easy! You can do nothing, and turndown should continue to behave correctly because `kubectl get turndownschedule` and related commands will correctly default to the new `turndownschedules.kubecost.com/v1alpha1` CRD after you upgrade to Kubecost v1.94 or higher. | ||
|
||
If you would like to be fastidious and clean up the old CRD, simply run `kubectl delete crd turndownschedules.kubecost.k8s.io` after upgrading Kubecost to v1.94 or higher. | ||
|
||
|
||
# Situation 2: You currently use turndown | ||
|
||
In this situation, you've deployed Kubecost's Cluster Controller at some point using `--set clusterController.enabled=true` and you have at least one `turndownschedule.kubecost.k8s.io` resource currently present in your cluster. | ||
|
||
That means that this command should return one line: | ||
|
||
kubectl get crd turndownschedules.kubecost.k8s.io | ||
|
||
And this command should return at least one resource: | ||
|
||
kubectl get turndownschedules.kubecost.k8s.io | ||
|
||
We have a few steps to perform if you want Cluster Controller's turndown functionality to continue to behave according to your already-defined turndown schedules. | ||
|
||
1. Upgrade Kubecost to v1.94 or higher with `--set clusterController.enabled=true` | ||
2. Make sure the new CRD has been defined after your Kubecost upgrade. | ||
|
||
This command should return a line: | ||
|
||
kubectl get crd turndownschedules.kubecost.com | ||
|
||
3. Copy your existing `turndownschedules.kubecost.k8s.io` resources into the new CRD. | ||
|
||
kubectl get turndownschedules.kubecost.k8s.io -o yaml \ | ||
| sed 's|kubecost.k8s.io|kubecost.com|' \ | ||
| kubectl apply -f - | ||
|
||
4. (optional) Delete the old `turndownschedules.kubecost.k8s.io` CRD | ||
|
||
Because the CRDs have a finalizer on them, we have to follow [this workaround](https://github.com/kubernetes/kubernetes/issues/60538#issuecomment-369099998) to remove the finalizer from our old resources. This lets us clean up without locking up. | ||
|
||
kubectl patch \ | ||
crd/turndownschedules.kubecost.k8s.io \ | ||
-p '{"metadata":{"finalizers":[]}}' \ | ||
--type=merge | ||
|
||
> The following command may be unnecessary because Helm should automatically remove the `turndownschedules.kubecost.k8s.io` resource during the upgrade. The removal will remain in a pending state until the finalizer patch above is implemented. | ||
kubectl delete crd turndownschedules.kubecost.k8s.io | ||
|
||
|
||
<!--- {"article":"","section":"4402815636375","permissiongroup":"1500001277122"} ---> |