From 326e902441cc467b93b3c04100e3319abcb616bf Mon Sep 17 00:00:00 2001 From: Mohamed Rafraf Date: Tue, 18 Jun 2024 14:03:03 +0100 Subject: [PATCH 1/2] fix helm release timeout issue fix helm release timeout issue --- pkg/apis/kubeone/types.go | 3 +-- pkg/apis/kubeone/v1beta2/defaults.go | 4 ++-- pkg/apis/kubeone/v1beta2/types.go | 3 +-- pkg/apis/kubeone/v1beta2/zz_generated.conversion.go | 5 ++--- pkg/apis/kubeone/v1beta2/zz_generated.deepcopy.go | 1 + pkg/apis/kubeone/v1beta3/defaults.go | 4 ++-- pkg/apis/kubeone/v1beta3/types.go | 3 +-- pkg/apis/kubeone/v1beta3/zz_generated.conversion.go | 5 ++--- pkg/apis/kubeone/v1beta3/zz_generated.deepcopy.go | 1 + pkg/apis/kubeone/zz_generated.deepcopy.go | 1 + pkg/localhelm/helm3.go | 2 +- 11 files changed, 15 insertions(+), 17 deletions(-) diff --git a/pkg/apis/kubeone/types.go b/pkg/apis/kubeone/types.go index 706ef2846..32c8a1c9d 100644 --- a/pkg/apis/kubeone/types.go +++ b/pkg/apis/kubeone/types.go @@ -18,7 +18,6 @@ package kubeone import ( "encoding/json" - "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -160,7 +159,7 @@ type HelmRelease struct { Wait bool `json:"wait,omitempty"` // WaitTimeout --timeout flag of the `helm install` command. Default to 5m - WaitTimeout time.Duration `json:"timeout,omitempty"` + WaitTimeout metav1.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 f52216c83..f3c36afa2 100644 --- a/pkg/apis/kubeone/v1beta2/defaults.go +++ b/pkg/apis/kubeone/v1beta2/defaults.go @@ -256,8 +256,8 @@ func SetDefaults_HelmReleases(obj *KubeOneCluster) { obj.HelmReleases[idx].ReleaseName = hr.Chart } - if hr.WaitTimeout == 0 { - obj.HelmReleases[idx].WaitTimeout = time.Minute * 5 + if hr.WaitTimeout.Duration == 0 { + obj.HelmReleases[idx].WaitTimeout.Duration = time.Minute * 5 } } } diff --git a/pkg/apis/kubeone/v1beta2/types.go b/pkg/apis/kubeone/v1beta2/types.go index c0bb052c5..6191840e1 100644 --- a/pkg/apis/kubeone/v1beta2/types.go +++ b/pkg/apis/kubeone/v1beta2/types.go @@ -18,7 +18,6 @@ package v1beta2 import ( "encoding/json" - "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -157,7 +156,7 @@ type HelmRelease struct { Wait bool `json:"wait,omitempty"` // WaitTimeout --timeout flag of the `helm install` command. - WaitTimeout time.Duration `json:"timeout,omitempty"` + WaitTimeout metav1.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 0491929d7..bb582d1ca 100644 --- a/pkg/apis/kubeone/v1beta2/zz_generated.conversion.go +++ b/pkg/apis/kubeone/v1beta2/zz_generated.conversion.go @@ -23,7 +23,6 @@ package v1beta2 import ( json "encoding/json" - time "time" unsafe "unsafe" kubeone "k8c.io/kubeone/pkg/apis/kubeone" @@ -1344,7 +1343,7 @@ func autoConvert_v1beta2_HelmRelease_To_kubeone_HelmRelease(in *HelmRelease, out out.ReleaseName = in.ReleaseName out.Namespace = in.Namespace out.Wait = in.Wait - out.WaitTimeout = time.Duration(in.WaitTimeout) + out.WaitTimeout = in.WaitTimeout out.Values = *(*[]kubeone.HelmValues)(unsafe.Pointer(&in.Values)) return nil } @@ -1362,7 +1361,7 @@ func autoConvert_kubeone_HelmRelease_To_v1beta2_HelmRelease(in *kubeone.HelmRele out.ReleaseName = in.ReleaseName out.Namespace = in.Namespace out.Wait = in.Wait - out.WaitTimeout = time.Duration(in.WaitTimeout) + out.WaitTimeout = in.WaitTimeout out.Values = *(*[]HelmValues)(unsafe.Pointer(&in.Values)) return nil } diff --git a/pkg/apis/kubeone/v1beta2/zz_generated.deepcopy.go b/pkg/apis/kubeone/v1beta2/zz_generated.deepcopy.go index 1f06ce394..525f5f4d8 100644 --- a/pkg/apis/kubeone/v1beta2/zz_generated.deepcopy.go +++ b/pkg/apis/kubeone/v1beta2/zz_generated.deepcopy.go @@ -755,6 +755,7 @@ func (in *GCESpec) DeepCopy() *GCESpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HelmRelease) DeepCopyInto(out *HelmRelease) { *out = *in + out.WaitTimeout = in.WaitTimeout if in.Values != nil { in, out := &in.Values, &out.Values *out = make([]HelmValues, len(*in)) diff --git a/pkg/apis/kubeone/v1beta3/defaults.go b/pkg/apis/kubeone/v1beta3/defaults.go index 126a353f7..d15363bda 100644 --- a/pkg/apis/kubeone/v1beta3/defaults.go +++ b/pkg/apis/kubeone/v1beta3/defaults.go @@ -256,8 +256,8 @@ func SetDefaults_HelmReleases(obj *KubeOneCluster) { obj.HelmReleases[idx].ReleaseName = hr.Chart } - if hr.WaitTimeout == 0 { - obj.HelmReleases[idx].WaitTimeout = time.Minute * 5 + if hr.WaitTimeout.Duration == 0 { + obj.HelmReleases[idx].WaitTimeout.Duration = time.Minute * 5 } } } diff --git a/pkg/apis/kubeone/v1beta3/types.go b/pkg/apis/kubeone/v1beta3/types.go index c88f6836b..2c4faae85 100644 --- a/pkg/apis/kubeone/v1beta3/types.go +++ b/pkg/apis/kubeone/v1beta3/types.go @@ -18,7 +18,6 @@ package v1beta3 import ( "encoding/json" - "time" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -157,7 +156,7 @@ type HelmRelease struct { Wait bool `json:"wait,omitempty"` // WaitTimeout --timeout flag of the `helm install` command. - WaitTimeout time.Duration `json:"timeout,omitempty"` + WaitTimeout metav1.Duration `json:"timeout,omitempty"` // Values provide optional overrides of the helm values. Values []HelmValues `json:"values,omitempty"` diff --git a/pkg/apis/kubeone/v1beta3/zz_generated.conversion.go b/pkg/apis/kubeone/v1beta3/zz_generated.conversion.go index c120f2774..dc70a4c20 100644 --- a/pkg/apis/kubeone/v1beta3/zz_generated.conversion.go +++ b/pkg/apis/kubeone/v1beta3/zz_generated.conversion.go @@ -23,7 +23,6 @@ package v1beta3 import ( json "encoding/json" - time "time" unsafe "unsafe" kubeone "k8c.io/kubeone/pkg/apis/kubeone" @@ -1343,7 +1342,7 @@ func autoConvert_v1beta3_HelmRelease_To_kubeone_HelmRelease(in *HelmRelease, out out.ReleaseName = in.ReleaseName out.Namespace = in.Namespace out.Wait = in.Wait - out.WaitTimeout = time.Duration(in.WaitTimeout) + out.WaitTimeout = in.WaitTimeout out.Values = *(*[]kubeone.HelmValues)(unsafe.Pointer(&in.Values)) return nil } @@ -1361,7 +1360,7 @@ func autoConvert_kubeone_HelmRelease_To_v1beta3_HelmRelease(in *kubeone.HelmRele out.ReleaseName = in.ReleaseName out.Namespace = in.Namespace out.Wait = in.Wait - out.WaitTimeout = time.Duration(in.WaitTimeout) + out.WaitTimeout = in.WaitTimeout out.Values = *(*[]HelmValues)(unsafe.Pointer(&in.Values)) return nil } diff --git a/pkg/apis/kubeone/v1beta3/zz_generated.deepcopy.go b/pkg/apis/kubeone/v1beta3/zz_generated.deepcopy.go index a2edc17e3..6e42b887d 100644 --- a/pkg/apis/kubeone/v1beta3/zz_generated.deepcopy.go +++ b/pkg/apis/kubeone/v1beta3/zz_generated.deepcopy.go @@ -729,6 +729,7 @@ func (in *GCESpec) DeepCopy() *GCESpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HelmRelease) DeepCopyInto(out *HelmRelease) { *out = *in + out.WaitTimeout = in.WaitTimeout if in.Values != nil { in, out := &in.Values, &out.Values *out = make([]HelmValues, len(*in)) diff --git a/pkg/apis/kubeone/zz_generated.deepcopy.go b/pkg/apis/kubeone/zz_generated.deepcopy.go index 52a05f8c2..fa5755fe5 100644 --- a/pkg/apis/kubeone/zz_generated.deepcopy.go +++ b/pkg/apis/kubeone/zz_generated.deepcopy.go @@ -769,6 +769,7 @@ func (in *GCESpec) DeepCopy() *GCESpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HelmRelease) DeepCopyInto(out *HelmRelease) { *out = *in + out.WaitTimeout = in.WaitTimeout if in.Values != nil { in, out := &in.Values, &out.Values *out = make([]HelmValues, len(*in)) diff --git a/pkg/localhelm/helm3.go b/pkg/localhelm/helm3.go index ae44eaac9..03ba2324e 100644 --- a/pkg/localhelm/helm3.go +++ b/pkg/localhelm/helm3.go @@ -295,7 +295,7 @@ func newHelmInstallClient(cfg *helmaction.Configuration, release kubeoneapi.Helm helmInstall.RepoURL = release.RepoURL helmInstall.Version = release.Version helmInstall.Wait = release.Wait - helmInstall.Timeout = release.WaitTimeout + helmInstall.Timeout = release.WaitTimeout.Duration return helmInstall } From 8834e69a74a1f483b1d2df942c4770f925440cf9 Mon Sep 17 00:00:00 2001 From: Mohamed Rafraf Date: Tue, 18 Jun 2024 14:17:34 +0100 Subject: [PATCH 2/2] update api docs --- docs/api_reference/v1beta2.en.md | 4 ++-- docs/api_reference/v1beta3.en.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/api_reference/v1beta2.en.md b/docs/api_reference/v1beta2.en.md index 8b82caa65..c8e30cb7d 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-06-05T16:21:27+03:00 +date = 2024-06-18T14:12:31+01:00 weight = 11 +++ ## v1beta2 @@ -428,7 +428,7 @@ GCESpec defines the GCE cloud provider | 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 | +| timeout | WaitTimeout --timeout flag of the `helm install` command. | metav1.Duration | false | | values | Values provide optional overrides of the helm values. | [][HelmValues](#helmvalues) | false | [Back to Group](#v1beta2) diff --git a/docs/api_reference/v1beta3.en.md b/docs/api_reference/v1beta3.en.md index e32b6b0a4..cb21b62d9 100644 --- a/docs/api_reference/v1beta3.en.md +++ b/docs/api_reference/v1beta3.en.md @@ -1,6 +1,6 @@ +++ title = "v1beta3 API Reference" -date = 2024-06-05T16:21:27+03:00 +date = 2024-06-18T14:12:31+01:00 weight = 11 +++ ## v1beta3 @@ -416,7 +416,7 @@ GCESpec defines the GCE cloud provider | 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 | +| timeout | WaitTimeout --timeout flag of the `helm install` command. | metav1.Duration | false | | values | Values provide optional overrides of the helm values. | [][HelmValues](#helmvalues) | false | [Back to Group](#v1beta3)