Skip to content

Commit

Permalink
[OpenShift] fixes the disable affinity assistant configuration
Browse files Browse the repository at this point in the history
This is always true in case of openshift due to which user would
not able to enable it. so this fixes by removing the defaulting in
Operator CR and adding the field only when user adds it.
By default, the value in configmap is false for kubernetes and will
be changed to true for openshift which user can change if requires.

Signed-off-by: Shivam Mukhade <[email protected]>
  • Loading branch information
sm43 authored and tekton-robot committed Aug 20, 2021
1 parent 807756a commit 890ff32
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
3 changes: 0 additions & 3 deletions pkg/apis/operator/v1alpha1/tektonpipeline_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ func (tp *TektonPipeline) SetDefaults(ctx context.Context) {
}

func (p *PipelineProperties) setDefaults() {
if p.DisableAffinityAssistant == nil {
p.DisableAffinityAssistant = ptr.Bool(false)
}
if p.DisableHomeEnvOverwrite == nil {
p.DisableHomeEnvOverwrite = ptr.Bool(true)
}
Expand Down
1 change: 0 additions & 1 deletion pkg/apis/operator/v1alpha1/tektonpipeline_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func Test_SetDefaults_PipelineProperties(t *testing.T) {
}

properties := PipelineProperties{
DisableAffinityAssistant: ptr.Bool(false),
DisableHomeEnvOverwrite: ptr.Bool(true),
DisableWorkingDirectoryOverwrite: ptr.Bool(true),
DisableCredsInit: ptr.Bool(false),
Expand Down
9 changes: 5 additions & 4 deletions pkg/reconciler/openshift/tektonpipeline/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/injection"
"knative.dev/pkg/logging"
"knative.dev/pkg/ptr"
)

const (
Expand Down Expand Up @@ -131,10 +132,10 @@ func SetDefault(properties *v1alpha1.PipelineProperties) bool {
updated = true
}

// Set `disable-affinity-assistant` to true
// webhook will set `false` as default value
if properties.DisableAffinityAssistant == nil || !*properties.DisableAffinityAssistant {
*properties.DisableAffinityAssistant = DefaultDisableAffinityAssistant
// Set `disable-affinity-assistant` to true if not set in CR
// webhook will not set any value but by default in pipelines configmap it will be false
if properties.DisableAffinityAssistant == nil {
properties.DisableAffinityAssistant = ptr.Bool(DefaultDisableAffinityAssistant)
updated = true
}

Expand Down

0 comments on commit 890ff32

Please sign in to comment.