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

updateMethod: ignoreWhenShared - support for additional options. #85

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

Comments

@surendar-b
Copy link
Contributor

surendar-b commented Feb 25, 2022

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.

@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