diff --git a/prog/kube-peers/annotations.go b/prog/kube-peers/annotations.go index fae131e4..dd8b2db8 100644 --- a/prog/kube-peers/annotations.go +++ b/prog/kube-peers/annotations.go @@ -23,17 +23,17 @@ import ( ) type configMapAnnotations struct { - Name string - Namespace string - Client corev1client.ConfigMapsGetter - cm *v1.ConfigMap + ConfigMapName string + Namespace string + Client corev1client.ConfigMapsGetter + cm *v1.ConfigMap } -func newConfigMapAnnotations(ns string, name string, client *kubernetes.Clientset) *configMapAnnotations { +func newConfigMapAnnotations(ns string, configMapName string, clientset *kubernetes.Clientset) *configMapAnnotations { return &configMapAnnotations{ - Namespace: ns, - Name: name, - Client: client.CoreV1(), + Namespace: ns, + ConfigMapName: configMapName, + Client: clientset.CoreV1(), } } @@ -83,14 +83,14 @@ func (cml *configMapAnnotations) Init() error { // so that if the configmap is created after our GET but before or CREATE, we'll gracefully // re-try to get the configmap. var err error - cml.cm, err = cml.Client.ConfigMaps(cml.Namespace).Get(cml.Name, api.GetOptions{}) + cml.cm, err = cml.Client.ConfigMaps(cml.Namespace).Get(cml.ConfigMapName, api.GetOptions{}) if err != nil { if !kubeErrors.IsNotFound(err) { - return errors.Wrapf(err, "Unable to fetch ConfigMap %s/%s", cml.Namespace, cml.Name) + return errors.Wrapf(err, "Unable to fetch ConfigMap %s/%s", cml.Namespace, cml.ConfigMapName) } cml.cm, err = cml.Client.ConfigMaps(cml.Namespace).Create(&v1.ConfigMap{ ObjectMeta: api.ObjectMeta{ - Name: cml.Name, + Name: cml.ConfigMapName, Namespace: cml.Namespace, }, }) @@ -98,7 +98,7 @@ func (cml *configMapAnnotations) Init() error { if kubeErrors.IsAlreadyExists(err) { continue } - return errors.Wrapf(err, "Unable to create ConfigMap %s/%s", cml.Namespace, cml.Name) + return errors.Wrapf(err, "Unable to create ConfigMap %s/%s", cml.Namespace, cml.ConfigMapName) } } break