Skip to content

Commit f9d7c9f

Browse files
Make 'inline' a reserved name for patches
1 parent 1b61819 commit f9d7c9f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

api/v1beta1/common_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ const (
120120
// instead of being a source of truth for eventual consistency.
121121
// This annotation can be used to inform MachinePool status during in-progress scaling scenarios.
122122
ReplicasManagedByAnnotation = "cluster.x-k8s.io/replicas-managed-by"
123+
124+
// VariableDefinitionFromInline indicates a patch or variable was defined in the `.spec` of a ClusterClass
125+
// rather than from an external patch extension.
126+
VariableDefinitionFromInline = "inline"
123127
)
124128

125129
const (

internal/webhooks/patch_validation.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ func validatePatchName(patch clusterv1.ClusterClassPatch, names sets.Set[string]
6969
),
7070
)
7171
}
72+
if patch.Name == clusterv1.VariableDefinitionFromInline {
73+
allErrs = append(allErrs,
74+
field.Required(
75+
path.Child("name"),
76+
fmt.Sprintf("%q can not be used as the name of a patch", clusterv1.VariableDefinitionFromInline),
77+
),
78+
)
79+
}
7280

7381
if names.Has(patch.Name) {
7482
allErrs = append(allErrs,

0 commit comments

Comments
 (0)