From 6e4c1b3020d40305baa8fdcf6cdcf3d95ed952a0 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Tue, 8 Oct 2024 17:13:23 -0600 Subject: [PATCH 1/3] Support customisation of docker images per-keyspace Signed-off-by: Florent Poinsard --- .../crds/planetscale.com_vitessclusters.yaml | 8 +++ docs/api/index.html | 51 ++++++++++++++++++- .../planetscale/v2/vitesskeyspace_defaults.go | 12 +++++ .../planetscale/v2/vitesskeyspace_types.go | 16 +++++- test/endtoend/operator/operator-latest.yaml | 8 +++ 5 files changed, 93 insertions(+), 2 deletions(-) diff --git a/deploy/crds/planetscale.com_vitessclusters.yaml b/deploy/crds/planetscale.com_vitessclusters.yaml index 9b56e67b..a03f74a2 100644 --- a/deploy/crds/planetscale.com_vitessclusters.yaml +++ b/deploy/crds/planetscale.com_vitessclusters.yaml @@ -1181,6 +1181,14 @@ spec: mysql80Compatible: type: string type: object + mysqldExporter: + type: string + vtbackup: + type: string + vtorc: + type: string + vttablet: + type: string type: object name: maxLength: 63 diff --git a/docs/api/index.html b/docs/api/index.html index 809e6e46..b6de9ff1 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -5977,7 +5977,12 @@

VitessKeyspaceTemplateI

VitessKeyspaceTemplateImages specifies user-definable container images to -use for this keyspace.

+use for this keyspace. The images defined here by the user will override +those defined at the top-level in VitessCluster.spec.images

+

Note: this structure is a copy of VitessKeyspaceImages, once we have gotten +rid of MysqldImage and replaced it by MysqldImageNew (planned for v2.15), we +should be able to remove VitessKeyspaceTemplateImages entirely and just use +VitessKeyspaceImages instead as it contains exactly the same fields.

@@ -5989,6 +5994,39 @@

VitessKeyspaceTemplateI

+ + + + + + + + + + + + + + + +
+vttablet
+ +string + +
+

Vttablet is the container image (including version tag) to use for Vitess Tablet instances.

+
+vtorc
+ +string + +
+

Vtorc is the container image (including version tag) to use for Vitess Orchestrator instances.

+
+vtbackup
+ +string + +
+

Vtbackup is the container image (including version tag) to use for Vitess Backup jobs.

+
mysqld
@@ -6003,6 +6041,17 @@

VitessKeyspaceTemplateI mysqld running alongside each tablet.

+mysqldExporter
+ +string + +
+

MysqldExporter specifies the container image for mysqld-exporter.

+

VitessKeyspaceTurndownPolicy diff --git a/pkg/apis/planetscale/v2/vitesskeyspace_defaults.go b/pkg/apis/planetscale/v2/vitesskeyspace_defaults.go index aa5c51d2..a98a0f49 100644 --- a/pkg/apis/planetscale/v2/vitesskeyspace_defaults.go +++ b/pkg/apis/planetscale/v2/vitesskeyspace_defaults.go @@ -73,8 +73,20 @@ func DefaultVitessKeyspaceImages(dst *VitessKeyspaceImages, clusterDefaults *Vit // MergeVitessKeyspaceTemplateImages takes non-empty image values from a non-nil src // and sets them on dst. func MergeVitessKeyspaceTemplateImages(dst *VitessKeyspaceImages, src *VitessKeyspaceTemplateImages) { + if src.Vttablet != "" { + dst.Vttablet = src.Vttablet + } + if src.Vtorc != "" { + dst.Vtorc = src.Vtorc + } + if src.Vtbackup != "" { + dst.Vtbackup = src.Vtbackup + } if src.Mysqld != nil { dst.Mysqld.Mysql56Compatible = src.Mysqld.Mysql56Compatible dst.Mysqld.Mysql80Compatible = src.Mysqld.Mysql80Compatible } + if src.MysqldExporter != "" { + dst.MysqldExporter = src.MysqldExporter + } } diff --git a/pkg/apis/planetscale/v2/vitesskeyspace_types.go b/pkg/apis/planetscale/v2/vitesskeyspace_types.go index 1550b242..370e17c9 100644 --- a/pkg/apis/planetscale/v2/vitesskeyspace_types.go +++ b/pkg/apis/planetscale/v2/vitesskeyspace_types.go @@ -188,13 +188,27 @@ type VitessKeyspaceTemplate struct { } // VitessKeyspaceTemplateImages specifies user-definable container images to -// use for this keyspace. +// use for this keyspace. The images defined here by the user will override +// those defined at the top-level in VitessCluster.spec.images +// +// Note: this structure is a copy of VitessKeyspaceImages, once we have gotten +// rid of MysqldImage and replaced it by MysqldImageNew (planned for v2.15), we +// should be able to remove VitessKeyspaceTemplateImages entirely and just use +// VitessKeyspaceImages instead as it contains exactly the same fields. type VitessKeyspaceTemplateImages struct { + // Vttablet is the container image (including version tag) to use for Vitess Tablet instances. + Vttablet string `json:"vttablet,omitempty"` + // Vtorc is the container image (including version tag) to use for Vitess Orchestrator instances. + Vtorc string `json:"vtorc,omitempty"` + // Vtbackup is the container image (including version tag) to use for Vitess Backup jobs. + Vtbackup string `json:"vtbackup,omitempty"` // Mysqld specifies the container image to use for mysqld, as well as // declaring which MySQL flavor setting in Vitess the image is // compatible with. Only one flavor image may be provided at a time. // mysqld running alongside each tablet. Mysqld *MysqldImageNew `json:"mysqld,omitempty"` + // MysqldExporter specifies the container image for mysqld-exporter. + MysqldExporter string `json:"mysqldExporter,omitempty"` } // VitessOrchestratorSpec specifies deployment parameters for vtorc. diff --git a/test/endtoend/operator/operator-latest.yaml b/test/endtoend/operator/operator-latest.yaml index 847cc8b5..76bd563c 100644 --- a/test/endtoend/operator/operator-latest.yaml +++ b/test/endtoend/operator/operator-latest.yaml @@ -2498,6 +2498,14 @@ spec: mysql80Compatible: type: string type: object + mysqldExporter: + type: string + vtbackup: + type: string + vtorc: + type: string + vttablet: + type: string type: object name: maxLength: 63 From d81400fa24ae2c0ed27e805f9464bfd2a125628d Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Wed, 9 Oct 2024 09:51:17 -0600 Subject: [PATCH 2/3] add disclaimer in the documentation about vitess compatibility Signed-off-by: Florent Poinsard --- docs/api/index.html | 8 +++++++- pkg/apis/planetscale/v2/vitesskeyspace_types.go | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/api/index.html b/docs/api/index.html index b6de9ff1..8b37ba19 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -5978,7 +5978,13 @@

VitessKeyspaceTemplateI

VitessKeyspaceTemplateImages specifies user-definable container images to use for this keyspace. The images defined here by the user will override -those defined at the top-level in VitessCluster.spec.images

+those defined at the top-level in VitessCluster.spec.images.

+

While this field allows you to set a different set of Vitess version for +some components of Vitess than the version defined at the top level, it +is important to note that Vitess only ensure compatibility between one +version and the next and previous one. For instance: N is only compatible +with N+1 and N-1. Do be careful when specifying multiple versions across +your cluster so that they respect this compatibility rule.

Note: this structure is a copy of VitessKeyspaceImages, once we have gotten rid of MysqldImage and replaced it by MysqldImageNew (planned for v2.15), we should be able to remove VitessKeyspaceTemplateImages entirely and just use diff --git a/pkg/apis/planetscale/v2/vitesskeyspace_types.go b/pkg/apis/planetscale/v2/vitesskeyspace_types.go index 370e17c9..5f1558f9 100644 --- a/pkg/apis/planetscale/v2/vitesskeyspace_types.go +++ b/pkg/apis/planetscale/v2/vitesskeyspace_types.go @@ -189,7 +189,14 @@ type VitessKeyspaceTemplate struct { // VitessKeyspaceTemplateImages specifies user-definable container images to // use for this keyspace. The images defined here by the user will override -// those defined at the top-level in VitessCluster.spec.images +// those defined at the top-level in VitessCluster.spec.images. +// +// While this field allows you to set a different set of Vitess version for +// some components of Vitess than the version defined at the top level, it +// is important to note that Vitess only ensure compatibility between one +// version and the next and previous one. For instance: N is only compatible +// with N+1 and N-1. Do be careful when specifying multiple versions across +// your cluster so that they respect this compatibility rule. // // Note: this structure is a copy of VitessKeyspaceImages, once we have gotten // rid of MysqldImage and replaced it by MysqldImageNew (planned for v2.15), we From 29c74a1a905e2a91bf46392d6e00b72b0437320e Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Fri, 11 Oct 2024 08:54:05 -0600 Subject: [PATCH 3/3] Review suggestion - doc Signed-off-by: Florent Poinsard --- docs/api/index.html | 8 ++++---- pkg/apis/planetscale/v2/vitesskeyspace_types.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/api/index.html b/docs/api/index.html index 8b37ba19..c22c0e76 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -5979,10 +5979,10 @@

VitessKeyspaceTemplateI

VitessKeyspaceTemplateImages specifies user-definable container images to use for this keyspace. The images defined here by the user will override those defined at the top-level in VitessCluster.spec.images.

-

While this field allows you to set a different set of Vitess version for -some components of Vitess than the version defined at the top level, it -is important to note that Vitess only ensure compatibility between one -version and the next and previous one. For instance: N is only compatible +

While this field allows you to set a different Vitess version for some +components than the version defined at the top level, it is important to +note that Vitess only ensures compatibility between one version and the +next and previous one. For instance: N is only guaranteed to be compatible with N+1 and N-1. Do be careful when specifying multiple versions across your cluster so that they respect this compatibility rule.

Note: this structure is a copy of VitessKeyspaceImages, once we have gotten diff --git a/pkg/apis/planetscale/v2/vitesskeyspace_types.go b/pkg/apis/planetscale/v2/vitesskeyspace_types.go index 5f1558f9..1d8dbdd0 100644 --- a/pkg/apis/planetscale/v2/vitesskeyspace_types.go +++ b/pkg/apis/planetscale/v2/vitesskeyspace_types.go @@ -191,10 +191,10 @@ type VitessKeyspaceTemplate struct { // use for this keyspace. The images defined here by the user will override // those defined at the top-level in VitessCluster.spec.images. // -// While this field allows you to set a different set of Vitess version for -// some components of Vitess than the version defined at the top level, it -// is important to note that Vitess only ensure compatibility between one -// version and the next and previous one. For instance: N is only compatible +// While this field allows you to set a different Vitess version for some +// components than the version defined at the top level, it is important to +// note that Vitess only ensures compatibility between one version and the +// next and previous one. For instance: N is only guaranteed to be compatible // with N+1 and N-1. Do be careful when specifying multiple versions across // your cluster so that they respect this compatibility rule. //