From d93a10c0477094866f767656081aef6209b54a5e Mon Sep 17 00:00:00 2001 From: Mohamed Rafraf <81432497+mohamed-rafraf@users.noreply.github.com> Date: Wed, 5 Jun 2024 11:17:03 +0100 Subject: [PATCH 1/3] add wait feature in helm (#3190) * add wait feature in helm * add wait feature in helm integration * add timeout field in helm releases --- docs/api_reference/v1beta2.en.md | 4 +++- pkg/apis/kubeone/types.go | 7 +++++++ pkg/apis/kubeone/v1beta2/defaults.go | 5 +++++ pkg/apis/kubeone/v1beta2/types.go | 7 +++++++ pkg/apis/kubeone/v1beta2/zz_generated.conversion.go | 5 +++++ pkg/localhelm/helm3.go | 2 ++ 6 files changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/api_reference/v1beta2.en.md b/docs/api_reference/v1beta2.en.md index 82e16fa2b..40b08cb43 100644 --- a/docs/api_reference/v1beta2.en.md +++ b/docs/api_reference/v1beta2.en.md @@ -1,6 +1,6 @@ +++ title = "v1beta2 API Reference" -date = 2024-04-29T17:38:32+05:00 +date = 2024-05-14T12:20:58+01:00 weight = 11 +++ ## v1beta2 @@ -439,6 +439,8 @@ GCESpec defines the GCE cloud provider | version | Version is --version flag of the `helm upgrade` command. Specify the exact chart version to use. If this is not specified, the latest version is used. | string | false | | releaseName | ReleaseName is [RELEASE] part of the `helm upgrade [RELEASE] [CHART]` command. Empty is defaulted to chart. | string | false | | namespace | Namespace is --namespace flag of the `helm upgrade` command. A namespace to use for a release. | string | true | +| wait | Wait is --wait flag of the `helm install` command. | bool | false | +| timeout | WaitTimeout --timeout flag of the `helm install` command. | time.Duration | false | | values | Values provide optional overrides of the helm values. | [][HelmValues](#helmvalues) | false | [Back to Group](#v1beta2) diff --git a/pkg/apis/kubeone/types.go b/pkg/apis/kubeone/types.go index f3589a2a2..706ef2846 100644 --- a/pkg/apis/kubeone/types.go +++ b/pkg/apis/kubeone/types.go @@ -18,6 +18,7 @@ package kubeone import ( "encoding/json" + "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -155,6 +156,12 @@ type HelmRelease struct { // Namespace is --namespace flag of the `helm upgrade` command. A namespace to use for a release. Namespace string `json:"namespace"` + // Wait is --wait flag of the `helm install` command. + Wait bool `json:"wait,omitempty"` + + // WaitTimeout --timeout flag of the `helm install` command. Default to 5m + WaitTimeout time.Duration `json:"timeout,omitempty"` + // Values provide optional overrides of the helm values. Values []HelmValues `json:"values,omitempty"` } diff --git a/pkg/apis/kubeone/v1beta2/defaults.go b/pkg/apis/kubeone/v1beta2/defaults.go index be26e4ad8..f52216c83 100644 --- a/pkg/apis/kubeone/v1beta2/defaults.go +++ b/pkg/apis/kubeone/v1beta2/defaults.go @@ -20,6 +20,7 @@ import ( "crypto/tls" "fmt" "strings" + "time" "github.com/Masterminds/semver/v3" @@ -254,6 +255,10 @@ func SetDefaults_HelmReleases(obj *KubeOneCluster) { if hr.ReleaseName == "" { obj.HelmReleases[idx].ReleaseName = hr.Chart } + + if hr.WaitTimeout == 0 { + obj.HelmReleases[idx].WaitTimeout = time.Minute * 5 + } } } diff --git a/pkg/apis/kubeone/v1beta2/types.go b/pkg/apis/kubeone/v1beta2/types.go index 306e5fbe6..c398c7767 100644 --- a/pkg/apis/kubeone/v1beta2/types.go +++ b/pkg/apis/kubeone/v1beta2/types.go @@ -18,6 +18,7 @@ package v1beta2 import ( "encoding/json" + "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -152,6 +153,12 @@ type HelmRelease struct { // Namespace is --namespace flag of the `helm upgrade` command. A namespace to use for a release. Namespace string `json:"namespace"` + // Wait is --wait flag of the `helm install` command. + Wait bool `json:"wait,omitempty"` + + // WaitTimeout --timeout flag of the `helm install` command. + WaitTimeout time.Duration `json:"timeout,omitempty"` + // Values provide optional overrides of the helm values. Values []HelmValues `json:"values,omitempty"` } diff --git a/pkg/apis/kubeone/v1beta2/zz_generated.conversion.go b/pkg/apis/kubeone/v1beta2/zz_generated.conversion.go index 442506a9a..c615a6aac 100644 --- a/pkg/apis/kubeone/v1beta2/zz_generated.conversion.go +++ b/pkg/apis/kubeone/v1beta2/zz_generated.conversion.go @@ -23,6 +23,7 @@ package v1beta2 import ( json "encoding/json" + time "time" unsafe "unsafe" kubeone "k8c.io/kubeone/pkg/apis/kubeone" @@ -1382,6 +1383,8 @@ func autoConvert_v1beta2_HelmRelease_To_kubeone_HelmRelease(in *HelmRelease, out out.Version = in.Version out.ReleaseName = in.ReleaseName out.Namespace = in.Namespace + out.Wait = in.Wait + out.WaitTimeout = time.Duration(in.WaitTimeout) out.Values = *(*[]kubeone.HelmValues)(unsafe.Pointer(&in.Values)) return nil } @@ -1398,6 +1401,8 @@ func autoConvert_kubeone_HelmRelease_To_v1beta2_HelmRelease(in *kubeone.HelmRele out.Version = in.Version out.ReleaseName = in.ReleaseName out.Namespace = in.Namespace + out.Wait = in.Wait + out.WaitTimeout = time.Duration(in.WaitTimeout) out.Values = *(*[]HelmValues)(unsafe.Pointer(&in.Values)) return nil } diff --git a/pkg/localhelm/helm3.go b/pkg/localhelm/helm3.go index 2c715407c..ae44eaac9 100644 --- a/pkg/localhelm/helm3.go +++ b/pkg/localhelm/helm3.go @@ -294,6 +294,8 @@ func newHelmInstallClient(cfg *helmaction.Configuration, release kubeoneapi.Helm helmInstall.ReleaseName = release.ReleaseName helmInstall.RepoURL = release.RepoURL helmInstall.Version = release.Version + helmInstall.Wait = release.Wait + helmInstall.Timeout = release.WaitTimeout return helmInstall } From b9768c8495faab44e8441df72ee625233a5ad968 Mon Sep 17 00:00:00 2001 From: Simon Bein Date: Thu, 6 Jun 2024 11:52:05 +0200 Subject: [PATCH 2/3] Kubernetes 1.30 support (#3209) * update stable version marker * update version constraint * update metrics server version * fix typos in test Readme * add e2e tests * small additions to kubernetes support template * move issue template tips into separate section * replace initKubeOneVersion with upgraded kubeoneStableBaseRef * update kube_proxy_ipvs_external and fix line ending * remove non compatibel versioned tests * update test gen * clarify crane tip --- .github/ISSUE_TEMPLATE/kubernetes-support.md | 10 +- .prow/generated.yaml | 7558 ++++++++++++++---- Makefile | 2 +- pkg/apis/kubeone/validation/validation.go | 2 +- pkg/templates/images/images.go | 2 +- test/README.md | 6 +- test/e2e/scenario_upgrade.go | 2 +- test/e2e/tests_test.go | 1859 ++++- test/tests.yml | 215 +- 9 files changed, 8059 insertions(+), 1597 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/kubernetes-support.md b/.github/ISSUE_TEMPLATE/kubernetes-support.md index 2994fb9a5..c5c969a58 100644 --- a/.github/ISSUE_TEMPLATE/kubernetes-support.md +++ b/.github/ISSUE_TEMPLATE/kubernetes-support.md @@ -25,15 +25,19 @@ This is a collector issue for Kubernetes 1.2x support in KubeOne. The following * [ ] Update the `build` image to update Sonobuoy (and other dependencies if needed) * [ ] Update the latest supported Kubernetes version in [the API validation](https://github.com/kubermatic/kubeone/blob/main/pkg/apis/kubeone/validation/validation.go#L40-L41) * [ ] Update [default admission controllers](https://github.com/kubermatic/kubeone/blob/main/pkg/kubeflags/data.go) if needed -* [ ] Update `pause` image version in `pkg/apis/kubeone` if needed +* [ ] Update `pause` image version in `pkg/apis/kubeone/helpers.go` if needed * [ ] Update [the stable version marker in Makefile](https://github.com/kubermatic/kubeone/blob/5273f9a372736569c6b09b38f2959019d29e4d6a/Makefile#L24) -* [ ] Update [machine-controller and operating-system-manager](https://github.com/kubermatic/kubeone/blob/a5c3a14725bf135cb2682c4ec96d5872b165b98f/pkg/templates/images/images.go#L222-L224) -* [ ] Add E2E tests +* [ ] Add E2E tests inside `tests.yml` * [ ] Update daily periodics to use the latest Kubernetes release * [ ] Update [the Compatibility Matrix](https://docs.kubermatic.com/kubeone/main/architecture/compatibility/supported-versions/) * [ ] Create an issue to track updating [images](https://github.com/kubermatic/kubeone/blob/main/pkg/templates/images/images.go) * [ ] Run the full conformance tests suite using [Sonobuoy](https://github.com/vmware-tanzu/sonobuoy) +Tips & Tricks: + +* Sometimes the image tag does no match any official GitHub Release name. In these cases `crane ls ` can be used to check if a new version of an image exists. Nonetheless, changelog still needs to be checked if the new version introduces any breaking changes +* Default Admission Controllers can be obtained via `docker run --rm registry.k8s.io/kube-apiserver:v${KUBERNETES_VERSION} kube-apiserver -h | grep "admission-control"` +