Skip to content

Commit

Permalink
check if assignment is ok
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <ondrej.dubaj@dynatrace.com>
  • Loading branch information
odubajDT committed Nov 16, 2023
1 parent 227364a commit f7c89e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion webhooks/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import (
)

func OpenFeatureEnabledAnnotationIndex(o client.Object) []string {
pod := o.(*corev1.Pod)
pod, ok := o.(*corev1.Pod)
if !ok {
return []string{"false"}
}
if pod.ObjectMeta.Annotations == nil {
return []string{
"false",
Expand Down
4 changes: 4 additions & 0 deletions webhooks/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ func TestOpenFeatureEnabledAnnotationIndex(t *testing.T) {
want []string
}{
{
name: "not a pod",
o: &corev1.ConfigMap{},
want: []string{"false"},
}, {
name: "no annotations",
o: &corev1.Pod{},
want: []string{"false"},
Expand Down

0 comments on commit f7c89e6

Please sign in to comment.