Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Jan 8, 2025
1 parent 24fa283 commit cfc6672
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 60 deletions.
14 changes: 7 additions & 7 deletions docs/api-references/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -10972,7 +10972,7 @@ message.</p>
<a href="#tidbclusterspec">TidbClusterSpec</a>)
</p>
<p>
<p>PDMSSpec contains details of PD Micro Service</p>
<p>PDMSSpec contains details of PD Microservice</p>
</p>
<table>
<thead>
Expand Down Expand Up @@ -11020,7 +11020,7 @@ string
</em>
</td>
<td>
<p>Name of the PD Micro Service</p>
<p>Name of the PD Microservice</p>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -11068,7 +11068,7 @@ ServiceSpec
</td>
<td>
<em>(Optional)</em>
<p>Service defines a Kubernetes service of PD Micro Service cluster.
<p>Service defines a Kubernetes service of PD Microservice cluster.
Optional: Defaults to <code>.spec.services</code> in favor of backward compatibility</p>
</td>
</tr>
Expand Down Expand Up @@ -11096,7 +11096,7 @@ PDConfigWraper
</td>
<td>
<em>(Optional)</em>
<p>Config is the Configuration of pd Micro Service servers</p>
<p>Config is the Configuration of pd Microservice servers</p>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -11145,7 +11145,7 @@ string
</td>
<td>
<em>(Optional)</em>
<p>The storageClassName of the persistent volume for PD Micro Service log storage.
<p>The storageClassName of the persistent volume for PD Microservice log storage.
Defaults to Kubernetes default storage class.</p>
</td>
</tr>
Expand All @@ -11160,7 +11160,7 @@ Defaults to Kubernetes default storage class.</p>
</td>
<td>
<em>(Optional)</em>
<p>StorageVolumes configure additional storage for PD Micro Service pods.</p>
<p>StorageVolumes configure additional storage for PD Microservice pods.</p>
</td>
</tr>
<tr>
Expand All @@ -11182,7 +11182,7 @@ int
<a href="#tidbclusterstatus">TidbClusterStatus</a>)
</p>
<p>
<p>PDMSStatus is PD Micro Service Status</p>
<p>PDMSStatus is PD Microservice Status</p>
</p>
<table>
<thead>
Expand Down
12 changes: 6 additions & 6 deletions pkg/apis/pingcap/v1alpha1/openapi_generated.go

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

4 changes: 2 additions & 2 deletions pkg/apis/pingcap/v1alpha1/tidbcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (tc *TidbCluster) PDVersion() string {
return getImageVersion(tc.PDImage())
}

// PDMSImage return the image used by specified PD MicroService.
// PDMSImage return the image used by specified PD Microservice.
//
// If PDMS isn't specified, return empty string.
func (tc *TidbCluster) PDMSImage(spec *PDMSSpec) string {
Expand Down Expand Up @@ -127,7 +127,7 @@ func (tc *TidbCluster) PDMSImage(spec *PDMSSpec) string {
return image
}

// PDMSVersion return the image version used by specified PD MicroService.
// PDMSVersion return the image version used by specified PD Microservice.
//
// If PDMS isn't specified, return empty string.
func (tc *TidbCluster) PDMSVersion(name string) string {
Expand Down
14 changes: 7 additions & 7 deletions pkg/apis/pingcap/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,12 +600,12 @@ type PDSpec struct {
}

// +k8s:openapi-gen=true
// PDMSSpec contains details of PD Micro Service
// PDMSSpec contains details of PD Microservice
type PDMSSpec struct {
ComponentSpec `json:",inline"`
corev1.ResourceRequirements `json:",inline"`

// Name of the PD Micro Service
// Name of the PD Microservice
// +kubebuilder:validation:Enum:="tso";"scheduling"
Name string `json:"name"`

Expand All @@ -621,7 +621,7 @@ type PDMSSpec struct {
// +optional
BaseImage *string `json:"baseImage"`

// Service defines a Kubernetes service of PD Micro Service cluster.
// Service defines a Kubernetes service of PD Microservice cluster.
// Optional: Defaults to `.spec.services` in favor of backward compatibility
// +optional
Service *ServiceSpec `json:"service,omitempty"`
Expand All @@ -632,7 +632,7 @@ type PDMSSpec struct {
// +optional
MaxFailoverCount *int32 `json:"maxFailoverCount,omitempty"`

// Config is the Configuration of pd Micro Service servers
// Config is the Configuration of pd Microservice servers
// +optional
// +kubebuilder:validation:Schemaless
// +kubebuilder:validation:XPreserveUnknownFields
Expand All @@ -652,12 +652,12 @@ type PDMSSpec struct {
// +kubebuilder:validation:Enum:="";"v1"
StartUpScriptVersion string `json:"startUpScriptVersion,omitempty"`

// The storageClassName of the persistent volume for PD Micro Service log storage.
// The storageClassName of the persistent volume for PD Microservice log storage.
// Defaults to Kubernetes default storage class.
// +optional
StorageClassName *string `json:"storageClassName,omitempty"`

// StorageVolumes configure additional storage for PD Micro Service pods.
// StorageVolumes configure additional storage for PD Microservice pods.
// +optional
StorageVolumes []StorageVolume `json:"storageVolumes,omitempty"`

Expand Down Expand Up @@ -1522,7 +1522,7 @@ type PDStatus struct {
VolReplaceInProgress bool `json:"volReplaceInProgress,omitempty"`
}

// PDMSStatus is PD Micro Service Status
// PDMSStatus is PD Microservice Status
type PDMSStatus struct {
Name string `json:"name,omitempty"`
// +optional
Expand Down
16 changes: 8 additions & 8 deletions pkg/manager/member/pd_ms_member_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ func NewPDMSMemberManager(dependencies *controller.Dependencies, pdMSScaler Scal
}
}

// Sync for all PD Micro Service components.
// Sync for all PD Microservice components.
func (m *pdMSMemberManager) Sync(tc *v1alpha1.TidbCluster) error {
// Need to start PD API
if tc.Spec.PDMS != nil && tc.Spec.PD == nil {
klog.Infof("PD Micro Service is enabled, but PD is not enabled, skip syncing PD Micro Service")
klog.Infof("PD Microservice is enabled, but PD is not enabled, skip syncing PD Microservice")
return nil
}
// remove all micro service components if PDMS is not enabled
Expand Down Expand Up @@ -95,7 +95,7 @@ func (m *pdMSMemberManager) Sync(tc *v1alpha1.TidbCluster) error {
return nil
}

// init PD Micro Service status
// init PD Microservice status
if tc.Status.PDMS == nil {
tc.Status.PDMS = make(map[string]*v1alpha1.PDMSStatus)
}
Expand All @@ -115,10 +115,10 @@ func (m *pdMSMemberManager) Sync(tc *v1alpha1.TidbCluster) error {
return nil
}

// syncSingleService for single PD Micro Service components.
// syncSingleService for single PD Microservice components.
func (m *pdMSMemberManager) syncSingleService(tc *v1alpha1.TidbCluster, curSpec *v1alpha1.PDMSSpec) error {
curService := curSpec.Name
// Skip sync if PD Micro Service is suspended
// Skip sync if PD Microservice is suspended
componentMemberType := v1alpha1.PDMSMemberType(curService)
needSuspend, err := m.suspender.SuspendComponent(tc, componentMemberType)
if err != nil {
Expand All @@ -129,17 +129,17 @@ func (m *pdMSMemberManager) syncSingleService(tc *v1alpha1.TidbCluster, curSpec
return nil
}

// Sync PD Micro Service
// Sync PD Microservice
if err := m.syncPDMSService(tc, curSpec); err != nil {
return err
}

// Sync PD Micro Service Headless Service
// Sync PD Microservice Headless Service
if err := m.syncPDMSHeadlessService(tc, curSpec); err != nil {
return err
}

// Sync PD Micro Service StatefulSet
// Sync PD Microservice StatefulSet
return m.syncPDMSStatefulSet(tc, curSpec)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/manager/member/pd_ms_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type pdMSScaler struct {
generalScaler
}

// NewPDMSScaler returns a PD Micro Service Scaler.
// NewPDMSScaler returns a PD Microservice Scaler.
func NewPDMSScaler(deps *controller.Dependencies) *pdMSScaler {
return &pdMSScaler{generalScaler: generalScaler{deps: deps}}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/manager/member/pd_ms_upgrader.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type pdMSUpgrader struct {
deps *controller.Dependencies
}

// NewPDMSUpgrader returns a PD Micro Service Upgrader
// NewPDMSUpgrader returns a PD Microservice Upgrader
func NewPDMSUpgrader(deps *controller.Dependencies) Upgrader {
return &pdMSUpgrader{
deps: deps,
Expand Down Expand Up @@ -129,7 +129,7 @@ func (u *pdMSUpgrader) gracefulUpgrade(tc *v1alpha1.TidbCluster, oldSet *apps.St

func (u *pdMSUpgrader) upgradePDMSPod(tc *v1alpha1.TidbCluster, ordinal int32, newSet *apps.StatefulSet, curService string) error {
// Only support after `8.3.0` to keep compatibility.
if check, err := pdMSSupportMicroServicesWithName.Check(tc.PDMSVersion(curService)); check && err == nil {
if check, err := pdMSSupportMicroservicesWithName.Check(tc.PDMSVersion(curService)); check && err == nil {
ns := tc.GetNamespace()
tcName := tc.GetName()
upgradePDMSName := PDMSName(tcName, ordinal, tc.Namespace, tc.Spec.ClusterDomain, tc.Spec.AcrossK8s, curService)
Expand Down Expand Up @@ -206,9 +206,9 @@ func choosePDMSToTransferFromMembers(tc *v1alpha1.TidbCluster, newSet *apps.Stat
return targetName
}

// PDMSSupportMicroServicesWithName returns true if the given version of PDMS supports microservices with name.
// PDMSSupportMicroservicesWithName returns true if the given version of PDMS supports microservices with name.
// related https://github.com/tikv/pd/pull/8157.
var pdMSSupportMicroServicesWithName, _ = cmpver.NewConstraint(cmpver.GreaterOrEqual, "v8.3.0")
var pdMSSupportMicroservicesWithName, _ = cmpver.NewConstraint(cmpver.GreaterOrEqual, "v8.3.0")

type fakePDMSUpgrader struct{}

Expand Down
2 changes: 1 addition & 1 deletion pkg/manager/member/pvc_resizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (p *pvcResizer) buildContextForTC(tc *v1alpha1.TidbCluster, status v1alpha1
ctx.desiredVolumeQuantity[v1alpha1.GetStorageVolumeName("", v1alpha1.PDMemberType)] = quantity
}
storageVolumes = tc.Spec.PD.StorageVolumes
// PD Micro Service
// PD Microservice
case v1alpha1.PDMSTSOMemberType, v1alpha1.PDMSSchedulingMemberType:
pdmsRequirement := util.MustNewRequirement(label.ComponentLabelKey, selection.Equals, []string{label.PDMSLabel(comp.String())})
ctx.selector = selector.Add(*pdmsRequirement)
Expand Down
2 changes: 1 addition & 1 deletion pkg/manager/member/startscript/v2/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fi
`
dnsAwaitPart = "<<dns-await-part>>"

pdEnableMicroService = "<<pd-enable-micro-service>>"
pdEnableMicroservice = "<<pd-enable-micro-service>>"

componentCommonWaitForDnsIpMatchScript = `
elapseTime=0
Expand Down
24 changes: 12 additions & 12 deletions pkg/manager/member/startscript/v2/pd_start_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type PDStartScriptModel struct {
PDInitWaitTime int
}

// PDMSStartScriptModel contain fields for rendering PD Micro Service start script
// PDMSStartScriptModel contain fields for rendering PD Microservice start script
type PDMSStartScriptModel struct {
PDStartTimeout int
PDInitWaitTime int
Expand Down Expand Up @@ -112,7 +112,7 @@ func RenderPDStartScript(tc *v1alpha1.TidbCluster) (string, error) {
componentCommonScript +
replacePdStartScriptCustomPorts(
replacePdStartScriptDnsAwaitPart(waitForDnsNameIpMatchOnStartup,
enableMicroServiceModeDynamic(mode, pdStartScript)))),
enableMicroserviceModeDynamic(mode, pdStartScript)))),
)

return renderTemplateFunc(pdStartScriptTpl, m)
Expand All @@ -138,7 +138,7 @@ func renderPDMSStartScript(tc *v1alpha1.TidbCluster, name string) (string, error
m.PDMSDomain = m.PDMSDomain + "." + tc.Spec.ClusterDomain
}

if check, err := pdMSSupportMicroServicesWithName.Check(tc.PDMSVersion(name)); check && err == nil {
if check, err := pdMSSupportMicroservicesWithName.Check(tc.PDMSVersion(name)); check && err == nil {
m.PDMSName = "${PDMS_POD_NAME}"
if tc.Spec.ClusterDomain != "" {
m.PDMSName = m.PDMSDomain
Expand Down Expand Up @@ -185,7 +185,7 @@ func renderPDMSStartScript(tc *v1alpha1.TidbCluster, name string) (string, error
componentCommonScript +
replacePdStartScriptCustomPorts(
replacePdStartScriptDnsAwaitPart(waitForDnsNameIpMatchOnStartup,
enableMicroServiceModeDynamic(name, pdmsStartScriptTplText)))))
enableMicroserviceModeDynamic(name, pdmsStartScriptTplText)))))

return renderTemplateFunc(msStartScriptTpl, m)
}
Expand All @@ -202,7 +202,7 @@ sleep initWaitTime
nsLookupCmd="dig ${componentDomain} A ${componentDomain} AAAA +search +short"
` + componentCommonWaitForDnsIpMatchScript

pdEnableMicroServiceSubScript = "services"
pdEnableMicroserviceSubScript = "services"

pdWaitForDnsOnlySubScript = `
Expand Down Expand Up @@ -241,7 +241,7 @@ done
PD_POD_NAME=${POD_NAME:-$HOSTNAME}
PD_DOMAIN={{ .PDDomain }}` +
dnsAwaitPart + `
ARGS="` + pdEnableMicroService + `--data-dir={{ .DataDir }} \
ARGS="` + pdEnableMicroservice + `--data-dir={{ .DataDir }} \
--name={{ .PDName }} \
--peer-urls={{ .PeerURL }} \
--advertise-peer-urls={{ .AdvertisePeerURL }} \
Expand Down Expand Up @@ -295,7 +295,7 @@ PD_DOMAIN={{ .PDMSDomain }}` +
dnsAwaitPart + `
{{- if .AcrossK8s -}} {{ template "AcrossK8sSubscript" . }} {{- end }}
ARGS="` + pdEnableMicroService + `--listen-addr={{ .ListenAddr }} \
ARGS="` + pdEnableMicroservice + `--listen-addr={{ .ListenAddr }} \
--advertise-listen-addr={{ .AdvertiseListenAddr }} \
--backend-endpoints={{ .PDAddresses }} \
--config=/etc/pd/pd.toml \
Expand Down Expand Up @@ -330,15 +330,15 @@ func replacePdStartScriptDnsAwaitPart(withLocalIpMatch bool, startScript string)
// - for `PD API` service, startParams should be `api`
// - for `TSO` and `Scheduling`, startParams should be `tso` and `scheduling` respectively.
// NOTICE: in `8.3.0` we have supported `name` start parameter, so we will pass `tso name=${PDMS_POD_NAME}` to startParams.
func enableMicroServiceModeDynamic(startParams string, startScript string) string {
func enableMicroserviceModeDynamic(startParams string, startScript string) string {
if startParams != "" {
return strings.ReplaceAll(startScript, pdEnableMicroService, fmt.Sprintf(" %s %s ", pdEnableMicroServiceSubScript, startParams))
return strings.ReplaceAll(startScript, pdEnableMicroservice, fmt.Sprintf(" %s %s ", pdEnableMicroserviceSubScript, startParams))
} else {
// for original `PD`, should be empty.
return strings.ReplaceAll(startScript, pdEnableMicroService, "")
return strings.ReplaceAll(startScript, pdEnableMicroservice, "")
}
}

// PDMSSupportMicroServicesWithName returns true if the given version of PDMS supports microservices with name.
// PDMSSupportMicroservicesWithName returns true if the given version of PDMS supports microservices with name.
// related https://github.com/tikv/pd/pull/8461.
var pdMSSupportMicroServicesWithName, _ = cmpver.NewConstraint(cmpver.GreaterOrEqual, "v8.3.0")
var pdMSSupportMicroservicesWithName, _ = cmpver.NewConstraint(cmpver.GreaterOrEqual, "v8.3.0")
Loading

0 comments on commit cfc6672

Please sign in to comment.