Skip to content

Commit 0eb4b2d

Browse files
authored
fix(apps): reconcile shared account secret rotations (#10743)
1 parent eb0c472 commit 0eb4b2d

14 files changed

Lines changed: 801 additions & 45 deletions

‎apis/apps/v1/types.go‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ type ComponentService struct {
400400
DisableAutoProvision *bool `json:"disableAutoProvision,omitempty"`
401401
}
402402

403+
// +kubebuilder:validation:XValidation:rule="!has(self.secretRefRevision) || size(self.secretRefRevision) == 0 || has(self.secretRef)",message="secretRef must be specified when secretRefRevision is non-empty"
403404
type ComponentSystemAccount struct {
404405
// The name of the system account.
405406
//
@@ -423,10 +424,22 @@ type ComponentSystemAccount struct {
423424
//
424425
// For user-specified passwords, the maximum length is limited to 64 bytes.
425426
//
427+
// Updates to the referenced Secret do not automatically trigger reconciliation.
428+
// To apply updated credentials, update the referenced Secret first and then change
429+
// SecretRefRevision to a new value.
430+
//
426431
// This field is immutable once set.
427432
//
428433
// +optional
429434
SecretRef *ProvisionSecretRef `json:"secretRef,omitempty"`
435+
436+
// Specifies an opaque revision of the referenced Secret.
437+
//
438+
// After updating the referenced Secret, change this field to a new value to apply
439+
// the updated credentials. The value is treated as an opaque token.
440+
//
441+
// +optional
442+
SecretRefRevision string `json:"secretRefRevision,omitempty"`
430443
}
431444

432445
// PasswordConfig helps provide to customize complexity of password generation pattern.

‎config/crd/bases/apps.kubeblocks.io_clusters.yaml‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4358,6 +4358,10 @@ spec:
43584358

43594359
For user-specified passwords, the maximum length is limited to 64 bytes.
43604360

4361+
Updates to the referenced Secret do not automatically trigger reconciliation.
4362+
To apply updated credentials, update the referenced Secret first and then change
4363+
SecretRefRevision to a new value.
4364+
43614365
This field is immutable once set.
43624366
properties:
43634367
name:
@@ -4377,9 +4381,21 @@ spec:
43774381
required:
43784382
- name
43794383
type: object
4384+
secretRefRevision:
4385+
description: |-
4386+
Specifies an opaque revision of the referenced Secret.
4387+
4388+
After updating the referenced Secret, change this field to a new value to apply
4389+
the updated credentials. The value is treated as an opaque token.
4390+
type: string
43804391
required:
43814392
- name
43824393
type: object
4394+
x-kubernetes-validations:
4395+
- message: secretRef must be specified when secretRefRevision
4396+
is non-empty
4397+
rule: '!has(self.secretRefRevision) || size(self.secretRefRevision)
4398+
== 0 || has(self.secretRef)'
43834399
type: array
43844400
tls:
43854401
description: |-
@@ -15562,6 +15578,10 @@ spec:
1556215578

1556315579
For user-specified passwords, the maximum length is limited to 64 bytes.
1556415580

15581+
Updates to the referenced Secret do not automatically trigger reconciliation.
15582+
To apply updated credentials, update the referenced Secret first and then change
15583+
SecretRefRevision to a new value.
15584+
1556515585
This field is immutable once set.
1556615586
properties:
1556715587
name:
@@ -15581,9 +15601,21 @@ spec:
1558115601
required:
1558215602
- name
1558315603
type: object
15604+
secretRefRevision:
15605+
description: |-
15606+
Specifies an opaque revision of the referenced Secret.
15607+
15608+
After updating the referenced Secret, change this field to a new value to apply
15609+
the updated credentials. The value is treated as an opaque token.
15610+
type: string
1558415611
required:
1558515612
- name
1558615613
type: object
15614+
x-kubernetes-validations:
15615+
- message: secretRef must be specified when secretRefRevision
15616+
is non-empty
15617+
rule: '!has(self.secretRefRevision) || size(self.secretRefRevision)
15618+
== 0 || has(self.secretRef)'
1558715619
type: array
1558815620
tls:
1558915621
description: |-

‎config/crd/bases/apps.kubeblocks.io_components.yaml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4989,6 +4989,10 @@ spec:
49894989

49904990
For user-specified passwords, the maximum length is limited to 64 bytes.
49914991

4992+
Updates to the referenced Secret do not automatically trigger reconciliation.
4993+
To apply updated credentials, update the referenced Secret first and then change
4994+
SecretRefRevision to a new value.
4995+
49924996
This field is immutable once set.
49934997
properties:
49944998
name:
@@ -5008,9 +5012,21 @@ spec:
50085012
required:
50095013
- name
50105014
type: object
5015+
secretRefRevision:
5016+
description: |-
5017+
Specifies an opaque revision of the referenced Secret.
5018+
5019+
After updating the referenced Secret, change this field to a new value to apply
5020+
the updated credentials. The value is treated as an opaque token.
5021+
type: string
50115022
required:
50125023
- name
50135024
type: object
5025+
x-kubernetes-validations:
5026+
- message: secretRef must be specified when secretRefRevision is
5027+
non-empty
5028+
rule: '!has(self.secretRefRevision) || size(self.secretRefRevision)
5029+
== 0 || has(self.secretRef)'
50145030
type: array
50155031
terminationPolicy:
50165032
default: Delete

0 commit comments

Comments
 (0)