diff --git a/cmd/openshift/operator/kodata/openshift/00-prereconcile/openshift-pipelines-scc.yaml b/cmd/openshift/operator/kodata/openshift/00-prereconcile/openshift-pipelines-scc.yaml index 790ad43ae0..1f0d813419 100644 --- a/cmd/openshift/operator/kodata/openshift/00-prereconcile/openshift-pipelines-scc.yaml +++ b/cmd/openshift/operator/kodata/openshift/00-prereconcile/openshift-pipelines-scc.yaml @@ -32,8 +32,6 @@ seLinuxContext: type: MustRunAs supplementalGroups: type: RunAsAny -seccompProfiles: -- runtime/default volumes: - configMap - downwardAPI diff --git a/pkg/apis/operator/v1alpha1/tektontrigger_defaults.go b/pkg/apis/operator/v1alpha1/tektontrigger_defaults.go index 05351e4905..aa6ed9fe18 100644 --- a/pkg/apis/operator/v1alpha1/tektontrigger_defaults.go +++ b/pkg/apis/operator/v1alpha1/tektontrigger_defaults.go @@ -20,6 +20,7 @@ import ( "context" "github.com/tektoncd/triggers/pkg/apis/config" + "knative.dev/pkg/ptr" ) var ( @@ -46,4 +47,11 @@ func (t *Trigger) openshiftDefaulting() { if t.DefaultServiceAccount == "" { t.DefaultServiceAccount = DefaultOpenshiftSA } + + if t.DefaultRunAsUser == nil { + t.DefaultRunAsUser = ptr.String("") + } + if t.DefaultRunAsGroup == nil { + t.DefaultRunAsGroup = ptr.String("") + } } diff --git a/pkg/apis/operator/v1alpha1/tektontrigger_types.go b/pkg/apis/operator/v1alpha1/tektontrigger_types.go index acb262409f..1a3e5f5030 100644 --- a/pkg/apis/operator/v1alpha1/tektontrigger_types.go +++ b/pkg/apis/operator/v1alpha1/tektontrigger_types.go @@ -92,5 +92,7 @@ type TriggersProperties struct { // OptionalTriggersProperties defines the fields which are to be // defined for triggers only if user pass them type OptionalTriggersProperties struct { - DefaultServiceAccount string `json:"default-service-account,omitempty"` + DefaultServiceAccount string `json:"default-service-account,omitempty"` + DefaultRunAsUser *string `json:"default-run-as-user,omitempty"` + DefaultRunAsGroup *string `json:"default-run-as-group,omitempty"` } diff --git a/pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go index ab1d930cfc..256981e375 100644 --- a/pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go @@ -699,6 +699,16 @@ func (in *OptionalPipelineProperties) DeepCopy() *OptionalPipelineProperties { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *OptionalTriggersProperties) DeepCopyInto(out *OptionalTriggersProperties) { *out = *in + if in.DefaultRunAsUser != nil { + in, out := &in.DefaultRunAsUser, &out.DefaultRunAsUser + *out = new(string) + **out = **in + } + if in.DefaultRunAsGroup != nil { + in, out := &in.DefaultRunAsGroup, &out.DefaultRunAsGroup + *out = new(string) + **out = **in + } return } @@ -2158,7 +2168,7 @@ func (in *TektonTriggerStatus) DeepCopy() *TektonTriggerStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Trigger) DeepCopyInto(out *Trigger) { *out = *in - out.TriggersProperties = in.TriggersProperties + in.TriggersProperties.DeepCopyInto(&out.TriggersProperties) in.Options.DeepCopyInto(&out.Options) return } @@ -2176,7 +2186,7 @@ func (in *Trigger) DeepCopy() *Trigger { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TriggersProperties) DeepCopyInto(out *TriggersProperties) { *out = *in - out.OptionalTriggersProperties = in.OptionalTriggersProperties + in.OptionalTriggersProperties.DeepCopyInto(&out.OptionalTriggersProperties) return } diff --git a/pkg/reconciler/openshift/tektontrigger/transformers_test.go b/pkg/reconciler/openshift/tektontrigger/transformers_test.go index 30d1db2911..dadf167871 100644 --- a/pkg/reconciler/openshift/tektontrigger/transformers_test.go +++ b/pkg/reconciler/openshift/tektontrigger/transformers_test.go @@ -56,13 +56,12 @@ func TestReplaceImages(t *testing.T) { } newManifest, err := manifest.Transform( - replaceDeploymentArgs("-el-security-context", "false"), replaceDeploymentArgs("-el-events", "enable"), ) if err != nil { t.Errorf("assertion failed; expected no error %v", err) } - assertDeployContainerArgsValue(t, newManifest.Resources(), "-el-security-context", "false") + assertDeployContainerArgsValue(t, newManifest.Resources(), "-el-security-context", "true") assertDeployContainerArgsValue(t, newManifest.Resources(), "-el-events", "enable") }) }