BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.

# first check if old replica sets exits in your deployment

kubectl -n <namespace> get rs | awk '{if ($2 + $3 + $4 == 0) print $1}' | grep -v 'NAME'

 

# example output

sas-analytics-execution-55c4ff9765
sas-analytics-execution-6b6bff6c9f
sas-analytics-execution-6f5fb878f8
sas-analytics-execution-7967d59b85
sas-analytics-execution-7bc584847f
sas-analytics-execution-7d6bdb5756
sas-analytics-execution-84bcfb799f
sas-analytics-execution-856c4d56d4
sas-analytics-execution-cc775d7df
sas-analytics-execution-d9cdcfb8b
sas-analytics-for-io-t-app-54f56cfdbf
sas-analytics-for-io-t-app-5689ffd66d
sas-analytics-for-io-t-app-5c84bb5dff
sas-analytics-for-io-t-app-65589964b4
sas-analytics-for-io-t-app-65f88548c4
sas-analytics-for-io-t-app-66865d987b
sas-analytics-for-io-t-app-69b4f68f7c
sas-analytics-for-io-t-app-6b9bc8c7b6
sas-analytics-for-io-t-app-6d6f55dcbc
sas-analytics-for-io-t-app-86f56c5575
sas-analytics-resources-557c6977bb
sas-analytics-resources-55b54c84d9
sas-analytics-resources-5856c9bd78
sas-analytics-resources-5c564c48c6
sas-analytics-resources-68cb96b679
sas-analytics-resources-6c4c4c4c5
sas-analytics-resources-7487f4bc67
sas-analytics-resources-78dd6c4679
sas-analytics-resources-84744d5644
sas-analytics-resources-8d67cc4d
sas-analytics-services-55648d9f54
.....

sas-workflow-58c8f4bd67
sas-workflow-5b64dfd64b
sas-workflow-67df5d5fff
sas-workflow-6bf55dcff4
sas-workflow-7659c688d7
sas-workflow-864f74bd98
sas-workflow-86f47565b6
sas-workflow-8d64748d7
sas-workflow-cbc44fc89
sas-workflow-definition-history-5cf76968dd
sas-workflow-definition-history-64dc9d885b
sas-workflow-definition-history-64dd9fbcbb
sas-workflow-definition-history-657c8bfc76
sas-workflow-definition-history-69889f7cd
sas-workflow-definition-history-6f74df5b86
sas-workflow-definition-history-77df479b7f
sas-workflow-definition-history-7cb86bb875
sas-workflow-definition-history-8564f57775
sas-workflow-definition-history-8f6dfb99c
sas-workflow-f8c9d6964
sas-workflow-manager-app-54cb88c94b
sas-workflow-manager-app-5947bb8bcc
sas-workflow-manager-app-5b54cc745f
sas-workflow-manager-app-5ccd8f8b88
sas-workflow-manager-app-68f8f44f84
sas-workflow-manager-app-7557447d85
sas-workflow-manager-app-789bd448b7
sas-workflow-manager-app-7bff4d89cf
sas-workflow-manager-app-7dc5b566f6
sas-workflow-manager-app-7f6cbb5977

 

# remove old replica sets

kubectl -n <namespace> delete rs $(kubectl -n <namespace> get rs | awk '{if ($2 + $3 + $4 == 0) print $1}' | grep -v 'NAME')

 

# example output

replicaset.apps "sas-app-registry-765f7754fc" deleted
replicaset.apps "sas-data-flows-7c666dd448" deleted
replicaset.apps "sas-data-server-operator-5b9b88db6d" deleted
replicaset.apps "sas-deployment-data-7cc56d6c6" deleted
replicaset.apps "sas-feature-flags-b77c6d9c6" deleted
replicaset.apps "sas-fraud-decisioning-config-75db8b56ff" deleted
replicaset.apps "sas-health-ingestions-c58fcb964" deleted
replicaset.apps "sas-model-publish-9b56888c7" deleted
replicaset.apps "sas-report-operations-7b77494dc8" deleted
replicaset.apps "sas-singlestore-operator-68fc967fd8" deleted
replicaset.apps "sas-studio-67f74946c" deleted
replicaset.apps "sas-studio-app-5c89b84bdb" deleted
replicaset.apps "sas-studio-development-b8f54b966" deleted

1 ACCEPTED SOLUTION

Accepted Solutions
gwootton
SAS Super FREQ

SAS doesn't specify it in our assets (except for sas-rabbitmq-server) so the default is used. You could add a patch transformer reference to your kustomization.yaml to update it for deployment objects. For example something like this:

---
apiVersion: builtin
kind: PatchTransformer
metadata:
  name: deployment-rev-history
patch: |-
  - op: add
    path: /spec/revisionHistoryLimit
    value: 1
target:
  kind: Deployment
  labelSelector: sas.com/deployment=sas-viya
--
Greg Wootton | Principal Systems Technical Support Engineer

View solution in original post

5 REPLIES 5
gwootton
SAS Super FREQ
The retention of old replica sets is configurable if you don't want to keep as much history for rollback.

https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#clean-up-policy
--
Greg Wootton | Principal Systems Technical Support Engineer
KurtHaemmerle
SAS Employee

Yes I know that, but currently we do using "revisionHistoryLimit" default value which is 10 for SAS Viya Deployments.
As soon this has been modified by SAS, my fix isn't neccessary.

Best Regards. 

gwootton
SAS Super FREQ

SAS doesn't specify it in our assets (except for sas-rabbitmq-server) so the default is used. You could add a patch transformer reference to your kustomization.yaml to update it for deployment objects. For example something like this:

---
apiVersion: builtin
kind: PatchTransformer
metadata:
  name: deployment-rev-history
patch: |-
  - op: add
    path: /spec/revisionHistoryLimit
    value: 1
target:
  kind: Deployment
  labelSelector: sas.com/deployment=sas-viya
--
Greg Wootton | Principal Systems Technical Support Engineer
gwootton
SAS Super FREQ
You could also patch a deployment object directly with a kubectl command, which should trigger Kubernetes to remove the old objects, for example:

kubectl -n namespace patch deploy sas-notifications --type json -p='[{"op":"replace", "path":"/spec/revisionHistoryLimit","value":"1"}]'
--
Greg Wootton | Principal Systems Technical Support Engineer
KurtHaemmerle
SAS Employee

Thanks you very much for this helpful hints!
I will apply the transformer patch.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1021 views
  • 3 likes
  • 2 in conversation