dotnet / tye

Tye is a tool that makes developing, testing, and deploying microservices and distributed applications easier. Project Tye includes a local orchestrator to make developing microservices easier and the ability to deploy microservices to Kubernetes with minimal configuration.
MIT License
5.29k stars 520 forks source link

Support deployment labels #732

Open jongio opened 3 years ago

jongio commented 3 years ago

What should we add or change to make your life better?

In my project, and lots of other projects, we need a way to tell k8s that a new container is available. The way we do this is when we do a redeploy, we generate a unique label to trigger a redeployment.

I use the container_tag value to do this like so:

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd:
      kompose convert --file ./src/net/docker-compose.yml -o ./pac/kubectl/net
      --volumes hostPath
    kompose.version: 1.21.0 (992df58d8)
  creationTimestamp: null
  labels:
    io.kompose.service: memealyzernetapi
  name: memealyzernetapi
spec:
  replicas: 3
  selector:
    matchLabels:
      io.kompose.service: memealyzernetapi
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kompose.cmd:
          kompose convert --file ./src/net/docker-compose.yml -o ./pac/kubectl/net
          --volumes hostPath
        kompose.version: 1.21.0 (992df58d8)
      creationTimestamp: null
      labels:
        io.kompose.service: memealyzernetapi
        checksum/config: ${CONTAINER_TAG}
    spec:
      containers:
          image: ${AZURE_CONTAINER_REGISTRY_SERVER}/memealyzernetapi:${CONTAINER_TAG}
          imagePullPolicy: "Always"
          name: memealyzernetapi
          ports:
            - containerPort: 80
            - containerPort: 443
          resources: {}
      restartPolicy: Always
      serviceAccountName: ""
status: {}

Notice the labels: checksum/config label.

This is a k8s hack, but it does cause the new container to be redeployed.

We should support this scenario. If we can find a better way, then great. If not, then let's allow deployment labels.

azsdke2e azsdke2e2

Why is this important to you?

ssarwa commented 3 years ago

+1 for this.

In terms of PodIdentity feature for AKS, we need to add the label to the manifest while deploying. Adding it through tye would make it easier.