Skip to content

Commit

Permalink
cr: dont propagate mariadb or non-mysqld related images; update comme…
Browse files Browse the repository at this point in the history
…nts about version skew

Signed-off-by: Max Englander <[email protected]>
  • Loading branch information
maxenglander committed Jan 24, 2024
1 parent 5030d17 commit a4207a5
Show file tree
Hide file tree
Showing 7 changed files with 155 additions and 46 deletions.
12 changes: 0 additions & 12 deletions deploy/crds/planetscale.com_vitessclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1176,23 +1176,11 @@ spec:
properties:
mysqld:
properties:
mariadb103Compatible:
type: string
mariadbCompatible:
type: string
mysql56Compatible:
type: string
mysql80Compatible:
type: string
type: object
mysqldExporter:
type: string
vtbackup:
type: string
vtorc:
type: string
vttablet:
type: string
type: object
name:
maxLength: 63
Expand Down
100 changes: 89 additions & 11 deletions docs/api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1450,9 +1450,7 @@ <h3 id="planetscale.com/v2.MysqldImage">MysqldImage
<a href="#planetscale.com/v2.VitessKeyspaceImages">VitessKeyspaceImages</a>)
</p>
<p>
<p>MysqldImage specifies the container image to use for mysqld,
as well as declaring which MySQL flavor setting in Vitess the
image is compatible with.</p>
<p>TODO: Remove this once everything is migrated to MysqldImageNew.</p>
</p>
<table class="table table-striped">
<thead class="thead-dark">
Expand Down Expand Up @@ -1512,6 +1510,52 @@ <h3 id="planetscale.com/v2.MysqldImage">MysqldImage
</tr>
</tbody>
</table>
<h3 id="planetscale.com/v2.MysqldImageNew">MysqldImageNew
</h3>
<p>
(<em>Appears on:</em>
<a href="#planetscale.com/v2.VitessKeyspaceTemplateImages">VitessKeyspaceTemplateImages</a>)
</p>
<p>
<p>MysqldImageNew specifies the container image to use for mysqld,
as well as declaring which MySQL flavor setting in Vitess the
image is compatible with.</p>
<p>TODO: rename this to MysqldImage once MysqldImage is removed.</p>
</p>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>mysql56Compatible</code></br>
<em>
string
</em>
</td>
<td>
<p>Mysql56Compatible is a container image (including version tag) for mysqld
that&rsquo;s compatible with the Vitess &ldquo;MySQL56&rdquo; flavor setting.</p>
</td>
</tr>
<tr>
<td>
<code>mysql80Compatible</code></br>
<em>
string
</em>
</td>
<td>
<p>Mysql80Compatible is a container image (including version tag) for mysqld
that&rsquo;s compatible with the Vitess &ldquo;MySQL80&rdquo; flavor setting.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="planetscale.com/v2.MysqldSpec">MysqldSpec
</h3>
<p>
Expand Down Expand Up @@ -4774,7 +4818,8 @@ <h3 id="planetscale.com/v2.VitessKeyspace">VitessKeyspace
specified keyspace-level overrides. Version skew across the cluster is
discouraged except during rolling updates, in which case this field is
automatically managed by the VitessCluster controller that owns this
VitessKeyspace.</p>
VitessKeyspace, or else when a user has specified a keyspace-level
images on VitessKeyspaceTemplate.</p>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -5079,7 +5124,6 @@ <h3 id="planetscale.com/v2.VitessKeyspaceImages">VitessKeyspaceImages
<p>
(<em>Appears on:</em>
<a href="#planetscale.com/v2.VitessKeyspaceSpec">VitessKeyspaceSpec</a>,
<a href="#planetscale.com/v2.VitessKeyspaceTemplate">VitessKeyspaceTemplate</a>,
<a href="#planetscale.com/v2.VitessShardSpec">VitessShardSpec</a>)
</p>
<p>
Expand Down Expand Up @@ -5563,7 +5607,8 @@ <h3 id="planetscale.com/v2.VitessKeyspaceSpec">VitessKeyspaceSpec
specified keyspace-level overrides. Version skew across the cluster is
discouraged except during rolling updates, in which case this field is
automatically managed by the VitessCluster controller that owns this
VitessKeyspace.</p>
VitessKeyspace, or else when a user has specified a keyspace-level
images on VitessKeyspaceTemplate.</p>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -5943,22 +5988,55 @@ <h3 id="planetscale.com/v2.VitessKeyspaceTemplate">VitessKeyspaceTemplate
<td>
<code>images</code></br>
<em>
<a href="#planetscale.com/v2.VitessKeyspaceImages">
VitessKeyspaceImages
<a href="#planetscale.com/v2.VitessKeyspaceTemplateImages">
VitessKeyspaceTemplateImages
</a>
</em>
</td>
<td>
<p>Users are encouraged to let the VitessCluster controller automatically
propagate image changes from the VitessCluster to the VitessKeyspace
via rolling updates.</p>
<p>For special cases, users may specify per-VitessKeyspace images. An
example: migrating from MySQL 5.7 to MySQL 8.0 via a <code>MoveTables</code>
operation, after which the source keyspace is destroyed.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="planetscale.com/v2.VitessKeyspaceTemplateImages">VitessKeyspaceTemplateImages
</h3>
<p>
(<em>Appears on:</em>
<a href="#planetscale.com/v2.VitessKeyspaceTemplate">VitessKeyspaceTemplate</a>)
</p>
<p>
<p>VitessKeyspaceTemplateImages specifies user-definable container images to
use for this keyspace.</p>
</p>
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>mysqld</code></br>
<em>
<a href="#planetscale.com/v2.MysqldImageNew">
MysqldImageNew
</a>
</em>
</td>
<td>
<p>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.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="planetscale.com/v2.VitessKeyspaceTurndownPolicy">VitessKeyspaceTurndownPolicy
(<code>string</code> alias)</p></h3>
<p>
Expand Down
14 changes: 13 additions & 1 deletion pkg/apis/planetscale/v2/vitesscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,21 @@ type VitessImages struct {
MysqldExporter string `json:"mysqldExporter,omitempty"`
}

// MysqldImage specifies the container image to use for mysqld,
// MysqldImageNew specifies the container image to use for mysqld,
// as well as declaring which MySQL flavor setting in Vitess the
// image is compatible with.
//
// TODO: rename this to MysqldImage once MysqldImage is removed.
type MysqldImageNew struct {
// Mysql56Compatible is a container image (including version tag) for mysqld
// that's compatible with the Vitess "MySQL56" flavor setting.
Mysql56Compatible string `json:"mysql56Compatible,omitempty"`
// Mysql80Compatible is a container image (including version tag) for mysqld
// that's compatible with the Vitess "MySQL80" flavor setting.
Mysql80Compatible string `json:"mysql80Compatible,omitempty"`
}

// TODO: Remove this once everything is migrated to MysqldImageNew.
type MysqldImage struct {
// Mysql56Compatible is a container image (including version tag) for mysqld
// that's compatible with the Vitess "MySQL56" flavor setting.
Expand Down
19 changes: 4 additions & 15 deletions pkg/apis/planetscale/v2/vitesskeyspace_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,11 @@ func DefaultVitessKeyspaceImages(dst *VitessKeyspaceImages, clusterDefaults *Vit
}
}

// MergeVitessKeyspaceImages takes non-empty image values from a non-nil src
// MergeVitessKeyspaceTemplateImages takes non-empty image values from a non-nil src
// and sets them on dst.
func MergeVitessKeyspaceImages(dst *VitessKeyspaceImages, src *VitessKeyspaceImages) {
if src.Vttablet != "" {
dst.Vttablet = src.Vttablet
}
if src.Vtorc != "" {
dst.Vtorc = src.Vtorc
}
if src.Vtbackup != "" {
dst.Vtbackup = src.Vtbackup
}
func MergeVitessKeyspaceTemplateImages(dst *VitessKeyspaceImages, src *VitessKeyspaceTemplateImages) {
if src.Mysqld != nil {
dst.Mysqld = src.Mysqld
}
if src.MysqldExporter != "" {
dst.MysqldExporter = src.MysqldExporter
dst.Mysqld.Mysql56Compatible = src.Mysqld.Mysql56Compatible
dst.Mysqld.Mysql80Compatible = src.Mysqld.Mysql80Compatible
}
}
19 changes: 13 additions & 6 deletions pkg/apis/planetscale/v2/vitesskeyspace_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ type VitessKeyspaceSpec struct {
// specified keyspace-level overrides. Version skew across the cluster is
// discouraged except during rolling updates, in which case this field is
// automatically managed by the VitessCluster controller that owns this
// VitessKeyspace.
// VitessKeyspace, or else when a user has specified a keyspace-level
// images on VitessKeyspaceTemplate.
Images VitessKeyspaceImages `json:"images,omitempty"`

// ImagePullPolicies are inherited from the VitessCluster spec.
Expand Down Expand Up @@ -180,14 +181,20 @@ type VitessKeyspaceTemplate struct {
// Annotations can optionally be used to attach custom annotations to the VitessKeyspace object.
Annotations map[string]string `json:"annotations,omitempty"`

// Users are encouraged to let the VitessCluster controller automatically
// propagate image changes from the VitessCluster to the VitessKeyspace
// via rolling updates.
//
// For special cases, users may specify per-VitessKeyspace images. An
// example: migrating from MySQL 5.7 to MySQL 8.0 via a `MoveTables`
// operation, after which the source keyspace is destroyed.
Images VitessKeyspaceImages `json:"images,omitempty"`
Images VitessKeyspaceTemplateImages `json:"images,omitempty"`
}

// VitessKeyspaceTemplateImages specifies user-definable container images to
// use for this keyspace.
type VitessKeyspaceTemplateImages struct {
// 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"`
}

// VitessOrchestratorSpec specifies deployment parameters for vtorc.
Expand Down
35 changes: 35 additions & 0 deletions pkg/apis/planetscale/v2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/controller/vitesscluster/reconcile_keyspaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func newVitessKeyspace(key client.ObjectKey, vt *planetscalev2.VitessCluster, pa
planetscalev2.DefaultVitessKeyspaceImages(&images, &vt.Spec.Images)

// Apply user-defined overrides for images.
planetscalev2.MergeVitessKeyspaceImages(&images, &keyspace.Images)
planetscalev2.MergeVitessKeyspaceTemplateImages(&images, &keyspace.Images)

// Copy parent labels map and add keyspace-specific label.
labels := make(map[string]string, len(parentLabels)+1)
Expand Down

0 comments on commit a4207a5

Please sign in to comment.