Skip to content

Commit 26e8dc5

Browse files
Merge pull request #2757 from bradbehle/ovn-run-as-user-ibmcloud
CORENET-6247: Set runAsUser for ovnkube-control-plane
2 parents 5c08dc8 + 0cc5579 commit 26e8dc5

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

bindata/network/ovn-kubernetes/managed/ovnkube-control-plane.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,13 @@ spec:
288288
"{{$key}}": "{{$value}}"
289289
{{ end }}
290290
{{ end }}
291+
{{- if .RunAsUser }}
292+
securityContext:
293+
runAsUser: {{.RunAsUser}}
294+
runAsNonRoot: true
295+
seccompProfile:
296+
type: RuntimeDefault
297+
{{- end }}
291298
volumes:
292299
- name: ovnkube-config
293300
configMap:

pkg/bootstrap/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ type OVNHyperShiftBootstrapResult struct {
1111
Enabled bool
1212
ClusterID string
1313
Namespace string
14+
RunAsUser string
1415
HCPNodeSelector map[string]string
1516
HCPLabels map[string]string
1617
HCPTolerations []string

pkg/network/ovn_kubernetes.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ func renderOVNKubernetes(conf *operv1.NetworkSpec, bootstrapResult *bootstrap.Bo
420420
productFlavor = "managed"
421421
data.Data["CAConfigMap"] = bootstrapResult.OVN.OVNKubernetesConfig.HyperShiftConfig.CAConfigMap
422422
data.Data["CAConfigMapKey"] = bootstrapResult.OVN.OVNKubernetesConfig.HyperShiftConfig.CAConfigMapKey
423+
data.Data["RunAsUser"] = bootstrapResult.OVN.OVNKubernetesConfig.HyperShiftConfig.RunAsUser
423424
}
424425
manifestSubDir := filepath.Join(manifestDir, "network/ovn-kubernetes", productFlavor)
425426
manifestDirs = append(manifestDirs, manifestSubDir)
@@ -716,6 +717,7 @@ func bootstrapOVNHyperShiftConfig(hc *hypershift.HyperShiftConfig, kubeClient cn
716717
ovnHypershiftResult := &bootstrap.OVNHyperShiftBootstrapResult{
717718
Enabled: hc.Enabled,
718719
Namespace: hc.Namespace,
720+
RunAsUser: hc.RunAsUser,
719721
ReleaseImage: hc.ReleaseImage,
720722
ControlPlaneImage: hc.ControlPlaneImage,
721723
CAConfigMap: hc.CAConfigMap,

0 commit comments

Comments
 (0)