Skip to content

Commit

Permalink
add mysql_server_version flag to vtbackup and mysqlctld
Browse files Browse the repository at this point in the history
Signed-off-by: Florent Poinsard <[email protected]>
  • Loading branch information
frouioui committed Jan 18, 2024
1 parent 6a7482f commit 5f7d0b8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/vitessshard/reconcile_backup_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (r *ReconcileVitessShard) reconcileBackupJob(ctx context.Context, vts *plan
Kind: &corev1.Pod{},

New: func(key client.ObjectKey) runtime.Object {
return vttablet.NewBackupPod(key, specMap[key])
return vttablet.NewBackupPod(key, specMap[key], vts.Spec.Images.Mysqld.Image())
},
Status: func(key client.ObjectKey, obj runtime.Object) {
pod := obj.(*corev1.Pod)
Expand Down
5 changes: 4 additions & 1 deletion pkg/operator/vttablet/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,16 @@ func UpdatePod(obj *corev1.Pod, spec *Spec) {
var mysqldContainer *corev1.Container
var mysqldExporterContainer *corev1.Container

mysqlctldAllFlags := mysqlctldFlags.Get(spec)
mysql.UpdateMySQLServerVersion(mysqlctldAllFlags, spec.Images.Mysqld.Image())

if spec.Mysqld != nil {
mysqldContainer = &corev1.Container{
Name: MysqldContainerName,
Image: spec.Images.Mysqld.Image(),
ImagePullPolicy: spec.ImagePullPolicies.Mysqld,
Command: []string{mysqldCommand},
Args: mysqlctldFlags.Get(spec).FormatArgs(),
Args: mysqlctldAllFlags.FormatArgs(),
Ports: []corev1.ContainerPort{
{
Name: planetscalev2.DefaultMysqlPortName,
Expand Down
7 changes: 5 additions & 2 deletions pkg/operator/vttablet/vtbackup_pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"planetscale.dev/vitess-operator/pkg/operator/mysql"
"sigs.k8s.io/controller-runtime/pkg/client"

planetscalev2 "planetscale.dev/vitess-operator/pkg/apis/planetscale/v2"
Expand Down Expand Up @@ -92,7 +93,7 @@ func InitialBackupPodName(clusterName, keyspaceName string, keyRange planetscale

// NewBackupPod creates a new vtbackup Pod, which is like a special kind of
// minimal tablet used to run backups as a batch process.
func NewBackupPod(key client.ObjectKey, backupSpec *BackupSpec) *corev1.Pod {
func NewBackupPod(key client.ObjectKey, backupSpec *BackupSpec, mysqldImage string) *corev1.Pod {
tabletSpec := backupSpec.TabletSpec

// Include vttablet env vars, since we run some vttablet code like backups.
Expand Down Expand Up @@ -132,6 +133,8 @@ func NewBackupPod(key client.ObjectKey, backupSpec *BackupSpec) *corev1.Pod {
// Make a copy of Resources since it contains pointers.
update.ResourceRequirements(&containerResources, &tabletSpec.Mysqld.Resources)

vtbackupAllFlags := vtbackupFlags.Get(backupSpec)
mysql.UpdateMySQLServerVersion(vtbackupAllFlags, mysqldImage)
pod := &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Namespace: key.Namespace,
Expand Down Expand Up @@ -171,7 +174,7 @@ func NewBackupPod(key client.ObjectKey, backupSpec *BackupSpec) *corev1.Pod {
Image: tabletSpec.Images.Mysqld.Image(),
ImagePullPolicy: tabletSpec.ImagePullPolicies.Mysqld,
Command: []string{vtbackupCommand},
Args: vtbackupFlags.Get(backupSpec).FormatArgs(),
Args: vtbackupAllFlags.FormatArgs(),
Resources: containerResources,
SecurityContext: securityContext,
Env: env,
Expand Down

0 comments on commit 5f7d0b8

Please sign in to comment.