Kustomize Replacement and prefix Issue: prefix container registry host to Image with missing registry and Registry Replacements for existing images

I’m working on a Kustomize setup where I need to:

Replace the registry for images that already have a registry (e.g., docker.io → 10.20.30.40).
Prepend the registry for images without one (e.g., mysql:8.0.29 → 10.20.30.40/mysql:8.0.29).

the original scenario is to bring or download all images from my local registry i.e 10.20.30.40

I tried image prefix as well, thats prefixing to all images and not doing replacement. Not I am trying replacement and its replacing all images first position.

kustomization.yaml

# kustomization.yaml
resources:
- test_two.yaml

replacements:
- source:
    kind: ConfigMap
    name: local-config
    fieldPath: data.registry
  targets:
  - select:
      kind: Deployment
    fieldPaths:
    - spec.template.spec.containers.*.image
    options:
      delimiter: "/"
      index: 0

testing these two images in test_two.yaml

apiVersion: v1
kind: ConfigMap
metadata:
  name: local-config
  annotations:
    config.kubernetes.io/local-config: "true"
data:
  registry: "10.20.30.40"
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    katib.kubeflow.org/component: mysql
  name: katib-mysql
  namespace: kubeflow
spec:
  replicas: 1
  selector:
    matchLabels:
      katib.kubeflow.org/component: mysql
  template:
    metadata:
      annotations:
        sidecar.istio.io/inject: "false"
      labels:
        katib.kubeflow.org/component: mysql
    spec:
      containers:
      - args:
        - --datadir
        - /var/lib/mysql/datadir
        env:
        - name: MYSQL_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: katib-mysql-secrets
              key: MYSQL_ROOT_PASSWORD
        - name: MYSQL_ALLOW_EMPTY_PASSWORD
          value: "true"
        - name: MYSQL_DATABASE
          value: "katib"
        image: mysql:8.0.29
        name: katib-mysql
        ports:
        - containerPort: 3306
          name: dbapi
        readinessProbe:
          exec:
            command:
            - /bin/bash
            - -c
            - mysql -D ${MYSQL_DATABASE} -u root -p${MYSQL_ROOT_PASSWORD} -e 'SELECT 1'
          initialDelaySeconds: 10
          periodSeconds: 5
          failureThreshold: 10
        livenessProbe:
          exec:
            command:
            - /bin/bash
            - -c
            - mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}
          initialDelaySeconds: 10
          periodSeconds: 5
          failureThreshold: 10
        startupProbe:
          exec:
            command:
            - /bin/bash
            - -c
            - mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}
          periodSeconds: 15
          failureThreshold: 60
        volumeMounts:
        - name: katib-mysql
          mountPath: /var/lib/mysql
      volumes:
      - name: katib-mysql
        persistentVolumeClaim:
          claimName: katib-mysql
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    katib.kubeflow.org/component: ui
  name: katib-ui
  namespace: kubeflow
spec:
  replicas: 1
  selector:
    matchLabels:
      katib.kubeflow.org/component: ui
  template:
    metadata:
      annotations:
        sidecar.istio.io/inject: "true"
      labels:
        katib.kubeflow.org/component: ui
    spec:
      containers:
      - args:
        - --port=8080
        command:
        - ./katib-ui
        env:
        - name: KATIB_CORE_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: APP_DISABLE_AUTH
          value: "false"
        image: docker.io/kubeflowkatib/katib-ui:v0.17.0
        name: katib-ui
        ports:
        - containerPort: 8080
          name: ui
      serviceAccountName: katib-ui

output :

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    katib.kubeflow.org/component: mysql
  name: katib-mysql
  namespace: kubeflow
spec:
  replicas: 1
  selector:
    matchLabels:
      katib.kubeflow.org/component: mysql
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        sidecar.istio.io/inject: "false"
      labels:
        katib.kubeflow.org/component: mysql
    spec:
      containers:
      - args:
        - --datadir
        - /var/lib/mysql/datadir
        env:
        - name: MYSQL_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              key: MYSQL_ROOT_PASSWORD
              name: katib-mysql-secrets
        - name: MYSQL_ALLOW_EMPTY_PASSWORD
          value: "true"
        - name: MYSQL_DATABASE
          value: katib
        image: 10.20.30.40 ----here i want ip followed by original image mysql:8.0.29 and expected is 10.20.30.40/mysql:8.0.29
        livenessProbe:
          exec:
            command:
            - /bin/bash
            - -c
            - mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}
          failureThreshold: 10
          initialDelaySeconds: 10
          periodSeconds: 5
        name: katib-mysql
        ports:
        - containerPort: 3306
          name: dbapi
        readinessProbe:
          exec:
            command:
            - /bin/bash
            - -c
            - mysql -D ${MYSQL_DATABASE} -u root -p${MYSQL_ROOT_PASSWORD} -e 'SELECT
              1'
          failureThreshold: 10
          initialDelaySeconds: 10
          periodSeconds: 5
        startupProbe:
          exec:
            command:
            - /bin/bash
            - -c
            - mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}
          failureThreshold: 60
          periodSeconds: 15
        volumeMounts:
        - mountPath: /var/lib/mysql
          name: katib-mysql
      volumes:
      - name: katib-mysql
        persistentVolumeClaim:
          claimName: katib-mysql
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    katib.kubeflow.org/component: ui
  name: katib-ui
  namespace: kubeflow
spec:
  replicas: 1
  selector:
    matchLabels:
      katib.kubeflow.org/component: ui
  template:
    metadata:
      annotations:
        sidecar.istio.io/inject: "true"
      labels:
        katib.kubeflow.org/component: ui
    spec:
      containers:
      - args:
        - --port=8080
        command:
        - ./katib-ui
        env:
        - name: KATIB_CORE_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: APP_DISABLE_AUTH
          value: "false"
        image: 10.20.30.40/kubeflowkatib/katib-ui:v0.17.0  ----- this is correct as expected
        name: katib-ui
        ports:
        - containerPort: 8080
          name: ui
      serviceAccountName: katib-ui

Note: don’t want with container runtime

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật