Skip to content

Commit 5eeadb7

Browse files
committed
Always flatten image names
* preserve tags Fixes projectriff#901 Make flattened image names more meaningful Fixes projectriff#902 Serialise image manifest correctly The map should be called "images" rather than "Images".
1 parent db57f38 commit 5eeadb7

File tree

14 files changed

+436
-167
lines changed

14 files changed

+436
-167
lines changed

cmd/commands/image.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,6 @@ func ImageRelocate(c *core.ImageClient) *cobra.Command {
117117
command.Flags().StringVarP(&options.RegistryUser, "registry-user", "u", "", "user name for mapped images")
118118
command.MarkFlagRequired("registry-user")
119119

120-
command.Flags().BoolVar(&options.Flatten, "flatten", false, "flatten image names (for registries that do not support hierarchical names)")
121-
122120
command.Flags().StringVarP(&options.Images, "images", "i", "", "path of an image manifest")
123121
command.MarkFlagRequired("images")
124122

docs/riff_image_relocate.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ riff image relocate [flags]
3737

3838
```
3939
-f, --file string path of a kubernetes configuration file
40-
--flatten flatten image names (for registries that do not support hierarchical names)
4140
-h, --help help for relocate
4241
-i, --images string path of an image manifest
4342
-m, --manifest string path of a riff manifest (default "manifest.yaml")

pkg/core/fixtures/image_relocation/build_relocated.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ spec:
3030
- --artifact=${FUNCTION_ARTIFACT}
3131
- --handler=${FUNCTION_HANDLER}
3232
- --filepath=${FUNCTION_FILE_PATH}
33-
image: reg.org/user/riff-init-a53b8b34598fd723044b9fc6d0471a62-33130595cba42999c2a25dccb2d25b9accd5e2f6745dad75702e9e061a762d72
33+
image: reg.org/user/projectriff-riff-init-a53b8b34598fd723044b9fc6d0471a62-f771f61b00c706065b1613d8904059ed
3434
name: riff-init
3535
- args:
3636
- --dockerfile=/workspace/Dockerfile
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
manifestVersion: 0.1
2-
images:
3-
"reg.org/user/github.com/knative/build/cmd/creds-init-b5dff24742c5c8ac4673dc991e3f960d11b58efdf751d26c54ec5144c48eef30":
4-
"reg.org/user/github.com/knative/build/cmd/git-init-fe0d19e5da3fc9e7da20abc13d032beafcc283358a8325188dced62536a66e54":
5-
"reg.org/user/github.com/knative/build/cmd/controller-3981b19105aabf3ed66db38c15407dc7accf026f4f4703d7e0ca7986ffd37d99":
6-
"reg.org/user/github.com/knative/build/cmd/webhook-b9a97b7d360e10e540edfc9329e4f1c01832e58bf57d5dddea5c3a664f64bfc6":
7-
"reg.org/user/proxyv2:0.8.0":
8-
"reg.org/user/github.com/knative/serving/cmd/activator-e83258dd5858c8b1e92dbd413d0857ad2b22a7c4215ed911f256f68e2972f362":
9-
"reg.org/user/github.com/knative/serving/cmd/autoscaler-76222399addc02454db9837ea3ff54bae29849168586051a9d0180daa2c1a805":
10-
"reg.org/user/github.com/knative/serving/cmd/queue-99c841aa72c2928d1bf333348a848b5afb182715a2a0441da6282c86d4be807e":
11-
"reg.org/user/fluentd-elasticsearch-e71ae1e56d9a15bbcf26be734d13b608":
12-
"reg.org/user/github.com/knative/serving/cmd/controller-28db335f18cbd2a015fd218b9c7ce30b4366898fa3728a7f6dab6537991de028":
13-
"reg.org/user/github.com/knative/serving/cmd/webhook-50ea89c48f8890fbe0cee336fc5cbdadcfe6884afbe5977db5d66892095b397d": "50ea89c48f8890fbe0cee336fc5cbdadcfe6884afbe5977db5d66892095b397d"
14-
"reg.org/user/proxy_init:1.0.1":
15-
"reg.org/user/proxyv2:1.0.1": "00ea89c48f8890fbe0cee336fc5cbdadcfe6884afbe5977db5d66892095b3970"
16-
"reg.org/user/hyperkube:v1.7.6_coreos.0":
17-
"reg.org/user/statsd-exporter:v0.6.0":
18-
"reg.org/user/galley:1.0.1":
19-
"reg.org/user/mixer:1.0.1":
20-
"reg.org/user/pilot:1.0.1":
21-
"reg.org/user/citadel:1.0.1":
22-
"reg.org/user/sidecar_injector:1.0.1":
23-
"reg.org/user/riff-init-a53b8b34598fd723044b9fc6d0471a62-33130595cba42999c2a25dccb2d25b9accd5e2f6745dad75702e9e061a762d72":
1+
Images:
2+
reg.org/user/coreos-hyperkube-a3fdb8f1a9ab0ce4818a4c2b1bd35d05:v1.7.6_coreos.0: ""
3+
reg.org/user/fluentd-elasticsearch-e71ae1e56d9a15bbcf26be734d13b608:v2.0.4: ""
4+
reg.org/user/istio-citadel-e0f4cbedb0016f105a9fb667b0657501:1.0.1: ""
5+
reg.org/user/istio-galley-53681e4e55f068cbad6dbbfd7dbcdb33:1.0.1: ""
6+
reg.org/user/istio-mixer-3bfa0237625d076539b152ea48ea8381:1.0.1: ""
7+
reg.org/user/istio-pilot-2f303924900423ca1ed0c555001cb274:1.0.1: ""
8+
reg.org/user/istio-proxy_init-868cfc0d8893f6f807d59493e57adf68:1.0.1: ""
9+
reg.org/user/istio-proxyv2-20dc6a94cbee6d31af3259dac5e7d0e0:0.8.0: ""
10+
reg.org/user/istio-proxyv2-85a6550901d9fcc8baef756fab8b596a:1.0.1: 00ea89c48f8890fbe0cee336fc5cbdadcfe6884afbe5977db5d66892095b3970
11+
reg.org/user/istio-sidecar_injector-3f9ffb5b050bdcf3022a5f351cbb2806:1.0.1: ""
12+
reg.org/user/knative-releases-github.com-knative-build-cmd-controller-bfad3766247657529a87f0ddf16dbeed: ""
13+
reg.org/user/knative-releases-github.com-knative-build-cmd-creds-init-e0551882498e6397dbc2e59a99bf3012: ""
14+
reg.org/user/knative-releases-github.com-knative-build-cmd-git-init-7b7b673684f76173b8ad3d30053c4e53: ""
15+
reg.org/user/knative-releases-github.com-knative-build-cmd-webhook-79fbc83d8e24379b267b66a1ff921ecb: ""
16+
reg.org/user/knative-releases-github.com-knative-serving-cmd-activator-5cc313d653b28219f4e19c493e8bf4c6: ""
17+
reg.org/user/knative-releases-github.com-knative-serving-cmd-autoscaler-92b6a2e1f9e5f995e90cfa86a7cd039c: ""
18+
reg.org/user/knative-releases-github.com-knative-serving-cmd-controller-77e8afbbcb188941b5d5c5856dd9b318: ""
19+
reg.org/user/knative-releases-github.com-knative-serving-cmd-queue-c1d51575dab2e8084e766e7b4e571a91: ""
20+
reg.org/user/knative-releases-github.com-knative-serving-cmd-webhook-cf1afbbf00c53462afd5737fd5f6e9ec: 50ea89c48f8890fbe0cee336fc5cbdadcfe6884afbe5977db5d66892095b397d
21+
reg.org/user/projectriff-riff-init-a53b8b34598fd723044b9fc6d0471a62-f771f61b00c706065b1613d8904059ed: ""
22+
reg.org/user/prom-statsd-exporter-c8b14ad0def9f2c59788c9906fad64f7:v0.6.0: ""
23+
manifestVersion: "0.1"

pkg/core/fixtures/image_relocation/istio_relocated.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ data:
303303
template: |-
304304
initContainers:
305305
- name: istio-init
306-
image: "reg.org/user/proxy_init:1.0.1"
306+
image: "reg.org/user/istio-proxy_init-868cfc0d8893f6f807d59493e57adf68:1.0.1"
307307
args:
308308
- "-p"
309309
- [[ .MeshConfig.ProxyListenPort ]]
@@ -346,7 +346,7 @@ data:
346346
image: [[ if (isset .ObjectMeta.Annotations "sidecar.istio.io/proxyImage") -]]
347347
"[[ index .ObjectMeta.Annotations "sidecar.istio.io/proxyImage" ]]"
348348
[[ else -]]
349-
reg.org/user/proxyv2:1.0.1
349+
reg.org/user/istio-proxyv2-85a6550901d9fcc8baef756fab8b596a:1.0.1
350350
[[ end -]]
351351
args:
352352
- proxy
@@ -595,7 +595,7 @@ spec:
595595
serviceAccountName: istio-cleanup-secrets-service-account
596596
containers:
597597
- name: hyperkube
598-
image: "reg.org/user/hyperkube:v1.7.6_coreos.0"
598+
image: "reg.org/user/coreos-hyperkube-a3fdb8f1a9ab0ce4818a4c2b1bd35d05:v1.7.6_coreos.0"
599599
command:
600600
- /bin/bash
601601
- -c
@@ -2210,7 +2210,7 @@ spec:
22102210
name: istio-statsd-prom-bridge
22112211
containers:
22122212
- name: statsd-prom-bridge
2213-
image: "reg.org/user/statsd-exporter:v0.6.0"
2213+
image: "reg.org/user/prom-statsd-exporter-c8b14ad0def9f2c59788c9906fad64f7:v0.6.0"
22142214
imagePullPolicy: IfNotPresent
22152215
ports:
22162216
- containerPort: 9102
@@ -2318,7 +2318,7 @@ spec:
23182318
serviceAccountName: istio-galley-service-account
23192319
containers:
23202320
- name: validator
2321-
image: "reg.org/user/galley:1.0.1"
2321+
image: "reg.org/user/istio-galley-53681e4e55f068cbad6dbbfd7dbcdb33:1.0.1"
23222322
imagePullPolicy: IfNotPresent
23232323
ports:
23242324
- containerPort: 443
@@ -2432,7 +2432,7 @@ spec:
24322432
serviceAccountName: istio-egressgateway-service-account
24332433
containers:
24342434
- name: istio-proxy
2435-
image: "reg.org/user/proxyv2:1.0.1"
2435+
image: "reg.org/user/istio-proxyv2-85a6550901d9fcc8baef756fab8b596a:1.0.1"
24362436
imagePullPolicy: IfNotPresent
24372437
ports:
24382438
- containerPort: 80
@@ -2568,7 +2568,7 @@ spec:
25682568
serviceAccountName: istio-ingressgateway-service-account
25692569
containers:
25702570
- name: istio-proxy
2571-
image: "reg.org/user/proxyv2:1.0.1"
2571+
image: "reg.org/user/istio-proxyv2-85a6550901d9fcc8baef756fab8b596a:1.0.1"
25722572
imagePullPolicy: IfNotPresent
25732573
ports:
25742574
- containerPort: 80
@@ -2753,7 +2753,7 @@ spec:
27532753
- s390x
27542754
containers:
27552755
- name: mixer
2756-
image: "reg.org/user/mixer:1.0.1"
2756+
image: "reg.org/user/istio-mixer-3bfa0237625d076539b152ea48ea8381:1.0.1"
27572757
imagePullPolicy: IfNotPresent
27582758
ports:
27592759
- containerPort: 9093
@@ -2778,7 +2778,7 @@ spec:
27782778
initialDelaySeconds: 5
27792779
periodSeconds: 5
27802780
- name: istio-proxy
2781-
image: "reg.org/user/proxyv2:1.0.1"
2781+
image: "reg.org/user/istio-proxyv2-85a6550901d9fcc8baef756fab8b596a:1.0.1"
27822782
imagePullPolicy: IfNotPresent
27832783
ports:
27842784
- containerPort: 9091
@@ -2850,7 +2850,7 @@ spec:
28502850
emptyDir: {}
28512851
containers:
28522852
- name: mixer
2853-
image: "reg.org/user/mixer:1.0.1"
2853+
image: "reg.org/user/istio-mixer-3bfa0237625d076539b152ea48ea8381:1.0.1"
28542854
imagePullPolicy: IfNotPresent
28552855
ports:
28562856
- containerPort: 9093
@@ -2875,7 +2875,7 @@ spec:
28752875
initialDelaySeconds: 5
28762876
periodSeconds: 5
28772877
- name: istio-proxy
2878-
image: "reg.org/user/proxyv2:1.0.1"
2878+
image: "reg.org/user/istio-proxyv2-85a6550901d9fcc8baef756fab8b596a:1.0.1"
28792879
imagePullPolicy: IfNotPresent
28802880
ports:
28812881
- containerPort: 9091
@@ -2947,7 +2947,7 @@ spec:
29472947
serviceAccountName: istio-pilot-service-account
29482948
containers:
29492949
- name: discovery
2950-
image: "reg.org/user/pilot:1.0.1"
2950+
image: "reg.org/user/istio-pilot-2f303924900423ca1ed0c555001cb274:1.0.1"
29512951
imagePullPolicy: IfNotPresent
29522952
args:
29532953
- "discovery"
@@ -2992,7 +2992,7 @@ spec:
29922992
mountPath: /etc/certs
29932993
readOnly: true
29942994
- name: istio-proxy
2995-
image: "reg.org/user/proxyv2:1.0.1"
2995+
image: "reg.org/user/istio-proxyv2-85a6550901d9fcc8baef756fab8b596a:1.0.1"
29962996
imagePullPolicy: IfNotPresent
29972997
ports:
29982998
- containerPort: 15003
@@ -3100,7 +3100,7 @@ spec:
31003100
serviceAccountName: istio-citadel-service-account
31013101
containers:
31023102
- name: citadel
3103-
image: "reg.org/user/citadel:1.0.1"
3103+
image: "reg.org/user/istio-citadel-e0f4cbedb0016f105a9fb667b0657501:1.0.1"
31043104
imagePullPolicy: IfNotPresent
31053105
args:
31063106
- --append-dns-names=true
@@ -3173,7 +3173,7 @@ spec:
31733173
serviceAccountName: istio-sidecar-injector-service-account
31743174
containers:
31753175
- name: sidecar-injector-webhook
3176-
image: "reg.org/user/sidecar_injector:1.0.1"
3176+
image: "reg.org/user/istio-sidecar_injector-3f9ffb5b050bdcf3022a5f351cbb2806:1.0.1"
31773177
imagePullPolicy: IfNotPresent
31783178
args:
31793179
- --caCertFile=/etc/istio/certs/root-cert.pem

pkg/core/fixtures/image_relocation/release_relocated.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ spec:
225225
- -stderrthreshold
226226
- INFO
227227
- -creds-image
228-
- reg.org/user/github.com/knative/build/cmd/creds-init-b5dff24742c5c8ac4673dc991e3f960d11b58efdf751d26c54ec5144c48eef30
228+
- reg.org/user/knative-releases-github.com-knative-build-cmd-creds-init-e0551882498e6397dbc2e59a99bf3012
229229
- -git-image
230-
- reg.org/user/github.com/knative/build/cmd/git-init-fe0d19e5da3fc9e7da20abc13d032beafcc283358a8325188dced62536a66e54
231-
image: reg.org/user/github.com/knative/build/cmd/controller-3981b19105aabf3ed66db38c15407dc7accf026f4f4703d7e0ca7986ffd37d99
230+
- reg.org/user/knative-releases-github.com-knative-build-cmd-git-init-7b7b673684f76173b8ad3d30053c4e53
231+
image: reg.org/user/knative-releases-github.com-knative-build-cmd-controller-bfad3766247657529a87f0ddf16dbeed
232232
name: build-controller
233233
serviceAccountName: build-controller
234234
---
@@ -252,7 +252,7 @@ spec:
252252
- -logtostderr
253253
- -stderrthreshold
254254
- INFO
255-
image: reg.org/user/github.com/knative/build/cmd/webhook-b9a97b7d360e10e540edfc9329e4f1c01832e58bf57d5dddea5c3a664f64bfc6
255+
image: reg.org/user/knative-releases-github.com-knative-build-cmd-webhook-79fbc83d8e24379b267b66a1ff921ecb
256256
name: build-webhook
257257
volumeMounts:
258258
- mountPath: /etc/config-logging
@@ -691,7 +691,7 @@ spec:
691691
valueFrom:
692692
fieldRef:
693693
fieldPath: metadata.name
694-
image: reg.org/user/proxyv2:0.8.0
694+
image: reg.org/user/istio-proxyv2-20dc6a94cbee6d31af3259dac5e7d0e0:0.8.0
695695
imagePullPolicy: IfNotPresent
696696
name: ingressgateway
697697
ports:
@@ -898,7 +898,7 @@ spec:
898898
- args:
899899
- -logtostderr=false
900900
- -stderrthreshold=FATAL
901-
image: reg.org/user/github.com/knative/serving/cmd/activator-e83258dd5858c8b1e92dbd413d0857ad2b22a7c4215ed911f256f68e2972f362
901+
image: reg.org/user/knative-releases-github.com-knative-serving-cmd-activator-5cc313d653b28219f4e19c493e8bf4c6
902902
name: activator
903903
ports:
904904
- containerPort: 8080
@@ -947,7 +947,7 @@ spec:
947947
app: autoscaler
948948
spec:
949949
containers:
950-
- image: reg.org/user/github.com/knative/serving/cmd/autoscaler-76222399addc02454db9837ea3ff54bae29849168586051a9d0180daa2c1a805
950+
- image: reg.org/user/knative-releases-github.com-knative-serving-cmd-autoscaler-92b6a2e1f9e5f995e90cfa86a7cd039c
951951
name: autoscaler
952952
ports:
953953
- containerPort: 8080
@@ -989,7 +989,7 @@ metadata:
989989
---
990990
apiVersion: v1
991991
data:
992-
queueSidecarImage: reg.org/user/github.com/knative/serving/cmd/queue-99c841aa72c2928d1bf333348a848b5afb182715a2a0441da6282c86d4be807e
992+
queueSidecarImage: reg.org/user/knative-releases-github.com-knative-serving-cmd-queue-c1d51575dab2e8084e766e7b4e571a91
993993
registriesSkippingTagResolving: ko.local,dev.local
994994
kind: ConfigMap
995995
metadata:
@@ -1048,7 +1048,7 @@ metadata:
10481048
apiVersion: v1
10491049
data:
10501050
logging.enable-var-log-collection: "false"
1051-
logging.fluentd-sidecar-image: reg.org/user/fluentd-elasticsearch-e71ae1e56d9a15bbcf26be734d13b608
1051+
logging.fluentd-sidecar-image: reg.org/user/fluentd-elasticsearch-e71ae1e56d9a15bbcf26be734d13b608:v2.0.4
10521052
logging.fluentd-sidecar-output-config: |
10531053
# Parse json log before sending to Elastic Search
10541054
<filter **>
@@ -1113,7 +1113,7 @@ spec:
11131113
app: controller
11141114
spec:
11151115
containers:
1116-
- image: reg.org/user/github.com/knative/serving/cmd/controller-28db335f18cbd2a015fd218b9c7ce30b4366898fa3728a7f6dab6537991de028
1116+
- image: reg.org/user/knative-releases-github.com-knative-serving-cmd-controller-77e8afbbcb188941b5d5c5856dd9b318
11171117
name: controller
11181118
ports:
11191119
- containerPort: 9090
@@ -1143,7 +1143,7 @@ spec:
11431143
role: webhook
11441144
spec:
11451145
containers:
1146-
- image: reg.org/user/github.com/knative/serving/cmd/webhook-50ea89c48f8890fbe0cee336fc5cbdadcfe6884afbe5977db5d66892095b397d
1146+
- image: reg.org/user/knative-releases-github.com-knative-serving-cmd-webhook-cf1afbbf00c53462afd5737fd5f6e9ec
11471147
name: webhook
11481148
volumeMounts:
11491149
- mountPath: /etc/config-logging

pkg/core/image.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ type RelocateImagesOptions struct {
4848
Registry string
4949
RegistryUser string
5050
Images string
51-
Flatten bool
5251
}
5352

5453
type DownloadSystemOptions struct {
@@ -80,7 +79,7 @@ func createImageMapper(options RelocateImagesOptions) (*imageMapper, error) {
8079
return nil, err
8180
}
8281

83-
imageMapper, err := newImageMapper(options.Registry, options.RegistryUser, keys(imageManifest.Images), options.Flatten)
82+
imageMapper, err := newImageMapper(options.Registry, options.RegistryUser, keys(imageManifest.Images))
8483
if err != nil {
8584
return nil, err
8685
}

0 commit comments

Comments
 (0)