2022-11-16

Best way to change a docker image tag in a azure pipeline with kubernetes

I have my azure pipeline doing a kubernetes@1 task with my kubernetes config:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: tennant-service-deployment
  labels:
    app: tennant-service
spec:
  replicas: 3
  selector:
    matchLabels:
      app: tennant-service
  template:
    metadata:
      labels:
        app: tennant-service
    spec:
      containers:
        - name: tennant-service
          image: cronesharedwesteurope.azurecr.io/tennant-service:dev
          ports:
            - containerPort: 80   
      imagePullSecrets:
        - name: registrysecret

You can see that at the moment my image is hard coded in my yaml file (tennant-service:dev).

I want the user to tell me witha azure devops pipeline parameter which version he wants (e.g, dev / 1.0 / latest). But because the kubernetes is a yaml config file, I can't change it with a parameter, can I? Are there any tools to do exactly this?



No comments:

Post a Comment