Skip to content

Commit

Permalink
Added default value for config name (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
fraliv13 authored Oct 21, 2021
1 parent 56e0a67 commit d5ae765
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/injector/pod_patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package injector
import (
"encoding/json"
"fmt"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"path"
"rusi/pkg/utils"
"strconv"
"strings"

"github.com/pkg/errors"
"k8s.io/klog/v2"

v1 "k8s.io/api/admission/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down Expand Up @@ -51,7 +52,7 @@ const (
apiAddress = "rusi-api"
apiPort = 80
kubernetesMountPath = "/var/run/secrets/kubernetes.io/serviceaccount"
defaultConfig = "rusisystem"
defaultConfig = "default"
defaultEnabledMetric = true
defaultMetricsPort = 9090
defaultSidecarDebug = false
Expand Down Expand Up @@ -218,7 +219,7 @@ func podContainsSidecarContainer(pod *corev1.Pod) bool {
}

func getConfig(annotations map[string]string) string {
return getStringAnnotation(annotations, rusiConfigKey)
return getStringAnnotationOrDefault(annotations, rusiConfigKey, defaultConfig)
}

func getEnableDebug(annotations map[string]string) bool {
Expand Down

0 comments on commit d5ae765

Please sign in to comment.