diff --git a/k8s_juju_ns/README.md b/k8s_juju_ns/README.md deleted file mode 100644 index 11c615d194e14b2af2c1d5117d25dd01a85f5df9..0000000000000000000000000000000000000000 --- a/k8s_juju_ns/README.md +++ /dev/null @@ -1,159 +0,0 @@ -# Onboarding and instantiation - -```bash -osm nfpkg-create k8s_base_vnf.tar.gz -osm nfpkg-create k8s_juju_vnf.tar.gz -osm nspkg-create k8s_base_ns.tar.gz -osm ns-create --ns_name k8s --nsd_name k8s_base --vim_account ost9-canonical-fortville --config '{vld: [ {name: mgmtnet, vim-network-name: mgmt} ] }' -``` - -This deploys a NS (k8s\_base\_ns) with one VNF that runs Juju (k8s\_juju\_vnf) and 4 VNFs (k8s\_base\_vnf) that run the K8s cluster (1 master, 3 workers). - -VMs will be called: - -- JUJU -- NODE1 -- NODE2 -- NODE3 -- NODE4 - -# Install and bootstrap of Juju in the VM where juju runs (JUJU) - -## Install juju - -```bash -sudo snap install juju --classic --channel=2.6/stable -ssh-keygen -``` - -## Add the cloud: manual provider type - -```bash -# Copy the ssh key locally -ssh-copy-id ubuntu@ -juju add-cloud - manual - k8s - ubuntu@ -``` - -## Create the controller - -```bash -ssh-copy-id -i /home/ubuntu/.local/share/juju/ssh/juju_id_rsa ubuntu@ -#The same as: cat /home/ubuntu/.local/share/juju/ssh/juju_id_rsa.pub >> .ssh/authorized_keys -juju bootstrap k8s jujuk8s -``` - -This creates a controller locally in the machine - -Juju status can be checked with: - -``` -juju status -``` - -# Add the VMs to juju (manual provider mode) - -First from JUJU you need to copy the controller SSH key to all nodes of the cluster (master and workers) - -```bash -#cat /home/ubuntu/.local/share/juju/ssh/juju_id_rsa.pub -#vi .ssh/authorized_keys -ssh-copy-id -i /home/ubuntu/.local/share/juju/ssh/juju_id_rsa ubuntu@ -ssh-copy-id -i /home/ubuntu/.local/share/juju/ssh/juju_id_rsa ubuntu@ -ssh-copy-id -i /home/ubuntu/.local/share/juju/ssh/juju_id_rsa ubuntu@ -ssh-copy-id -i /home/ubuntu/.local/share/juju/ssh/juju_id_rsa ubuntu@ -``` - -After that add the machines to juju controller mannually in JUJU: - -```bash -juju add-machine ssh:ubuntu@ --debug -juju add-machine ssh:ubuntu@ --debug -juju add-machine ssh:ubuntu@ --debug -juju add-machine ssh:ubuntu@ --debug -``` - -Next we look for the indentifiers of the machines and take notes of it. - -```bash -juju machines -``` - -If they are the first machines we add, then the ids will be 0, 1, 2, 3. - -# Deploy the K8s cluster with the bundle - -The original bundle cannot be used as it is because it assumes that it is going to be deployed in a cloud without specifying the machines. - -```bash -#juju deploy charmed-kubernetes -#wget https://api.jujucharms.com/charmstore/v5/charmed-kubernetes/archive/bundle.yaml -#vi bundle.yaml -``` - -The bundle has been edited to specify which application runs in which machine. - -We copy the bundle from osm-descriptors repo to JUJU: - -```bash -scp osm-descriptors/tid/k8s/k8s_base_ns/bundle/bundle.yaml ubuntu@ -``` - -Deploy the bundle and check the result: - -```bash -juju deploy ./bundle.yaml --map-machines=existing,0=0,1=1,2=2,3=3 -#juju deploy ./bundle.yaml --map-machines=existing,0=30,1=31,2=32,3=33 -juju status -``` - -# Interacting with the Kubernetes cluster - -In JUJU machine: - -```bash -mkdir -p ~/.kube -juju scp kubernetes-master/0:config ~/.kube/config -sudo snap install kubectl --classic -kubectl cluster-info -``` - -# To access the K8s dashboard - -In JUJU machine: - -```bash -juju config kubernetes-master enable-dashboard-addons=true -``` - -The dashboard could be accesible running this kubectl command: - -```bash -kubectl proxy --address -``` - -And now a SSH tunnel could be done from the PC to JUJU, and from the web browser access to the dashboard: - - - -# Install and init Helm - -## Install - -```bash -sudo snap install helm --classic -``` - -## Init - -```bash -# Optional. Create account for tiller -# kubectl --namespace kube-system create serviceaccount tiller -# kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller -helm init -# helm init --service-account tiller --wait -# kubectl --namespace kube-system patch deploy tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}' -kubectl get all --all-namespaces -``` diff --git a/k8s_juju_ns/bundle/bundle.yaml b/k8s_juju_ns/bundle/bundle.yaml deleted file mode 100644 index 113e9ecee973bf45a9b94c1f1ee4885904c55957..0000000000000000000000000000000000000000 --- a/k8s_juju_ns/bundle/bundle.yaml +++ /dev/null @@ -1,133 +0,0 @@ -description: A highly-available, production-grade Kubernetes cluster. -series: bionic -machines: - "0": - "1": - "2": - "3": -services: - containerd: - annotations: - gui-x: '475' - gui-y: '800' - charm: cs:~containers/containerd-20 - resources: {} - easyrsa: - annotations: - gui-x: '90' - gui-y: '420' - charm: cs:~containers/easyrsa-270 - constraints: root-disk=8G - num_units: 1 - resources: - easyrsa: 5 - to: - - "0" - etcd: - annotations: - gui-x: '800' - gui-y: '420' - charm: cs:~containers/etcd-449 - constraints: root-disk=8G - num_units: 3 - options: - channel: 3.2/stable - resources: - core: 0 - etcd: 3 - snapshot: 0 - to: - - "1" - - "2" - - "3" - flannel: - annotations: - gui-x: '475' - gui-y: '605' - charm: cs:~containers/flannel-438 - resources: - flannel-amd64: 394 - flannel-arm64: 390 - flannel-s390x: 377 - kubeapi-load-balancer: - annotations: - gui-x: '450' - gui-y: '250' - charm: cs:~containers/kubeapi-load-balancer-664 - constraints: root-disk=8G - expose: true - num_units: 1 - resources: {} - to: - - "0" - kubernetes-master: - annotations: - gui-x: '800' - gui-y: '850' - charm: cs:~containers/kubernetes-master-724 - constraints: cores=2 mem=4G root-disk=16G - num_units: 2 - options: - channel: 1.15/stable - resources: - cdk-addons: 0 - core: 0 - kube-apiserver: 0 - kube-controller-manager: 0 - kube-proxy: 0 - kube-scheduler: 0 - kubectl: 0 - to: - - "1" - - "2" - kubernetes-worker: - annotations: - gui-x: '90' - gui-y: '850' - charm: cs:~containers/kubernetes-worker-571 - constraints: cores=4 mem=4G root-disk=16G - expose: true - num_units: 3 - options: - channel: 1.15/stable - resources: - cni-amd64: 392 - cni-arm64: 383 - cni-s390x: 395 - core: 0 - kube-proxy: 0 - kubectl: 0 - kubelet: 0 - to: - - "1" - - "2" - - "3" -relations: -- - kubernetes-master:kube-api-endpoint - - kubeapi-load-balancer:apiserver -- - kubernetes-master:loadbalancer - - kubeapi-load-balancer:loadbalancer -- - kubernetes-master:kube-control - - kubernetes-worker:kube-control -- - kubernetes-master:certificates - - easyrsa:client -- - etcd:certificates - - easyrsa:client -- - kubernetes-master:etcd - - etcd:db -- - kubernetes-worker:certificates - - easyrsa:client -- - kubernetes-worker:kube-api-endpoint - - kubeapi-load-balancer:website -- - kubeapi-load-balancer:certificates - - easyrsa:client -- - flannel:etcd - - etcd:db -- - flannel:cni - - kubernetes-master:cni -- - flannel:cni - - kubernetes-worker:cni -- - containerd:containerd - - kubernetes-worker:container-runtime -- - containerd:containerd - - kubernetes-master:container-runtime diff --git a/k8s_juju_ns/icons/osm.png b/k8s_juju_ns/icons/osm.png deleted file mode 100644 index 62012d2a2b491bdcd536d62c3c3c863c0d8c1b33..0000000000000000000000000000000000000000 Binary files a/k8s_juju_ns/icons/osm.png and /dev/null differ diff --git a/k8s_juju_ns/k8s_juju_nsd.yaml b/k8s_juju_ns/k8s_juju_nsd.yaml deleted file mode 100644 index 472b21cd854d6af4870e1f180723f03e97aca09c..0000000000000000000000000000000000000000 --- a/k8s_juju_ns/k8s_juju_nsd.yaml +++ /dev/null @@ -1,43 +0,0 @@ -nsd-catalog: - nsd: - - id: k8s_juju - name: k8s_juju - short-name: k8s_juju - description: NS consisting of a 4 k8s_jujumachine VNFs and 1 k8s_jujucontroller VNF connected to mgmt network - vendor: OSM - version: '1.0' - logo: osm.png - constituent-vnfd: - - member-vnf-index: k8s_vnf1 - vnfd-id-ref: k8s_jujumachine_vnf - - member-vnf-index: k8s_vnf2 - vnfd-id-ref: k8s_jujumachine_vnf - - member-vnf-index: k8s_vnf3 - vnfd-id-ref: k8s_jujumachine_vnf - - member-vnf-index: k8s_vnf4 - vnfd-id-ref: k8s_jujumachine_vnf - - member-vnf-index: k8s_juju - vnfd-id-ref: k8s_jujucontroller_vnf - vld: - - id: mgmtnet - name: mgmtnet - type: ELAN - mgmt-network: 'true' - vim-network-name: mgmt - vnfd-connection-point-ref: - - member-vnf-index-ref: k8s_vnf1 - vnfd-id-ref: k8s_jujumachine_vnf - vnfd-connection-point-ref: mgmt - - member-vnf-index-ref: k8s_vnf2 - vnfd-id-ref: k8s_jujumachine_vnf - vnfd-connection-point-ref: mgmt - - member-vnf-index-ref: k8s_vnf3 - vnfd-id-ref: k8s_jujumachine_vnf - vnfd-connection-point-ref: mgmt - - member-vnf-index-ref: k8s_vnf4 - vnfd-id-ref: k8s_jujumachine_vnf - vnfd-connection-point-ref: mgmt - - member-vnf-index-ref: k8s_juju - vnfd-id-ref: k8s_jujucontroller_vnf - vnfd-connection-point-ref: mgmt - diff --git a/k8s_jujucontroller_vnf/README b/k8s_jujucontroller_vnf/README deleted file mode 100644 index faa5468f46633876e427479aa2f01422114e90a6..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/README +++ /dev/null @@ -1,3 +0,0 @@ -This is a VNF with a single small VDU intended to run a juju controller -that will deploy a K8s cluster using a juju bundle on a set of machines. - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/.build.manifest b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/.build.manifest deleted file mode 100644 index b697fe2d45997791b3ce445a052045d10c4ea349..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/.build.manifest +++ /dev/null @@ -1,566 +0,0 @@ -{ - "layers": [ - { - "rev": "fcdcea4e5de3e1556c24e6704607862d0ba00a56", - "url": "layer:options" - }, - { - "rev": "1d2489bff56daf2f8d1c06ee9248bb0094e4ad49", - "url": "layer:basic" - }, - { - "rev": "29d9dd2e642048f84e1ac388e03756c6cdec3551", - "url": "layer:sshproxy" - }, - { - "rev": "e6a495fab012f06484ed419fd5c2453e6a92eef1", - "url": "layer:vnfproxy" - }, - { - "rev": "5891094f6efebc720bcc806a7784419abe5c892a", - "url": "tid-jujuk8s" - } - ], - "signatures": { - ".build.manifest": [ - "build", - "dynamic", - "unchecked" - ], - ".gitignore": [ - "layer:sshproxy", - "static", - "17526a7f7312e7eefb932d1c514b7bc8425fab5bd1ade149e106ecf8bff67358" - ], - "LICENSE": [ - "layer:basic", - "static", - "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30" - ], - "Makefile": [ - "layer:basic", - "static", - "b7ab3a34e5faf79b96a8632039a0ad0aa87f2a9b5f0ba604e007cafb22190301" - ], - "README.md": [ - "layer:vnfproxy", - "static", - "fed2909a56f740deec009fed50deffe9b017531a5ef6bcde6d2ec519e19d4014" - ], - "actions.yaml": [ - "tid-jujuk8s", - "dynamic", - "cd54801693ce9c48e2275e2d205974641784e25244971a4db76693c0240b8d93" - ], - "actions/add-machine": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/add-machines": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/add-repo": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/delete-release": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/deploy-bundle": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/generate-ssh-key": [ - "layer:sshproxy", - "static", - "46bf4be02078a0f5ac60ab81609372a8f9943885b7a4999ce5332ea2f4857036" - ], - "actions/get-ssh-public-key": [ - "layer:sshproxy", - "static", - "46bf4be02078a0f5ac60ab81609372a8f9943885b7a4999ce5332ea2f4857036" - ], - "actions/init-helm": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/install-chart": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/install-openebs-chart": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/install-openebs-kubectl": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/post-deploy": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/reboot": [ - "layer:vnfproxy", - "static", - "afc0df4409fb6eb7b7e6595490913c1efe329b393d4860ae226d8aaccc01fcf2" - ], - "actions/remove-machines": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/remove-repo": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/restart": [ - "layer:vnfproxy", - "static", - "afc0df4409fb6eb7b7e6595490913c1efe329b393d4860ae226d8aaccc01fcf2" - ], - "actions/rollback-release": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/run": [ - "layer:sshproxy", - "static", - "46bf4be02078a0f5ac60ab81609372a8f9943885b7a4999ce5332ea2f4857036" - ], - "actions/setup-juju": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/start": [ - "layer:vnfproxy", - "static", - "afc0df4409fb6eb7b7e6595490913c1efe329b393d4860ae226d8aaccc01fcf2" - ], - "actions/stop": [ - "layer:vnfproxy", - "static", - "afc0df4409fb6eb7b7e6595490913c1efe329b393d4860ae226d8aaccc01fcf2" - ], - "actions/undeploy-bundle": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/upgrade": [ - "layer:vnfproxy", - "static", - "afc0df4409fb6eb7b7e6595490913c1efe329b393d4860ae226d8aaccc01fcf2" - ], - "actions/upgrade-release": [ - "tid-jujuk8s", - "static", - "d24cace87faffae2500250abf7717bcfd81dffa2a8985bc13657826b7a76e7b0" - ], - "actions/verify-ssh-credentials": [ - "layer:sshproxy", - "static", - "46bf4be02078a0f5ac60ab81609372a8f9943885b7a4999ce5332ea2f4857036" - ], - "bin/charm-env": [ - "layer:basic", - "static", - "458c53532c19ee357cbf4209ccc7d811810718ba0ea3b0588b3d3ef040a44b8e" - ], - "bin/layer_option": [ - "layer:options", - "static", - "e959bf29da4c5edff28b2602c24113c4df9e25cdc9f2aa3b5d46c8577b2a40cc" - ], - "config.yaml": [ - "tid-jujuk8s", - "dynamic", - "6004ebea9161166b9a0c87bdced4770aaea71ff98831e032ba0c7bd633cdfa82" - ], - "copyright": [ - "layer:basic", - "static", - "f6740d66fd60b60f2533d9fcb53907078d1e20920a0219afce7182e2a1c97629" - ], - "copyright.layer-options": [ - "layer:options", - "static", - "f6740d66fd60b60f2533d9fcb53907078d1e20920a0219afce7182e2a1c97629" - ], - "helm/elastic-data.yaml": [ - "tid-jujuk8s", - "static", - "de9db1d8286743347b38e229987bcdd1c88304af094cd2a768a30f19c8ba8db5" - ], - "helm/elastic-kibana.yaml": [ - "tid-jujuk8s", - "static", - "ee069fe64512dad4de7145ab9da3863a533446da3a40419613d5ab532a5e1454" - ], - "helm/elastic-master.yaml": [ - "tid-jujuk8s", - "static", - "7544171333b5e47f914849bdb4638c558c73d1d3f0c6427625ead8c5779797b8" - ], - "helm/kafka-bitnami.yaml": [ - "tid-jujuk8s", - "static", - "4aed51ccb174ed96052912ad929c16eeafdee6b808051f8134c47ff38df5a92c" - ], - "helm/nifi-cetic.yaml": [ - "tid-jujuk8s", - "static", - "a56fe6ea3a48020f29da247518684571796f3216ee42f110858774c0756e8e9f" - ], - "helm/spark-bitnami.yaml": [ - "tid-jujuk8s", - "static", - "36e17c4d277fe028ed4fcb39467d82433adba6aaa519b0816ae24a2685c732ca" - ], - "hooks/collect-metrics": [ - "layer:vnfproxy", - "static", - "f2a6360cf21993f7dc07785ad702f141679a5a9b03c3db5d50dd06ffbe26bbb2" - ], - "hooks/config-changed": [ - "layer:basic", - "dynamic", - "2b693cb2a11594a80cc91235c2dc219a0a6303ae62bee8aa87eb35781f7158f7" - ], - "hooks/hook.template": [ - "layer:basic", - "static", - "2b693cb2a11594a80cc91235c2dc219a0a6303ae62bee8aa87eb35781f7158f7" - ], - "hooks/install": [ - "layer:basic", - "dynamic", - "2b693cb2a11594a80cc91235c2dc219a0a6303ae62bee8aa87eb35781f7158f7" - ], - "hooks/leader-elected": [ - "layer:basic", - "dynamic", - "2b693cb2a11594a80cc91235c2dc219a0a6303ae62bee8aa87eb35781f7158f7" - ], - "hooks/leader-settings-changed": [ - "layer:basic", - "dynamic", - "2b693cb2a11594a80cc91235c2dc219a0a6303ae62bee8aa87eb35781f7158f7" - ], - "hooks/post-series-upgrade": [ - "layer:basic", - "dynamic", - "2b693cb2a11594a80cc91235c2dc219a0a6303ae62bee8aa87eb35781f7158f7" - ], - "hooks/pre-series-upgrade": [ - "layer:basic", - "dynamic", - "2b693cb2a11594a80cc91235c2dc219a0a6303ae62bee8aa87eb35781f7158f7" - ], - "hooks/start": [ - "layer:basic", - "dynamic", - "2b693cb2a11594a80cc91235c2dc219a0a6303ae62bee8aa87eb35781f7158f7" - ], - "hooks/stop": [ - "layer:basic", - "dynamic", - "2b693cb2a11594a80cc91235c2dc219a0a6303ae62bee8aa87eb35781f7158f7" - ], - "hooks/update-status": [ - "layer:basic", - "dynamic", - "2b693cb2a11594a80cc91235c2dc219a0a6303ae62bee8aa87eb35781f7158f7" - ], - "hooks/upgrade-charm": [ - "layer:basic", - "dynamic", - "2b693cb2a11594a80cc91235c2dc219a0a6303ae62bee8aa87eb35781f7158f7" - ], - "icon.svg": [ - "tid-jujuk8s", - "static", - "d20624e9389af6506a8d8a69ac9bba4d41709601b624c0875fd7d6717b395088" - ], - "layer.yaml": [ - "tid-jujuk8s", - "dynamic", - "18aaafe36590b1b7d954cb65b042a60296dad86af760ec1c8d35d8c679774c89" - ], - "lib/charms/layer/__init__.py": [ - "layer:basic", - "static", - "dfe0d26c6bf409767de6e2546bc648f150e1b396243619bad3aa0553ab7e0e6f" - ], - "lib/charms/layer/basic.py": [ - "layer:basic", - "static", - "445652dbaa1f0b84a7215da185bcbdff097bb9bbbce11b4c2dbbff90f77719a9" - ], - "lib/charms/layer/execd.py": [ - "layer:basic", - "static", - "fda8bd491032db1db8ddaf4e99e7cc878c6fb5432efe1f91cadb5b34765d076d" - ], - "lib/charms/layer/options.py": [ - "layer:options", - "static", - "8ae7a07d22542fc964f2d2bee8219d1c78a68dace70a1b38d36d4aea47b1c3b2" - ], - "lib/charms/sshproxy.py": [ - "layer:sshproxy", - "static", - "fba0834f98f570b0b3d6b3e8a7f17b1d8909f50da9410ccda89b586f914b7ffd" - ], - "metadata.yaml": [ - "tid-jujuk8s", - "dynamic", - "77766673d555457570d19232797fb6d01e598ef20c325c96a54a97b8cc4c5348" - ], - "reactive/__init__.py": [ - "layer:basic", - "static", - "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - ], - "reactive/sshproxy.py": [ - "layer:sshproxy", - "static", - "acfaedf414946f8d218e5ebd04177f87258286915ba83b9c42ff7385975da6ab" - ], - "reactive/tid-jujuk8s.py": [ - "tid-jujuk8s", - "static", - "2ea9fde00640699891adee85b303aad00901ed1c682ff28be382ea3c86b82c98" - ], - "reactive/vnfproxy.py": [ - "layer:vnfproxy", - "static", - "8e4101a72f02832e5c233b731981ff483675be608321b8eb9743d605b3f7d77a" - ], - "requirements.txt": [ - "layer:basic", - "static", - "0f1c70d27e26005a96d66ad54482877ae20f7737693c833e29dd72bd6ac24892" - ], - "scripts/add-machine.sh": [ - "tid-jujuk8s", - "static", - "19798eea45157940114d36e360cab3f3e9eed47b594b9361b5b6ecf21842ecde" - ], - "scripts/add-repo.sh": [ - "tid-jujuk8s", - "static", - "b7c089422cff12bd7d4bcc6e5303abcdf52ca831067a2002804b6aec09f848fa" - ], - "scripts/bundle-4machines.yaml": [ - "tid-jujuk8s", - "static", - "cb789a4a5e6bb712a27b81a215e4bc23dd6b4cc23dc62b5c9ad4f0f75148bbb4" - ], - "scripts/bundle-empty.yaml": [ - "tid-jujuk8s", - "static", - "1bc216d8973e0aefdce00a68f80267ee9093a205bd76ac6ffc60ff236d38e47f" - ], - "scripts/bundle.yaml": [ - "tid-jujuk8s", - "static", - "e9c868c2ecdca84f19b54c625364cbbb1ede26c5eabf822950b29de72c8a3c65" - ], - "scripts/delete-release.sh": [ - "tid-jujuk8s", - "static", - "73aa2183f3913e7f51013dafbb14cd5779955c40d0e0ac77a3d2baf6e2cd8aca" - ], - "scripts/init-helm.sh": [ - "tid-jujuk8s", - "static", - "c8f6a55660c717c77fde22fa6c6d0197e630b449cb41a7ec28287e410fbc55e9" - ], - "scripts/install-chart.sh": [ - "tid-jujuk8s", - "static", - "bb0ff17a7000cf4b3e191aeaaef8caa216a6722c1c7d6c9c0a91cac609d4b89d" - ], - "scripts/install-openebs-chart.sh": [ - "tid-jujuk8s", - "static", - "caeecdc6069a48f1c1fd348fbdecfee8b2b01fe3fc0e2f1eff664f0db4cf7fcb" - ], - "scripts/install-openebs-kubectl.sh": [ - "tid-jujuk8s", - "static", - "5364ad5284915b7edd761a0b9708e313f76ff3ae98a35ef51e7c9227b764ecd1" - ], - "scripts/k8s-cloud-template.yaml": [ - "tid-jujuk8s", - "static", - "9e2343f5a27768af9dae44838351cca95474ec0ba9fe7791efe84c8c2b635a83" - ], - "scripts/openebs-storage-class.yaml": [ - "tid-jujuk8s", - "static", - "02a720019bb34ab89fa9d2fcb8da9d757f3c046ec5165e84af8dc3a85f5f1609" - ], - "scripts/post-deploy.sh": [ - "tid-jujuk8s", - "static", - "edacb68927c00f45879ba1312bb63eb398d8532cc9964f44f76d98a8fd72ae97" - ], - "scripts/remove-machine.sh": [ - "tid-jujuk8s", - "static", - "d9622fae2ab02fe359ed150964a92653697bfb235e20947aa3c3f385484e97bf" - ], - "scripts/remove-repo.sh": [ - "tid-jujuk8s", - "static", - "629cbb1ce65036170cf6e46f0dda1b72609055b749a830b8f274060713a0c08d" - ], - "scripts/rollback-release.sh": [ - "tid-jujuk8s", - "static", - "70dba456b3b7f6b1d02738294083f13dd43f3582ed1180a486546667bdea7415" - ], - "scripts/setup-juju.sh": [ - "tid-jujuk8s", - "static", - "5ecf257a6e6218f4ba7bf8c503147ba76f1a128df9caad80ab167d8ac61cdf44" - ], - "scripts/test-elastic.sh": [ - "tid-jujuk8s", - "static", - "50814381337d2f39215275067d15f0ceba3b9e0a56ad39ed79908588c18ba002" - ], - "scripts/test-spark-pi.py": [ - "tid-jujuk8s", - "static", - "866c6b5405b30a88d61d103c7b157328d1c321d7df68bfc294dc451bc023a3df" - ], - "scripts/testNifiKafka.xml": [ - "tid-jujuk8s", - "static", - "d3f41988516bef475d11e6e67765117892c72b595164925ae13e4b0d5668fb8a" - ], - "scripts/undeploy-bundle.sh": [ - "tid-jujuk8s", - "static", - "d9622fae2ab02fe359ed150964a92653697bfb235e20947aa3c3f385484e97bf" - ], - "scripts/upgrade-release.sh": [ - "tid-jujuk8s", - "static", - "d318575ad0ca243dfca6f251fe212501f0bf4e04f759d480ab97e0aaf6027024" - ], - "tests/00-setup": [ - "tid-jujuk8s", - "static", - "111c079b81d260bbcd716dcf41672372a4cf4aaa14154b6c3055deeedae37a06" - ], - "tests/10-deploy": [ - "tid-jujuk8s", - "static", - "042b110489b80ee9b5da765e31e58892ed77f98255de26cbc4646f98a5170195" - ], - "version": [ - "tid-jujuk8s", - "dynamic", - "3057645b724505c606b8471d5b8a541beea27e2881a946fd0f6015e5db46b517" - ], - "wheelhouse/Jinja2-2.10.3.tar.gz": [ - "layer:basic", - "dynamic", - "9fe95f19286cfefaa917656583d020be14e7859c6b0252588391e47db34527de" - ], - "wheelhouse/MarkupSafe-1.1.1.tar.gz": [ - "layer:basic", - "dynamic", - "29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b" - ], - "wheelhouse/PyYAML-5.3.tar.gz": [ - "layer:basic", - "dynamic", - "e9f45bd5b92c7974e59bcd2dcc8631a6b6cc380a904725fce7bc08872e691615" - ], - "wheelhouse/Tempita-0.5.2.tar.gz": [ - "layer:basic", - "dynamic", - "cacecf0baa674d356641f1d406b8bff1d756d739c46b869a54de515d08e6fc9c" - ], - "wheelhouse/charmhelpers-0.20.7.tar.gz": [ - "layer:basic", - "dynamic", - "e0f8d005d39cded1b0c5997d8ef1d90832341c67ebeb4a334ad1eb348fbd803a" - ], - "wheelhouse/charms.reactive-1.3.0.tar.gz": [ - "layer:basic", - "dynamic", - "82d2c614c82d64bf56e913990f22663e5de64b99db15838abfd9a064f1cc2f51" - ], - "wheelhouse/ecdsa-0.15.tar.gz": [ - "layer:sshproxy", - "dynamic", - "8f12ac317f8a1318efa75757ef0a651abe12e51fc1af8838fb91079445227277" - ], - "wheelhouse/netaddr-0.7.19.tar.gz": [ - "layer:basic", - "dynamic", - "38aeec7cdd035081d3a4c306394b19d677623bf76fa0913f6695127c7753aefd" - ], - "wheelhouse/paramiko-1.16.3.tar.gz": [ - "layer:sshproxy", - "dynamic", - "97d932fdb4fec9aadf6bea368123f3ee15b92199f92eb62666370c7fed62d072" - ], - "wheelhouse/pip-18.1.tar.gz": [ - "layer:basic", - "dynamic", - "c0a292bd977ef590379a3f05d7b7f65135487b67470f6281289a94e015650ea1" - ], - "wheelhouse/pyaml-19.12.0.tar.gz": [ - "layer:basic", - "dynamic", - "b3f636b467864319d7ded1558f86bb305b8612a274f5d443a62dc5eceb1b7176" - ], - "wheelhouse/pycrypto-2.6.1.tar.gz": [ - "layer:sshproxy", - "dynamic", - "f2ce1e989b272cfcb677616763e0a2e7ec659effa67a88aa92b3a65528f60a3c" - ], - "wheelhouse/setuptools-41.6.0.zip": [ - "layer:basic", - "dynamic", - "6afa61b391dcd16cb8890ec9f66cc4015a8a31a6e1c2b4e0c464514be1a3d722" - ], - "wheelhouse/setuptools_scm-1.17.0.tar.gz": [ - "layer:basic", - "dynamic", - "70a4cf5584e966ae92f54a764e6437af992ba42ac4bca7eb37cc5d02b98ec40a" - ], - "wheelhouse/six-1.13.0.tar.gz": [ - "layer:sshproxy", - "dynamic", - "30f610279e8b2578cab6db20741130331735c781b56053c59c4076da27f06b66" - ], - "wheelhouse/wheel-0.33.6.tar.gz": [ - "layer:basic", - "dynamic", - "10c9da68765315ed98850f8e048347c3eb06dd81822dc2ab1d4fde9dc9702646" - ] - } -} \ No newline at end of file diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/LICENSE b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/LICENSE deleted file mode 100644 index d645695673349e3947e8e5ae42332d0ac3164cd7..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/Makefile b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/Makefile deleted file mode 100644 index a1ad3a5cd27751144f6bd1a0a7db50f1e11b18eb..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/make - -all: lint unit_test - - -.PHONY: clean -clean: - @rm -rf .tox - -.PHONY: apt_prereqs -apt_prereqs: - @# Need tox, but don't install the apt version unless we have to (don't want to conflict with pip) - @which tox >/dev/null || (sudo apt-get install -y python-pip && sudo pip install tox) - -.PHONY: lint -lint: apt_prereqs - @tox --notest - @PATH=.tox/py34/bin:.tox/py35/bin flake8 $(wildcard hooks reactive lib unit_tests tests) - @charm proof - -.PHONY: unit_test -unit_test: apt_prereqs - @echo Starting tests... - tox diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/README.md b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/README.md deleted file mode 100644 index 9d4451e3dc69a07de2dd31391f5e61f88cdec75b..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/README.md +++ /dev/null @@ -1,268 +0,0 @@ -# vnfproxy - -A [Juju](https://jujucharms.com/) charm layer. See [how it works](https://jujucharms.com/how-it-works) and the [Getting Started](https://jujucharms.com/docs/stable/developer-getting-started) page for more information about Juju and Charms. - -[OSM](https://osm.etsi.org/) is an [ETSI](http://www.etsi.org/)-hosted project to develop an Open Source NFV Management and Orchestration (MANO) software stack aligned with ETSI NFV. - -## Overview - -The vnfproxy [layer](https://jujucharms.com/docs/stable/developer-layers) is intended for use by vendors who wish to integrate a VNF with OSM. The current release of OSM only supports a lightweight version of Juju charms, which we refer to as VNF Configuration or "proxy" charms. - -This document will describe the steps necessary to create a charm for your VNF. - -First, consider the diagram below: - -``` -+---------------------+ +---------------------+ -| <----+ | -| Resource | | Service | -| Orchestrator (RO) +----> Orchestrator (SO) | -| | | | -+------------------+--+ +-------+----^--------+ - | | | - | | | - | | | - +-----v-----+ +-v----+--+ - | <-------+ | - | Virtual | | Proxy | - | Machine | | Charm | - | +-------> | - +-----------+ +---------+ -``` - -The Virtual Machine (VM) is created by the Resource Orchestrator (RO), at the -request of the Service Orchestrator (SO). Once the VM has been created, a -"proxy charm" is deployed in order to facilitate operations between the SO and -your service running within the VM. - -As such, a proxy charm will expose a number of actions -- also known as service primitives -- that are run by the SO. By default, the following actions are exposed: - -```bash -actions -├── reboot -├── restart -├── run -├── start -├── stop -└── upgrade -``` - -Some actions, such as `run` and `reboot`, do not require any additional configuration. The rest, however, require you to implement the command(s) required to interact with your VNF. - -A charm is composed of multiple layers of code. The layer you create for your VNF is the topmost layer. It will include the basic layer, which provides the framework for building reactive charms, and the vnfproxy layer, which adds functionality specific to operating and configuring VNFs. Finally, these layers are combined to form the charm you'll place inside your VNF Descriptor Package. - -## Step 1: Create the layer for your proxy charm: - -Create a new charm layer, substituting "myvnf" with the name of your VNF. - -```bash -$ charm create myvnf -$ cd myvnf -``` - -Modify `layer.yaml` to the following: -```yaml -includes: - - layer:basic - - layer:vnfproxy -``` - -The `metadata.yaml` describes your service. It should look similar to the following: - -```yaml -name: myvnf -summary: My VNF provides a specific virtualized network function. -maintainer: Adam Israel -description: | - A longer description of your VNF and what it provides to users. -series: - - xenial -tags: - - osm - - vnf -subordinate: false -``` - -### Actions (Service Primitives) - -In Juju, Service Primitives are referred to as Actions. These are commands that will be executed on the VNF on request of the Service Orchestrator. - -#### Defining Actions - -Actions are defined through a yaml file called `actions.yaml` in the root directory of your charm. This file describes the action and the parameters it requires in order to execute. - -```yaml -configure-server: - description: "Configure a thing" - params: - polling-interval: - type: int - description: "The interval, in seconds, to poll a thing." - default: 30 - -``` -#### Implementing your Actions - -We use executable files in the charm's `actions/` directory to invoke a reactive handler for your VNF logic. Each file should have the same name as the action you defined in `actions.yaml`. - -Cut and paste the following into `actions/configure-server` and `chmod +x actions/configure-server`: - -```bash -#!/usr/bin/env python3 -import sys -sys.path.append('lib') - -from charms.reactive import main -from charms.reactive import set_state -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_state('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) -``` - -Next, we'll add the code that will be executed inside your VNF via the ssh credentials. Open `reactive/myvnf.py` and add the following reactive handler code: - -```python -# Change configure-server to match the name of the action you want to execute. -@when('actions.configure-server') -def configure_server(): - err = '' - try: - # Put the code here that you want to execute - cmd = "" - result, err = charms.sshproxy._run(cmd) - except: - action_fail('command failed:' + err) - else: - action_set({'output': result}) - finally: - remove_flag('actions.start') - -``` - -#### Default Actions (Service Primitives) - -The vnfproxy layer defines several default actions that you may implement. If you choose not to implement these, the actions will do nothing. - -Add the following code to `reactive/myvnf.py` and fill in the `cmd` variable with the command to be run on your VNF: - -```python -@when('actions.start') -def start(): - err = '' - try: - # Put the code here that you want to execute - cmd = "" - result, err = charms.sshproxy._run(cmd) - except: - action_fail('command failed:' + err) - else: - action_set({'output': result}) - finally: - remove_flag('actions.start') - - -@when('actions.stop') -def stop(): - err = '' - try: - # Enter the command to stop your service(s) - cmd = "service myname stop" - result, err = charms.sshproxy._run(cmd) - except: - action_fail('command failed:' + err) - else: - action_set({'output': result}) - finally: - remove_flag('actions.stop') - - -@when('actions.restart') -def restart(): - err = '' - try: - # Enter the command to restart your service(s) - cmd = "service myname restart" - result, err = charms.sshproxy._run(cmd) - except: - action_fail('command failed:' + err) - else: - action_set({'output': result}) - finally: - remove_flag('actions.restart') - - @when('actions.upgrade') - def upgrade_vnf(): - """Upgrade the software on the VNF. - - This action is intended to be used to perform software upgrades on a running VNF. - """ - err = '' - try: - # Enter the command (s) to upgrade your VNF software - cmd = "" - result, err = charms.sshproxy._run(cmd) - except: - action_fail('command failed:' + err) - else: - action_set({'output': result}) - finally: - remove_flag('actions.upgrade') -``` - -Rename `README.ex` to `README.md` and describe your application and its usage. - -### Configuration - -Charms support immutable configuration, defined by the `config.yaml` file. In the case of OSM, it's configuration is primarily driven through service primitives. Feel free to delete `config.yaml`. - -### Metrics - -Juju supports the polling of metrics. To do this, create the `metrics.yaml` file in the root directory of your charm, following the example below. The command specified will be executed inside your VNF; it should return a positive decimal number. The collected metrics will be made available to OSM, beginning with Release 4. - -```yaml -metrics: - uptime: - type: gauge - description: "Seconds since the machine was rebooted." - command: awk '{print $1}' /proc/uptime - -``` - -These metrics are collected automatically by way of the `collect-metrics` hook, are stored in the Juju Controller, and will be periodically polled by the OSM MON module. - -### Building your VNF charm - -Once you've implemented your actions, you need to compile the various charm layers. From the charm's root directory: -```bash -$ charm build -``` - -This will combine all of the layers required by your VNF layer into a single charm, in the builds/ directory. At this point, the charm can be delivered to a Network Operator for onboarding. - -### VNF Descriptor Package -Copy the combined charm into the `charm` directory of your [VNF package]: - -``` -├── charm -│   └── myvnf -├── cloud_init -│   └── myvnf_cloud_init.cfg -├── icons -│   └── myvnf_logo.png -└── myvnf_vnfd.yaml -``` - -## Contact - -Send an email to the OSM_TECH@list.etsi.org mailing list. - -[VNF package]: https://osm.etsi.org/wikipub/index.php/Creating_your_own_VNF_package_(Release_TWO) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions.yaml deleted file mode 100644 index 096b9d38b32191738569dc311700aa71b5f273f3..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions.yaml +++ /dev/null @@ -1,231 +0,0 @@ -## -# Copyright 2016 Canonical Ltd. -# All rights reserved. -# -# 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. -## - -"run": - "description": "Run an arbitrary command" - "params": - "command": - "description": "The command to execute." - "type": "string" - "default": "" - "required": - - "command" -"generate-ssh-key": - "description": "Generate a new SSH keypair for this unit. This will replace any\ - \ existing previously generated keypair." -"verify-ssh-credentials": - "description": "Verify that this unit can authenticate with server specified by\ - \ ssh-hostname and ssh-username." -"get-ssh-public-key": - "description": "Get the public SSH key for this unit." -"start": - "description": "Stop the service on the VNF." -"stop": - "description": "Stop the service on the VNF." -"restart": - "description": "Stop the service on the VNF." -"reboot": - "description": "Reboot the VNF virtual machine." -"upgrade": - "description": "Upgrade the software on the VNF." -"setup-juju": - "description": "Adds a local manual cloud, bootstraps the controller" -"add-machine": - "description": "Add one machine to the local cloud" - "params": - "machine": - "description": "IP address of machine" - "type": "string" - "default": "" -"add-machines": - "description": "Add machines to the local cloud" - "params": - "machine1": - "description": "IP address of machine1" - "type": "string" - "default": "" - "machine2": - "description": "IP address of machine2" - "type": "string" - "default": "" - "machine3": - "description": "IP address of machine3" - "type": "string" - "default": "" - "machine4": - "description": "IP address of machine4" - "type": "string" - "default": "" - "machine5": - "description": "IP address of machine5" - "type": "string" - "default": "" - "machine6": - "description": "IP address of machine6" - "type": "string" - "default": "" - "machine7": - "description": "IP address of machine7" - "type": "string" - "default": "" - "machine8": - "description": "IP address of machine8" - "type": "string" - "default": "" - "machine9": - "description": "IP address of machine9" - "type": "string" - "default": "" - "machine10": - "description": "IP address of machine10" - "type": "string" - "default": "" - "required": - - "machine1" - - "machine2" - - "machine3" - - "machine4" -"remove-machines": - "description": "Remove all machines" - "params": - "force": - "description": "Flag to force the removal" - "type": "boolean" - "default": !!bool "false" -"deploy-bundle": - "description": "Deploys the bundle in the machines" - "params": - "bundle": - "description": "Optional bundle in JSON/YAML string format" - "type": "string" - "default": "" -"undeploy-bundle": - "description": "Remove all applications of the bundle that was deployed" -"post-deploy": - "description": "Configuration after deployment (kubectl, juju privileges)" -"init-helm": - "description": "Initialize helm" -"install-openebs-kubectl": - "description": "Install OpenEBS with kubectl, required for PVC" -"install-openebs-chart": - "description": "Install OpenEBS helm chart, required for PVC" -"add-repo": - "description": "Add repo to helm" - "params": - "name": - "description": "Name of the repo" - "type": "string" - "default": "" - "url": - "description": "URL of the repo" - "type": "string" - "default": "" - "required": - - "name" - - "url" -"remove-repo": - "description": "Remove repo from helm" - "params": - "name": - "description": "Name of the repo" - "type": "string" - "default": "" - "required": - - "name" -"install-chart": - "description": "Install chart" - "params": - "chart": - "description": "Name of the chart" - "type": "string" - "default": "" - "name": - "description": "Name of the release" - "type": "string" - "default": "" - "namespace": - "description": "Namespace where the release will be set" - "type": "string" - "default": "" - "atomic": - "description": "Flag to run it as atomic" - "type": "boolean" - "default": !!bool "false" - "values": - "description": "Serialized values of a YAML file in a string" - "type": "string" - "default": "" - "valuesFile": - "description": "Values in a YAML file or a URL" - "type": "string" - "default": "" - "required": - - "chart" - - "name" -"upgrade-release": - "description": "Upgrade release" - "params": - "name": - "description": "Name of the release" - "type": "string" - "default": "" - "chart": - "description": "Name of the chart" - "type": "string" - "default": "" - "namespace": - "description": "Namespace where the release will be set" - "type": "string" - "default": "" - "atomic": - "description": "Flag to run it as atomic" - "type": "boolean" - "default": "" - "values": - "description": "Serialized values of a YAML file in a string" - "type": "string" - "default": "" - "valuesFile": - "description": "Values in a YAML file or a URL" - "type": "string" - "default": "" - "required": - - "name" - - "chart" -"rollback-release": - "description": "Rollback release" - "params": - "name": - "description": "Name of the release" - "type": "string" - "default": "" - "revision": - "description": "Revision of the release" - "type": "string" - "default": "0" - "required": - - "name" -"delete-release": - "description": "Delete release" - "params": - "name": - "description": "Name of the release" - "type": "string" - "default": "" - "required": - - "name" - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/add-machine b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/add-machine deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/add-machine +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/add-machines b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/add-machines deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/add-machines +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/add-repo b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/add-repo deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/add-repo +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/delete-release b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/delete-release deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/delete-release +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/deploy-bundle b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/deploy-bundle deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/deploy-bundle +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/generate-ssh-key b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/generate-ssh-key deleted file mode 100755 index 7e30af4cfa084120a9343bf71c421b69ec3f2967..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/generate-ssh-key +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/get-ssh-public-key b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/get-ssh-public-key deleted file mode 100755 index 7e30af4cfa084120a9343bf71c421b69ec3f2967..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/get-ssh-public-key +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/init-helm b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/init-helm deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/init-helm +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/install-chart b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/install-chart deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/install-chart +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/install-openebs-chart b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/install-openebs-chart deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/install-openebs-chart +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/install-openebs-kubectl b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/install-openebs-kubectl deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/install-openebs-kubectl +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/post-deploy b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/post-deploy deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/post-deploy +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/reboot b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/reboot deleted file mode 100755 index 9a2ba24b9efdfa3d21457469c503c050196fb170..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/reboot +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 -import sys -sys.path.append('lib') -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/remove-machines b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/remove-machines deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/remove-machines +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/remove-repo b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/remove-repo deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/remove-repo +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/restart b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/restart deleted file mode 100755 index 9a2ba24b9efdfa3d21457469c503c050196fb170..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/restart +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 -import sys -sys.path.append('lib') -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/rollback-release b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/rollback-release deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/rollback-release +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/run b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/run deleted file mode 100755 index 7e30af4cfa084120a9343bf71c421b69ec3f2967..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/run +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/setup-juju b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/setup-juju deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/setup-juju +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/start b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/start deleted file mode 100755 index 9a2ba24b9efdfa3d21457469c503c050196fb170..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/start +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 -import sys -sys.path.append('lib') -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/stop b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/stop deleted file mode 100755 index 9a2ba24b9efdfa3d21457469c503c050196fb170..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/stop +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 -import sys -sys.path.append('lib') -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/undeploy-bundle b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/undeploy-bundle deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/undeploy-bundle +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/upgrade b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/upgrade deleted file mode 100755 index 9a2ba24b9efdfa3d21457469c503c050196fb170..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/upgrade +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 -import sys -sys.path.append('lib') -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/upgrade-release b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/upgrade-release deleted file mode 100755 index e13c144d2132556f24eee7225adccbc70400658f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/upgrade-release +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# Copyright 2017-18 Telefonica -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/verify-ssh-credentials b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/verify-ssh-credentials deleted file mode 100755 index 7e30af4cfa084120a9343bf71c421b69ec3f2967..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/actions/verify-ssh-credentials +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env python3 -## -# Copyright 2016 Canonical Ltd. -# All rights reserved. -# -# 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. -## -import sys -sys.path.append('lib') - -from charms.reactive import main, set_flag -from charmhelpers.core.hookenv import action_fail, action_name - -""" -`set_state` only works here because it's flushed to disk inside the `main()` -loop. remove_state will need to be called inside the action method. -""" -set_flag('actions.{}'.format(action_name())) - -try: - main() -except Exception as e: - action_fail(repr(e)) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/bin/charm-env b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/bin/charm-env deleted file mode 100755 index aca7de3c1022ecad619cb82a4ac3160fb6b5677d..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/bin/charm-env +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/bash - -VERSION="1.0.0" - - -find_charm_dirs() { - # Hopefully, $JUJU_CHARM_DIR is set so which venv to use in unambiguous. - if [[ -n "$JUJU_CHARM_DIR" || -n "$CHARM_DIR" ]]; then - if [[ -z "$JUJU_CHARM_DIR" ]]; then - # accept $CHARM_DIR to be more forgiving - export JUJU_CHARM_DIR="$CHARM_DIR" - fi - if [[ -z "$CHARM_DIR" ]]; then - # set CHARM_DIR as well to help with backwards compatibility - export CHARM_DIR="$JUJU_CHARM_DIR" - fi - return - fi - # Try to guess the value for JUJU_CHARM_DIR by looking for a non-subordinate - # (because there's got to be at least one principle) charm directory; - # if there are several, pick the first by alpha order. - agents_dir="/var/lib/juju/agents" - if [[ -d "$agents_dir" ]]; then - desired_charm="$1" - found_charm_dir="" - if [[ -n "$desired_charm" ]]; then - for charm_dir in $(/bin/ls -d "$agents_dir"/unit-*/charm); do - charm_name="$(JUJU_CHARM_DIR="$charm_dir" charm-env python3 -c 'from charmhelpers.core.hookenv import charm_name; print(charm_name())')" - if [[ "$charm_name" == "$desired_charm" ]]; then - if [[ -n "$found_charm_dir" ]]; then - >&2 echo "Ambiguous possibilities for JUJU_CHARM_DIR matching '$desired_charm'; please run within a Juju hook context" - exit 1 - fi - found_charm_dir="$charm_dir" - fi - done - if [[ -z "$found_charm_dir" ]]; then - >&2 echo "Unable to determine JUJU_CHARM_DIR matching '$desired_charm'; please run within a Juju hook context" - exit 1 - fi - export JUJU_CHARM_DIR="$found_charm_dir" - export CHARM_DIR="$found_charm_dir" - return - fi - # shellcheck disable=SC2126 - non_subordinates="$(grep -L 'subordinate:.*true' "$agents_dir"/unit-*/charm/metadata.yaml | wc -l)" - if [[ "$non_subordinates" -gt 1 ]]; then - >&2 echo 'Ambiguous possibilities for JUJU_CHARM_DIR; please use --charm or run within a Juju hook context' - exit 1 - elif [[ "$non_subordinates" -eq 1 ]]; then - for charm_dir in $(/bin/ls -d "$agents_dir"/unit-*/charm); do - if grep -q 'subordinate:.*true' "$charm_dir/metadata.yaml"; then - continue - fi - export JUJU_CHARM_DIR="$charm_dir" - export CHARM_DIR="$charm_dir" - return - done - fi - fi - >&2 echo 'Unable to determine JUJU_CHARM_DIR; please run within a Juju hook context' - exit 1 -} - -try_activate_venv() { - if [[ -d "$JUJU_CHARM_DIR/../.venv" ]]; then - . "$JUJU_CHARM_DIR/../.venv/bin/activate" - fi -} - -find_wrapped() { - PATH="${PATH/\/usr\/local\/sbin:}" which "$(basename "$0")" -} - - -if [[ "$1" == "--version" || "$1" == "-v" ]]; then - echo "$VERSION" - exit 0 -fi - - -# allow --charm option to hint which JUJU_CHARM_DIR to choose when ambiguous -# NB: --charm option must come first -# NB: option must be processed outside find_charm_dirs to modify $@ -charm_name="" -if [[ "$1" == "--charm" ]]; then - charm_name="$2" - shift; shift -fi - -find_charm_dirs "$charm_name" -try_activate_venv -export PYTHONPATH="$JUJU_CHARM_DIR/lib:$PYTHONPATH" - -if [[ "$(basename "$0")" == "charm-env" ]]; then - # being used as a shebang - exec "$@" -elif [[ "$0" == "$BASH_SOURCE" ]]; then - # being invoked as a symlink wrapping something to find in the venv - exec "$(find_wrapped)" "$@" -elif [[ "$(basename "$BASH_SOURCE")" == "charm-env" ]]; then - # being sourced directly; do nothing - /bin/true -else - # being sourced for wrapped bash helpers - . "$(find_wrapped)" -fi diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/bin/layer_option b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/bin/layer_option deleted file mode 100755 index 3253ef8aadb95807f26e5ebd8486adde67e5cbc2..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/bin/layer_option +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -import sys -import argparse -from charms import layer - - -parser = argparse.ArgumentParser(description='Access layer options.') -parser.add_argument('section', - help='the section, or layer, the option is from') -parser.add_argument('option', - help='the option to access') - -args = parser.parse_args() -value = layer.options.get(args.section, args.option) -if isinstance(value, bool): - sys.exit(0 if value else 1) -elif isinstance(value, list): - for val in value: - print(val) -else: - print(value) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/config.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/config.yaml deleted file mode 100644 index 737c37887e357e118ce0d083bb3c726a1c7abb30..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/config.yaml +++ /dev/null @@ -1,42 +0,0 @@ -"options": - "ssh-hostname": - "type": "string" - "default": "" - "description": "The hostname or IP address of the machine to" - "ssh-username": - "type": "string" - "default": "" - "description": "The username to login as." - "ssh-password": - "type": "string" - "default": "" - "description": "The password used to authenticate." - "ssh-private-key": - "type": "string" - "default": "" - "description": "DEPRECATED. The private ssh key to be used to authenticate." - "ssh-public-key": - "type": "string" - "default": "" - "description": "The public key of this unit." - "ssh-key-type": - "type": "string" - "default": "rsa" - "description": "The type of encryption to use for the SSH key." - "ssh-key-bits": - "type": "int" - "default": !!int "4096" - "description": "The number of bits to use for the SSH key." - "string-option": - "type": "string" - "default": "Default Value" - "description": "A short description of the configuration option" - "boolean-option": - "type": "boolean" - "default": !!bool "false" - "description": "A short description of the configuration option" - "int-option": - "type": "int" - "default": !!int "9001" - "description": "A short description of the configuration option" - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/copyright b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/copyright deleted file mode 100644 index d4fdd18281c632d030a301d26d45b4dabdb308ef..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/copyright +++ /dev/null @@ -1,16 +0,0 @@ -Format: http://dep.debian.net/deps/dep5/ - -Files: * -Copyright: Copyright 2015-2017, Canonical Ltd., All Rights Reserved. -License: Apache License 2.0 - 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. diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/copyright.layer-options b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/copyright.layer-options deleted file mode 100644 index d4fdd18281c632d030a301d26d45b4dabdb308ef..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/copyright.layer-options +++ /dev/null @@ -1,16 +0,0 @@ -Format: http://dep.debian.net/deps/dep5/ - -Files: * -Copyright: Copyright 2015-2017, Canonical Ltd., All Rights Reserved. -License: Apache License 2.0 - 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. diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/elastic-data.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/elastic-data.yaml deleted file mode 100644 index 654258948f20e500543c2f2723b19dc85c1749b0..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/elastic-data.yaml +++ /dev/null @@ -1,27 +0,0 @@ -clusterName: "srvfd-elk" -nodeGroup: "data" -masterService: "srvfd-elk-mst" -service: - type: "LoadBalancer" -roles: - master: "false" - ingest: "true" - data: "true" -replicas: 3 -image: "docker.elastic.co/elasticsearch/elasticsearch" -imageTag: "6.8.3" -esJavaOpts: "-Xmx1g -Xms1g" -resources: - requests: - cpu: "2" - memory: "4Gi" - limits: - cpu: "2" - memory: "4Gi" -volumeClaimTemplate: - accessModes: [ "ReadWriteOnce" ] - resources: - requests: - storage: 40Gi -antiAffinity: "hard" - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/elastic-kibana.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/elastic-kibana.yaml deleted file mode 100644 index 7b649be07640187782681572a9665bf0b5703fa9..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/elastic-kibana.yaml +++ /dev/null @@ -1,5 +0,0 @@ -elasticsearchHosts: "http://srvfd-elk-mst:9200" -imageTag: "6.8.3" -service: - type: "LoadBalancer" - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/elastic-master.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/elastic-master.yaml deleted file mode 100644 index a1b5def084a02ba10e6129adacdd31b18d70e3f9..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/elastic-master.yaml +++ /dev/null @@ -1,23 +0,0 @@ -clusterName: "srvfd-elk" -nodeGroup: "mst" -masterService: "srvfd-elk-mst" -service: - type: "LoadBalancer" -roles: - master: "true" - ingest: "false" - data: "false" -replicas: 3 -minimumMasterNodes: 2 -image: "docker.elastic.co/elasticsearch/elasticsearch" -imageTag: "6.8.3" -esJavaOpts: "-Xmx1g -Xms1g" -resources: - requests: - cpu: "1" - memory: "2Gi" - limits: - cpu: "2" - memory: "2Gi" -antiAffinity: "hard" - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/kafka-bitnami.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/kafka-bitnami.yaml deleted file mode 100644 index 30c1ca0b0659fbf1dcb4af3e021af8b46650d7d0..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/kafka-bitnami.yaml +++ /dev/null @@ -1,18 +0,0 @@ -clusterDomain: "cluster.local" -image: - tag: "1.1.1-debian-9-r307" -replicaCount: 4 -service: - type: "LoadBalancer" -persistence: - size: "20Gi" -resources: - limits: - cpu: 2 - memory: "4Gi" - requests: - memory: "4Gi" - cpu: 2 -zookeeper: - enabled: true - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/nifi-cetic.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/nifi-cetic.yaml deleted file mode 100644 index 571bcc7cabc40944a5e1e23bb4b0346271c69c18..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/nifi-cetic.yaml +++ /dev/null @@ -1,8 +0,0 @@ -resources: - requests: - cpu: "2" - memory: "4Gi" - limits: - cpu: "2" - memory: "4Gi" - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/spark-bitnami.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/spark-bitnami.yaml deleted file mode 100644 index 8b02b296de7ab90be6c57c1f19ec93e1e0075d4b..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/helm/spark-bitnami.yaml +++ /dev/null @@ -1,49 +0,0 @@ -image: - tag: 2.4.4-debian-9-r27 -master: - debug: false - daemonMemoryLimit: 4g - resources: - limits: - cpu: 4 - memory: 8Gi - requests: - memory: 8Gi - cpu: 4 -worker: - replicaCount: 3 - memoryLimit: 8g - daemonMemoryLimit: 4g - coreLimit: 4 - debug: true - autoscaling: - enabled: false - CpuTargetPercentage: 50 - replicasMax: 5 - debug: false - resources: - limits: - cpu: 4 - memory: 8Gi - requests: - memory: 8Gi - cpu: 4 -security: - rpc: - authenticationEnabled: no - encryptionEnabled: no - storageEncryptionEnabled: no - ssl: - enabled: no - needClientAuth: no - protocol: TLSv1.2 -service: - type: LoadBalancer - clusterPort: 7077 - webPort: 80 -ingress: - enabled: false - hosts: - - name: spark.local - path: / - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/collect-metrics b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/collect-metrics deleted file mode 100755 index ecd7e62385689b00cc023b1057a0061b0f373134..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/collect-metrics +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python3 -"""Handle the collect-metrics hook via proxy. - -The normal metrics layer will only execute metrics collection against the local -machine. This hook implements the same approach, but runs the collection code -against the configured ssh proxy. - -Because the metrics hook runs in a restricted context, it can't be run as a -normal reactive event, nor can it access things like config. -""" - -import os -import shlex -from subprocess import check_call, CalledProcessError -import sys -import yaml - -# Load modules from $CHARM_DIR/lib -sys.path.append('lib') -import charms.sshproxy - - -def build_command(doc): - """Build the commands to report metrics. - - Build a list of `add-metric` commands to report the current metrics - back to the Juju controller. - """ - values = {} - metrics = doc.get("metrics", {}) - for metric, mdoc in metrics.items(): - cmd = mdoc.get("command") - if cmd: - try: - value, err = charms.sshproxy._run( - # The command may contain quotes that need to be preserved, - # i.e., `awk '{print $1}' /proc/uptime` - shlex.split(cmd, posix=False) - ) - except Exception as e: - # Ignore all errors - with open("metrics.log", "a") as f: - f.write("{}".format(e)) - continue - - if isinstance(value, bytes): - value = value.decode('utf-8') - - value = value.strip() - if value: - values[metric] = value - - if not values: - return None - command = ["add-metric"] - for metric, value in values.items(): - command.append("%s=%s" % (metric, value)) - return command - - -if __name__ == '__main__': - charm_dir = os.path.dirname(os.path.abspath(os.path.join(__file__, ".."))) - metrics_yaml = os.path.join(charm_dir, "metrics.yaml") - with open(metrics_yaml) as f: - doc = yaml.load(f) - command = build_command(doc) - if command: - check_call(command) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/config-changed b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/config-changed deleted file mode 100755 index 9858c6be15b8a682778ab4727835151e1b693801..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/config-changed +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -# Load modules from $JUJU_CHARM_DIR/lib -import sys -sys.path.append('lib') - -from charms.layer import basic # noqa -basic.bootstrap_charm_deps() - -from charmhelpers.core import hookenv # noqa -hookenv.atstart(basic.init_config_states) -hookenv.atexit(basic.clear_config_states) - - -# This will load and run the appropriate @hook and other decorated -# handlers from $JUJU_CHARM_DIR/reactive, $JUJU_CHARM_DIR/hooks/reactive, -# and $JUJU_CHARM_DIR/hooks/relations. -# -# See https://jujucharms.com/docs/stable/authors-charm-building -# for more information on this pattern. -from charms.reactive import main # noqa -main() diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/hook.template b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/hook.template deleted file mode 100644 index 9858c6be15b8a682778ab4727835151e1b693801..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/hook.template +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -# Load modules from $JUJU_CHARM_DIR/lib -import sys -sys.path.append('lib') - -from charms.layer import basic # noqa -basic.bootstrap_charm_deps() - -from charmhelpers.core import hookenv # noqa -hookenv.atstart(basic.init_config_states) -hookenv.atexit(basic.clear_config_states) - - -# This will load and run the appropriate @hook and other decorated -# handlers from $JUJU_CHARM_DIR/reactive, $JUJU_CHARM_DIR/hooks/reactive, -# and $JUJU_CHARM_DIR/hooks/relations. -# -# See https://jujucharms.com/docs/stable/authors-charm-building -# for more information on this pattern. -from charms.reactive import main # noqa -main() diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/install b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/install deleted file mode 100755 index 9858c6be15b8a682778ab4727835151e1b693801..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/install +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -# Load modules from $JUJU_CHARM_DIR/lib -import sys -sys.path.append('lib') - -from charms.layer import basic # noqa -basic.bootstrap_charm_deps() - -from charmhelpers.core import hookenv # noqa -hookenv.atstart(basic.init_config_states) -hookenv.atexit(basic.clear_config_states) - - -# This will load and run the appropriate @hook and other decorated -# handlers from $JUJU_CHARM_DIR/reactive, $JUJU_CHARM_DIR/hooks/reactive, -# and $JUJU_CHARM_DIR/hooks/relations. -# -# See https://jujucharms.com/docs/stable/authors-charm-building -# for more information on this pattern. -from charms.reactive import main # noqa -main() diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/leader-elected b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/leader-elected deleted file mode 100755 index 9858c6be15b8a682778ab4727835151e1b693801..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/leader-elected +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -# Load modules from $JUJU_CHARM_DIR/lib -import sys -sys.path.append('lib') - -from charms.layer import basic # noqa -basic.bootstrap_charm_deps() - -from charmhelpers.core import hookenv # noqa -hookenv.atstart(basic.init_config_states) -hookenv.atexit(basic.clear_config_states) - - -# This will load and run the appropriate @hook and other decorated -# handlers from $JUJU_CHARM_DIR/reactive, $JUJU_CHARM_DIR/hooks/reactive, -# and $JUJU_CHARM_DIR/hooks/relations. -# -# See https://jujucharms.com/docs/stable/authors-charm-building -# for more information on this pattern. -from charms.reactive import main # noqa -main() diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/leader-settings-changed b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/leader-settings-changed deleted file mode 100755 index 9858c6be15b8a682778ab4727835151e1b693801..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/leader-settings-changed +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -# Load modules from $JUJU_CHARM_DIR/lib -import sys -sys.path.append('lib') - -from charms.layer import basic # noqa -basic.bootstrap_charm_deps() - -from charmhelpers.core import hookenv # noqa -hookenv.atstart(basic.init_config_states) -hookenv.atexit(basic.clear_config_states) - - -# This will load and run the appropriate @hook and other decorated -# handlers from $JUJU_CHARM_DIR/reactive, $JUJU_CHARM_DIR/hooks/reactive, -# and $JUJU_CHARM_DIR/hooks/relations. -# -# See https://jujucharms.com/docs/stable/authors-charm-building -# for more information on this pattern. -from charms.reactive import main # noqa -main() diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/post-series-upgrade b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/post-series-upgrade deleted file mode 100755 index 9858c6be15b8a682778ab4727835151e1b693801..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/post-series-upgrade +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -# Load modules from $JUJU_CHARM_DIR/lib -import sys -sys.path.append('lib') - -from charms.layer import basic # noqa -basic.bootstrap_charm_deps() - -from charmhelpers.core import hookenv # noqa -hookenv.atstart(basic.init_config_states) -hookenv.atexit(basic.clear_config_states) - - -# This will load and run the appropriate @hook and other decorated -# handlers from $JUJU_CHARM_DIR/reactive, $JUJU_CHARM_DIR/hooks/reactive, -# and $JUJU_CHARM_DIR/hooks/relations. -# -# See https://jujucharms.com/docs/stable/authors-charm-building -# for more information on this pattern. -from charms.reactive import main # noqa -main() diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/pre-series-upgrade b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/pre-series-upgrade deleted file mode 100755 index 9858c6be15b8a682778ab4727835151e1b693801..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/pre-series-upgrade +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -# Load modules from $JUJU_CHARM_DIR/lib -import sys -sys.path.append('lib') - -from charms.layer import basic # noqa -basic.bootstrap_charm_deps() - -from charmhelpers.core import hookenv # noqa -hookenv.atstart(basic.init_config_states) -hookenv.atexit(basic.clear_config_states) - - -# This will load and run the appropriate @hook and other decorated -# handlers from $JUJU_CHARM_DIR/reactive, $JUJU_CHARM_DIR/hooks/reactive, -# and $JUJU_CHARM_DIR/hooks/relations. -# -# See https://jujucharms.com/docs/stable/authors-charm-building -# for more information on this pattern. -from charms.reactive import main # noqa -main() diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/start b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/start deleted file mode 100755 index 9858c6be15b8a682778ab4727835151e1b693801..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/start +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -# Load modules from $JUJU_CHARM_DIR/lib -import sys -sys.path.append('lib') - -from charms.layer import basic # noqa -basic.bootstrap_charm_deps() - -from charmhelpers.core import hookenv # noqa -hookenv.atstart(basic.init_config_states) -hookenv.atexit(basic.clear_config_states) - - -# This will load and run the appropriate @hook and other decorated -# handlers from $JUJU_CHARM_DIR/reactive, $JUJU_CHARM_DIR/hooks/reactive, -# and $JUJU_CHARM_DIR/hooks/relations. -# -# See https://jujucharms.com/docs/stable/authors-charm-building -# for more information on this pattern. -from charms.reactive import main # noqa -main() diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/stop b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/stop deleted file mode 100755 index 9858c6be15b8a682778ab4727835151e1b693801..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/stop +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -# Load modules from $JUJU_CHARM_DIR/lib -import sys -sys.path.append('lib') - -from charms.layer import basic # noqa -basic.bootstrap_charm_deps() - -from charmhelpers.core import hookenv # noqa -hookenv.atstart(basic.init_config_states) -hookenv.atexit(basic.clear_config_states) - - -# This will load and run the appropriate @hook and other decorated -# handlers from $JUJU_CHARM_DIR/reactive, $JUJU_CHARM_DIR/hooks/reactive, -# and $JUJU_CHARM_DIR/hooks/relations. -# -# See https://jujucharms.com/docs/stable/authors-charm-building -# for more information on this pattern. -from charms.reactive import main # noqa -main() diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/update-status b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/update-status deleted file mode 100755 index 9858c6be15b8a682778ab4727835151e1b693801..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/update-status +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -# Load modules from $JUJU_CHARM_DIR/lib -import sys -sys.path.append('lib') - -from charms.layer import basic # noqa -basic.bootstrap_charm_deps() - -from charmhelpers.core import hookenv # noqa -hookenv.atstart(basic.init_config_states) -hookenv.atexit(basic.clear_config_states) - - -# This will load and run the appropriate @hook and other decorated -# handlers from $JUJU_CHARM_DIR/reactive, $JUJU_CHARM_DIR/hooks/reactive, -# and $JUJU_CHARM_DIR/hooks/relations. -# -# See https://jujucharms.com/docs/stable/authors-charm-building -# for more information on this pattern. -from charms.reactive import main # noqa -main() diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/upgrade-charm b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/upgrade-charm deleted file mode 100755 index 9858c6be15b8a682778ab4727835151e1b693801..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/hooks/upgrade-charm +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python3 - -# Load modules from $JUJU_CHARM_DIR/lib -import sys -sys.path.append('lib') - -from charms.layer import basic # noqa -basic.bootstrap_charm_deps() - -from charmhelpers.core import hookenv # noqa -hookenv.atstart(basic.init_config_states) -hookenv.atexit(basic.clear_config_states) - - -# This will load and run the appropriate @hook and other decorated -# handlers from $JUJU_CHARM_DIR/reactive, $JUJU_CHARM_DIR/hooks/reactive, -# and $JUJU_CHARM_DIR/hooks/relations. -# -# See https://jujucharms.com/docs/stable/authors-charm-building -# for more information on this pattern. -from charms.reactive import main # noqa -main() diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/icon.svg b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/icon.svg deleted file mode 100644 index 96a5d0c068d4b3271c7e397f76cf77fdf0651038..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/icon.svg +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/layer.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/layer.yaml deleted file mode 100644 index 5d43c7506a8c395b712df5d563ff447cc7e19b7e..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/layer.yaml +++ /dev/null @@ -1,16 +0,0 @@ -"includes": -- "layer:options" -- "layer:basic" -- "layer:sshproxy" -- "layer:vnfproxy" -"exclude": [".travis.yml", "tests", "tox.ini", "test-requirements.txt"] -"options": - "basic": - "use_venv": !!bool "false" - "packages": [] - "python_packages": [] - "include_system_packages": !!bool "false" - "sshproxy": {} - "vnfproxy": {} - "tid-jujuk8s": {} -"is": "tid-jujuk8s" diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/lib/charms/layer/__init__.py b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/lib/charms/layer/__init__.py deleted file mode 100644 index a8e0c640642f44cac85df60f3d9b7f73b0bb18bb..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/lib/charms/layer/__init__.py +++ /dev/null @@ -1,60 +0,0 @@ -import sys -from importlib import import_module -from pathlib import Path - - -def import_layer_libs(): - """ - Ensure that all layer libraries are imported. - - This makes it possible to do the following: - - from charms import layer - - layer.foo.do_foo_thing() - - Note: This function must be called after bootstrap. - """ - for module_file in Path('lib/charms/layer').glob('*'): - module_name = module_file.stem - if module_name in ('__init__', 'basic', 'execd') or not ( - module_file.suffix == '.py' or module_file.is_dir() - ): - continue - import_module('charms.layer.{}'.format(module_name)) - - -# Terrible hack to support the old terrible interface. -# Try to get people to call layer.options.get() instead so -# that we can remove this garbage. -# Cribbed from https://stackoverfLow.com/a/48100440/4941864 -class OptionsBackwardsCompatibilityHack(sys.modules[__name__].__class__): - def __call__(self, section=None, layer_file=None): - if layer_file is None: - return self.get(section=section) - else: - return self.get(section=section, - layer_file=Path(layer_file)) - - -def patch_options_interface(): - from charms.layer import options - if sys.version_info.minor >= 5: - options.__class__ = OptionsBackwardsCompatibilityHack - else: - # Py 3.4 doesn't support changing the __class__, so we have to do it - # another way. The last line is needed because we already have a - # reference that doesn't get updated with sys.modules. - name = options.__name__ - hack = OptionsBackwardsCompatibilityHack(name) - hack.get = options.get - sys.modules[name] = hack - sys.modules[__name__].options = hack - - -try: - patch_options_interface() -except ImportError: - # This may fail if pyyaml hasn't been installed yet. But in that - # case, the bootstrap logic will try it again once it has. - pass diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/lib/charms/layer/basic.py b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/lib/charms/layer/basic.py deleted file mode 100644 index 39319591156a512b6ff46a082f51c3c8382055ec..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/lib/charms/layer/basic.py +++ /dev/null @@ -1,286 +0,0 @@ -import os -import sys -import shutil -from glob import glob -from subprocess import check_call, check_output, CalledProcessError -from time import sleep - -from charms import layer -from charms.layer.execd import execd_preinstall - - -def lsb_release(): - """Return /etc/lsb-release in a dict""" - d = {} - with open('/etc/lsb-release', 'r') as lsb: - for l in lsb: - k, v = l.split('=') - d[k.strip()] = v.strip() - return d - - -def bootstrap_charm_deps(): - """ - Set up the base charm dependencies so that the reactive system can run. - """ - # execd must happen first, before any attempt to install packages or - # access the network, because sites use this hook to do bespoke - # configuration and install secrets so the rest of this bootstrap - # and the charm itself can actually succeed. This call does nothing - # unless the operator has created and populated $JUJU_CHARM_DIR/exec.d. - execd_preinstall() - # ensure that $JUJU_CHARM_DIR/bin is on the path, for helper scripts - charm_dir = os.environ['JUJU_CHARM_DIR'] - os.environ['PATH'] += ':%s' % os.path.join(charm_dir, 'bin') - venv = os.path.abspath('../.venv') - vbin = os.path.join(venv, 'bin') - vpip = os.path.join(vbin, 'pip') - vpy = os.path.join(vbin, 'python') - hook_name = os.path.basename(sys.argv[0]) - is_bootstrapped = os.path.exists('wheelhouse/.bootstrapped') - is_charm_upgrade = hook_name == 'upgrade-charm' - is_series_upgrade = hook_name == 'post-series-upgrade' - post_upgrade = os.path.exists('wheelhouse/.upgrade') - is_upgrade = not post_upgrade and (is_charm_upgrade or is_series_upgrade) - if is_bootstrapped and not is_upgrade: - # older subordinates might have downgraded charm-env, so we should - # restore it if necessary - install_or_update_charm_env() - activate_venv() - # the .upgrade file prevents us from getting stuck in a loop - # when re-execing to activate the venv; at this point, we've - # activated the venv, so it's safe to clear it - if post_upgrade: - os.unlink('wheelhouse/.upgrade') - return - if is_series_upgrade and os.path.exists(venv): - # series upgrade should do a full clear of the venv, rather than just - # updating it, to bring in updates to Python itself - shutil.rmtree(venv) - if is_upgrade: - if os.path.exists('wheelhouse/.bootstrapped'): - os.unlink('wheelhouse/.bootstrapped') - open('wheelhouse/.upgrade', 'w').close() - # bootstrap wheelhouse - if os.path.exists('wheelhouse'): - with open('/root/.pydistutils.cfg', 'w') as fp: - # make sure that easy_install also only uses the wheelhouse - # (see https://github.com/pypa/pip/issues/410) - fp.writelines([ - "[easy_install]\n", - "allow_hosts = ''\n", - "find_links = file://{}/wheelhouse/\n".format(charm_dir), - ]) - apt_install([ - 'python3-pip', - 'python3-setuptools', - 'python3-yaml', - 'python3-dev', - 'python3-wheel', - 'build-essential', - ]) - from charms.layer import options - cfg = options.get('basic') - # include packages defined in layer.yaml - apt_install(cfg.get('packages', [])) - # if we're using a venv, set it up - if cfg.get('use_venv'): - if not os.path.exists(venv): - series = lsb_release()['DISTRIB_CODENAME'] - if series in ('precise', 'trusty'): - apt_install(['python-virtualenv']) - else: - apt_install(['virtualenv']) - cmd = ['virtualenv', '-ppython3', '--never-download', venv] - if cfg.get('include_system_packages'): - cmd.append('--system-site-packages') - check_call(cmd) - os.environ['PATH'] = ':'.join([vbin, os.environ['PATH']]) - pip = vpip - else: - pip = 'pip3' - # save a copy of system pip to prevent `pip3 install -U pip` - # from changing it - if os.path.exists('/usr/bin/pip'): - shutil.copy2('/usr/bin/pip', '/usr/bin/pip.save') - # need newer pip, to fix spurious Double Requirement error: - # https://github.com/pypa/pip/issues/56 - check_call([pip, 'install', '-U', '--no-index', '-f', 'wheelhouse', - 'pip']) - # per https://github.com/juju-solutions/layer-basic/issues/110 - # this replaces the setuptools that was copied over from the system on - # venv create with latest setuptools and adds setuptools_scm - check_call([pip, 'install', '-U', '--no-index', '-f', 'wheelhouse', - 'setuptools', 'setuptools-scm']) - # install the rest of the wheelhouse deps - check_call([pip, 'install', '-U', '--ignore-installed', '--no-index', - '-f', 'wheelhouse'] + glob('wheelhouse/*')) - # re-enable installation from pypi - os.remove('/root/.pydistutils.cfg') - # install python packages from layer options - if cfg.get('python_packages'): - check_call([pip, 'install', '-U'] + cfg.get('python_packages')) - if not cfg.get('use_venv'): - # restore system pip to prevent `pip3 install -U pip` - # from changing it - if os.path.exists('/usr/bin/pip.save'): - shutil.copy2('/usr/bin/pip.save', '/usr/bin/pip') - os.remove('/usr/bin/pip.save') - # setup wrappers to ensure envs are used for scripts - install_or_update_charm_env() - for wrapper in ('charms.reactive', 'charms.reactive.sh', - 'chlp', 'layer_option'): - src = os.path.join('/usr/local/sbin', 'charm-env') - dst = os.path.join('/usr/local/sbin', wrapper) - if not os.path.exists(dst): - os.symlink(src, dst) - if cfg.get('use_venv'): - shutil.copy2('bin/layer_option', vbin) - else: - shutil.copy2('bin/layer_option', '/usr/local/bin/') - # re-link the charm copy to the wrapper in case charms - # call bin/layer_option directly (as was the old pattern) - os.remove('bin/layer_option') - os.symlink('/usr/local/sbin/layer_option', 'bin/layer_option') - # flag us as having already bootstrapped so we don't do it again - open('wheelhouse/.bootstrapped', 'w').close() - # Ensure that the newly bootstrapped libs are available. - # Note: this only seems to be an issue with namespace packages. - # Non-namespace-package libs (e.g., charmhelpers) are available - # without having to reload the interpreter. :/ - reload_interpreter(vpy if cfg.get('use_venv') else sys.argv[0]) - - -def install_or_update_charm_env(): - # On Trusty python3-pkg-resources is not installed - try: - from pkg_resources import parse_version - except ImportError: - apt_install(['python3-pkg-resources']) - from pkg_resources import parse_version - - try: - installed_version = parse_version( - check_output(['/usr/local/sbin/charm-env', - '--version']).decode('utf8')) - except (CalledProcessError, FileNotFoundError): - installed_version = parse_version('0.0.0') - try: - bundled_version = parse_version( - check_output(['bin/charm-env', - '--version']).decode('utf8')) - except (CalledProcessError, FileNotFoundError): - bundled_version = parse_version('0.0.0') - if installed_version < bundled_version: - shutil.copy2('bin/charm-env', '/usr/local/sbin/') - - -def activate_venv(): - """ - Activate the venv if enabled in ``layer.yaml``. - - This is handled automatically for normal hooks, but actions might - need to invoke this manually, using something like: - - # Load modules from $JUJU_CHARM_DIR/lib - import sys - sys.path.append('lib') - - from charms.layer.basic import activate_venv - activate_venv() - - This will ensure that modules installed in the charm's - virtual environment are available to the action. - """ - from charms.layer import options - venv = os.path.abspath('../.venv') - vbin = os.path.join(venv, 'bin') - vpy = os.path.join(vbin, 'python') - use_venv = options.get('basic', 'use_venv') - if use_venv and '.venv' not in sys.executable: - # activate the venv - os.environ['PATH'] = ':'.join([vbin, os.environ['PATH']]) - reload_interpreter(vpy) - layer.patch_options_interface() - layer.import_layer_libs() - - -def reload_interpreter(python): - """ - Reload the python interpreter to ensure that all deps are available. - - Newly installed modules in namespace packages sometimes seemt to - not be picked up by Python 3. - """ - os.execve(python, [python] + list(sys.argv), os.environ) - - -def apt_install(packages): - """ - Install apt packages. - - This ensures a consistent set of options that are often missed but - should really be set. - """ - if isinstance(packages, (str, bytes)): - packages = [packages] - - env = os.environ.copy() - - if 'DEBIAN_FRONTEND' not in env: - env['DEBIAN_FRONTEND'] = 'noninteractive' - - cmd = ['apt-get', - '--option=Dpkg::Options::=--force-confold', - '--assume-yes', - 'install'] - for attempt in range(3): - try: - check_call(cmd + packages, env=env) - except CalledProcessError: - if attempt == 2: # third attempt - raise - try: - # sometimes apt-get update needs to be run - check_call(['apt-get', 'update']) - except CalledProcessError: - # sometimes it's a dpkg lock issue - pass - sleep(5) - else: - break - - -def init_config_states(): - import yaml - from charmhelpers.core import hookenv - from charms.reactive import set_state - from charms.reactive import toggle_state - config = hookenv.config() - config_defaults = {} - config_defs = {} - config_yaml = os.path.join(hookenv.charm_dir(), 'config.yaml') - if os.path.exists(config_yaml): - with open(config_yaml) as fp: - config_defs = yaml.safe_load(fp).get('options', {}) - config_defaults = {key: value.get('default') - for key, value in config_defs.items()} - for opt in config_defs.keys(): - if config.changed(opt): - set_state('config.changed') - set_state('config.changed.{}'.format(opt)) - toggle_state('config.set.{}'.format(opt), config.get(opt)) - toggle_state('config.default.{}'.format(opt), - config.get(opt) == config_defaults[opt]) - - -def clear_config_states(): - from charmhelpers.core import hookenv, unitdata - from charms.reactive import remove_state - config = hookenv.config() - remove_state('config.changed') - for opt in config.keys(): - remove_state('config.changed.{}'.format(opt)) - remove_state('config.set.{}'.format(opt)) - remove_state('config.default.{}'.format(opt)) - unitdata.kv().flush() diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/lib/charms/layer/execd.py b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/lib/charms/layer/execd.py deleted file mode 100644 index 438d9a1bc90042fd8b20517d5ecf358dfbf08afc..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/lib/charms/layer/execd.py +++ /dev/null @@ -1,114 +0,0 @@ -# Copyright 2014-2016 Canonical Limited. -# -# This file is part of layer-basic, the reactive base layer for Juju. -# -# charm-helpers is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 as -# published by the Free Software Foundation. -# -# charm-helpers is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with charm-helpers. If not, see . - -# This module may only import from the Python standard library. -import os -import sys -import subprocess -import time - -''' -execd/preinstall - -Read the layer-basic docs for more info on how to use this feature. -https://charmsreactive.readthedocs.io/en/latest/layer-basic.html#exec-d-support -''' - - -def default_execd_dir(): - return os.path.join(os.environ['JUJU_CHARM_DIR'], 'exec.d') - - -def execd_module_paths(execd_dir=None): - """Generate a list of full paths to modules within execd_dir.""" - if not execd_dir: - execd_dir = default_execd_dir() - - if not os.path.exists(execd_dir): - return - - for subpath in os.listdir(execd_dir): - module = os.path.join(execd_dir, subpath) - if os.path.isdir(module): - yield module - - -def execd_submodule_paths(command, execd_dir=None): - """Generate a list of full paths to the specified command within exec_dir. - """ - for module_path in execd_module_paths(execd_dir): - path = os.path.join(module_path, command) - if os.access(path, os.X_OK) and os.path.isfile(path): - yield path - - -def execd_sentinel_path(submodule_path): - module_path = os.path.dirname(submodule_path) - execd_path = os.path.dirname(module_path) - module_name = os.path.basename(module_path) - submodule_name = os.path.basename(submodule_path) - return os.path.join(execd_path, - '.{}_{}.done'.format(module_name, submodule_name)) - - -def execd_run(command, execd_dir=None, stop_on_error=True, stderr=None): - """Run command for each module within execd_dir which defines it.""" - if stderr is None: - stderr = sys.stdout - for submodule_path in execd_submodule_paths(command, execd_dir): - # Only run each execd once. We cannot simply run them in the - # install hook, as potentially storage hooks are run before that. - # We cannot rely on them being idempotent. - sentinel = execd_sentinel_path(submodule_path) - if os.path.exists(sentinel): - continue - - try: - subprocess.check_call([submodule_path], stderr=stderr, - universal_newlines=True) - with open(sentinel, 'w') as f: - f.write('{} ran successfully {}\n'.format(submodule_path, - time.ctime())) - f.write('Removing this file will cause it to be run again\n') - except subprocess.CalledProcessError as e: - # Logs get the details. We can't use juju-log, as the - # output may be substantial and exceed command line - # length limits. - print("ERROR ({}) running {}".format(e.returncode, e.cmd), - file=stderr) - print("STDOUT< 0: - raise CalledProcessError(returncode=retcode, - cmd=cmd, - output=stderr.decode("utf-8").strip()) - return (stdout.decode('utf-8').strip(), stderr.decode('utf-8').strip()) - - -def _run(cmd, env=None): - """Run a command remotely via SSH. - - Note: The previous behavior was to run the command locally if SSH wasn't - configured, but that can lead to cases where execution succeeds when you'd - expect it not to. - """ - if isinstance(cmd, str): - cmd = shlex.split(cmd) - - if type(cmd) is not list: - cmd = [cmd] - - cfg = get_config() - - if cfg: - if all(k in cfg for k in ['ssh-hostname', 'ssh-username', - 'ssh-password', 'ssh-private-key']): - host = get_host_ip() - user = cfg['ssh-username'] - passwd = cfg['ssh-password'] - key = cfg['ssh-private-key'] # DEPRECATED - - if host and user: - return ssh(cmd, host, user, passwd, key) - - raise Exception("Invalid SSH credentials.") - - -def get_ssh_client(host, user, password=None, key=None): - """Return a connected Paramiko ssh object.""" - client = paramiko.SSHClient() - client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) - - pkey = None - - # Check for the DEPRECATED private-key - if key: - f = io.StringIO(key) - pkey = paramiko.RSAKey.from_private_key(f) - else: - # Otherwise, check for the auto-generated private key - if os.path.exists('/root/.ssh/id_juju_sshproxy'): - with open('/root/.ssh/id_juju_sshproxy', 'r') as f: - pkey = paramiko.RSAKey.from_private_key(f) - - ########################################################################### - # There is a bug in some versions of OpenSSH 4.3 (CentOS/RHEL 5) where # - # the server may not send the SSH_MSG_USERAUTH_BANNER message except when # - # responding to an auth_none request. For example, paramiko will attempt # - # to use password authentication when a password is set, but the server # - # could deny that, instead requesting keyboard-interactive. The hack to # - # workaround this is to attempt a reconnect, which will receive the right # - # banner, and authentication can proceed. See the following for more info # - # https://github.com/paramiko/paramiko/issues/432 # - # https://github.com/paramiko/paramiko/pull/438 # - ########################################################################### - - try: - client.connect(host, port=22, username=user, - password=password, pkey=pkey) - except paramiko.ssh_exception.SSHException as e: - if 'Error reading SSH protocol banner' == str(e): - # Once more, with feeling - client.connect(host, port=22, username=user, - password=password, pkey=pkey) - else: - # Reraise the original exception - raise e - - return client - - -def sftp(local_file, remote_file, host, user, password=None, key=None): - """Copy a local file to a remote host.""" - client = get_ssh_client(host, user, password, key) - - # Create an sftp connection from the underlying transport - sftp = paramiko.SFTPClient.from_transport(client.get_transport()) - sftp.put(local_file, remote_file) - client.close() - - -def ssh(cmd, host, user, password=None, key=None): - """Run an arbitrary command over SSH.""" - client = get_ssh_client(host, user, password, key) - - cmds = ' '.join(cmd) - stdin, stdout, stderr = client.exec_command(cmds, get_pty=True) - retcode = stdout.channel.recv_exit_status() - client.close() # @TODO re-use connections - if retcode > 0: - output = stderr.read().strip() - raise CalledProcessError(returncode=retcode, cmd=cmd, - output=output) - return ( - stdout.read().decode('utf-8').strip(), - stderr.read().decode('utf-8').strip() - ) diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/metadata.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/metadata.yaml deleted file mode 100644 index 0cf5f92325934593b7b310a46cee3eee55da04d5..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/metadata.yaml +++ /dev/null @@ -1,25 +0,0 @@ -"name": "tid-jujuk8s" -"summary": "A charm for k8s_jujucontroller_vnf to deploy a K8s cluster" -"maintainers": -- "garciadeblas " -- "garomero " -"description": | - A charm to manage k8s_jujucontroller_vnf in order to deploy a k8s cluster. - It assumes that juju is already installed via cloud-init, with a manual cloud - and a bootstrapped controller. - It has an action "create-cluster" that receives the IP addresses of the 4 machines - belonging to the cluster and does the following: - - Copy ssh key of the juju controller to the machines - - Add the machines to juju - - Deploys the k8s bundle in the machines. -"tags": - # Replace "misc" with one or more whitelisted tags from this list: - # https://jujucharms.com/docs/stable/authors-charm-metadata -- "misc" -- "osm" -- "vnf" -"series": -- "bionic" -- "xenial" -- "trusty" -"subordinate": !!bool "false" diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/reactive/__init__.py b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/reactive/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/reactive/sshproxy.py b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/reactive/sshproxy.py deleted file mode 100644 index 5ef0f56f09612a9a775a1bc3037685cc1f27755e..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/reactive/sshproxy.py +++ /dev/null @@ -1,210 +0,0 @@ -## -# Copyright 2016 Canonical Ltd. -# All rights reserved. -# -# 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. -## - -from charmhelpers.core import unitdata -from charmhelpers.core.hookenv import ( - action_fail, - action_get, - action_set, - config, - log, - status_set, - DEBUG, -) - -from charms.reactive.flags import register_trigger - -from charms.reactive import ( - clear_flag, - set_flag, - when, - when_not, - when_any, -) -import charms.sshproxy -import os -import subprocess - -# Register a trigger so that we can respond to config.changed, even if -# it's being cleared by another handler -register_trigger(when='config.changed', - set_flag='sshproxy.reconfigure') - - -# @when_any('config.changed', 'sshproxy.reconfigure') -@when_any('config.set.ssh-hostname', 'config.set.ssh-username', 'config.set.ssh-password', 'sshproxy.reconfigure') -def ssh_configured(): - """Check if charm is properly configured. - - Check to see if the charm is configured with SSH credentials. If so, - set a state flag that can be used to execute ssh-only actions. - - For example: - - @when('sshproxy.configured') - def run_remote_command(cmd): - ... - - @when_not('sshproxy.configured') - def run_local_command(cmd): - ... - """ - log("Checking sshproxy configuration", DEBUG) - cfg = config() - ssh_keys = ['ssh-hostname', 'ssh-username', - 'ssh-password', 'ssh-private-key'] - - if all(k in cfg for k in ssh_keys): - - # Store config in unitdata so it's accessible to sshproxy - db = unitdata.kv() - db.set('config', cfg) - - # Explicitly flush the kv so it's immediately available - db.flush() - - log("Verifying ssh credentials...", DEBUG) - (verified, output) = charms.sshproxy.verify_ssh_credentials() - if verified: - log("SSH credentials verified.", DEBUG) - set_flag('sshproxy.configured') - status_set('active', 'Ready!') - else: - clear_flag('sshproxy.configured') - status_set('blocked', "Remote machine not ready yet: {}".format(output)) - else: - log("No ssh credentials configured", DEBUG) - clear_flag('sshproxy.configured') - status_set('blocked', 'Invalid SSH credentials.') - - -def generate_ssh_key(): - """Generate a new 4096-bit rsa keypair. - - If there is an existing keypair for this unit, it will be overwritten. - """ - cfg = config() - if all(k in cfg for k in ['ssh-key-type', 'ssh-key-bits']): - keytype = cfg['ssh-key-type'] - bits = str(cfg['ssh-key-bits']) - privatekey = '/root/.ssh/id_juju_sshproxy' - publickey = "{}.pub".format(privatekey) - - if os.path.exists(privatekey): - os.remove(privatekey) - if os.path.exists(publickey): - os.remove(publickey) - - cmd = "ssh-keygen -t {} -b {} -N '' -f {}".format( - keytype, - bits, - privatekey - ) - - output, err = charms.sshproxy.run_local([cmd]) - if len(err) == 0: - return True - return False - - -@when('actions.generate-ssh-key') -def action_generate_ssh_key(): - """Generate a new 4096-bit rsa keypair. - - If there is an existing keypair for this unit, it will be overwritten. - """ - try: - if not generate_ssh_key(): - action_fail('Unable to generate ssh key.') - except subprocess.CalledProcessError as e: - action_fail('Command failed: %s (%s)' % - (' '.join(e.cmd), str(e.output))) - finally: - clear_flag('actions.generate-ssh-key') - - -def get_ssh_public_key(): - """Get the public SSH key of this unit.""" - publickey_path = '/root/.ssh/id_juju_sshproxy.pub' - publickey = None - if os.path.exists(publickey_path): - with open(publickey_path, 'r') as f: - publickey = f.read() - - return publickey - - -@when('actions.get-ssh-public-key') -def action_get_ssh_public_key(): - """Get the public SSH key of this unit.""" - try: - action_set({'pubkey': get_ssh_public_key()}) - except subprocess.CalledProcessError as e: - action_fail('Command failed: %s (%s)' % - (' '.join(e.cmd), str(e.output))) - finally: - clear_flag('actions.get-ssh-public-key') - - -@when('actions.verify-ssh-credentials') -def action_verify_ssh_credentials(): - """Verify the ssh credentials have been installed to the VNF. - - Attempts to run a stock command - `hostname` on the remote host. - """ - try: - (verified, output) = charms.sshproxy.verify_ssh_credentials() - action_set({ - 'output': output, - 'verified': verified, - }) - if not verified: - action_fail("Verification failed: {}".format( - output, - )) - finally: - clear_flag('actions.verify-ssh-credentials') - - -@when('actions.run') -def run_command(): - """Run an arbitrary command. - - Run an arbitrary command, either locally or over SSH with the configured - credentials. - """ - try: - cmd = action_get('command') - output, err = charms.sshproxy._run(cmd) - if len(err): - action_fail("Command '{}' returned error code {}".format(cmd, err)) - else: - action_set({'output': output}) - except subprocess.CalledProcessError as e: - action_fail('Command failed: %s (%s)' % - (' '.join(e.cmd), str(e.output))) - finally: - clear_flag('actions.run') - - -@when_not('sshproxy.installed') -def install_vnf_ubuntu_proxy(): - """Install and Configure SSH Proxy.""" - - log("Generating SSH key...", DEBUG) - generate_ssh_key() - set_flag('sshproxy.installed') diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/reactive/tid-jujuk8s.py b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/reactive/tid-jujuk8s.py deleted file mode 100644 index 21259cc999b8d7dc2c74ec5d8975f84830da6c13..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/reactive/tid-jujuk8s.py +++ /dev/null @@ -1,699 +0,0 @@ -from charmhelpers.core.hookenv import ( - action_get, - action_fail, - action_set, - status_set, - log, -) -from charms.reactive import ( - clear_flag, - set_flag, - when, - when_not, -) - -import charms.sshproxy -import sys, traceback -from jinja2 import Environment, FileSystemLoader -import time -import yaml - -class TidJujuK8sException(Exception): - pass - -@when_not('tid-jujuk8s.installed') -def install_tid_jujuk8s(): - set_flag('tid-jujuk8s.installed') - -@when('actions.setup-juju') -def setup_juju(): - err = '' - try: - cmd = "ip -4 -o a s ens3 | awk \\'{split($4,a,\\\"/\\\"); print a[1]}\\'" - log("setup-juju: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - mgmt_ip=result - - env = Environment(loader=FileSystemLoader('.')) - template = env.get_template('scripts/k8s-cloud-template.yaml') - output_from_parsed_template = template.render (controller_mgmt_ip_address = mgmt_ip) - temp_file="k8s-cloud.yaml" - with open(temp_file, "w") as fh: - fh.write(output_from_parsed_template) - fh.close() - - cfg = charms.sshproxy.get_config() - host = charms.sshproxy.get_host_ip() - user = cfg['ssh-username'] - charms.sshproxy.sftp('scripts/setup-juju.sh', '/home/ubuntu/setup-juju.sh', host, user) - charms.sshproxy.sftp('k8s-cloud.yaml', '/home/ubuntu/k8s-cloud.yaml', host, user) - - cmd = "chmod +x /home/ubuntu/setup-juju.sh; /home/ubuntu/setup-juju.sh > /dev/null && echo 'OK'" - log("setup-juju: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("setup-juju: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.setup-juju') - -@when('actions.add-machine') -def add_machines(): - err = '' - try: - machine = action_get('machine') - - cfg = charms.sshproxy.get_config() - host = charms.sshproxy.get_host_ip() - user = cfg['ssh-username'] - charms.sshproxy.sftp('scripts/add-machine.sh', '/home/ubuntu/add-machine.sh', host, user) - - cmd = "chmod +x /home/ubuntu/add-machine.sh" - log("add-machine: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - - cmd = "/home/ubuntu/add-machine.sh {} > /dev/null && echo 'OK'".format(machine) - log("add-machine: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("add-machine: added {}".format(machine)) - log("add-machine: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.add-machine') - -@when('actions.add-machines') -def add_machines(): - err = '' - try: - machines = [] - machines.append(action_get('machine1')) - machines.append(action_get('machine2')) - machines.append(action_get('machine3')) - machines.append(action_get('machine4')) - machines.append(action_get('machine5')) - machines.append(action_get('machine6')) - machines.append(action_get('machine7')) - machines.append(action_get('machine8')) - machines.append(action_get('machine9')) - machines.append(action_get('machine10')) - - cfg = charms.sshproxy.get_config() - host = charms.sshproxy.get_host_ip() - user = cfg['ssh-username'] - charms.sshproxy.sftp('scripts/add-machine.sh', '/home/ubuntu/add-machine.sh', host, user) - - cmd = "chmod +x /home/ubuntu/add-machine.sh" - log("add-machines: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - - number_of_machines = 0 - for m in machines: - if not m: - continue - cmd = "/home/ubuntu/add-machine.sh {} > /dev/null && echo 'OK'".format(m) - log("add-machines: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("add-machines: added {}".format(m)) - number_of_machines += 1 - log("add-machines: Checking whether all machines are ready") - timeout = 0 - while timeout <= 600: - try: - started = 0 - cmd = "/snap/bin/juju machines --format yaml" - log("add-machines: getting machines: " + cmd) - result, err = charms.sshproxy._run(cmd) - juju_machines = yaml.safe_load(result) - for k,v in juju_machines['machines'].items(): - if v.get('juju-status').get('current') == "started": - started += 1 - if started >= number_of_machines: - log("add-machines: {}/{} machines are ready".format(started,number_of_machines)) - break - log("add-machines: {}/{} machines are ready".format(started,number_of_machines)) - except: - log("Error. Command Failed." + str(err)) - time.sleep(20) - timeout += 20 - else: - log("add-machines: Machines are not ready after {} seconds.".format(timeout)) - raise TidJujuK8sException("Timeout when adding machines") - log("add-machines: DONE") - except TidJujuK8sException as toexception: - log("add-machines: TidJujuK8sException:" + str(toexception)) - action_fail('Timeout reached for adding machines:' + str(toexception)) - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.add-machines') - -@when('actions.deploy-bundle') -def deploy_bundle(): - err = '' - try: - cmd = "/snap/bin/juju machines --format yaml" - log("deploy-bundle: getting machines: " + cmd) - result, err = charms.sshproxy._run(cmd) - juju_machines = yaml.safe_load(result) - n_machines = len(juju_machines['machines']) - - bundle = action_get('bundle') - bundle_dict = {} - if bundle: - try: - bundle_dict = yaml.safe_load(bundle) - except yaml.YAMLError as exc: - raise TidJujuK8sException("Error loading the provided bundle " + bundle + ": " + str(exc)) - else: - with open("scripts/bundle-empty.yaml", 'r') as stream: - try: - bundle_dict = yaml.safe_load(stream) - except yaml.YAMLError as exc: - raise TidJujuK8sException("Error loading the default bundle bundle-empty.yaml: " + str(exc)) - if n_machines < 4: - raise TidJujuK8sException("Not possible to deploy a bundle when number of machines is lower than 4") - else: - n_etcd = 3 - n_masters = 2 - n_workers = n_machines - 1 - bundle_dict["machines"]={} - #bundle_dict["machines"].extend(map(str,range(n_machines))) - for i in range(n_machines): - bundle_dict["machines"][str(i)] = {} - bundle_dict["services"]["easyrsa"]["num_units"]=1 - bundle_dict["services"]["easyrsa"]["to"]=[] - bundle_dict["services"]["easyrsa"]["to"].append("0") - bundle_dict["services"]["kubeapi-load-balancer"]["num_units"]=1 - bundle_dict["services"]["kubeapi-load-balancer"]["to"]=[] - bundle_dict["services"]["kubeapi-load-balancer"]["to"].append("0") - bundle_dict["services"]["etcd"]["num_units"]=n_etcd - bundle_dict["services"]["etcd"]["to"]=[] - bundle_dict["services"]["etcd"]["to"].extend(map(str,range(0,n_etcd))) - bundle_dict["services"]["kubernetes-master"]["num_units"]=n_masters - bundle_dict["services"]["kubernetes-master"]["to"]=[] - bundle_dict["services"]["kubernetes-master"]["to"].extend(map(str,range(0,n_masters))) - bundle_dict["services"]["kubernetes-worker"]["num_units"]=n_workers - bundle_dict["services"]["kubernetes-worker"]["to"]=[] - bundle_dict["services"]["kubernetes-worker"]["to"].extend(map(str,range(1,n_workers+1))) - - with open("scripts/bundle.yaml", 'w') as stream: - try: - yaml.safe_dump(bundle_dict, stream) - except yaml.YAMLError as exc: - raise TidJujuK8sException("Error while dumping bundle_dict to bundle.yaml: " + str(exc)) - - cfg = charms.sshproxy.get_config() - host = charms.sshproxy.get_host_ip() - user = cfg['ssh-username'] - charms.sshproxy.sftp('scripts/bundle.yaml', '/home/ubuntu/bundle.yaml', host, user) - - existing_machines = [] - map_machines = "" - bundle_machine = 0 - for k in sorted(juju_machines['machines'].keys()): - map_machines = "{}{}={}".format(map_machines, bundle_machine, k) - bundle_machine += 1 - if bundle_machine < n_machines: - map_machines += "," - log("deploy-bundle: map_machines: " + map_machines) - - cmd = "/snap/bin/juju deploy ./bundle.yaml --map-machines=existing,{}".format(map_machines) - log("deploy-bundle: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("deploy-bundle: Checking whether all applications in the bundle are active") - timeout = 0 - while timeout <= 12000: - try: - cmd = "/snap/bin/juju status --format yaml" - log("deploy-bundle: getting status: " + cmd) - result, err = charms.sshproxy._run(cmd) - juju_status = yaml.safe_load(result) - for k,v in juju_status['applications'].items(): - if v.get('application-status').get('current') != 'active': - log('deploy-bundle: Application {} not active'.format(k)) - break - else: - log('deploy-bundle: All applications are active') - break - except: - log("Error. Command Failed." + str(err)) - time.sleep(20) - timeout += 20 - else: - log("deploy-bundle: Applications in the bundle are not ready after {} seconds.".format(timeout)) - raise TidJujuK8sException("Timeout when deploying bundle") - log("deploy-bundle: DONE") - except TidJujuK8sException as toexception: - log("deploy-bundle: TidJujuK8sException:" + str(toexception)) - action_fail('Timeout reached for deploying the bundle:' + str(toexception)) - log("deploy-bundle: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.deploy-bundle') - -@when('actions.undeploy-bundle') -def undeploy_bundle(): - ''' TODO: Not yet properly working - ''' - err = '' - try: - cmd = "/snap/bin/juju machines --format yaml" - log("undeploy-bundle: getting machines: " + cmd) - result, err = charms.sshproxy._run(cmd) - juju_machines = yaml.safe_load(result) - - n_machines = len(juju_machines['machines']) - cmd = "chmod +x /home/ubuntu/undeploy-bundle.sh; /home/ubuntu/undeploy-bundle.sh > /dev/null && echo 'OK'" - log("undeploy-bundle: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("undeploy-bundle: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.undeploy-bundle') - -@when('actions.remove-machines') -def remove_machines(): - ''' TODO: Not yet properly working - ''' - err = '' - try: - force = action_get('force') - - cmd = "/snap/bin/juju machines --format yaml" - log("remove-machines: getting machines: " + cmd) - result, err = charms.sshproxy._run(cmd) - juju_machines = yaml.safe_load(result) - number_of_machines = len(juju_machines['machines']) - - #cfg = charms.sshproxy.get_config() - #host = charms.sshproxy.get_host_ip() - #user = cfg['ssh-username'] - #charms.sshproxy.sftp('scripts/remove-machine.sh', '/home/ubuntu/remove-machine.sh', host, user) - - for m in juju_machines['machines']: - #cmd = "chmod +x /home/ubuntu/remove-machine.sh; /home/ubuntu/remove-machine.sh > /dev/null && echo 'OK'" - cmd = "/snap/bin/juju remove-machine {}".format(m) - if force: - cmd += " --force" - cmd += " > /dev/null && echo 'OK'" - log("remove-machine: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("remove-machines: Checking whether all machines were removed") - timeout = 0 - while timeout <= 600: - try: - started = 0 - cmd = "/snap/bin/juju machines --format yaml" - log("remove-machines: getting machines: " + cmd) - result, err = charms.sshproxy._run(cmd) - if result: - juju_machines = yaml.safe_load(result) - n_machines = len(juju_machines['machines']) - log("remove-machines: {}/{} machines are active".format(n_machines,number_of_machines)) - if n_machines == 0: - log("remove-machines: no machines".format(n_machines,number_of_machines)) - break - else: - log("remove-machines: no machines".format(n_machines,number_of_machines)) - break - except: - log("Error. Command Failed." + str(err)) - time.sleep(20) - timeout += 20 - else: - log("remove-machines: Machines were not removed after {} seconds.".format(timeout)) - raise TidJujuK8sException("Timeout when adding machines") - log("remove-machines: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.remove-machines') - -@when('actions.post-deploy') -def post_deploy(): - err = '' - try: - cfg = charms.sshproxy.get_config() - host = charms.sshproxy.get_host_ip() - user = cfg['ssh-username'] - charms.sshproxy.sftp('scripts/post-deploy.sh', '/home/ubuntu/post-deploy.sh', host, user) - - cmd = "chmod +x /home/ubuntu/post-deploy.sh; /home/ubuntu/post-deploy.sh > /dev/null && echo 'OK'" - log("post-deploy: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("post-deploy: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.post-deploy') - -@when('actions.init-helm') -def init_helm(): - err = '' - try: - cfg = charms.sshproxy.get_config() - host = charms.sshproxy.get_host_ip() - user = cfg['ssh-username'] - charms.sshproxy.sftp('scripts/init-helm.sh', '/home/ubuntu/init-helm.sh', host, user) - - cmd = "chmod +x /home/ubuntu/init-helm.sh; /home/ubuntu/init-helm.sh > /dev/null && echo 'OK'" - log("init-helm: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("init-helm: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.init-helm') - -@when('actions.install-openebs-chart') -def install_openebs_chart(): - err = '' - try: - cfg = charms.sshproxy.get_config() - host = charms.sshproxy.get_host_ip() - user = cfg['ssh-username'] - charms.sshproxy.sftp('scripts/openebs-storage-class.yaml', '/home/ubuntu/openebs-storage-class.yaml', host, user) - - cfg = charms.sshproxy.get_config() - host = charms.sshproxy.get_host_ip() - user = cfg['ssh-username'] - charms.sshproxy.sftp('scripts/install-openebs-chart.sh', '/home/ubuntu/install-openebs-chart.sh', host, user) - - cmd = "chmod +x /home/ubuntu/install-openebs-chart.sh; /home/ubuntu/install-openebs-chart.sh > /dev/null && echo 'OK'" - log("install-openebs-chart: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("install-openebs-chart: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.install-openebs-chart') - -@when('actions.install-openebs-kubectl') -def install_openebs_kubectl(): - err = '' - try: - cfg = charms.sshproxy.get_config() - host = charms.sshproxy.get_host_ip() - user = cfg['ssh-username'] - charms.sshproxy.sftp('scripts/openebs-storage-class.yaml', '/home/ubuntu/openebs-storage-class.yaml', host, user) - - cfg = charms.sshproxy.get_config() - host = charms.sshproxy.get_host_ip() - user = cfg['ssh-username'] - charms.sshproxy.sftp('scripts/install-openebs-kubectl.sh', '/home/ubuntu/install-openebs-kubectl.sh', host, user) - - cmd = "chmod +x /home/ubuntu/install-openebs-kubectl.sh; /home/ubuntu/install-openebs-kubectl.sh > /dev/null && echo 'OK'" - log("install-openebs-kubectl: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("install-openebs-kubectl: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.install-openebs-kubectl') - -@when('actions.install-chart') -def install_chart(): - err = '' - try: - chart = action_get('chart') - name = action_get('name') - namespace = action_get('namespace') - atomic = action_get('atomic') - values = action_get('values') - valuesFile = action_get('valuesFile') - - #cfg = charms.sshproxy.get_config() - #host = charms.sshproxy.get_host_ip() - #user = cfg['ssh-username'] - #charms.sshproxy.sftp('scripts/install-chart.sh', '/home/ubuntu/install-chart.sh', host, user) - - #cmd = "chmod +x /home/ubuntu/install-chart.sh; /home/ubuntu/install-chart.sh > /dev/null && echo 'OK'" - cmd = "/snap/bin/helm install {} -n {}".format(chart, name) - if namespace: - cmd += " --namespace {}".format(namespace) - if atomic: - cmd += " --atomic" - values_dict = {} - if values: - try: - values_dict = yaml.safe_load(stream) - except yaml.YAMLError as exc: - raise TidJujuK8sException("Error in values: " + str(exc)) - with open("myvalues.yaml", 'w') as stream: - try: - yaml.safe_dump(values_dict, stream) - except yaml.YAMLError as exc: - raise TidJujuK8sException("Error while dumping values_dict to myvalues.yaml: " + str(exc)) - valuesFile = "myvalues.yaml" - if valuesFile: - cfg = charms.sshproxy.get_config() - host = charms.sshproxy.get_host_ip() - user = cfg['ssh-username'] - charms.sshproxy.sftp(valuesFile, '/home/ubuntu/myvalues.yaml', host, user) - cmd += " -f /home/ubuntu/myvalues.yaml" - - log("install-chart: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("install-chart: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.install-chart') - -@when('actions.upgrade-release') -def upgrade_release(): - err = '' - try: - chart = action_get('chart') - name = action_get('name') - namespace = action_get('namespace') - atomic = action_get('atomic') - values = action_get('values') - valuesFile = action_get('valuesFile') - - #cfg = charms.sshproxy.get_config() - #host = charms.sshproxy.get_host_ip() - #user = cfg['ssh-username'] - #charms.sshproxy.sftp('scripts/upgrade-release.sh', '/home/ubuntu/upgrade-release.sh', host, user) - - #cmd = "chmod +x /home/ubuntu/upgrade-release.sh; /home/ubuntu/upgrade-release.sh > /dev/null && echo 'OK'" - cmd = "/snap/bin/helm upgrade {} {}".format(name, chart) - if namespace: - cmd += " --namespace {}".format(namespace) - if atomic: - cmd += " --atomic" - values_dict = {} - if values: - try: - values_dict = yaml.safe_load(stream) - except yaml.YAMLError as exc: - raise TidJujuK8sException("Error in values: " + str(exc)) - with open("myvalues.yaml", 'w') as stream: - try: - yaml.safe_dump(values_dict, stream) - except yaml.YAMLError as exc: - raise TidJujuK8sException("Error while dumping values_dict to myvalues.yaml: " + str(exc)) - valuesFile = "myvalues.yaml" - if valuesFile: - cfg = charms.sshproxy.get_config() - host = charms.sshproxy.get_host_ip() - user = cfg['ssh-username'] - charms.sshproxy.sftp(valuesFile, '/home/ubuntu/myvalues.yaml', host, user) - cmd += " -f /home/ubuntu/myvalues.yaml" - - log("upgrade-release: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("upgrade-release: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.upgrade-release') - -@when('actions.rollback-release') -def rollback_release(): - err = '' - try: - name = action_get('name') - revision = action_get('revision') - - #cfg = charms.sshproxy.get_config() - #host = charms.sshproxy.get_host_ip() - #user = cfg['ssh-username'] - #charms.sshproxy.sftp('scripts/rollback-release.sh', '/home/ubuntu/rollback-release.sh', host, user) - - #cmd = "chmod +x /home/ubuntu/rollback-release.sh; /home/ubuntu/rollback-release.sh > /dev/null && echo 'OK'" - cmd = "/snap/bin/helm rollback {}".format(name) - if revision: - cmd += " {}".format(revision) - log("rollback-release: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("rollback-release: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.rollback-release') - -@when('actions.delete-release') -def delete_release(): - err = '' - try: - name = action_get('name') - - #cfg = charms.sshproxy.get_config() - #host = charms.sshproxy.get_host_ip() - #user = cfg['ssh-username'] - #charms.sshproxy.sftp('scripts/delete-release.sh', '/home/ubuntu/delete-release.sh', host, user) - - #cmd = "chmod +x /home/ubuntu/delete-release.sh; /home/ubuntu/delete-release.sh > /dev/null && echo 'OK'" - cmd = "/snap/bin/helm delete --purge {}".format(name) - log("delete-release: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("delete-release: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.delete-release') - -@when('actions.add-repo') -def add_repo(): - err = '' - try: - name = action_get('name') - url = action_get('url') - - #cfg = charms.sshproxy.get_config() - #host = charms.sshproxy.get_host_ip() - #user = cfg['ssh-username'] - #charms.sshproxy.sftp('scripts/add-repo.sh', '/home/ubuntu/add-repo.sh', host, user) - - #cmd = "chmod +x /home/ubuntu/add-repo.sh; /home/ubuntu/add-repo.sh > /dev/null && echo 'OK'" - cmd = "/snap/bin/helm repo add {} {} > /dev/null && /snap/bin/helm repo update > /dev/null && echo 'OK'".format(name,url) - log("add-repo: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("add-repo: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.add-repo') - -@when('actions.remove-repo') -def remove_repo(): - err = '' - try: - name = action_get('name') - - #cfg = charms.sshproxy.get_config() - #host = charms.sshproxy.get_host_ip() - #user = cfg['ssh-username'] - #charms.sshproxy.sftp('scripts/remove-repo.sh', '/home/ubuntu/remove-repo.sh', host, user) - - #cmd = "chmod +x /home/ubuntu/remove-repo.sh; /home/ubuntu/remove-repo.sh > /dev/null && echo 'OK'" - cmd = "/snap/bin/helm repo remove {} > /dev/null && /snap/bin/helm repo update > /dev/null && echo 'OK'".format(name) - log("remove-repo: command to execute: " + cmd) - result, err = charms.sshproxy._run(cmd) - log("remove-repo: DONE") - except: - log("Error. Command Failed.") - action_fail('command failed:' + err) - exc_type, exc_value, exc_traceback = sys.exc_info() - err = traceback.format_exception(exc_type, exc_value, exc_traceback) - log(str(err)) - else: - action_set({'output': result}) - finally: - clear_flag('actions.remove-repo') - - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/reactive/vnfproxy.py b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/reactive/vnfproxy.py deleted file mode 100644 index 6616991df245a920116b9301b52602f15ba7a9bc..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/reactive/vnfproxy.py +++ /dev/null @@ -1,89 +0,0 @@ -from charmhelpers.core.hookenv import ( - action_fail, - action_set, -) - -from charms.reactive import ( - when, - clear_flag, -) -import charms.sshproxy - - -@when('actions.reboot') -def reboot(): - err = '' - try: - result, err = charms.sshproxy._run("reboot") - except: - action_fail('command failed:' + err) - else: - action_set({'outout': result}) - finally: - clear_flag('actions.reboot') - - -############################################################################### -# Below is an example implementation of the start/stop/restart actions. # -# To use this, copy the below code into your layer and add the appropriate # -# command(s) necessary to perform the action. # -############################################################################### - -# @when('actions.start') -# def start(): -# err = '' -# try: -# cmd = "service myname start" -# result, err = charms.sshproxy._run(cmd) -# except: -# action_fail('command failed:' + err) -# else: -# action_set({'outout': result}) -# finally: -# clear_flag('actions.start') -# -# -# @when('actions.stop') -# def stop(): -# err = '' -# try: -# # Enter the command to stop your service(s) -# cmd = "service myname stop" -# result, err = charms.sshproxy._run(cmd) -# except: -# action_fail('command failed:' + err) -# else: -# action_set({'outout': result}) -# finally: -# clear_flag('actions.stop') -# -# -# @when('actions.restart') -# def restart(): -# err = '' -# try: -# # Enter the command to restart your service(s) -# cmd = "service myname restart" -# result, err = charms.sshproxy._run(cmd) -# except: -# action_fail('command failed:' + err) -# else: -# action_set({'outout': result}) -# finally: -# clear_flag('actions.restart') -# -# -# @when('actions.upgrade') -# def upgrade_vnf(): -# err = '' -# try: -# # Add the command(s) to perform a VNF software upgrade -# cmd = '' -# result, err = charms.sshproxy._run(cmd) -# except: -# action_fail('command failed:' + err) -# else: -# action_set({'outout': result}) -# finally: -# clear_flag('actions.upgrade') -# diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/requirements.txt b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/requirements.txt deleted file mode 100644 index 28ecacab6029381bd43d65f8dcfc0cc704870f71..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -flake8 -pytest diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/add-machine.sh b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/add-machine.sh deleted file mode 100755 index 4db9d6c9bc2df6e38d8a7f6f79937629b0444432..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/add-machine.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -sshpass -posm4u ssh-copy-id -o "StrictHostKeyChecking no" -i /home/ubuntu/.local/share/juju/ssh/juju_id_rsa ubuntu@$1 -sudo su -l ubuntu -c "nohup /snap/bin/juju add-machine ssh:ubuntu@"$1" > /dev/null 2>&1 &" - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/add-repo.sh b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/add-repo.sh deleted file mode 100755 index bfeb8565f335752a208c4cf8605cf0ee8aed4120..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/add-repo.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -REPO_NAME=$1 -REPO_URL=$2 -helm repo add ${REPO_NAME} ${REPO_URL} -helm repo update - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/bundle-4machines.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/bundle-4machines.yaml deleted file mode 100644 index 9bb42cd9c9cf5f16189a6c4d8d6c27d1ee5c54d5..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/bundle-4machines.yaml +++ /dev/null @@ -1,134 +0,0 @@ -description: A highly-available, production-grade Kubernetes cluster. -series: bionic -machines: - "0": - "1": - "2": - "3": -services: - containerd: - annotations: - gui-x: '475' - gui-y: '800' - charm: cs:~containers/containerd-20 - resources: {} - easyrsa: - annotations: - gui-x: '90' - gui-y: '420' - charm: cs:~containers/easyrsa-270 - constraints: root-disk=8G - num_units: 1 - resources: - easyrsa: 5 - to: - - "0" - etcd: - annotations: - gui-x: '800' - gui-y: '420' - charm: cs:~containers/etcd-449 - constraints: root-disk=8G - num_units: 3 - options: - channel: 3.2/stable - resources: - core: 0 - etcd: 3 - snapshot: 0 - to: - - "1" - - "2" - - "3" - flannel: - annotations: - gui-x: '475' - gui-y: '605' - charm: cs:~containers/flannel-438 - resources: - flannel-amd64: 394 - flannel-arm64: 390 - flannel-s390x: 377 - kubeapi-load-balancer: - annotations: - gui-x: '450' - gui-y: '250' - charm: cs:~containers/kubeapi-load-balancer-664 - constraints: root-disk=8G - expose: true - num_units: 1 - resources: {} - to: - - "0" - kubernetes-master: - annotations: - gui-x: '800' - gui-y: '850' - charm: cs:~containers/kubernetes-master-724 - constraints: cores=2 mem=4G root-disk=16G - num_units: 2 - options: - channel: 1.15/stable - resources: - cdk-addons: 0 - core: 0 - kube-apiserver: 0 - kube-controller-manager: 0 - kube-proxy: 0 - kube-scheduler: 0 - kubectl: 0 - to: - - "1" - - "2" - kubernetes-worker: - annotations: - gui-x: '90' - gui-y: '850' - charm: cs:~containers/kubernetes-worker-571 - constraints: cores=4 mem=4G root-disk=16G - expose: true - num_units: 3 - options: - channel: 1.15/stable - resources: - cni-amd64: 392 - cni-arm64: 383 - cni-s390x: 395 - core: 0 - kube-proxy: 0 - kubectl: 0 - kubelet: 0 - to: - - "1" - - "2" - - "3" -relations: -- - kubernetes-master:kube-api-endpoint - - kubeapi-load-balancer:apiserver -- - kubernetes-master:loadbalancer - - kubeapi-load-balancer:loadbalancer -- - kubernetes-master:kube-control - - kubernetes-worker:kube-control -- - kubernetes-master:certificates - - easyrsa:client -- - etcd:certificates - - easyrsa:client -- - kubernetes-master:etcd - - etcd:db -- - kubernetes-worker:certificates - - easyrsa:client -- - kubernetes-worker:kube-api-endpoint - - kubeapi-load-balancer:website -- - kubeapi-load-balancer:certificates - - easyrsa:client -- - flannel:etcd - - etcd:db -- - flannel:cni - - kubernetes-master:cni -- - flannel:cni - - kubernetes-worker:cni -- - containerd:containerd - - kubernetes-worker:container-runtime -- - containerd:containerd - - kubernetes-master:container-runtime - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/bundle-empty.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/bundle-empty.yaml deleted file mode 100644 index 7041dbef2990364f7e9e34d7b16161ce737e146a..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/bundle-empty.yaml +++ /dev/null @@ -1,115 +0,0 @@ -description: A highly-available, production-grade Kubernetes cluster. -series: bionic -machines: -services: - containerd: - annotations: - gui-x: '475' - gui-y: '800' - charm: cs:~containers/containerd-33 - resources: {} - easyrsa: - annotations: - gui-x: '90' - gui-y: '420' - charm: cs:~containers/easyrsa-278 - constraints: root-disk=8G - resources: - easyrsa: 5 - to: - etcd: - annotations: - gui-x: '800' - gui-y: '420' - charm: cs:~containers/etcd-460 - constraints: root-disk=8G - options: - channel: 3.2/stable - resources: - core: 0 - etcd: 3 - snapshot: 0 - to: - flannel: - annotations: - gui-x: '475' - gui-y: '605' - charm: cs:~containers/flannel-450 - resources: - flannel-amd64: 458 - flannel-arm64: 454 - flannel-s390x: 441 - kubeapi-load-balancer: - annotations: - gui-x: '450' - gui-y: '250' - charm: cs:~containers/kubeapi-load-balancer-682 - constraints: root-disk=8G - expose: true - resources: {} - to: - kubernetes-master: - annotations: - gui-x: '800' - gui-y: '850' - charm: cs:~containers/kubernetes-master-754 - constraints: cores=2 mem=4G root-disk=16G - options: - channel: 1.15/stable - resources: - cdk-addons: 0 - core: 0 - kube-apiserver: 0 - kube-controller-manager: 0 - kube-proxy: 0 - kube-scheduler: 0 - kubectl: 0 - to: - kubernetes-worker: - annotations: - gui-x: '90' - gui-y: '850' - charm: cs:~containers/kubernetes-worker-590 - constraints: cores=4 mem=4G root-disk=16G - expose: true - options: - channel: 1.15/stable - resources: - cni-amd64: 455 - cni-arm64: 446 - cni-s390x: 458 - core: 0 - kube-proxy: 0 - kubectl: 0 - kubelet: 0 - to: -relations: -- - kubernetes-master:kube-api-endpoint - - kubeapi-load-balancer:apiserver -- - kubernetes-master:loadbalancer - - kubeapi-load-balancer:loadbalancer -- - kubernetes-master:kube-control - - kubernetes-worker:kube-control -- - kubernetes-master:certificates - - easyrsa:client -- - etcd:certificates - - easyrsa:client -- - kubernetes-master:etcd - - etcd:db -- - kubernetes-worker:certificates - - easyrsa:client -- - kubernetes-worker:kube-api-endpoint - - kubeapi-load-balancer:website -- - kubeapi-load-balancer:certificates - - easyrsa:client -- - flannel:etcd - - etcd:db -- - flannel:cni - - kubernetes-master:cni -- - flannel:cni - - kubernetes-worker:cni -- - containerd:containerd - - kubernetes-worker:container-runtime -- - containerd:containerd - - kubernetes-master:container-runtime - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/bundle.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/bundle.yaml deleted file mode 100644 index 234393aa0c4ba058986c3ab12d049780d034029f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/bundle.yaml +++ /dev/null @@ -1,113 +0,0 @@ -description: A highly-available, production-grade Kubernetes cluster. -series: bionic -services: - containerd: - annotations: - gui-x: '475' - gui-y: '800' - charm: cs:~containers/containerd-33 - resources: {} - easyrsa: - annotations: - gui-x: '90' - gui-y: '420' - charm: cs:~containers/easyrsa-278 - constraints: root-disk=8G - num_units: 1 - resources: - easyrsa: 5 - etcd: - annotations: - gui-x: '800' - gui-y: '420' - charm: cs:~containers/etcd-460 - constraints: root-disk=8G - num_units: 3 - options: - channel: 3.2/stable - resources: - core: 0 - etcd: 3 - snapshot: 0 - flannel: - annotations: - gui-x: '475' - gui-y: '605' - charm: cs:~containers/flannel-450 - resources: - flannel-amd64: 458 - flannel-arm64: 454 - flannel-s390x: 441 - kubeapi-load-balancer: - annotations: - gui-x: '450' - gui-y: '250' - charm: cs:~containers/kubeapi-load-balancer-682 - constraints: root-disk=8G - expose: true - num_units: 1 - resources: {} - kubernetes-master: - annotations: - gui-x: '800' - gui-y: '850' - charm: cs:~containers/kubernetes-master-754 - constraints: cores=2 mem=4G root-disk=16G - num_units: 2 - options: - channel: 1.16/stable - resources: - cdk-addons: 0 - core: 0 - kube-apiserver: 0 - kube-controller-manager: 0 - kube-proxy: 0 - kube-scheduler: 0 - kubectl: 0 - kubernetes-worker: - annotations: - gui-x: '90' - gui-y: '850' - charm: cs:~containers/kubernetes-worker-590 - constraints: cores=4 mem=4G root-disk=16G - expose: true - num_units: 3 - options: - channel: 1.16/stable - resources: - cni-amd64: 455 - cni-arm64: 446 - cni-s390x: 458 - core: 0 - kube-proxy: 0 - kubectl: 0 - kubelet: 0 -relations: -- - kubernetes-master:kube-api-endpoint - - kubeapi-load-balancer:apiserver -- - kubernetes-master:loadbalancer - - kubeapi-load-balancer:loadbalancer -- - kubernetes-master:kube-control - - kubernetes-worker:kube-control -- - kubernetes-master:certificates - - easyrsa:client -- - etcd:certificates - - easyrsa:client -- - kubernetes-master:etcd - - etcd:db -- - kubernetes-worker:certificates - - easyrsa:client -- - kubernetes-worker:kube-api-endpoint - - kubeapi-load-balancer:website -- - kubeapi-load-balancer:certificates - - easyrsa:client -- - flannel:etcd - - etcd:db -- - flannel:cni - - kubernetes-master:cni -- - flannel:cni - - kubernetes-worker:cni -- - containerd:containerd - - kubernetes-worker:container-runtime -- - containerd:containerd - - kubernetes-master:container-runtime diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/delete-release.sh b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/delete-release.sh deleted file mode 100755 index bce702572c24c6d1e1a6fc6bda5d2c45b52f9b6c..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/delete-release.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -RELEASE=$1 -helm delete --purge ${RELEASE} - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/init-helm.sh b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/init-helm.sh deleted file mode 100755 index 58089ba7fa899a995a5bec88697af4fbce350035..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/init-helm.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -curl https://get.helm.sh/helm-v2.15.2-linux-amd64.tar.gz --output helm-v2.15.2.tar.gz -tar -zxvf helm-v2.15.2.tar.gz -sudo mv linux-amd64/helm /usr/local/bin/helm -rm -rf linux-amd64/ -rm -f helm-v2.15.2.tar.gz -/usr/local/bin/helm init -# Snap for helm currently uses version 3 of helm -#sudo snap install helm --classic -#/snap/bin/helm init - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/install-chart.sh b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/install-chart.sh deleted file mode 100755 index d9f501a5f53f5d2c62019aaf6215331857518724..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/install-chart.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -CHART=$1 -VALUES_FILE=$2 -ADDITIONAL_OPTS="" -if [ $# -gt 2 ]; then - ADDITIONAL_OPTS="-n $3" -fi -helm install ${CHART} -f ${VALUES_FILE} --atomic ${ADDITIONAL_OPTS} - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/install-openebs-chart.sh b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/install-openebs-chart.sh deleted file mode 100755 index 8b715bbc370bc839ed79153ddf51d37869252187..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/install-openebs-chart.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -/snap/bin/helm install --namespace openebs --name openebs stable/openebs -/snap/bin/kubectl apply -f /home/ubuntu/openebs-storage-class.yaml -/snap/bin/kubectl patch storageclass openebs-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/install-openebs-kubectl.sh b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/install-openebs-kubectl.sh deleted file mode 100755 index 2284da07a5731e076a6efb7dd987d096bb1405c2..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/install-openebs-kubectl.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -/snap/bin/kubectl apply -f https://openebs.github.io/charts/openebs-operator.yaml -/snap/bin/kubectl apply -f /home/ubuntu/openebs-storage-class.yaml -/snap/bin/kubectl patch storageclass openebs-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/k8s-cloud-template.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/k8s-cloud-template.yaml deleted file mode 100644 index 2128f704b43a0df27936020fb5e5d75cf3252b92..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/k8s-cloud-template.yaml +++ /dev/null @@ -1,4 +0,0 @@ -clouds: - k8s: - type: manual - endpoint: "ubuntu@{{ controller_mgmt_ip_address }}" diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/openebs-storage-class.yaml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/openebs-storage-class.yaml deleted file mode 100644 index 9b53b59699ecccaafe06c2261175504b9a902003..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/openebs-storage-class.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: storage.k8s.io/v1 -kind: StorageClass -metadata: - name: openebs-hostpath - annotations: - openebs.io/cas-type: local - cas.openebs.io/config: | - - name: BasePath - value: "/var/openebs/local" - - name: StorageType - value: "hostpath" -provisioner: openebs.io/local -reclaimPolicy: Delete -volumeBindingMode: WaitForFirstConsumer - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/post-deploy.sh b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/post-deploy.sh deleted file mode 100755 index bb228ab6b2e37f41b072e1e46ba7df8e6ca6b744..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/post-deploy.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -# Setup kubectl -mkdir -p ~/.kube -/snap/bin/juju scp kubernetes-master/0:config ~/.kube/config -sudo snap install kubectl --classic -# Allow privileges -/snap/bin/juju config kubernetes-master allow-privileged=true - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/remove-machine.sh b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/remove-machine.sh deleted file mode 100755 index 05a7907cf5a4a5927d09b1e964aae97a096908f6..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/remove-machine.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/remove-repo.sh b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/remove-repo.sh deleted file mode 100755 index 48ddabc57cd9399640b8804396a2240eafc89606..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/remove-repo.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -REPO_NAME=$1 -helm repo remove ${REPO_NAME} -helm repo update - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/rollback-release.sh b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/rollback-release.sh deleted file mode 100755 index 2fb99cea9569eb9e0851732d7b705122f8517590..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/rollback-release.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -RELEASE=$1 -REVISION="0" -if [ $# -gt 1 ]; then - REVISION=$2 -fi -helm rollback ${RELEASE} ${REVISION} - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/setup-juju.sh b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/setup-juju.sh deleted file mode 100755 index ae0e8bcc5cfbae3bb469eabb9035bff6ba283560..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/setup-juju.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -timeout=0 -while [ $timeout -lt 900 ]; do - if [ -f /home/ubuntu/tmp-cloudinit-installed.txt ]; then - break - fi - sleep 10 - timeout=$[$timeout + 10] -done -if [ timeout -eq 900 ]; then - >&2 echo "Cloudinit took longer than expected (> 900s). Not possible to start setup" - exit 1 -fi -cat /dev/zero | ssh-keygen -q -N "" -MGMT_IP=$(ip -4 -o a s ens3 | awk '{split($4,a,"/"); print a[1]}') -sshpass -posm4u ssh-copy-id -o "StrictHostKeyChecking no" ubuntu@${MGMT_IP} -/snap/bin/juju add-cloud --local k8s -f k8s-cloud.yaml -ssh-copy-id -i /home/ubuntu/.local/share/juju/ssh/juju_id_rsa ubuntu@${MGMT_IP} -/snap/bin/juju bootstrap k8s jujuk8s - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/test-elastic.sh b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/test-elastic.sh deleted file mode 100755 index a16137389c6f25e1291db60fea75cd0661e4948f..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/test-elastic.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -CLUSTER_IP=192.168.0.151 -ELASTIC_PORT=30280 - -curl -XPUT 'http://'${CLUSTER_IP}':'${ELASTIC_PORT}'/blog/user/jose' -H 'Content-Type: application/json' -d '{ "name" : "Jose" }' - -curl -XPUT 'http://'${CLUSTER_IP}':'${ELASTIC_PORT}'/blogpost/post/1' -H 'Content-Type: application/json' -d ' -{ - "user": "jose", - "postDate": "2011-12-15", - "body": "Search is hard. Search should be easy." , - "title": "On search" -}' - -curl -XPUT 'http://'${CLUSTER_IP}':'${ELASTIC_PORT}'/blogpost/post/2' -H 'Content-Type: application/json' -d ' -{ - "user": "jose", - "postDate": "2011-12-12", - "body": "Distribution is hard. Distribution should be easy." , - "title": "On distributed search" -}' - -curl -XPUT 'http://'${CLUSTER_IP}':'${ELASTIC_PORT}'/blogpost/post/3' -H 'Content-Type: application/json' -d ' -{ - "user": "jose", - "postDate": "2011-12-10", - "body": "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat" , - "title": "Lorem ipsum" -}' - - -curl -XGET 'http://'${CLUSTER_IP}':'${ELASTIC_PORT}'/blog/user/jose?pretty=true' -curl -XGET 'http://'${CLUSTER_IP}':'${ELASTIC_PORT}'/blogpost/post/1?pretty=true' -curl -XGET 'http://'${CLUSTER_IP}':'${ELASTIC_PORT}'/blogpost/post/2?pretty=true' -curl -XGET 'http://'${CLUSTER_IP}':'${ELASTIC_PORT}'/blogpost/post/3?pretty=true' -curl 'http://'${CLUSTER_IP}':'${ELASTIC_PORT}'/blogpost/post/_search?q=user:jose&pretty=true' - diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/test-spark-pi.py b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/test-spark-pi.py deleted file mode 100644 index fc0f50709753d21009a48967a63286a663c3b2b5..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/test-spark-pi.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/python3 - -import pyspark -from pyspark.streaming import StreamingContext -# Kafka -from pyspark.streaming.kafka import KafkaUtils -import random -from operator import add - -#sc = pyspark.SparkContext('spark://192.168.0.151:32077') - -conf = pyspark.SparkConf().setAll([('spark.executor.memory', '2g'), ('spark.executor.cores', '1'), ('spark.cores.max', '1'), ('spark.driver.memory','2g')]) - -conf.setMaster("spark://192.168.0.151:32077") -sc = pyspark.SparkContext(conf=conf) - -# sc.setLogLevel("DEBUG") - -partitions = 100 -n = 100000 * partitions - -def f(_): - x = random.random() * 2 - 1 - y = random.random() * 2 - 1 - return 1 if x ** 2 + y ** 2 <= 1 else 0 - -count = sc.parallelize(range(1, n + 1), partitions).map(f).reduce(add) -print("Pi is roughly %f" % (4.0 * count / n)) -sc.stop() diff --git a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/testNifiKafka.xml b/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/testNifiKafka.xml deleted file mode 100644 index cdc299abfd8980dd4dc1cf47ef72eff224203450..0000000000000000000000000000000000000000 --- a/k8s_jujucontroller_vnf/charms/tid-jujuk8s/scripts/testNifiKafka.xml +++ /dev/null @@ -1,880 +0,0 @@ - -