Refactor: Improve naming

This commit is contained in:
Brice Fernandes authored and Bryan Boreham committed 2017-11-14 14:06:33 +00:00
1 parent cb0c9e5fba
commit fd2f91e2ee
1 file changed
+12 -12
+12 -12
View File
@@ -23,17 +23,17 @@ import (
) )
type configMapAnnotations struct { type configMapAnnotations struct {
Name string ConfigMapName string
Namespace string Namespace string
Client corev1client.ConfigMapsGetter Client corev1client.ConfigMapsGetter
cm *v1.ConfigMap 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{ return &configMapAnnotations{
Namespace: ns, Namespace: ns,
Name: name, ConfigMapName: configMapName,
Client: client.CoreV1(), 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 // so that if the configmap is created after our GET but before or CREATE, we'll gracefully
// re-try to get the configmap. // re-try to get the configmap.
var err error 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 err != nil {
if !kubeErrors.IsNotFound(err) { 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{ cml.cm, err = cml.Client.ConfigMaps(cml.Namespace).Create(&v1.ConfigMap{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: cml.Name, Name: cml.ConfigMapName,
Namespace: cml.Namespace, Namespace: cml.Namespace,
}, },
}) })
@@ -98,7 +98,7 @@ func (cml *configMapAnnotations) Init() error {
if kubeErrors.IsAlreadyExists(err) { if kubeErrors.IsAlreadyExists(err) {
continue 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 break