Skip to content

Commit

Permalink
Skip dataplane + init containers when building list of application us…
Browse files Browse the repository at this point in the history
…erIDs to skip over
  • Loading branch information
nathancoleman committed Jul 5, 2024
1 parent ab16a35 commit 5d715de
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion control-plane/connect-inject/common/openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ import (
"strconv"
"strings"

"github.com/hashicorp/consul-k8s/control-plane/connect-inject/constants"
"golang.org/x/exp/maps"
"golang.org/x/exp/slices"
corev1 "k8s.io/api/core/v1"

"github.com/hashicorp/consul-k8s/control-plane/connect-inject/constants"
)

func GetDataplaneUID(namespace corev1.Namespace, pod corev1.Pod) (int64, error) {
Expand Down Expand Up @@ -87,6 +88,14 @@ func getAvailableIDs(namespace corev1.Namespace, pod corev1.Pod, annotationName
}
}
for _, c := range pod.Spec.Containers {
if strings.HasPrefix(c.Name, "consul-dataplane") {
continue
}

if strings.HasPrefix(c.Name, "consul-connect-inject-init") {
continue
}

if c.SecurityContext != nil && c.SecurityContext.RunAsUser != nil {
appUIDs = append(appUIDs, *c.SecurityContext.RunAsUser)
}
Expand Down

0 comments on commit 5d715de

Please sign in to comment.