Skip to content

Commit

Permalink
Remove unused flag and continue on error
Browse files Browse the repository at this point in the history
Signed-off-by: AbdelrahmanElawady <[email protected]>
  • Loading branch information
AbdelrahmanElawady committed Sep 18, 2024
1 parent 71c213c commit 255e9c2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion pkg/KubeArmorOperator/cmd/snitch-cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ func applyCRIOHook(socket string) error {
"/usr/share/kubearmor/hook",
"--runtime-socket",
socket,
"--k8s",
},
},
When: hooks.When{Always: &always},
Expand Down
10 changes: 6 additions & 4 deletions pkg/KubeArmorOperator/hook/crio.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main
import (
"context"
"encoding/json"
"log"

"github.com/kubearmor/KubeArmor/KubeArmor/types"
"github.com/opencontainers/runtime-spec/specs-go"
Expand Down Expand Up @@ -53,7 +54,8 @@ func (h *crioHandler) listContainers(ctx context.Context) ([]types.Container, er
for _, container := range containersList.GetContainers() {
c, err := h.getContainer(ctx, container.GetId())
if err != nil {
return nil, err
log.Printf("failed to get container %q: %s", container.GetId(), err.Error())
continue
}
containers = append(containers, c)
}
Expand Down Expand Up @@ -84,11 +86,11 @@ func containerFromContainerStatus(status *runtime.ContainerStatus, info string)
container.NamespaceName = "Unknown"
container.EndPointName = "Unknown"

containerLables := status.Labels
if val, ok := containerLables["io.kubernetes.pod.namespace"]; ok {
containerLabels := status.Labels
if val, ok := containerLabels["io.kubernetes.pod.namespace"]; ok {
container.NamespaceName = val
}
if val, ok := containerLables["io.kubernetes.pod.name"]; ok {
if val, ok := containerLabels["io.kubernetes.pod.name"]; ok {
container.EndPointName = val
}

Expand Down
2 changes: 0 additions & 2 deletions pkg/KubeArmorOperator/hook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ import (
var (
kubeArmorSocket string
runtimeSocket string
k8s bool
detached bool
)

func main() {
flag.StringVar(&kubeArmorSocket, "kubearmor-socket", "/var/run/kubearmor/ka.sock", "KubeArmor socket")
flag.StringVar(&runtimeSocket, "runtime-socket", "", "container runtime socket")
flag.BoolVar(&k8s, "k8s", false, "kubernetes environment")
flag.BoolVar(&detached, "detached", false, "run detached")
flag.Parse()

Expand Down

0 comments on commit 255e9c2

Please sign in to comment.