Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ const (
// instead of being a source of truth for eventual consistency.
// This annotation can be used to inform MachinePool status during in-progress scaling scenarios.
ReplicasManagedByAnnotation = "cluster.x-k8s.io/replicas-managed-by"

// VariableDefinitionFromInline indicates a patch or variable was defined in the `.spec` of a ClusterClass
// rather than from an external patch extension.
VariableDefinitionFromInline = "inline"
)

const (
Expand Down
8 changes: 8 additions & 0 deletions internal/webhooks/patch_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ func validatePatchName(patch clusterv1.ClusterClassPatch, names sets.Set[string]
),
)
}
if patch.Name == clusterv1.VariableDefinitionFromInline {
allErrs = append(allErrs,
field.Required(
path.Child("name"),
fmt.Sprintf("%q can not be used as the name of a patch", clusterv1.VariableDefinitionFromInline),
),
)
}

if names.Has(patch.Name) {
allErrs = append(allErrs,
Expand Down