Skip to content

Commit a9cf197

Browse files
committed
decouple configmapandsecret and hash packages
1 parent 51ece94 commit a9cf197

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

pkg/commands/edit/add/configmap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func addConfigMap(
115115
return err
116116
}
117117
// Validate by trying to create corev1.configmap.
118-
_, _, err = factory.MakeUnstructAndGenerateName(cmArgs)
118+
_, err = factory.MakeConfigMap(cmArgs)
119119
if err != nil {
120120
return err
121121
}

pkg/configmapandsecret/configmapfactory.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
"k8s.io/apimachinery/pkg/runtime"
3232
"k8s.io/apimachinery/pkg/util/validation"
3333
"sigs.k8s.io/kustomize/pkg/fs"
34-
"sigs.k8s.io/kustomize/pkg/hash"
3534
"sigs.k8s.io/kustomize/pkg/loader"
3635
"sigs.k8s.io/kustomize/pkg/types"
3736
)
@@ -48,20 +47,15 @@ func NewConfigMapFactory(
4847
return &ConfigMapFactory{fSys: fSys, ldr: l}
4948
}
5049

51-
// MakeUnstructAndGenerateName returns an configmap and the name appended with a hash.
52-
func (f *ConfigMapFactory) MakeUnstructAndGenerateName(
53-
args *types.ConfigMapArgs) (*unstructured.Unstructured, string, error) {
50+
// MakeUnstruct returns an configmap in unstructured representation.
51+
func (f *ConfigMapFactory) MakeUnstruct(
52+
args *types.ConfigMapArgs) (*unstructured.Unstructured, error) {
5453
cm, err := f.MakeConfigMap(args)
5554
if err != nil {
56-
return nil, "", err
57-
}
58-
h, err := hash.ConfigMapHash(cm)
59-
if err != nil {
60-
return nil, "", err
55+
return nil, err
6156
}
62-
nameWithHash := fmt.Sprintf("%s-%s", cm.GetName(), h)
6357
unstructuredCM, err := objectToUnstructured(cm)
64-
return unstructuredCM, nameWithHash, err
58+
return unstructuredCM, err
6559
}
6660

6761
func objectToUnstructured(in runtime.Object) (*unstructured.Unstructured, error) {

0 commit comments

Comments
 (0)