Skip to content

Commit

Permalink
Added container security capability
Browse files Browse the repository at this point in the history
Signed-off-by: Kanha gupta <kanhag4163@gmail.com>
  • Loading branch information
kanha-gupta committed May 14, 2024
1 parent 548a115 commit 45da300
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
5 changes: 5 additions & 0 deletions pkg/antctl/raw/check/cluster/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ func (t *testContext) setup(ctx context.Context) error {
NodeSelector: map[string]string{
"kubernetes.io/os": "linux",
},
SecurityContext: &corev1.SecurityContext{
Capabilities: &corev1.Capabilities{
Add: []corev1.Capability{"SYS_MODULE"},
},
},
})

t.Log("Creating Deployment")
Expand Down
30 changes: 16 additions & 14 deletions pkg/antctl/raw/check/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func NewDeployment(p DeploymentParameters) *appsv1.Deployment {
Command: p.Command,
Args: p.Args,
VolumeMounts: p.VolumeMounts,
SecurityContext: p.SecurityContext,
},
},
Tolerations: p.Tolerations,
Expand All @@ -164,20 +165,21 @@ func NewDeployment(p DeploymentParameters) *appsv1.Deployment {
}

type DeploymentParameters struct {
Name string
Role string
Image string
Replicas int
Port int
Command []string
Args []string
Affinity *corev1.Affinity
Tolerations []corev1.Toleration
Labels map[string]string
VolumeMounts []corev1.VolumeMount
Volumes []corev1.Volume
HostNetwork bool
NodeSelector map[string]string
Name string
Role string
Image string
Replicas int
Port int
Command []string
Args []string
Affinity *corev1.Affinity
Tolerations []corev1.Toleration
Labels map[string]string
VolumeMounts []corev1.VolumeMount
Volumes []corev1.Volume
HostNetwork bool
NodeSelector map[string]string
SecurityContext *corev1.SecurityContext
}

func WaitForDeploymentsReady(ctx context.Context,
Expand Down

0 comments on commit 45da300

Please sign in to comment.