Skip to content

Commit d443a09

Browse files
committed
feat(api)!: require the application release prefix to be dot-free
Constrain ApplicationDefinition spec.application.release.prefix to lowercase DNS-1123 characters (^[a-z0-9-]*$), which excludes the dot. Release names are "<prefix><app name>" and the tenant CA trust anchor is projected to "<release>.tenant-ca"; the dot is the separator that makes that name unreachable by any engine, so a prefix carrying a dot would break the guarantee. BREAKING CHANGE: an ApplicationDefinition whose release prefix contains a dot, or any character outside [a-z0-9-], is now rejected at admission. Existing definitions with such a prefix must be corrected before this CRD is applied. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent aef9e20 commit d443a09

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎api/v1alpha1/applicationdefinitions_types.go‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,12 @@ type ApplicationDefinitionRelease struct {
7979
ChartRef *helmv2.CrossNamespaceSourceReference `json:"chartRef"`
8080
// Labels for the release
8181
Labels map[string]string `json:"labels,omitempty"`
82-
// Prefix for the release name
82+
// Prefix for the release name. Release names are "<prefix><app name>" and the
83+
// tenant CA trust anchor is projected to "<release>.tenant-ca", where the dot
84+
// is a separator no release name may contain — so the prefix must be dot-free.
85+
// It is restricted to lowercase DNS-1123 characters, which excludes the dot by
86+
// construction.
87+
// +kubebuilder:validation:Pattern=`^[a-z0-9-]*$`
8388
Prefix string `json:"prefix"`
8489

8590
// WaitStrategy maps to HelmReleaseSpec.WaitStrategy.Name — a deliberate

‎packages/system/application-definition-crd/definition/cozystack.io_applicationdefinitions.yaml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,13 @@ spec:
361361
description: Labels for the release
362362
type: object
363363
prefix:
364-
description: Prefix for the release name
364+
description: |-
365+
Prefix for the release name. Release names are "<prefix><app name>" and the
366+
tenant CA trust anchor is projected to "<release>.tenant-ca", where the dot
367+
is a separator no release name may contain — so the prefix must be dot-free.
368+
It is restricted to lowercase DNS-1123 characters, which excludes the dot by
369+
construction.
370+
pattern: ^[a-z0-9-]*$
365371
type: string
366372
waitStrategy:
367373
description: |-

0 commit comments

Comments
 (0)