Skip to content

Commit

Permalink
Templatize walg image (#720)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha authored Nov 30, 2023
1 parent 1f351ba commit dc4c869
Show file tree
Hide file tree
Showing 55 changed files with 86 additions and 84 deletions.
8 changes: 5 additions & 3 deletions catalog/kubedb/fmt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,9 @@ func main() {
panic(err)
}
for prop := range spec {
templatizeRegistry := func(field string) {
img, ok, _ := unstructured.NestedString(obj.Object, "spec", prop, field)
templatizeRegistry := func(fields ...string) {
fieldList := append([]string{"spec", prop}, fields...)
img, ok, _ := unstructured.NestedString(obj.Object, fieldList...)
if ok {
ref, err := name.ParseReference(img)
if err != nil {
Expand All @@ -520,14 +521,15 @@ func main() {
if ref.Tag != "" && ref.Tag != "latest" {
newimg += ":" + ref.Tag
}
err = unstructured.SetNestedField(obj.Object, newimg, "spec", prop, field)
err = unstructured.SetNestedField(obj.Object, newimg, fieldList...)
if err != nil {
panic(err)
}
}
}
templatizeRegistry("image")
templatizeRegistry("yqImage")
templatizeRegistry("walg", "image")
}

if i > 0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:3.4.17'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:3.4.22'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:3.6.13'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
manifest:
addonName: kubedb-manifest-addon
walg:
image: ghcr.io/kubedb/wal-g:v1.0.0
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v1.0.0'
db:
image: '{{ include "image.dockerHub" (merge (dict "_repo" "percona/percona-server-mongodb") $) }}:3.6.18'
distribution: Percona
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:3.6.8'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:4.0.11'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:4.0.3'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:4.0.5'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:4.1.13'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:4.1.4'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:4.1.7'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:4.2.24'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:4.2.3'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerHub" (merge (dict "_repo" "percona/percona-server-mongodb") $) }}:4.2.7-7'
distribution: Percona
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
manifest:
addonName: kubedb-manifest-addon
walg:
image: ghcr.io/kubedb/wal-g:v1.0.0
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v1.0.0'
db:
image: '{{ include "image.dockerHub" (merge (dict "_repo" "percona/percona-server-mongodb") $) }}:4.4.10'
distribution: Percona
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:4.4.6'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:5.0.15'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:5.0.2'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:5.0.3'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/wal-g:v2023.11.30_mongo
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/wal-g") $) }}:v2023.11.30_mongo'
db:
image: '{{ include "image.dockerLibrary" (merge (dict "_repo" "mongo") $) }}:6.0.5'
distribution: Official
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_11.22-bookworm
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_11.22-bookworm'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down Expand Up @@ -65,7 +65,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_11.22-alpine
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_11.22-alpine'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_11.22-bookworm
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_11.22-bookworm'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down Expand Up @@ -65,7 +65,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_11.22-alpine
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_11.22-alpine'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_11.22-bookworm
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_11.22-bookworm'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_11.22-bookworm
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_11.22-bookworm'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down Expand Up @@ -65,7 +65,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_11.22-alpine
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_11.22-alpine'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_11.22-bookworm
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_11.22-bookworm'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down Expand Up @@ -65,7 +65,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_11.22-alpine
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_11.22-alpine'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_11.22-bookworm
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_11.22-bookworm'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down Expand Up @@ -65,7 +65,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_11.22-alpine
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_11.22-alpine'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_12.17-bookworm
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_12.17-bookworm'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down Expand Up @@ -66,7 +66,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_12.17-alpine
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_12.17-alpine'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_12.17-bookworm
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_12.17-bookworm'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down Expand Up @@ -66,7 +66,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_12.17-alpine
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_12.17-alpine'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_12.17-bookworm
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_12.17-bookworm'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down Expand Up @@ -66,7 +66,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_12.17-alpine
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_12.17-alpine'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_12.17-bookworm
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_12.17-bookworm'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down Expand Up @@ -66,7 +66,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_12.17-alpine
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_12.17-alpine'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_12.17-bookworm
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_12.17-bookworm'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down Expand Up @@ -66,7 +66,7 @@ spec:
volumeSnapshot:
name: VolumeSnapshot
walg:
image: ghcr.io/kubedb/postgres-archiver:v0.0.1_12.17-alpine
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/postgres-archiver") $) }}:v0.0.1_12.17-alpine'
coordinator:
image: '{{ include "image.ghcr" (merge (dict "_repo" "kubedb/pg-coordinator") $) }}:v0.21.0'
db:
Expand Down
Loading

0 comments on commit dc4c869

Please sign in to comment.