Last active
February 28, 2021 13:00
-
-
Save making/159651d21cc9d412cebfe08fa05e47a5 to your computer and use it in GitHub Desktop.
コンテナイメージ名を変換したい
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: demo | |
name: demo | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: demo | |
template: | |
metadata: | |
labels: | |
app: demo | |
spec: | |
containers: | |
- image: making/hello-tanzu | |
name: hello-tanzu | |
- image: making/sidecar | |
name: sidecar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@ load("@ytt:overlay", "overlay") | |
#@ def replace_image(x): | |
#@ container = dict(**x) | |
#@ image = container["image"] | |
#@ rest = image.split("/")[-2:] | |
#@ container["image"] = "/".join(["harbor.example.com"] + rest) | |
#@ return container | |
#@ end | |
#@overlay/match by=overlay.subset({"kind":"Deployment","metadata":{"name":"demo"}}) | |
--- | |
spec: | |
template: | |
spec: | |
containers: | |
#@overlay/match by=overlay.all, expects="1+" | |
- #@overlay/replace via=lambda a,b: replace_image(a) | |
image: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment