gopaddle-io / configurator

Synchronize and Version Control ConfigMaps & Secrets across Deployment Rollouts.
Other
112 stars 45 forks source link

Verify if a CCM is created for a ConfigMap which is not used in any deployment #86

Open surendar-b opened 2 years ago

surendar-b commented 2 years ago

Describe the bug If the cluster has ConfigMap that is not used by any of the deployment, configurator not is creating a version (CCM). This needs to be verified. To Reproduce

1.Create a ConfigMaps to be used in a deployment

apiVersion: v1
kind: ConfigMap
metadata:
  name: demo-config-1
data:
   # file-like keys  
   user-interface.properties: |
      color.good=purple
      color.bad=yellow
    $ kubectl apply -f demo-config-1.yaml

2.Create a ConfigMap that will not be used in a deployment

apiVersion: v1
kind: ConfigMap
metadata:
  name: demo-config-2
data:
  # file-like keys
  game.properties: |
    android.apk=free fire,bgmi
    computer=stambled guys   
    $ kubectl apply -f demo-config-2.yaml
  1. Create deployment with ConfigMap mounted. (Node:- except 'demo-config' use some other CM)
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-1
$ kubectl apply -f deployment.yaml
  1. Install configurator

    helm install configurator gopaddle_configurator/configurator --version 0.4.0-alpha
  2. Verify annotation added in 'spec.template.metadata.annotation' level in deployment.

    $ kubectl get deployment demo-deployment -o yaml
template:
    metadata:
      annotations:
        ccm-demo-config-1: qds24
  1. Verify the new version created for the 'demo-config-1' and 'demo-config-2'.

       $ kubectl get customconfigmap
  2. delete the demo-config-2

    kubectl delete configmap demo-config-2
  3. Create demo-config-2 again

    kubectl apply -f demo-config-2.yaml
  4. List the custom configmaps

    kubectl get customconfigmap

Expected behavior In steps 6 & 9 configurator must create a new version for demo-config-2 ConfigMap

gopaddle-io commented 2 years ago

Please send pull requests to SODACODE-2022