Skip to content

Commit 19d8445

Browse files
committed
Fix CEL to actually block deprecated resource create
1 parent bc58d64 commit 19d8445

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

api/v1alpha1/deprecated_temporalconnection_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ type TemporalConnectionStatus struct {
5151
//+kubebuilder:resource:shortName=tconn
5252
//+kubebuilder:printcolumn:name="Host",type="string",JSONPath=".spec.hostPort",description="Temporal server endpoint"
5353
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age"
54-
// +kubebuilder:validation:XValidation:rule="oldSelf != null",message="TemporalConnection is deprecated and cannot be created. Use Connection instead."
54+
// +kubebuilder:validation:XValidation:rule="oldSelf.hasValue()",message="TemporalConnection is deprecated and cannot be created. Use Connection instead.",optionalOldSelf=true
5555
// +kubebuilder:deprecatedversion:warning="TemporalConnection is deprecated. Use Connection instead."
5656

5757
// TemporalConnection is the Schema for the temporalconnections API

api/v1alpha1/deprecated_temporalworkerdeployment_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ type TemporalWorkerDeploymentStatus struct {
158158
//+kubebuilder:printcolumn:name="Ramp %",type="number",JSONPath=".status.targetVersion.rampPercentage",description="Ramp percentage"
159159
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Age"
160160
// +kubebuilder:validation:XValidation:rule="size(self.metadata.name) <= 63",message="name cannot be more than 63 characters"
161-
// +kubebuilder:validation:XValidation:rule="oldSelf != null",message="TemporalWorkerDeployment is deprecated and cannot be created. Use WorkerDeployment instead."
161+
// +kubebuilder:validation:XValidation:rule="oldSelf.hasValue()",message="TemporalWorkerDeployment is deprecated and cannot be created. Use WorkerDeployment instead.",optionalOldSelf=true
162162
// +kubebuilder:deprecatedversion:warning="TemporalWorkerDeployment is deprecated. Use WorkerDeployment instead."
163163

164164
// TemporalWorkerDeployment is the Schema for the temporalworkerdeployments API

helm/temporal-worker-controller-crds/templates/temporal.io_temporalconnections.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ spec:
115115
x-kubernetes-validations:
116116
- message: TemporalConnection is deprecated and cannot be created. Use Connection
117117
instead.
118-
rule: oldSelf != null
118+
optionalOldSelf: true
119+
rule: oldSelf.hasValue()
119120
served: true
120121
storage: true
121122
subresources:

helm/temporal-worker-controller-crds/templates/temporal.io_temporalworkerdeployments.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4216,7 +4216,8 @@ spec:
42164216
rule: size(self.metadata.name) <= 63
42174217
- message: TemporalWorkerDeployment is deprecated and cannot be created. Use
42184218
WorkerDeployment instead.
4219-
rule: oldSelf != null
4219+
optionalOldSelf: true
4220+
rule: oldSelf.hasValue()
42204221
served: true
42214222
storage: true
42224223
subresources:

0 commit comments

Comments
 (0)