You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Configurator purges all the unused CustomConfigMap (CCM) revisions that were once referenced by a deployment or statefulset revision. Based on the revision history configured for a deployment/statefulset, Kubernetes automatically removes the unused deployment/statefulset revisions. If a CCM version was referenced in one of those unused deployment/statefulset revisions, then Configurator purges those unused CCMs periodically (once in every 15 mins). However, if a CCM has never been referenced in any of the deployment/statefulset revisions from the time of its creation, then Configurator does not purge those CCM revisions.
To Reproduce
Steps to reproduce the behavior:
1.Create a file named ConfigMap.yaml with the below contents and create a ConfigMap.
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
2.Edit the contents of the ConfigMap and save the ConfigMap. This will create a new CCM revision.
$ kubectl edit cm demo-config
3.List the CCM. It will show the 2 CCM versions.
$ kubectl get ccm
NAME AGE
demo-config-ifoiu 28s
demo-config-sg1cl 3m30s
4.Wait for 15 minutes. After 15 minutes, the automatic purge functionality is invoked. But it doesn't delete the unused CCM versions.
5.List the CCM again. Note that there are 2 CCM revisions still.
$ kubectl get ccm
NAME AGE
demo-config-ifoiu 14m
demo-config-sg1cl 17m
6.Create a new ConfigMap with the below contents.
$ vi ConfigMap-2.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: demo2-config
data:
names: |
paul
peter
$ kubectl apply -f ConfigMap-2.yaml
7.Create a deployment using the new ConfigMap, and set the max revision to be maintained as 1 in ‘spec.revisionHistoryLimit’ level.
$kubectl get ccm
NAME AGE
demo-config-ifoiu 16m
demo-config-sg1cl 19m
demo2-config-4c897 52s
$ kubectl get replicaset
NAME DESIRED CURRENT READY AGE
demo-deployment-57d8c679b7 1 1 1 109s
9.Get new ConfigMap demo2-config as yaml. In annotation level deployment reference will be available
$ kubectl get cm demo2-config -o yaml
apiVersion: v1
data:
names: |
paul
peter
kind: ConfigMap
metadata:
annotations:
currentCustomConfigMapVersion: 21iu3
customConfigMap-name: demo2-config-21iu3
deployments: demo-deployment
updateMethod: ignoreWhenShared
creationTimestamp: "2022-02-25T08:33:29Z"
name: demo2-config
namespace: default
resourceVersion: "59171"
uid: 371d2f53-8d8a-4c9b-999f-21482502655c
10.Edit the new ConfigMap using $ kubectl edit cm demo2-config
11.Check for replicaset
$ kubectl get replicaset
NAME DESIRED CURRENT READY AGE
demo-deployment-57d8c679b7 0 0 0 4m19s
demo-deployment-5b6c7b5f57 1 1 1 40s
12.Wait for 15 mins. Check the older version is removed. The latest will be the second CCM and it will be retained. The first CCM version will be purged.
$ kubectl get replicaset demo-deployment-57d8c679b7 -o yaml
$ kubectl get ccm
NAME AGE
demo-config-ifoiu 27m
demo-config-sg1cl 30m
demo2-config-4c897 11m
demo2-config-we90z 5m29s
$ kubectl edit cm demo2-config
configmap/demo2-config edited
$ kubectl get ccm
NAME AGE
demo-config-ifoiu 29m
demo-config-sg1cl 32m
demo2-config-21iu3 33s
demo2-config-4c897 13m
demo2-config-we90z 7m8s
$ kubectl get replicaset
NAME DESIRED CURRENT READY AGE
demo-deployment-5b6c7b5f57 0 0 0 7m35s
demo-deployment-8767c6b9b 1 1 1 60s
Describe the bug
Configurator purges all the unused CustomConfigMap (CCM) revisions that were once referenced by a deployment or statefulset revision. Based on the revision history configured for a deployment/statefulset, Kubernetes automatically removes the unused deployment/statefulset revisions. If a CCM version was referenced in one of those unused deployment/statefulset revisions, then Configurator purges those unused CCMs periodically (once in every 15 mins). However, if a CCM has never been referenced in any of the deployment/statefulset revisions from the time of its creation, then Configurator does not purge those CCM revisions.
To Reproduce
Steps to reproduce the behavior:
1.Create a file named ConfigMap.yaml with the below contents and create a ConfigMap.
2.Edit the contents of the ConfigMap and save the ConfigMap. This will create a new CCM revision.
3.List the CCM. It will show the 2 CCM versions.
4.Wait for 15 minutes. After 15 minutes, the automatic purge functionality is invoked. But it doesn't delete the unused CCM versions.
5.List the CCM again. Note that there are 2 CCM revisions still.
6.Create a new ConfigMap with the below contents.
$ vi ConfigMap-2.yaml apiVersion: v1 kind: ConfigMap metadata: name: demo2-config data: names: | paul peter
7.Create a deployment using the new ConfigMap, and set the max revision to be maintained as 1 in ‘spec.revisionHistoryLimit’ level.
8.List the versions of ccm using
$kubectl get ccm NAME AGE demo-config-ifoiu 16m demo-config-sg1cl 19m demo2-config-4c897 52s $ kubectl get replicaset NAME DESIRED CURRENT READY AGE demo-deployment-57d8c679b7 1 1 1 109s
9.Get new ConfigMap demo2-config as yaml. In annotation level deployment reference will be available
10.Edit the new ConfigMap using $ kubectl edit cm demo2-config
11.Check for replicaset
12.Wait for 15 mins. Check the older version is removed. The latest will be the second CCM and it will be retained. The first CCM version will be purged.
Expected behavior
In step 5 : If a ConfigMap is not used in any deployment we must retain minimum 1 revision ie., latest revision
The text was updated successfully, but these errors were encountered: