From 1334eeb02d54085f474dcd3b4edd8659f8603ac9 Mon Sep 17 00:00:00 2001 From: Andrey Chulkov Date: Thu, 19 Sep 2024 10:19:03 +0000 Subject: [PATCH 1/2] Separate CHYT init options into makeDefault and createPublicClique --- api/v1/chyt_types.go | 4 ++++ config/crd/bases/cluster.ytsaurus.tech_chyts.yaml | 7 +++++++ config/samples/cluster_v1_chyt.yaml | 1 + docs/api.md | 3 ++- pkg/components/chyt.go | 2 +- ytop-chart/templates/crds/chyts.cluster.ytsaurus.tech.yaml | 7 +++++++ 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/api/v1/chyt_types.go b/api/v1/chyt_types.go index b6e9654b..2fc59813 100644 --- a/api/v1/chyt_types.go +++ b/api/v1/chyt_types.go @@ -40,8 +40,12 @@ type ChytSpec struct { Ytsaurus *corev1.LocalObjectReference `json:"ytsaurus,omitempty"` Image string `json:"image,omitempty"` + // Mark specified image as default for cliques. //+kubebuilder:default:=false MakeDefault bool `json:"makeDefault"` + // Create ch_public clique, which is used by default when running CHYT queries. + //+kubebuilder:default:=false + CreatePublicClique bool `json:"createPublicClique"` } // ChytStatus defines the observed state of Chyt diff --git a/config/crd/bases/cluster.ytsaurus.tech_chyts.yaml b/config/crd/bases/cluster.ytsaurus.tech_chyts.yaml index 1ce8dd03..921ed214 100644 --- a/config/crd/bases/cluster.ytsaurus.tech_chyts.yaml +++ b/config/crd/bases/cluster.ytsaurus.tech_chyts.yaml @@ -40,6 +40,11 @@ spec: spec: description: ChytSpec defines the desired state of Chyt properties: + createPublicClique: + default: false + description: Create ch_public clique, which is used by default when + running CHYT queries. + type: boolean image: type: string imagePullSecrets: @@ -58,6 +63,7 @@ spec: type: array makeDefault: default: false + description: Mark specified image as default for cliques. type: boolean ytsaurus: description: |- @@ -72,6 +78,7 @@ spec: type: object x-kubernetes-map-type: atomic required: + - createPublicClique - makeDefault type: object status: diff --git a/config/samples/cluster_v1_chyt.yaml b/config/samples/cluster_v1_chyt.yaml index aa3c3cfd..59cac769 100644 --- a/config/samples/cluster_v1_chyt.yaml +++ b/config/samples/cluster_v1_chyt.yaml @@ -8,3 +8,4 @@ spec: minisaurus image: ghcr.io/ytsaurus/chyt:2.14.0-relwithdebinfo makeDefault: true + createPublicClique: true diff --git a/docs/api.md b/docs/api.md index 1eb1e2a0..276c4193 100644 --- a/docs/api.md +++ b/docs/api.md @@ -181,7 +181,8 @@ _Appears in:_ | `imagePullSecrets` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#localobjectreference-v1-core) array_ | | | | | `ytsaurus` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#localobjectreference-v1-core)_ | | | | | `image` _string_ | | | | -| `makeDefault` _boolean_ | | false | | +| `makeDefault` _boolean_ | Mark specified image as default for cliques. | false | | +| `createPublicClique` _boolean_ | Create ch_public clique, which is used by default when running CHYT queries. | false | | diff --git a/pkg/components/chyt.go b/pkg/components/chyt.go index 83012f0b..3b8ab675 100644 --- a/pkg/components/chyt.go +++ b/pkg/components/chyt.go @@ -188,7 +188,7 @@ func (c *Chyt) doSync(ctx context.Context, dry bool) (ComponentStatus, error) { return status, err } - if c.ytsaurus.Spec.StrawberryController != nil && c.chyt.GetResource().Spec.MakeDefault { + if c.ytsaurus.Spec.StrawberryController != nil && c.chyt.GetResource().Spec.CreatePublicClique { if !dry { c.prepareChPublicJob() } diff --git a/ytop-chart/templates/crds/chyts.cluster.ytsaurus.tech.yaml b/ytop-chart/templates/crds/chyts.cluster.ytsaurus.tech.yaml index 9d284822..aa62be7e 100644 --- a/ytop-chart/templates/crds/chyts.cluster.ytsaurus.tech.yaml +++ b/ytop-chart/templates/crds/chyts.cluster.ytsaurus.tech.yaml @@ -51,6 +51,11 @@ spec: spec: description: ChytSpec defines the desired state of Chyt properties: + createPublicClique: + default: false + description: Create ch_public clique, which is used by default when + running CHYT queries. + type: boolean image: type: string imagePullSecrets: @@ -69,6 +74,7 @@ spec: type: array makeDefault: default: false + description: Mark specified image as default for cliques. type: boolean ytsaurus: description: |- @@ -83,6 +89,7 @@ spec: type: object x-kubernetes-map-type: atomic required: + - createPublicClique - makeDefault type: object status: From 313bb670fe63f876a8ce783921bff380862035f9 Mon Sep 17 00:00:00 2001 From: Andrey Chulkov Date: Thu, 19 Sep 2024 10:46:38 +0000 Subject: [PATCH 2/2] Change createPublicClique from bool to *bool --- api/v1/chyt_types.go | 3 +-- api/v1/zz_generated.deepcopy.go | 5 +++++ config/crd/bases/cluster.ytsaurus.tech_chyts.yaml | 2 -- docs/api.md | 2 +- pkg/components/chyt.go | 3 ++- ytop-chart/templates/crds/chyts.cluster.ytsaurus.tech.yaml | 2 -- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/api/v1/chyt_types.go b/api/v1/chyt_types.go index 2fc59813..1a7e5b9f 100644 --- a/api/v1/chyt_types.go +++ b/api/v1/chyt_types.go @@ -44,8 +44,7 @@ type ChytSpec struct { //+kubebuilder:default:=false MakeDefault bool `json:"makeDefault"` // Create ch_public clique, which is used by default when running CHYT queries. - //+kubebuilder:default:=false - CreatePublicClique bool `json:"createPublicClique"` + CreatePublicClique *bool `json:"createPublicClique,omitempty"` } // ChytStatus defines the observed state of Chyt diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index ec571566..efcd74ee 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -273,6 +273,11 @@ func (in *ChytSpec) DeepCopyInto(out *ChytSpec) { *out = new(corev1.LocalObjectReference) **out = **in } + if in.CreatePublicClique != nil { + in, out := &in.CreatePublicClique, &out.CreatePublicClique + *out = new(bool) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChytSpec. diff --git a/config/crd/bases/cluster.ytsaurus.tech_chyts.yaml b/config/crd/bases/cluster.ytsaurus.tech_chyts.yaml index 921ed214..616d8963 100644 --- a/config/crd/bases/cluster.ytsaurus.tech_chyts.yaml +++ b/config/crd/bases/cluster.ytsaurus.tech_chyts.yaml @@ -41,7 +41,6 @@ spec: description: ChytSpec defines the desired state of Chyt properties: createPublicClique: - default: false description: Create ch_public clique, which is used by default when running CHYT queries. type: boolean @@ -78,7 +77,6 @@ spec: type: object x-kubernetes-map-type: atomic required: - - createPublicClique - makeDefault type: object status: diff --git a/docs/api.md b/docs/api.md index 276c4193..4e7a9fc0 100644 --- a/docs/api.md +++ b/docs/api.md @@ -182,7 +182,7 @@ _Appears in:_ | `ytsaurus` _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#localobjectreference-v1-core)_ | | | | | `image` _string_ | | | | | `makeDefault` _boolean_ | Mark specified image as default for cliques. | false | | -| `createPublicClique` _boolean_ | Create ch_public clique, which is used by default when running CHYT queries. | false | | +| `createPublicClique` _boolean_ | Create ch_public clique, which is used by default when running CHYT queries. | | | diff --git a/pkg/components/chyt.go b/pkg/components/chyt.go index 3b8ab675..b9aa99bd 100644 --- a/pkg/components/chyt.go +++ b/pkg/components/chyt.go @@ -188,7 +188,8 @@ func (c *Chyt) doSync(ctx context.Context, dry bool) (ComponentStatus, error) { return status, err } - if c.ytsaurus.Spec.StrawberryController != nil && c.chyt.GetResource().Spec.CreatePublicClique { + createPublicClique := c.chyt.GetResource().Spec.CreatePublicClique + if c.ytsaurus.Spec.StrawberryController != nil && createPublicClique != nil && *createPublicClique { if !dry { c.prepareChPublicJob() } diff --git a/ytop-chart/templates/crds/chyts.cluster.ytsaurus.tech.yaml b/ytop-chart/templates/crds/chyts.cluster.ytsaurus.tech.yaml index aa62be7e..7ce12a8e 100644 --- a/ytop-chart/templates/crds/chyts.cluster.ytsaurus.tech.yaml +++ b/ytop-chart/templates/crds/chyts.cluster.ytsaurus.tech.yaml @@ -52,7 +52,6 @@ spec: description: ChytSpec defines the desired state of Chyt properties: createPublicClique: - default: false description: Create ch_public clique, which is used by default when running CHYT queries. type: boolean @@ -89,7 +88,6 @@ spec: type: object x-kubernetes-map-type: atomic required: - - createPublicClique - makeDefault type: object status: