Skip to content

Commit 6c5a75b

Browse files
remove metadata.creationTimestamp field from configMapGenerator
1 parent 58492e2 commit 6c5a75b

File tree

12 files changed

+12
-25
lines changed

12 files changed

+12
-25
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*.dll
55
*.so
66
*.dylib
7+
kustomize
78

89
# Test binary, build with `go test -c`
910
*.test

pkg/app/application_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ func TestResources1(t *testing.T) {
159159
"annotations": map[string]interface{}{
160160
"note": "This is a test annotation",
161161
},
162-
"creationTimestamp": nil,
163162
},
164163
"data": map[string]interface{}{
165164
"DB_USERNAME": "admin",
@@ -179,7 +178,6 @@ func TestResources1(t *testing.T) {
179178
"annotations": map[string]interface{}{
180179
"note": "This is a test annotation",
181180
},
182-
"creationTimestamp": nil,
183181
},
184182
"type": string(corev1.SecretTypeOpaque),
185183
"data": map[string]interface{}{

pkg/commands/testdata/testcase-configmaps/expected.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ data:
66
kind: ConfigMap
77
metadata:
88
annotations: {}
9-
creationTimestamp: null
109
labels: {}
1110
name: p1-com1-dhbbm922gd
1211
---
@@ -16,6 +15,5 @@ data:
1615
kind: ConfigMap
1716
metadata:
1817
annotations: {}
19-
creationTimestamp: null
2018
labels: {}
2119
name: p2-com2-c4b8md75k9

pkg/commands/testdata/testcase-multiple-patches-noconflict/expected.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ kind: ConfigMap
55
metadata:
66
annotations:
77
note: This is a test annotation
8-
creationTimestamp: null
98
labels:
109
app: mynginx
1110
env: staging
@@ -18,7 +17,6 @@ data:
1817
hello: world
1918
kind: ConfigMap
2019
metadata:
21-
creationTimestamp: null
2220
labels:
2321
env: staging
2422
name: staging-configmap-in-overlay-k7cbc75tg8

pkg/commands/testdata/testcase-simple/expected.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ kind: ConfigMap
77
metadata:
88
annotations:
99
note: This is a test annotation
10-
creationTimestamp: null
1110
labels:
1211
app: mungebot
1312
org: kubernetes
@@ -22,7 +21,6 @@ kind: ConfigMap
2221
metadata:
2322
annotations:
2423
note: This is a test annotation
25-
creationTimestamp: null
2624
labels:
2725
app: mungebot
2826
org: kubernetes
@@ -37,7 +35,6 @@ kind: Secret
3735
metadata:
3836
annotations:
3937
note: This is a test annotation
40-
creationTimestamp: null
4138
labels:
4239
app: mungebot
4340
org: kubernetes

pkg/commands/testdata/testcase-single-overlay/expected.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ kind: ConfigMap
55
metadata:
66
annotations:
77
note: This is a test annotation
8-
creationTimestamp: null
98
labels:
109
app: mynginx
1110
env: staging
@@ -18,7 +17,6 @@ data:
1817
hello: world
1918
kind: ConfigMap
2019
metadata:
21-
creationTimestamp: null
2220
labels:
2321
env: staging
2422
team: override-foo
@@ -33,7 +31,6 @@ kind: Secret
3331
metadata:
3432
annotations:
3533
note: This is a test annotation
36-
creationTimestamp: null
3734
labels:
3835
app: mynginx
3936
env: staging

pkg/commands/testdata/testcase-variable-ref/expected.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ data:
7272
foo: bar
7373
kind: ConfigMap
7474
metadata:
75-
creationTimestamp: null
7675
name: dev-base-test-config-map-b2g2dmd64b
7776
---
7877
apiVersion: v1

pkg/configmapandsecret/configmapfactory.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/pkg/errors"
2727
"k8s.io/api/core/v1"
2828
corev1 "k8s.io/api/core/v1"
29+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2930
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
3031
"k8s.io/apimachinery/pkg/runtime"
3132
"k8s.io/apimachinery/pkg/util/validation"
@@ -70,6 +71,7 @@ func objectToUnstructured(in runtime.Object) (*unstructured.Unstructured, error)
7071
}
7172
var out unstructured.Unstructured
7273
err = out.UnmarshalJSON(marshaled)
74+
out.SetCreationTimestamp(metav1.Time{})
7375
return &out, err
7476
}
7577

pkg/configmapandsecret/configmapfactory_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ func makeUnstructuredEnvConfigMap(name string) *unstructured.Unstructured {
5050
"apiVersion": "v1",
5151
"kind": "ConfigMap",
5252
"metadata": map[string]interface{}{
53-
"name": name,
54-
"creationTimestamp": nil,
53+
"name": name,
5554
},
5655
"data": map[string]interface{}{
5756
"DB_USERNAME": "admin",

pkg/resmap/configmap_test.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ func TestNewFromConfigMaps(t *testing.T) {
6060
"apiVersion": "v1",
6161
"kind": "ConfigMap",
6262
"metadata": map[string]interface{}{
63-
"name": "envConfigMap",
64-
"creationTimestamp": nil,
63+
"name": "envConfigMap",
6564
},
6665
"data": map[string]interface{}{
6766
"DB_USERNAME": "admin",
@@ -87,8 +86,7 @@ func TestNewFromConfigMaps(t *testing.T) {
8786
"apiVersion": "v1",
8887
"kind": "ConfigMap",
8988
"metadata": map[string]interface{}{
90-
"name": "fileConfigMap",
91-
"creationTimestamp": nil,
89+
"name": "fileConfigMap",
9290
},
9391
"data": map[string]interface{}{
9492
"app-init.ini": `FOO=bar
@@ -114,8 +112,7 @@ BAR=baz
114112
"apiVersion": "v1",
115113
"kind": "ConfigMap",
116114
"metadata": map[string]interface{}{
117-
"name": "literalConfigMap",
118-
"creationTimestamp": nil,
115+
"name": "literalConfigMap",
119116
},
120117
"data": map[string]interface{}{
121118
"a": "x",

0 commit comments

Comments
 (0)