configurator icon indicating copy to clipboard operation
configurator copied to clipboard

updateMethod: ignoreWhenShared - support for additional options.

Open surendar-b opened this issue 3 years ago • 1 comments

Describe the bug Configurator adds the annotation in ConfigMap ‘updateMethod: ignoreWhenShared’ as the default updateMethod . IgnoreWhenShared does not perform a rollingUpdate on a deployment when a ConfigMap it uses is shared by multiple deployments. Add support for additional flags like 'updateWhenShared' to update the deployment when a ConfigMap it uses is shared by multiple deployments.

To Reproduce Steps to reproduce the behavior: 1.Create ConfigMap.

$ kubectl apply -f demo-config.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

2.Get the ConfigMap.updateMethod is added in ConfigMap annotation level

$ kubectl get cm demo-config -o yaml
annotations:
    currentCustomConfigMapVersion: s1vw7
    customConfigMap-name: demo-config-s1vw7
    updateMethod: ignoreWhenShared

3.Create deployment with ‘demo-config’ mounted

$ kubectl apply -f deployment1.yaml

4.Get the ConfigMap. (Node:- annotation having the ‘deployments’)

$ kubectl get cm demo-config -o yaml 
annotations:
   currentCustomConfigMapVersion: s1vw7
   customConfigMap-name: demo-config-s1vw7
   deployments: demo-deployment
   updateMethod: ignoreWhenShared

5.Update the ConfigMap it will trigger the rolling update of that deployment.

$ Kubectl get replicaset
NAME                              DESIRED   CURRENT   READY   AGE
demo-deployment-5fbd8ccf54        1         1         1       2m58s
$ Kubectl edit cm demo-config
ConfigMap/demo-config edited
$ Kubectl get replicaset
NAME                              DESIRED   CURRENT   READY   AGE
demo-deployment-5fbd8ccf54        0         0         0       4m18s
demo-deployment-dcb75689b         1         1         1       25s

6.Create a deployment with same ConfigMap.

$ kubectl apply -f deployment2.yaml

7.Get the ConfigMap. Check the annotation it is having 2 deployments as comma separated.

$ kubectl get cm demo-config -o yaml
annotations:
   currentCustomConfigMapVersion: oa06p
   customConfigMap-name: demo-config-oa06p
   deployments: demo-deployment,demo2-deployment
   updateMethod: ignoreWhenShared

8.Edit the ConfigMap. Now rollingUpdate will not happen.

$ Kubectl get replicaset
NAME                              DESIRED   CURRENT   READY   AGE
demo-deployment-5fbd8ccf54        0         0         0       13m
demo-deployment-dcb75689b         1         1         1       9m43s
demo2-deployment-dcb75689b        1         1         1       2m37s
$ Kubectl edit cm demo-config 
ConfigMap/demo-config edited
$ Kubectl get replicaset
NAME                              DESIRED   CURRENT   READY   AGE
demo-deployment-5fbd8ccf54        0         0         0       14m
demo-deployment-dcb75689b         1         1         1       10m
demo2-deployment-dcb75689b        1         1         1       3m22s

Expected behavior Support to add support for ‘updateWhenShared’ updateType.

surendar-b avatar Feb 25 '22 13:02 surendar-b

Please send pull requests to SODACODE-2022

gopaddle-io avatar Feb 28 '22 14:02 gopaddle-io