Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Make 'inline' a reserved name for patches #8025

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"
killianmuldoon marked this conversation as resolved.
Show resolved Hide resolved
)

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