Skip to content

Commit

Permalink
Mount cluster client secret only if the clusterTLSSecretName is unset
Browse files Browse the repository at this point in the history
  • Loading branch information
ideascf committed Oct 28, 2024
1 parent 33fe843 commit 29e8f43
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions pkg/manager/member/ticdc_member_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,6 @@ func getNewTiCDCStatefulSet(tc *v1alpha1.TidbCluster, cm *corev1.ConfigMap) (*ap
Name: ticdcCertVolumeMount,
ReadOnly: true,
MountPath: constants.TiCDCCertPath,
}, corev1.VolumeMount{
Name: util.ClusterClientVolName,
ReadOnly: true,
MountPath: util.ClusterClientTLSPath,
})

vols = append(vols, corev1.Volume{
Expand All @@ -408,13 +404,23 @@ func getNewTiCDCStatefulSet(tc *v1alpha1.TidbCluster, cm *corev1.ConfigMap) (*ap
SecretName: getTiCDCClusterTLSCertSecretName(tc),
},
},
}, corev1.Volume{
Name: util.ClusterClientVolName, VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
SecretName: util.ClusterClientTLSSecretName(tc.Name),
},
},
})

// For compatibility, mount the cluster client TLS secret if the ClusterTLSSecretName is unset
if tc.Spec.TiCDC.ClusterTLSSecretName == "" {
volMounts = append(volMounts, corev1.VolumeMount{
Name: util.ClusterClientVolName,
ReadOnly: true,
MountPath: util.ClusterClientTLSPath,
})
vols = append(vols, corev1.Volume{
Name: util.ClusterClientVolName, VolumeSource: corev1.VolumeSource{
Secret: &corev1.SecretVolumeSource{
SecretName: util.ClusterClientTLSSecretName(tc.Name),
},
},
})
}
}

// handle StorageVolumes and AdditionalVolumeMounts in ComponentSpec
Expand Down

0 comments on commit 29e8f43

Please sign in to comment.