Skip to content

Commit f612cb2

Browse files
asararatnakarShoaeb Jindani
authored and
Shoaeb Jindani
committed
Disable unshare in the pod containers (#179)
Signed-off-by: asararatnakar <[email protected]> Signed-off-by: Shoaeb Jindani <[email protected]>
1 parent 6ebcc7e commit f612cb2

File tree

13 files changed

+50
-0
lines changed

13 files changed

+50
-0
lines changed

bundle/manifests/fabric-opensource-operator.clusterserviceversion.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -1816,6 +1816,8 @@ spec:
18161816
ephemeral-storage: 100Mi
18171817
memory: 200Mi
18181818
securityContext:
1819+
seccompProfile:
1820+
type: RuntimeDefault
18191821
allowPrivilegeEscalation: false
18201822
capabilities:
18211823
add:

config/manager/manager.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ spec:
9898
memory: 200Mi
9999
ephemeral-storage: 100Mi
100100
securityContext:
101+
seccompProfile:
102+
type: RuntimeDefault
101103
allowPrivilegeEscalation: false
102104
capabilities:
103105
add:

config/manifests/bases/fabric-opensource-operator.clusterserviceversion.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -1813,6 +1813,8 @@ spec:
18131813
ephemeral-storage: 100Mi
18141814
memory: 200Mi
18151815
securityContext:
1816+
seccompProfile:
1817+
type: RuntimeDefault
18161818
allowPrivilegeEscalation: false
18171819
capabilities:
18181820
add:

definitions/ca/deployment.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ spec:
7474
ephemeral-storage: 100M
7575
memory: 100Mi
7676
securityContext:
77+
seccompProfile:
78+
type: RuntimeDefault
7779
allowPrivilegeEscalation: false
7880
capabilities:
7981
add:

definitions/console/deployment.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ spec:
6262
ephemeral-storage: 100M
6363
memory: 1000Mi
6464
securityContext:
65+
seccompProfile:
66+
type: RuntimeDefault
6567
allowPrivilegeEscalation: false
6668
capabilities:
6769
add:
@@ -110,6 +112,8 @@ spec:
110112
ephemeral-storage: 100M
111113
memory: 200Mi
112114
securityContext:
115+
seccompProfile:
116+
type: RuntimeDefault
113117
allowPrivilegeEscalation: false
114118
capabilities:
115119
add:
@@ -160,6 +164,8 @@ spec:
160164
ephemeral-storage: 100M
161165
memory: 50Mi
162166
securityContext:
167+
seccompProfile:
168+
type: RuntimeDefault
163169
allowPrivilegeEscalation: false
164170
capabilities:
165171
add:

definitions/orderer/deployment.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ spec:
7272
ephemeral-storage: 100M
7373
memory: 100Mi
7474
securityContext:
75+
seccompProfile:
76+
type: RuntimeDefault
7577
allowPrivilegeEscalation: false
7678
capabilities:
7779
add:
@@ -165,6 +167,8 @@ spec:
165167
ephemeral-storage: 100M
166168
memory: 100Mi
167169
securityContext:
170+
seccompProfile:
171+
type: RuntimeDefault
168172
capabilities:
169173
add:
170174
- NET_BIND_SERVICE

definitions/peer/chaincode-launcher.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
name: "chaincode-launcher"
1919
imagePullPolicy: Always
2020
securityContext:
21+
seccompProfile:
22+
type: RuntimeDefault
2123
privileged: false
2224
readOnlyRootFileSystem: false
2325
runAsGroup: 7051

definitions/peer/couchdb.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ name: "couchdb"
1919
image: ""
2020
imagePullPolicy: Always
2121
securityContext:
22+
seccompProfile:
23+
type: RuntimeDefault
2224
privileged: false
2325
readOnlyRootFileSystem: false
2426
runAsGroup: 5984

pkg/offering/base/ca/override/deployment.go

+4
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"github.com/IBM-Blockchain/fabric-operator/pkg/manager/resources/deployment"
3434
dep "github.com/IBM-Blockchain/fabric-operator/pkg/manager/resources/deployment"
3535
"github.com/IBM-Blockchain/fabric-operator/pkg/manager/resources/serviceaccount"
36+
"github.com/IBM-Blockchain/fabric-operator/pkg/offering/common"
3637
"github.com/IBM-Blockchain/fabric-operator/pkg/util"
3738

3839
appsv1 "k8s.io/api/apps/v1"
@@ -182,6 +183,9 @@ func (o *Override) CommonDeployment(instance *current.IBPCA, deployment *dep.Dep
182183
deployment.SetReplicas(instance.Spec.Replicas)
183184
}
184185

186+
// set seccompProfile to RuntimeDefault
187+
common.GetPodSecurityContext(caCont)
188+
185189
return nil
186190
}
187191

pkg/offering/base/console/override/deployment.go

+5
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,11 @@ func (o *Override) CommonDeployment(instance *current.IBPConsole, deployment *de
319319
}
320320
init.SetCommand([]string{"sh", "-c", initCommand})
321321

322+
// set seccompProfile to RuntimeDefault
323+
common.GetPodSecurityContext(console)
324+
common.GetPodSecurityContext(deployer)
325+
common.GetPodSecurityContext(configtxlator)
326+
322327
return nil
323328
}
324329

pkg/offering/base/orderer/override/deployment.go

+4
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,10 @@ func (o *Override) CommonDeploymentOverrides(instance *current.IBPOrderer, deplo
317317
deployment.UpdateContainer(grpcProxy)
318318
deployment.UpdateInitContainer(initCont)
319319

320+
// set seccompProfile to RuntimeDefault
321+
common.GetPodSecurityContext(orderer)
322+
common.GetPodSecurityContext(grpcProxy)
323+
320324
return nil
321325
}
322326

pkg/offering/base/peer/override/deployment.go

+5
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,11 @@ func (o *Override) CommonDeploymentOverrides(instance *current.IBPPeer, deployme
732732

733733
deployment.UpdateContainer(peerContainer)
734734
deployment.UpdateContainer(grpcContainer)
735+
736+
// set seccompProfile to RuntimeDefault
737+
common.GetPodSecurityContext(peerContainer)
738+
common.GetPodSecurityContext(grpcContainer)
739+
735740
return nil
736741
}
737742

pkg/offering/common/override.go

+10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package common
2020

2121
import (
22+
container "github.com/IBM-Blockchain/fabric-operator/pkg/manager/resources/container"
2223
corev1 "k8s.io/api/core/v1"
2324
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2425
)
@@ -106,3 +107,12 @@ func GetPodAntiAffinity(orgName string) *corev1.PodAntiAffinity {
106107
},
107108
}
108109
}
110+
111+
func GetPodSecurityContext(con container.Container) {
112+
secContext := con.SecurityContext
113+
if secContext.SeccompProfile == nil {
114+
secContext.SeccompProfile = &corev1.SeccompProfile{
115+
Type: corev1.SeccompProfileTypeRuntimeDefault,
116+
}
117+
}
118+
}

0 commit comments

Comments
 (0)