Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Brian's cheatsheet for Helm commands: K8S / helm basic commands for ONAP integration


#ONAP installation from Windriver jumpserver. Git clone integration repo first, then#git pull in OOM repo

Code Block
titleONAP Installation
xuyang11@pod-onap-01-vjhost:~$ cd integration/
xuyang11@pod-onap-01-vjhost:~/src/integration$ source deployment/heat/onap-oom/env/windriver/Integration-SB-05-openrc 
xuyang11@pod-onap-01-vjhost:~/src/integration$ cd deployment/heat/onap-oom
xuyang11@pod-onap-01-vjhost:~/src/integration/deployment/heat/onap-oom$ ./scripts/deploy.sh -m docker-manifest-staging.csv -q env/windriver/onap-oom.env

#Update a project configuration. For example, change GLOBAL_AAI_USERNAME parameter in integration_robot_properties.py

git pull with submodule
Yangs-MacBook-Air:src yang$ git clone "https://gerrit.onap.org/r/oom"
Yangs-MacBook-Air:src yang$ cd oom
Yangs-MacBook-Air:oom yang$ git submodule update --init --recursive
Yangs-MacBook-Air:oom yang$ git pull


#find all unreleased ONAP images used by OOM charts

Code Block
titleUnrelease image list in OOM
Yangs-MacBook-Air:oom yang$ find . -name 'values.yaml' -exec grep -Hn image {} \; | grep onap | grep image | grep -E -i "staging|snapshot" | grep -v helm | sort 
./kubernetes/aai/charts/aai-elasticsearch/values.yaml:22:image: onap/elasticsearch-sg:1.4-STAGING-latest


#ONAP installation from Windriver jumpserver. Git clone integration repo or pull the latest from repo first, then

Code Block
titleONAP Installation
xuyang11@pod-onap-01-vjhost:~$ cd integration/
xuyang11@pod-onap-01-vjhost:~/src/integration$ git pull
xuyang11@pod-onap-01-vjhost:~/src/integration$ source deployment/heat/onap-oom/env/windriver/Integration-SB-XX-openrc 
xuyang11@pod-onap-01-vjhost:~/src/integration$ cd deployment/heat/onap-oom
xuyang11@pod-onap-01-vjhost:~/src/integration/deployment/heat/onap-oom$ nohup ./scripts/deploy.sh -m docker-manifest-staging.csv -q env/windriver/onap-oom.env &
                or 
xuyang11@pod-onap-01-vjhost:~/src/integration/deployment/heat/onap-oom$ nohup ./scripts/deploy.sh -m docker-manifest.csv -q env/windriver/onap-oom.env &


#Update a project configuration or simply restart a project. For example, change GLOBAL_AAI_USERNAME parameter in integration_robot_properties.py

Code Block
titleUpdate a project Chart
root@onap-oom-rancher:~# cd oom/kubernetes
root@onap-oom-rancher:~/oom/kubernetes# helm list -a
root@onap-oom-rancher:~/oom/kubernetes# helm delete dev-robot --purge
root@onap-oom-rancher:~/oom/kubernetes# ~/integration/deployment/heat/onap-oom/scripts/cleanup.sh robot                #clean up any resource used by robot
root@onap-oom-rancher:~/oom/kubernetes# rm -rf /dockerdata-nfs/dev-robot                                               #clean up the persistent data
root@onap-oom-rancher:~/oom/kubernetes# vi robot/resources/config/eteshare/config/integration_robot_properties.py      #make change to charts
root@onap-oom-rancher:~/oom/kubernetes# make robot
root@onap-oom-rancher:~/oom/kubernetes# make onap 
root@onap-oom-rancher:~/oom/kubernetes# helm deploy dev local/onap -f /root/oom/kubernetes/onap/resources/environments/public-cloud.yaml -f /root/integration-override.yaml --namespace onap


#Undeploy the whole ONAP  (not tested yet) - use 'kubectl -n onap get all' and then delete any dangling parts like below

Code Block
titleUndeploy ONAP
root@rancher: helm undeploy dev --purge

root@rancher: kubectl -n onap get all

root@rancher: kubectl -n onap delete services --all

root@rancher: kubectl -n onap delete pv --all

root@rancher: kubectl -n onap delete pvc --all

root@rancher: kubectl -n onap delete secrets --all

root@rancher: kubectl -n onap delete clusterrolebinding --all

root@rancher: kubectl -n onap delete statefulsets --all

root@rancher: kubectl -n onap delete deployments --all

root@rancher: kubectl -n onap delete job --all

root@rancher: kubectl -n onap delete pods --all

root@rancher: kubectl -n onap get all



#Deploy and undeploy a chart. See OOM Helm (un)Deploy plugins

Code Block
root@oom-rancher:~/oom/kubernetes# helm deploy dev-sdc local/onap --namespace onap -f /root/oom/kubernetes/onap/resources/environments/public-cloud.yaml -f /root/integration-override.yaml --verbose

If it fails, try to delete the release, and deploy again

Code Block
root@oom-rancher:~/oom/kubernetes# helm deploy dev-sdc local/onap --namespace onap -f /root/oom/kubernetes/onap/resources/environments/public-cloud.yaml -f /root/integration-override.yaml --verbose
fetching local/onap
Error: UPGRADE FAILED: "dev-sdc" has no deployed releases
root@oom-rancher:~/oom/kubernetes# helm del dev-sdc --purge
release "dev-sdc" deleted
root@oom-rancher:~/oom/kubernetes# helm deploy dev-sdc local/onap --namespace onap -f /root/oom/kubernetes/onap/resources/environments/public-cloud.yaml -f /root/integration-override.yaml --verbose
fetching local/onap
Release "dev-sdc" does not exist. Installing it now.
NAME: dev-sdc


#Another way to install one chart (deprecated due to memory size limit of configmap)

Code Block
titleInstall
root@oom-rancher:~/oom/kubenetes# helm delete --purge dev-sdc
root@oom-rancher:~/oom/kubenetes# helm install local/sdc --namespace onap --name dev-sdc -f /root/oom/kubernetes/onap/resources/environments/public-cloud.yaml  -f /root/integration-override.yaml


#Edit deployment. Very useful to change deployment parameters, like docker image version so you can pick a previous working docker image. K8S will restart the pod after the change is made

Code Block
titleHelm edit
root@onap-oom-rancher:~# kubectl edit deploy -n onap dev-sdc-sdc-fe


#Edit statefulset. Sometimes image version is in statefulset, use describe pod command and search for Controlled by keyword. You need to bounce pod after change

Code Block
root@oom
Code Block
titleUpdate a project Chart
root@onap-oom-rancher:~# cd oom/kubernetes
root@onap-oom-rancher:~/oom/kubernetes# vi robot/resources/config/eteshare/config/integration_robot_properties.py
root@onap-oom-rancher:~/oom/kubernetes# make robot
root@onap-oom-rancher:~/oom/kubernetes# make onap 
root@onap-oom-rancher:~/oom/kubernetes# helm list -a
root@onap-oom-rancher:~/oom/kubernetes# helm delete dev-robot --purge
root@onap-oom-rancher:~/oom/kubernetes# helm list -a |grep robot
root@onap-oom-rancher:~/oom/kubernetes# helm deploy dev local/onap -f /root/integration-override.yaml --namespace onap
root@onap-oom-rancher:~/oom/kubernetes# kubectl -n onap getonap podedit |grepstatefulset robot
dev-robot-robot-6f5b8b968f-7gwz9 1/1 Running 0 32sappc-appc


#Find AAI endpoint IP and port. IP can be ANY cluster node IP, and port is 30233

...

#Access ONAP portal. Get portal-app service private ip first, then go to Openstack Horizon to find public ip and update /etc/hosts with the public ipand update /etc/hosts with the public ip - see Mandeep Khindahttps://onap.readthedocs.io/en/latest/submodules/oom.git/docs/oom_user_guide.html#accessing-the-onap-portal-using-oom-and-a-kubernetes-cluster

Code Block
titlePortal Access
# Get portal-app service private ip 
root@oom-rancher:~# kubectl -n onap get services |grep "portal-app"
portal-app  LoadBalancer   10.43.138.237   10.0.0.10   8989:30215/TCP,8006:30213/TCP,8010:30214/TCP 16h
# Get public ip associated with the above private ip from Openstack
xuyang11@pod-onap-01-vjhost:~/Integration-SB-05$ source Integration-SB-05-openrc.sh 
xuyang11@pod-onap-01-vjhost:~/Integration-SB-05$ openstack server list  |grep 10.0.0.10
| b3ecfaac-4654-4b9f-ae33-41b296356384 | oom-k8s_1   | ACTIVE | oam_network_miiM=10.0.0.10, 10.12.5.78 | ubuntu-16-04-cloud-amd64 |
# Update your local /etc/hosts
Yangs-MacBook-Air:Downloads yang$ cat /etc/hosts
10.12.5.78 portal.api.simpledemo.onap.org
10.12.5.78 vid.api.simpledemo.onap.org
10.12.5.78 sdc.api.fe.simpledemo.onap.org
10.12.5.78 portal-sdk.simpledemo.onap.org
10.12.5.78 policy.api.simpledemo.onap.org
10.12.5.78 aai.api.sparky.simpledemo.onap.org
10.12.5.78 cli.api.simpledemo.onap.org
10.12.5.78 msb.api.discovery.simpledemo.onap.org
# Use browser to access ONAP portal url http://portal.api.simpledemo.onap.org:8989/ONAPPORTAL/login.htm

...

Code Block
root@oom-rancher:~# kubectl -n onap get configMap dev-so-so-sdc-controller-app-configmap -o yaml
apiVersion: v1
data:
override.yaml: |
# Copyright © 2018 AT&T USA
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
aai:
auth: 2630606608347B7124C244AB0FE34F6F
server:
port: 8085
spring:
security:
usercredentials:
-
username: asdc
password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
role: Asdc-Client
-
username: mso_admin
password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
role: ACTUATOR
mso:
msoKey: 07a7159d3bf51a0e53be7a8f89699be7
logPath: ./logs/sdc
catalog:
db:
spring:
endpoint: http://so-catalog-db-adapter.onap:8082
db:
auth: Basic YnBlbDpwYXNzd29yZDEk
site-name: onapheat
aai:
endpoint: https://aai.onap:8443
asdc-connections:
asdc-controller1:
user: mso
consumerGroup: sdc-OpenSource-Env1
consumerId: sdc-COpenSource-Env11
environmentName: AUTO
asdcAddress: sdc-be.onap:8443
password: 613AF3483E695524F9857643B697FA51C7A9A0951094F53791485BF3458F9EADA37DBACCCEBD0CB242B85B4062745247
pollingInterval: 60
pollingTimeout: 60
relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL
activateServerTLSAuth: false
keyStorePassword:
keyStorePath:
watchDogTimeout: 300
isFitlerInEmptyResources: true
... ...


#Edit ConfigMap - Change overrides.yaml on running deploye.g. chaning user name or password. Then you need to delete the pod and let k8s restart the pod to take the new values

Code Block
root@oom-rancher:~# kubectl -n onap edit configmap dev-so-so-bpmn-infra-app-configmap

## Edit something in the config
## Delete Pod and let kubernetes respawn with new config
root@oom-rancher:~# kubectl -n onap delete pod dev-so-so-bpmn-infra-5887f8c6c8-jkk7c

...

Code Block
## Replace service name below
root@oom-rancher:~# kubectl patch svc -n onap so-openstack-adapter --type='json' -p '[{"op":"replace","path":"/spec/type","value":"NodePort"}]'

## get nodeport assigned by kubernetes
root@oom-rancher:~# kubectl -n onap get service | grep so-openstack-adapter


so-openstack-adapter       NodePort       10.43.105.9     <none>                                 8087:32715/TCP


#Generate encrypted openstack password

Code Block
>echo -n <tenant_password>| openssl aes-128-ecb -e -K aa3871669d893c7fb8abbcda31b88b4f -nosalt | xxd -c 256 -p