Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Automating a release removes custom annotations #1044

Closed
sebastianrosch opened this issue Apr 15, 2018 · 4 comments
Closed

Automating a release removes custom annotations #1044

sebastianrosch opened this issue Apr 15, 2018 · 4 comments

Comments

@sebastianrosch
Copy link

I clicked on Automate in Weave Cloud, which created a new commit in my repository.

In this comment, the flux.weave.works/automated: "true" annotation was added to the service, but my custom annotations were removed.

This is the diff:

annotations:
-    prometheus.io/scrape: 'true'
-    prometheus.io/port: '9090'
+    flux.weave.works/automated: "true"

Please do not modify existing annotations but rather add the required ones.

@squaremo
Copy link
Member

@sebastianroesch We do go to some trouble not to disturb existing annotations; but clearly, it is far from perfect :-( May we see the full file that was altered (redacted, if necessary)?

@sebastianrosch
Copy link
Author

Sure, this is the (slightly redacted) file. The service has only two annotations, which were gone after automating the deployment.

apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: usert-service-v1
spec:
  replicas: 2
  template:
    metadata:
      labels:
        app: user-service-v1
        task: user
        version: v1
    spec:
      containers:
      - name: user-service-v1
        image: user-service:latest-dev
        imagePullPolicy: Always
        ports:
        - containerPort: 80
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        livenessProbe:
          httpGet:
            path: /healthy
            port: 80
          initialDelaySeconds: 60
          timeoutSeconds: 30
          periodSeconds: 10
          failureThreshold: 3
        readinessProbe:
          httpGet:
            path: /healthy
            port: 80
          initialDelaySeconds: 30
          timeoutSeconds: 2
          periodSeconds: 2
          failureThreshold: 5
      tolerations:
        - key:preemptible
          operator: Equal
          value: 'true'
          effect: NoSchedule
      imagePullSecrets:
        - name: mysecret
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: user-service-v1
    task: user
  name: user-service-v1
  namespace: default
  annotations:
    prometheus.io/scrape: 'true'
    prometheus.io/port: '9090'
spec:
  ports:
  - port: 80
    targetPort: 80
    name: api
  - port: 9090
    targetPort: 9090
    name: metrics
  selector:
    app: user-service-v1

@squaremo
Copy link
Member

Thanks @sebastianroesch . Flux doesn't cope with multiple docs in a file, for things it's trying to update (it's an annoying limitation, which comes about indirectly because we're trying to preserve comments in the YAMLs; see #1019 and https://github.com/weaveworks/flux/blob/master/site/requirements.md).

Until we can improve on this situation, if you separate the deployment into its own file, it'll work as advertised. Sorry on flux's behalf for stomping on your yaml!

@squaremo
Copy link
Member

squaremo commented Jun 5, 2018

After #976, flux handles multidocs, and won't botch this kind of update.

@squaremo squaremo closed this as completed Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants