Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

During the init process, configurator does not add the annotation 'config-sync-controller' to an existing deployment #83

Open
surendar-b opened this issue Feb 25, 2022 · 1 comment

Comments

@surendar-b
Copy link
Contributor

Describe the bug
Currently, whenever a new resource is created, say when deployment or a stateful set is created, the configurator checks whether this resource type is version controlled. If so, the configurator adds the annotation 'config-sync-controller' to the resource. For example, deployments and stateful sets are version controlled, whereas jobs are not version controlled. Hence the configurator does not add the annotation 'config-sync-controller' to a job resource. Similarly, the configurator is expected to add this annotation to all the versioned resources at the time of the init process as well.
To Reproduce
Steps to reproduce the behavior:

  1. Create a ConfigMap
$ vi ConfigMap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
    name: demo-config
data:
  # property-like keys; each key maps to a simple value
  player_initial_lives: "3"
  ui_properties_file_name: "user-interface.properties"

  # file-like keys
  game.properties: |
    android.apk=free fire,bgmi
    computer=stambled guys    
  user-interface.properties: |
    color.good=purple
    color.bad=yellow
    allow.textmode=tru
$ kubectl apply -f ConfigMap.yaml
  1. Create a deployment referencing the ConfigMap to apply deployment using
$ vi apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: service-nginx
  template:
    metadata:
      labels:
        app: service-nginx
    spec:
      containers:
        - name: nginx
          image: nginx:1.14
          ports:
            - containerPort: 80
          volumeMounts:
           - name: nginx
             mountPath: "/config"
             readOnly: true
      volumes:
      - name: nginx
        configMap:
          name: demo-config
$ kubectl apply -f deployment.yml
  1. Check the annotations in the deployment.(Note:- there are no additional annotations.)
$ kubectl get deploy demo-deployment -o yaml 
apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: "2022-02-25T07:31:24Z"
  generation: 2
  name: demo-deployment
  namespace: default
  resourceVersion: "29830"
  uid: f9130536-e869-4e97-ae64-3d0dd6df8981
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: service-nginx
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      annotations:
        ccm-demo2-config: ejxsw
        config-sync-controller: configurator
      creationTimestamp: null
      labels:
        app: service-nginx
    spec:
      containers:
      - image: nginx:1.14
        imagePullPolicy: IfNotPresent
        name: nginx
        ports:
        - containerPort: 80
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /config
          name: nginx
          readOnly: true
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - configMap:
          defaultMode: 420
          name: demo2-config
        name: nginx
status:
  availableReplicas: 1
  conditions:
  - lastTransitionTime: "2022-02-25T07:31:29Z"
    lastUpdateTime: "2022-02-25T07:31:29Z"
    message: Deployment has minimum availability.
    reason: MinimumReplicasAvailable
    status: "True"
    type: Available
  - lastTransitionTime: "2022-02-25T07:31:24Z"
    lastUpdateTime: "2022-02-25T07:32:51Z"
    message: ReplicaSet "demo-deployment-76bb6dbb75" has successfully progressed.
    reason: NewReplicaSetAvailable
    status: "True"
    type: Progressing
  observedGeneration: 2
  readyReplicas: 1
  replicas: 1
  updatedReplicas: 1
  1. Install configurator
  2. Check the annotation in the existing deployment ( Note:- configurator has added an annotation 'ccm-demo-config', but hasn't added the annotation 'config-sync-controller').
$ kubectl get deploy demo-deployment -o yaml
'annotations:
   ccm-demo-config: xsszs'
  1. Create a new deployment referencing the ConfigMap apply the deployment.
$ vi apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: service-nginx
  template:
    metadata:
      labels:
        app: service-nginx
    spec:
      containers:
        - name: nginx
          image: nginx:1.14
          ports:
            - containerPort: 80
          volumeMounts:
           - name: nginx
             mountPath: "/config"
             readOnly: true
      volumes:
      - name: nginx
        configMap:
          name: demo-config
$ kubectl apply -f deployment.yaml
  1. Check the annotations in the newly created deployment. ( Note:- configurator has added 2 annotations - 'ccm-demo-config' and 'config-sync-controller' and in 'spec.template.metadata.annotation'
$ kubectl get deploy demo-deployment -o yaml
annotations:
       ccm-demo-config: xsszs
      Config-sync-controller: configurator

Expected behavior
In step 5, the configurator must add the annotation 'config-sync-controller' to existing deployment at the time of the init process.

@gopaddle-io gopaddle-io changed the title During the init process, configurator does not add the annotation 'config-sync-controller' to an existing deployme During the init process, configurator does not add the annotation 'config-sync-controller' to an existing deployment Feb 25, 2022
@gopaddle-io
Copy link
Owner

Please send pull requests to SODACODE-2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants