Skip to content

Commit

Permalink
Log when a custom container/pod security context is configured
Browse files Browse the repository at this point in the history
Signed-off-by: Angel Misevski <[email protected]>
  • Loading branch information
amisevsk committed Oct 20, 2022
1 parent b8870e5 commit dba9175
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/config/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"context"
"encoding/json"
"fmt"
"reflect"
"strings"
"sync"

Expand Down Expand Up @@ -372,7 +373,6 @@ func GetCurrentConfigString(currConfig *controller.OperatorConfiguration) string
}
workspace := currConfig.Workspace
if workspace != nil {
// Don't include PodSecurityContext or ContainerSecurityContext for now as it's less easy to compare
if workspace.ImagePullPolicy != defaultConfig.Workspace.ImagePullPolicy {
config = append(config, fmt.Sprintf("workspace.imagePullPolicy=%s", workspace.ImagePullPolicy))
}
Expand Down Expand Up @@ -403,6 +403,12 @@ func GetCurrentConfigString(currConfig *controller.OperatorConfiguration) string
config = append(config, fmt.Sprintf("workspace.defaultStorageSize.perWorkspace=%s", workspace.DefaultStorageSize.PerWorkspace.String()))
}
}
if !reflect.DeepEqual(workspace.PodSecurityContext, defaultConfig.Workspace.PodSecurityContext) {
config = append(config, "workspace.podSecurityContext is set")
}
if !reflect.DeepEqual(workspace.ContainerSecurityContext, defaultConfig.Workspace.ContainerSecurityContext) {
config = append(config, "workspace.containerSecurityContext is set")
}
if workspace.DefaultTemplate != nil {
config = append(config, "workspace.defaultTemplate is set")
}
Expand Down

0 comments on commit dba9175

Please sign in to comment.