Skip to content

Commit 06a65da

Browse files
authored
fix(pd): wrong image can be fixed after pdgroup is created (#6536)
1 parent d3543d0 commit 06a65da

44 files changed

Lines changed: 778 additions & 483 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/runtime-gen/generators/runtime.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,14 @@ func (g *$.|pub$) TemplateAnnotations() map[string]string {
505505
return g.Spec.Template.Annotations
506506
}
507507
508+
func (g *$.|pub$) SetTemplateLabels(ls map[string]string) {
509+
g.Spec.Template.Labels = ls
510+
}
511+
512+
func (g *$.|pub$) SetTemplateAnnotations(anno map[string]string) {
513+
g.Spec.Template.Annotations = anno
514+
}
515+
508516
func (g *$.|pub$) Features() []metav1alpha1.Feature {
509517
return g.Spec.Features
510518
}

pkg/apiutil/core/v1alpha1/group.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,23 @@ func SetStatusSelector[
188188

189189
return changed
190190
}
191+
192+
func TemplateAnnotations[
193+
S scope.Group[F, T],
194+
F client.Object,
195+
T runtime.Group,
196+
](f F) map[string]string {
197+
obj := scope.From[S](f)
198+
199+
return obj.TemplateAnnotations()
200+
}
201+
202+
func SetTemplateAnnotations[
203+
S scope.Group[F, T],
204+
F client.Object,
205+
T runtime.Group,
206+
](f F, anno map[string]string) {
207+
obj := scope.From[S](f)
208+
209+
obj.SetTemplateAnnotations(anno)
210+
}

pkg/controllers/pd/builder.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ func (r *Reconciler) NewRunner(state *tasks.ReconcileContext, reporter task.Task
6262
tasks.TaskConfigMap(state, r.Client),
6363
common.TaskPVC[scope.PD](state, r.Client, r.VolumeModifierFactory, tasks.PVCNewer()),
6464
tasks.TaskPod(state, r.Client),
65-
// If pd client has not been registered yet, do not update status of the pd
66-
task.IfBreak(tasks.CondPDClientIsNotRegisterred(state),
67-
tasks.TaskStatusUnknown(),
68-
),
6965
common.TaskInstanceConditionSynced[scope.PD](state),
7066
common.TaskInstanceConditionReady[scope.PD](state),
7167
common.TaskInstanceConditionRunning[scope.PD](state),

pkg/controllers/pd/tasks/status.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@ import (
2929
"github.com/pingcap/tidb-operator/pkg/utils/task/v3"
3030
)
3131

32-
func TaskStatusUnknown() task.Task {
33-
return task.NameTaskFunc("StatusUnknown", func(_ context.Context) task.Result {
34-
return task.Wait().With("status of the pd is unknown")
35-
})
36-
}
37-
3832
//nolint:gocyclo // refactor if possible
3933
func TaskStatus(state *ReconcileContext, c client.Client) task.Task {
4034
return task.NameTaskFunc("Status", func(ctx context.Context) task.Result {

pkg/runtime/group.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ type Group interface {
3737
TemplateLabels() map[string]string
3838
TemplateAnnotations() map[string]string
3939

40+
SetTemplateLabels(map[string]string)
41+
SetTemplateAnnotations(map[string]string)
42+
4043
SetTemplateClusterTLS(ca, certKeyPair string)
4144

4245
MinReadySeconds() int64

pkg/runtime/zz_generated.runtime.pd.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/runtime/zz_generated.runtime.replicationworker.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/runtime/zz_generated.runtime.scheduler.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/runtime/zz_generated.runtime.scheduling.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/runtime/zz_generated.runtime.ticdc.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)