Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support customisation of docker images per-keyspace #610

Merged
merged 4 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions deploy/crds/planetscale.com_vitessclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,14 @@ spec:
mysql80Compatible:
type: string
type: object
mysqldExporter:
type: string
vtbackup:
type: string
vtorc:
type: string
vttablet:
type: string
type: object
name:
maxLength: 63
Expand Down
57 changes: 56 additions & 1 deletion docs/api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6551,7 +6551,18 @@ <h3 id="planetscale.com/v2.VitessKeyspaceTemplateImages">VitessKeyspaceTemplateI
</p>
<p>
<p>VitessKeyspaceTemplateImages specifies user-definable container images to
use for this keyspace.</p>
use for this keyspace. The images defined here by the user will override
those defined at the top-level in VitessCluster.spec.images.</p>
<p>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.</p>
<p>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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that that new was only temporary? This makes it seem like it's permanent. Maybe I'm misunderstanding.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is only temporary, we will fix it within this release cycle on main

should be able to remove VitessKeyspaceTemplateImages entirely and just use
VitessKeyspaceImages instead as it contains exactly the same fields.</p>
</p>
<table class="table table-striped">
<thead class="thead-dark">
Expand All @@ -6563,6 +6574,39 @@ <h3 id="planetscale.com/v2.VitessKeyspaceTemplateImages">VitessKeyspaceTemplateI
<tbody>
<tr>
<td>
<code>vttablet</code></br>
<em>
string
</em>
</td>
<td>
<p>Vttablet is the container image (including version tag) to use for Vitess Tablet instances.</p>
</td>
</tr>
<tr>
<td>
<code>vtorc</code></br>
<em>
string
</em>
</td>
<td>
<p>Vtorc is the container image (including version tag) to use for Vitess Orchestrator instances.</p>
</td>
</tr>
<tr>
<td>
<code>vtbackup</code></br>
<em>
string
</em>
</td>
<td>
<p>Vtbackup is the container image (including version tag) to use for Vitess Backup jobs.</p>
</td>
</tr>
<tr>
<td>
<code>mysqld</code></br>
<em>
<a href="#planetscale.com/v2.MysqldImageNew">
Expand All @@ -6577,6 +6621,17 @@ <h3 id="planetscale.com/v2.VitessKeyspaceTemplateImages">VitessKeyspaceTemplateI
mysqld running alongside each tablet.</p>
</td>
</tr>
<tr>
<td>
<code>mysqldExporter</code></br>
<em>
string
</em>
</td>
<td>
<p>MysqldExporter specifies the container image for mysqld-exporter.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="planetscale.com/v2.VitessKeyspaceTurndownPolicy">VitessKeyspaceTurndownPolicy
Expand Down
12 changes: 12 additions & 0 deletions pkg/apis/planetscale/v2/vitesskeyspace_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
23 changes: 22 additions & 1 deletion pkg/apis/planetscale/v2/vitesskeyspace_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,34 @@ 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.
//
// 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
// 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.
Expand Down
8 changes: 8 additions & 0 deletions test/endtoend/operator/operator-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2830,6 +2830,14 @@ spec:
mysql80Compatible:
type: string
type: object
mysqldExporter:
type: string
vtbackup:
type: string
vtorc:
type: string
vttablet:
type: string
type: object
name:
maxLength: 63
Expand Down
Loading