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

remove validation pdaddress #4718

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
6 changes: 3 additions & 3 deletions pkg/apis/pingcap/v1alpha1/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ func validateTiDBClusterSpec(spec *v1alpha1.TidbClusterSpec, fldPath *field.Path
if spec.TiCDC != nil {
allErrs = append(allErrs, validateTiCDCSpec(spec.TiCDC, fldPath.Child("ticdc"))...)
}
if spec.PDAddresses != nil {
allErrs = append(allErrs, validatePDAddresses(spec.PDAddresses, fldPath.Child("pdAddresses"))...)
}
// if spec.PDAddresses != nil {
// allErrs = append(allErrs, validatePDAddresses(spec.PDAddresses, fldPath.Child("pdAddresses"))...)
// }
return allErrs
}

Expand Down
7 changes: 7 additions & 0 deletions pkg/manager/member/pd_member_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,8 @@ func getNewPDSetForTidbCluster(tc *v1alpha1.TidbCluster, cm *corev1.ConfigMap) (
return pdSet, nil
}

const PDNamePrefixAnnKey = "tidb.pingcap.com/pd-name-prefix"

func getPDConfigMap(tc *v1alpha1.TidbCluster) (*corev1.ConfigMap, error) {
// For backward compatibility, only sync tidb configmap when .tidb.config is non-nil
if tc.Spec.PD.Config == nil {
Expand Down Expand Up @@ -873,6 +875,11 @@ func getPDConfigMap(tc *v1alpha1.TidbCluster) (*corev1.ConfigMap, error) {
Scheme: tc.Scheme(),
DataDir: filepath.Join(pdDataVolumeMountPath, tc.Spec.PD.DataSubDir),
}

if v, ok := tc.Annotations[PDNamePrefixAnnKey]; ok {
sm.PDNamePrefix = v
}

if tc.Spec.PD.StartUpScriptVersion == "v1" {
sm.CheckDomainScript = checkDNSV1
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/manager/member/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ fi {{- else}}{{.CheckDomainScript}}{{end}}
done

ARGS="--data-dir={{ .DataDir }} \
--name={{- if or .AcrossK8s .ClusterDomain }}${domain}{{- else }}${POD_NAME}{{- end }} \
--name={{ .PDNamePrefix }}{{- if or .AcrossK8s .ClusterDomain }}${domain}{{- else }}${POD_NAME}{{- end }} \
--peer-urls={{ .Scheme }}://0.0.0.0:2380 \
--advertise-peer-urls={{ .Scheme }}://${domain}:2380 \
--client-urls={{ .Scheme }}://0.0.0.0:2379 \
Expand Down Expand Up @@ -233,6 +233,7 @@ type PDStartScriptModel struct {
Scheme string
DataDir string
CheckDomainScript string
PDNamePrefix string
}

func RenderPDStartScript(model *PDStartScriptModel) (string, error) {
Expand Down