From edf3be272e3273470fe5f0dd2d335f63b5188e9d Mon Sep 17 00:00:00 2001 From: glaxman <508625+glaxman@users.noreply.github.com> Date: Wed, 30 Apr 2025 20:59:03 -0700 Subject: [PATCH] fix(traitdefinition): podsecuritycontext - Make localhostProfile optional for other types and provide it only for Localhost. Fixes #6772 (#6773) Signed-off-by: glaxman <508625+glaxman@users.noreply.github.com> --- .../templates/defwithtemplate/podsecuritycontext.yaml | 10 ++++++---- .../definitions/internal/trait/podsecuritycontext.cue | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/charts/vela-core/templates/defwithtemplate/podsecuritycontext.yaml b/charts/vela-core/templates/defwithtemplate/podsecuritycontext.yaml index 7707a50cf..23aaee5f6 100644 --- a/charts/vela-core/templates/defwithtemplate/podsecuritycontext.yaml +++ b/charts/vela-core/templates/defwithtemplate/podsecuritycontext.yaml @@ -39,8 +39,9 @@ spec: parameter: { // +usage=Specify the AppArmor profile for the pod appArmorProfile?: { - type: "RuntimeDefault" | "Unconfined" | "Localhost" - localhostProfile: string + type: "RuntimeDefault" | "Unconfined" | "Localhost" + // +usage: localhostProfile is required when type is 'Localhost' + localhostProfile?: string } fsGroup?: int runAsGroup?: int @@ -50,8 +51,9 @@ spec: runAsNonRoot: *true | bool // +usage=Specify the seccomp profile for the pod seccompProfile?: { - type: "RuntimeDefault" | "Unconfined" | "Localhost" - localhostProfile: string + type: "RuntimeDefault" | "Unconfined" | "Localhost" + // +usage: localhostProfile is required when type is 'Localhost' + localhostProfile?: string } } diff --git a/vela-templates/definitions/internal/trait/podsecuritycontext.cue b/vela-templates/definitions/internal/trait/podsecuritycontext.cue index 09d2ba496..055b987ba 100644 --- a/vela-templates/definitions/internal/trait/podsecuritycontext.cue +++ b/vela-templates/definitions/internal/trait/podsecuritycontext.cue @@ -33,8 +33,9 @@ template: { parameter: { // +usage=Specify the AppArmor profile for the pod appArmorProfile?: { - type: "RuntimeDefault" | "Unconfined" | "Localhost" - localhostProfile: string + type: "RuntimeDefault" | "Unconfined" | "Localhost" + // +usage: localhostProfile is required when type is 'Localhost' + localhostProfile?: string } fsGroup?: int runAsGroup?: int @@ -44,8 +45,9 @@ template: { runAsNonRoot: *true | bool // +usage=Specify the seccomp profile for the pod seccompProfile?: { - type: "RuntimeDefault" | "Unconfined" | "Localhost" - localhostProfile: string + type: "RuntimeDefault" | "Unconfined" | "Localhost" + // +usage: localhostProfile is required when type is 'Localhost' + localhostProfile?: string } } }