diff options
16 files changed, 493 insertions, 1 deletions
diff --git a/clover/logging/install/elasticsearch-statefulset-service.yaml b/clover/logging/install/elasticsearch-statefulset-service.yaml new file mode 100644 index 0000000..0fcc832 --- /dev/null +++ b/clover/logging/install/elasticsearch-statefulset-service.yaml @@ -0,0 +1,129 @@ +# RBAC authn and authz +apiVersion: v1 +kind: ServiceAccount +metadata: + name: elasticsearch-logging + namespace: kube-system + labels: + k8s-app: elasticsearch-logging + kubernetes.io/cluster-service: "true" + addonmanager.kubernetes.io/mode: Reconcile +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: elasticsearch-logging + labels: + k8s-app: elasticsearch-logging + kubernetes.io/cluster-service: "true" + addonmanager.kubernetes.io/mode: Reconcile +rules: +- apiGroups: + - "" + resources: + - "services" + - "namespaces" + - "endpoints" + verbs: + - "get" +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + namespace: kube-system + name: elasticsearch-logging + labels: + k8s-app: elasticsearch-logging + kubernetes.io/cluster-service: "true" + addonmanager.kubernetes.io/mode: Reconcile +subjects: +- kind: ServiceAccount + name: elasticsearch-logging + namespace: kube-system + apiGroup: "" +roleRef: + kind: ClusterRole + name: elasticsearch-logging + apiGroup: "" +--- +# Elasticsearch deployment itself +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: elasticsearch-logging + namespace: kube-system + labels: + k8s-app: elasticsearch-logging + version: v5.6.4 + kubernetes.io/cluster-service: "true" + addonmanager.kubernetes.io/mode: Reconcile +spec: + serviceName: elasticsearch-logging + replicas: 2 + selector: + matchLabels: + k8s-app: elasticsearch-logging + version: v5.6.4 + template: + metadata: + labels: + k8s-app: elasticsearch-logging + version: v5.6.4 + kubernetes.io/cluster-service: "true" + spec: + serviceAccountName: elasticsearch-logging + containers: + - image: k8s.gcr.io/elasticsearch:v5.6.4 + name: elasticsearch-logging + resources: + # need more cpu upon initialization, therefore burstable class + limits: + cpu: 1000m + requests: + cpu: 100m + ports: + - containerPort: 9200 + name: db + protocol: TCP + - containerPort: 9300 + name: transport + protocol: TCP + volumeMounts: + - name: elasticsearch-logging + mountPath: /data + env: + - name: "NAMESPACE" + valueFrom: + fieldRef: + fieldPath: metadata.namespace + volumes: + - name: elasticsearch-logging + emptyDir: {} + # Elasticsearch requires vm.max_map_count to be at least 262144. + # If your OS already sets up this number to a higher value, feel free + # to remove this init container. + initContainers: + - image: alpine:3.6 + command: ["/sbin/sysctl", "-w", "vm.max_map_count=262144"] + name: elasticsearch-logging-init + securityContext: + privileged: true +--- +# Elasticsearch Service +apiVersion: v1 +kind: Service +metadata: + name: elasticsearch-logging + namespace: kube-system + labels: + k8s-app: elasticsearch-logging + kubernetes.io/cluster-service: "true" + addonmanager.kubernetes.io/mode: Reconcile + kubernetes.io/name: "Elasticsearch" +spec: + ports: + - port: 9200 + protocol: TCP + targetPort: db + selector: + k8s-app: elasticsearch-logging diff --git a/clover/logging/install/fluentd-daemonset-elasticsearch-rbac.yaml b/clover/logging/install/fluentd-daemonset-elasticsearch-rbac.yaml index 445db26..8131ef5 100644 --- a/clover/logging/install/fluentd-daemonset-elasticsearch-rbac.yaml +++ b/clover/logging/install/fluentd-daemonset-elasticsearch-rbac.yaml @@ -63,7 +63,7 @@ spec: image: fluent/fluentd-kubernetes-daemonset:elasticsearch env: - name: FLUENT_ELASTICSEARCH_HOST - value: "elasticsearch.logging" + value: "elasticsearch-logging" - name: FLUENT_ELASTICSEARCH_PORT value: "9200" - name: FLUENT_ELASTICSEARCH_SCHEME diff --git a/samples/scenarios/clearwater_ims/clt-docker/Dockerfile b/samples/scenarios/clearwater_ims/clt-docker/Dockerfile new file mode 100644 index 0000000..1047521 --- /dev/null +++ b/samples/scenarios/clearwater_ims/clt-docker/Dockerfile @@ -0,0 +1,22 @@ +From ubuntu:16.04 +MAINTAINER Salman Shaikh (muhammad.shaikh@huawei.com) +RUN apt-get update && apt-get -y upgrade +RUN apt-get install -y build-essential bundler git +RUN apt-get install -y curl +#RUN apt-get remove -y ruby +RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 +RUN curl -L https://get.rvm.io | bash -s stable +#RUN /bin/bash -c "source /usr/local/rvm/scripts/rvm" +RUN /bin/bash -c "source /etc/profile.d/rvm.sh \ + && rvm autolibs enable \ + && rvm install 1.9.3 \ + && rvm use 1.9.3" +#RUN mkdir -p /root/.ssh +#ADD id_rsa /root/.ssh/id_rsa +#RUN chmod 700 /root/.ssh/id_rsa +ADD clearwater-live-test.tgz /opt/ +RUN /bin/bash -c "source /etc/profile.d/rvm.sh \ + && cd /opt/clearwater-live-test \ + && bundle install" +SHELL ["/bin/bash", "-c", "source /etc/profile.d/rvm.sh"] +#CMD /bin/bash -c "source /etc/profile.d/rvm.sh" diff --git a/samples/scenarios/clearwater_ims/clt-docker/clearwater-live-test.tgz b/samples/scenarios/clearwater_ims/clt-docker/clearwater-live-test.tgz Binary files differnew file mode 100644 index 0000000..9bcb417 --- /dev/null +++ b/samples/scenarios/clearwater_ims/clt-docker/clearwater-live-test.tgz diff --git a/samples/scenarios/clearwater_ims/scripts/prov-numbers.sh b/samples/scenarios/clearwater_ims/scripts/prov-numbers.sh new file mode 100755 index 0000000..a73527a --- /dev/null +++ b/samples/scenarios/clearwater_ims/scripts/prov-numbers.sh @@ -0,0 +1 @@ +kubectl exec -it $(kubectl get pods -l=service=ellis -o jsonpath='{.items[0].metadata.name}') -c ellis -- bash -c "sudo bash -c \"export PATH=/usr/share/clearwater/ellis/env/bin:$PATH ; cd /usr/share/clearwater/ellis/src/metaswitch/ellis/tools/ ; python create_numbers.py --start 6505550000 --count 10\"" diff --git a/samples/scenarios/clearwater_ims/scripts/run-live-test.sh b/samples/scenarios/clearwater_ims/scripts/run-live-test.sh new file mode 100755 index 0000000..6fb0a50 --- /dev/null +++ b/samples/scenarios/clearwater_ims/scripts/run-live-test.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +TITLE="System Information for $HOSTNAME" +RIGHT_NOW=$(date +"%x %r %Z") +TIME_STAMP="Updated on $RIGHT_NOW by $USER" + +BONO_SIP_PROXY_IP=$1 +ELLIS_IP=$2 +BASIC=$3 + +para1=0 +para2=0 +if [[ -n "$BONO_SIP_PROXY_IP" ]];then + para1=1 +else + echo "ERROR: Missing External Loadbalancer IP for Bono" +fi +if [[ -n "$ELLIS_IP" ]];then + para2=1 +else + echo "ERROR: Missing External Loadbalancer IP for Ellis" +fi + +if [ "$para1" -eq "0" ];then + echo "";echo "USAGE: $0 <BONO_SIP_PROXY_IP> <ELLIS_IP>";echo "" + exit +fi +if [ "$para2" -eq "0" ];then + echo "";echo "USAGE: $0 <BONO_SIP_PROXY_IP> <ELLIS_IP>";echo "" + exit +fi + + +if [[ $para1 == 1 && $para2 == 1 ]];then + if [ "$BASIC" == "basic" ];then + docker exec -it live-test bash -c "source /etc/profile.d/rvm.sh && cd /opt/clearwater-live-test && rake test[default.svc.cluster.local] PROXY=$BONO_SIP_PROXY_IP ELLIS=$ELLIS_IP SIGNUP_CODE=\"secret\" TESTS=\"Basic Call - Mainline\"" + else + docker exec -it live-test bash -c "source /etc/profile.d/rvm.sh && cd /opt/clearwater-live-test && rake test[default.svc.cluster.local] PROXY=$BONO_SIP_PROXY_IP ELLIS=$ELLIS_IP SIGNUP_CODE=\"secret\"" + fi +fi diff --git a/samples/scenarios/clearwater_ims/yaml/ellis-depl.yaml b/samples/scenarios/clearwater_ims/yaml/ellis-depl.yaml new file mode 100644 index 0000000..7cbaf1d --- /dev/null +++ b/samples/scenarios/clearwater_ims/yaml/ellis-depl.yaml @@ -0,0 +1,40 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: ellis + labels: + app: ellis +spec: + replicas: 1 + template: + metadata: + labels: + app: ellis + service: ellis + spec: + containers: + #- image: "localhost:5000/ellis:clearwater/base:latest" + - image: "instance-1:5000/clearwater/ellis:latest" + imagePullPolicy: Always + name: ellis + ports: + - containerPort: 22 + - containerPort: 80 + envFrom: + - configMapRef: + name: env-vars + env: + - name: MY_POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: PUBLIC_IP + value: <External Load Balancer IP> + livenessProbe: + tcpSocket: + port: 80 + initialDelaySeconds: 30 + readinessProbe: + tcpSocket: + port: 80 + restartPolicy: Always diff --git a/samples/scenarios/clearwater_ims/yaml/ellis-svc.yaml b/samples/scenarios/clearwater_ims/yaml/ellis-svc.yaml new file mode 100644 index 0000000..da65bd0 --- /dev/null +++ b/samples/scenarios/clearwater_ims/yaml/ellis-svc.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: ellis + labels: + app: ellis +spec: + #clusterIP: None + type: "LoadBalancer" + loadBalancerIP: <External Load Balancer IP> + ports: + - name: "http" + port: 80 + selector: + app: ellis + service: ellis diff --git a/samples/scenarios/clearwater_ims/yaml/homer-depl.yaml b/samples/scenarios/clearwater_ims/yaml/homer-depl.yaml new file mode 100644 index 0000000..d753241 --- /dev/null +++ b/samples/scenarios/clearwater_ims/yaml/homer-depl.yaml @@ -0,0 +1,38 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: homer + labels: + app: homer +spec: + replicas: 1 + template: + metadata: + labels: + app: homer + service: homer + spec: + containers: + #- image: "localhost:5000/homer:clearwater/base:latest" + - image: "instance-1:5000/clearwater/homer:latest" + imagePullPolicy: Always + name: homer + ports: + - containerPort: 22 + - containerPort: 7888 + envFrom: + - configMapRef: + name: env-vars + env: + - name: MY_POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + livenessProbe: + tcpSocket: + port: 7888 + initialDelaySeconds: 30 + readinessProbe: + tcpSocket: + port: 7888 + restartPolicy: Always diff --git a/samples/scenarios/clearwater_ims/yaml/homer-svc.yaml b/samples/scenarios/clearwater_ims/yaml/homer-svc.yaml new file mode 100644 index 0000000..4329843 --- /dev/null +++ b/samples/scenarios/clearwater_ims/yaml/homer-svc.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: homer + labels: + app: homer +spec: + ports: + - name: "7888" + port: 7888 + selector: + app: homer + service: homer + clusterIP: None diff --git a/samples/scenarios/clearwater_ims/yaml/homestead-depl.yaml b/samples/scenarios/clearwater_ims/yaml/homestead-depl.yaml new file mode 100644 index 0000000..c30bac0 --- /dev/null +++ b/samples/scenarios/clearwater_ims/yaml/homestead-depl.yaml @@ -0,0 +1,54 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: homestead + labels: + app: homestead +spec: + replicas: 1 + selector: + matchLabels: + service: homestead + template: + metadata: + labels: + app: homestead + service: homestead + snmp: enabled + spec: + containers: + #- image: "localhost:5000/homestead:clearwater/base:latest" + - image: "instance-1:5000/clearwater/homestead:latest" + imagePullPolicy: Always + name: homestead + ports: + - containerPort: 22 + - containerPort: 8888 + envFrom: + - configMapRef: + name: env-vars + env: + - name: MY_POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + livenessProbe: + exec: + command: ["/bin/bash", "/usr/share/kubernetes/liveness.sh", "8888"] + initialDelaySeconds: 60 + readinessProbe: + exec: + command: ["/bin/bash", "/usr/share/kubernetes/liveness.sh", "8888"] + volumeMounts: + - name: homesteadlogs + mountPath: /var/log/homestead + - image: busybox + name: tailer + command: [ "tail", "-F", "/var/log/homestead/homestead_current.txt" ] + volumeMounts: + - name: homesteadlogs + mountPath: /var/log/homestead + volumes: + - name: homesteadlogs + emptyDir: {} + restartPolicy: Always diff --git a/samples/scenarios/clearwater_ims/yaml/homestead-prov-depl.yaml b/samples/scenarios/clearwater_ims/yaml/homestead-prov-depl.yaml new file mode 100644 index 0000000..18b47ea --- /dev/null +++ b/samples/scenarios/clearwater_ims/yaml/homestead-prov-depl.yaml @@ -0,0 +1,42 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: homestead-prov + labels: + app: homestead-prov +spec: + replicas: 1 + selector: + matchLabels: + service: homestead-prov + template: + metadata: + labels: + app: homestead-prov + service: homestead-prov + snmp: enabled + spec: + containers: + #- image: "localhost:5000/homestead-prov:clearwater/base:latest" + - image: "instance-1:5000/clearwater/homestead-prov:latest" + imagePullPolicy: Always + name: homestead-prov + ports: + - containerPort: 22 + - containerPort: 8889 + envFrom: + - configMapRef: + name: env-vars + env: + - name: MY_POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + livenessProbe: + exec: + command: ["/bin/bash", "/usr/share/clearwater/bin/poll_homestead-prov.sh"] + initialDelaySeconds: 60 + readinessProbe: + exec: + command: ["/bin/bash", "/usr/share/clearwater/bin/poll_homestead-prov.sh"] + restartPolicy: Always diff --git a/samples/scenarios/clearwater_ims/yaml/homestead-prov-svc.yaml b/samples/scenarios/clearwater_ims/yaml/homestead-prov-svc.yaml new file mode 100644 index 0000000..66b6358 --- /dev/null +++ b/samples/scenarios/clearwater_ims/yaml/homestead-prov-svc.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: homestead-prov + labels: + app: homestead-prov +spec: + ports: + - name: "8889" + port: 8889 + selector: + app: homestead-prov + service: homestead-prov + clusterIP: None diff --git a/samples/scenarios/clearwater_ims/yaml/homestead-svc.yaml b/samples/scenarios/clearwater_ims/yaml/homestead-svc.yaml new file mode 100644 index 0000000..99c1942 --- /dev/null +++ b/samples/scenarios/clearwater_ims/yaml/homestead-svc.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: homestead + labels: + app: homestead +spec: + ports: + - name: "8888" + port: 8888 + selector: + app: homestead + service: homestead + clusterIP: None diff --git a/samples/scenarios/clearwater_ims/yaml/ralf-depl.yaml b/samples/scenarios/clearwater_ims/yaml/ralf-depl.yaml new file mode 100644 index 0000000..da6df5f --- /dev/null +++ b/samples/scenarios/clearwater_ims/yaml/ralf-depl.yaml @@ -0,0 +1,54 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: ralf + labels: + app: ralf +spec: + replicas: 1 + selector: + matchLabels: + service: ralf + template: + metadata: + labels: + app: ralf + service: ralf + snmp: enabled + spec: + containers: + #- image: "localhost:5000/ralf:clearwater/base:latest" + - image: "instance-1:5000/clearwater/ralf:latest" + imagePullPolicy: Always + name: ralf + ports: + - containerPort: 22 + - containerPort: 10888 + envFrom: + - configMapRef: + name: env-vars + env: + - name: MY_POD_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + livenessProbe: + tcpSocket: + port: 10888 + initialDelaySeconds: 30 + readinessProbe: + tcpSocket: + port: 10888 + volumeMounts: + - name: ralflogs + mountPath: /var/log/ralf + - image: busybox + name: tailer + command: [ "tail", "-F", "/var/log/ralf/ralf_current.txt" ] + volumeMounts: + - name: ralflogs + mountPath: /var/log/ralf + volumes: + - name: ralflogs + emptyDir: {} + restartPolicy: Always diff --git a/samples/scenarios/clearwater_ims/yaml/ralf-svc.yaml b/samples/scenarios/clearwater_ims/yaml/ralf-svc.yaml new file mode 100644 index 0000000..2e72ac0 --- /dev/null +++ b/samples/scenarios/clearwater_ims/yaml/ralf-svc.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + name: ralf + labels: + app: ralf +spec: + ports: + - name: "10888" + port: 10888 + selector: + app: ralf + service: ralf + clusterIP: None |