...
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
title | delete old configmap versions |
---|
linenumbers | true |
---|
collapse | true |
---|
|
#!/usr/bin/env bash
TARGET_NUM_REVISIONS=10
TARGET_NUM_REVISIONS=$(($TARGET_NUM_REVISIONS+0))
RELEASES=$(kubectl --namespace=kube-system get cm -l OWNER=TILLER -o go-template --template='{{range .items}}{{ .metadata.labels.NAME }}{{"\n"}}{{ end }}' | sort -u)
# create the directory to store backups
mkdir configmaps
for RELEASE in $RELEASES
do
# get the revisions of this release
REVISIONS=$(kubectl --namespace=kube-system get cm -l OWNER=TILLER -l NAME=$RELEASE | awk '{if(NR>1)print $1}' | sed 's/.*\.v//' | sort -n)
NUM_REVISIONS=$(echo $REVISIONS | tr " " "\n" | wc -l)
NUM_REVISIONS=$(($NUM_REVISIONS+0))
echo "Release $RELEASE has $NUM_REVISIONS revisions. Target is $TARGET_NUM_REVISIONS."
if [ $NUM_REVISIONS -gt $TARGET_NUM_REVISIONS ]; then
NUM_TO_DELETE=$(($NUM_REVISIONS-$TARGET_NUM_REVISIONS))
echo "Will delete $NUM_TO_DELETE revisions"
TO_DELETE=$(echo $REVISIONS | tr " " "\n" | head -n $NUM_TO_DELETE)
for DELETE_REVISION in $TO_DELETE
do
CMNAME=$RELEASE.v$DELETE_REVISION
echo "Deleting $CMNAME"
# Take a backup
kubectl --namespace=kube-system get cm $CMNAME -o yaml > configmaps/$CMNAME.yaml
# Do the delete
kubectl --namespace=kube-system delete cm $CMNAME
done
fi
done |
Update Edge Rules in running AAI deployment (OOM)
Note: this is not a recommended solution, as it is not persistent after PODs deletion. See https://lists.onap.org/g/onap-discuss/message/16171 and Jira Legacy |
---|
server | System Jira |
---|
serverId | 4733707d-2057-3a0f-ae5e-4fd8aff50176 |
---|
key | AAI-2154 |
---|
|
1) Add new edge rules to aai-traversal, aai-resources and aai-graphadmin containers. For instance:
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
kubectl exec -ti dev-aai-aai-resources-5b6c5f454c-kbmdh bash
root@aai-resources:/opt/app/aai-resources# vi /opt/app/aai-resources/resources/schema/onap/dbedgerules/v14/DbEdgeRules_newRules_v14.json |
2) Run createDBSchema script in aai-graphadmin
Code Block |
---|
language | bash |
---|
theme | Midnight |
---|
linenumbers | true |
---|
|
kubectl exec -ti dev-aai-aai-graphadmin-75d6587db4-xpmt5 bash
root@aai-graphadmin:/opt/app/aai-graphadmin# su aaiadmin
aaiadmin@aai-graphadmin:/opt/app/aai-graphadmin$ /opt/app/aai-graphadmin/bin/createDBSchema.sh |
3) Restart docker containers aai-traversal, aai-resources and aai-graphadmin using docker restart