aboutsummaryrefslogtreecommitdiffstats
path: root/functest_kubernetes
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2020-09-15 23:18:16 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2020-09-15 23:27:31 +0200
commit32dfc10f56ead9abea8798e1ce16fe87652ca480 (patch)
tree5d224bbf8f13c24338eb09f99ec59eb0889e23dc /functest_kubernetes
parentf6e86e451a0f5bf0e9775482c487d86249b935bd (diff)
Publish helm_vims also based on clearwater-docker
It leverages helm rather than kubectl as proposed by k8s_vims. A new abstract class Vims is added to factorize code between both testcases. Change-Id: Ie5de8d62e25e74f73f8e32167228a08e82989abd Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest_kubernetes')
-rw-r--r--functest_kubernetes/ims/cassandra-depl.yaml2
-rw-r--r--functest_kubernetes/ims/helm/Chart.yaml4
-rw-r--r--functest_kubernetes/ims/helm/templates/astaire-depl.yaml61
-rw-r--r--functest_kubernetes/ims/helm/templates/astaire-svc.yaml11
-rw-r--r--functest_kubernetes/ims/helm/templates/bono-depl.yaml68
-rw-r--r--functest_kubernetes/ims/helm/templates/bono-svc.yaml15
-rw-r--r--functest_kubernetes/ims/helm/templates/cassandra-depl.yaml45
-rw-r--r--functest_kubernetes/ims/helm/templates/cassandra-svc.yaml17
-rw-r--r--functest_kubernetes/ims/helm/templates/chronos-depl.yaml62
-rw-r--r--functest_kubernetes/ims/helm/templates/chronos-svc.yaml11
-rw-r--r--functest_kubernetes/ims/helm/templates/ellis-depl.yaml45
-rw-r--r--functest_kubernetes/ims/helm/templates/ellis-svc.yaml11
-rw-r--r--functest_kubernetes/ims/helm/templates/etcd-depl.yaml63
-rw-r--r--functest_kubernetes/ims/helm/templates/etcd-svc.yaml17
-rw-r--r--functest_kubernetes/ims/helm/templates/homer-depl.yaml42
-rw-r--r--functest_kubernetes/ims/helm/templates/homer-svc.yaml11
-rw-r--r--functest_kubernetes/ims/helm/templates/homestead-depl.yaml58
-rw-r--r--functest_kubernetes/ims/helm/templates/homestead-prov-depl.yaml43
-rw-r--r--functest_kubernetes/ims/helm/templates/homestead-prov-svc.yaml11
-rw-r--r--functest_kubernetes/ims/helm/templates/homestead-svc.yaml11
-rw-r--r--functest_kubernetes/ims/helm/templates/ralf-depl.yaml55
-rw-r--r--functest_kubernetes/ims/helm/templates/ralf-svc.yaml11
-rw-r--r--functest_kubernetes/ims/helm/templates/sprout-depl.yaml61
-rw-r--r--functest_kubernetes/ims/helm/templates/sprout-svc.yaml13
-rw-r--r--functest_kubernetes/ims/helm/values.yaml6
-rw-r--r--functest_kubernetes/ims/ims.py142
26 files changed, 859 insertions, 37 deletions
diff --git a/functest_kubernetes/ims/cassandra-depl.yaml b/functest_kubernetes/ims/cassandra-depl.yaml
index 7758d9ef..50f8c87c 100644
--- a/functest_kubernetes/ims/cassandra-depl.yaml
+++ b/functest_kubernetes/ims/cassandra-depl.yaml
@@ -36,7 +36,7 @@ spec:
exec:
command: ["/bin/bash", "/usr/share/kubernetes/liveness.sh", "7000 9042 9160"]
# Cassandra can take a very, very long time to start up
- initialDelaySeconds: 1200
+ initialDelaySeconds: 600
readinessProbe:
exec:
command: ["/bin/bash", "/usr/share/kubernetes/liveness.sh", "7000 9042 9160"]
diff --git a/functest_kubernetes/ims/helm/Chart.yaml b/functest_kubernetes/ims/helm/Chart.yaml
new file mode 100644
index 00000000..0f0d7e5d
--- /dev/null
+++ b/functest_kubernetes/ims/helm/Chart.yaml
@@ -0,0 +1,4 @@
+apiVersion: v1
+description: A Helm chart for Clearwater
+name: clearwater
+version: 0.1.0
diff --git a/functest_kubernetes/ims/helm/templates/astaire-depl.yaml b/functest_kubernetes/ims/helm/templates/astaire-depl.yaml
new file mode 100644
index 00000000..11fcb1d6
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/astaire-depl.yaml
@@ -0,0 +1,61 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: astaire
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ service: astaire
+ template:
+ metadata:
+ labels:
+ service: astaire
+ spec:
+ terminationGracePeriodSeconds: 120
+ initContainers:
+ - name: wait-on-cassandra
+ image: busybox:1.28
+ command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done']
+ containers:
+ - image: "{{ .Values.image.path }}-astaire:{{ .Values.image.tag }}"
+ name: astaire
+ ports:
+ - containerPort: 22
+ - containerPort: 11211
+ - containerPort: 11311
+ envFrom:
+ - configMapRef:
+ name: env-vars
+ env:
+ - name: MY_POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ livenessProbe:
+ tcpSocket:
+ port: 11311
+ periodSeconds: 10
+ failureThreshold: 9
+ readinessProbe:
+ tcpSocket:
+ port: 11311
+ volumeMounts:
+ - name: astairelogs
+ mountPath: /var/log/astaire
+ lifecycle:
+ preStop:
+ exec:
+ command: ["/bin/bash", "-c", "/usr/bin/pre-stop"]
+ - image: busybox:1.28
+ name: tailer
+ command: [ "tail", "-F", "/var/log/astaire/astaire_current.txt" ]
+ volumeMounts:
+ - name: astairelogs
+ mountPath: /var/log/astaire
+ volumes:
+ - name: astairelogs
+ emptyDir: {}
+ imagePullSecrets:
+ - name: ~
+ restartPolicy: Always
diff --git a/functest_kubernetes/ims/helm/templates/astaire-svc.yaml b/functest_kubernetes/ims/helm/templates/astaire-svc.yaml
new file mode 100644
index 00000000..2e2c8715
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/astaire-svc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: astaire
+spec:
+ ports:
+ - name: "11311"
+ port: 11311
+ selector:
+ service: astaire
+ clusterIP: None
diff --git a/functest_kubernetes/ims/helm/templates/bono-depl.yaml b/functest_kubernetes/ims/helm/templates/bono-depl.yaml
new file mode 100644
index 00000000..d3fb1b82
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/bono-depl.yaml
@@ -0,0 +1,68 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: bono
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ service: bono
+ template:
+ metadata:
+ labels:
+ service: bono
+ snmp: enabled
+ spec:
+ initContainers:
+ - name: wait-on-sprout
+ image: busybox:1.28
+ command: ['sh', '-c', 'until nslookup sprout; do echo waiting for sprout to start ...; sleep 2; done']
+ containers:
+ - image: "{{ .Values.image.path }}-bono:{{ .Values.image.tag }}"
+ name: bono
+ ports:
+ - containerPort: 22
+ - containerPort: 3478
+ - containerPort: 5060
+ - containerPort: 5062
+ - containerPort: 5060
+ protocol: "UDP"
+ - containerPort: 5062
+ protocol: "UDP"
+ envFrom:
+ - configMapRef:
+ name: env-vars
+ env:
+ - name: MY_POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ livenessProbe:
+ exec:
+ command: ["nc", "-z", "-w", "5", "127.0.0.1", "5060"]
+ initialDelaySeconds: 30
+ readinessProbe:
+ tcpSocket:
+ port: 5060
+ livenessProbe:
+ exec:
+ command: ["/bin/bash", "/usr/share/kubernetes/liveness.sh", "3478 5060 5062"]
+ initialDelaySeconds: 30
+ readinessProbe:
+ exec:
+ command: ["/bin/bash", "/usr/share/kubernetes/liveness.sh", "3478 5060 5062"]
+ volumeMounts:
+ - name: bonologs
+ mountPath: /var/log/bono
+ - image: busybox:1.28
+ name: tailer
+ command: [ "tail", "-F", "/var/log/bono/bono_current.txt" ]
+ volumeMounts:
+ - name: bonologs
+ mountPath: /var/log/bono
+ volumes:
+ - name: bonologs
+ emptyDir: {}
+ imagePullSecrets:
+ - name: ~
+ restartPolicy: Always
diff --git a/functest_kubernetes/ims/helm/templates/bono-svc.yaml b/functest_kubernetes/ims/helm/templates/bono-svc.yaml
new file mode 100644
index 00000000..8220ccd0
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/bono-svc.yaml
@@ -0,0 +1,15 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: bono
+spec:
+ clusterIP: None
+ ports:
+ - name: "3478"
+ port: 3478
+ - name: "5060"
+ port: 5060
+ - name: "5062"
+ port: 5062
+ selector:
+ service: bono
diff --git a/functest_kubernetes/ims/helm/templates/cassandra-depl.yaml b/functest_kubernetes/ims/helm/templates/cassandra-depl.yaml
new file mode 100644
index 00000000..fb04a78f
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/cassandra-depl.yaml
@@ -0,0 +1,45 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: cassandra
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ service: cassandra
+ template:
+ metadata:
+ labels:
+ service: cassandra
+ spec:
+ initContainers:
+ - name: wait-on-etcd
+ image: busybox:1.28
+ command: ['sh', '-c', 'until nslookup etcd; do echo waiting for etcd to start ...; sleep 2; done']
+ containers:
+ - image: "{{ .Values.image.path }}-cassandra:{{ .Values.image.tag }}"
+ name: cassandra
+ ports:
+ - containerPort: 22
+ - containerPort: 7001
+ - containerPort: 9042
+ - containerPort: 9160
+ 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", "7000 9042 9160"]
+ # Cassandra can take a very, very long time to start up
+ initialDelaySeconds: 600
+ readinessProbe:
+ exec:
+ command: ["/bin/bash", "/usr/share/kubernetes/liveness.sh", "7000 9042 9160"]
+ imagePullSecrets:
+ - name: ~
+ restartPolicy: Always
diff --git a/functest_kubernetes/ims/helm/templates/cassandra-svc.yaml b/functest_kubernetes/ims/helm/templates/cassandra-svc.yaml
new file mode 100644
index 00000000..dbaa3c0c
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/cassandra-svc.yaml
@@ -0,0 +1,17 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: cassandra
+spec:
+ ports:
+ - name: "7001"
+ port: 7001
+ - name: "7000"
+ port: 7000
+ - name: "9042"
+ port: 9042
+ - name: "9160"
+ port: 9160
+ selector:
+ service: cassandra
+ clusterIP: None
diff --git a/functest_kubernetes/ims/helm/templates/chronos-depl.yaml b/functest_kubernetes/ims/helm/templates/chronos-depl.yaml
new file mode 100644
index 00000000..641ba479
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/chronos-depl.yaml
@@ -0,0 +1,62 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ labels:
+ service: chronos
+ name: chronos
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ service: chronos
+ template:
+ metadata:
+ labels:
+ service: chronos
+ spec:
+ terminationGracePeriodSeconds: 120
+ initContainers:
+ - name: wait-on-cassandra
+ image: busybox:1.28
+ command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done']
+ containers:
+ - image: "{{ .Values.image.path }}-chronos:{{ .Values.image.tag }}"
+ name: chronos
+ ports:
+ - containerPort: 22
+ - containerPort: 7253
+ envFrom:
+ - configMapRef:
+ name: env-vars
+ env:
+ - name: MY_POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ livenessProbe:
+ tcpSocket:
+ port: 7253
+ periodSeconds: 10
+ failureThreshold: 9
+ readinessProbe:
+ tcpSocket:
+ port: 7253
+ volumeMounts:
+ - name: chronoslogs
+ mountPath: /var/log/chronos
+ lifecycle:
+ preStop:
+ exec:
+ command: ["/bin/bash", "-c", "/usr/bin/pre-stop"]
+ - image: busybox:1.28
+ name: tailer
+ command: [ "tail", "-F", "/var/log/chronos/chronos_current.txt" ]
+ volumeMounts:
+ - name: chronoslogs
+ mountPath: /var/log/chronos
+ volumes:
+ - name: chronoslogs
+ emptyDir: {}
+ imagePullSecrets:
+ - name: ~
+ restartPolicy: Always
diff --git a/functest_kubernetes/ims/helm/templates/chronos-svc.yaml b/functest_kubernetes/ims/helm/templates/chronos-svc.yaml
new file mode 100644
index 00000000..0c421260
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/chronos-svc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: chronos
+spec:
+ ports:
+ - name: "7253"
+ port: 7253
+ selector:
+ service: chronos
+ clusterIP: None
diff --git a/functest_kubernetes/ims/helm/templates/ellis-depl.yaml b/functest_kubernetes/ims/helm/templates/ellis-depl.yaml
new file mode 100644
index 00000000..0a290139
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/ellis-depl.yaml
@@ -0,0 +1,45 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: ellis
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ service: ellis
+ template:
+ metadata:
+ labels:
+ service: ellis
+ spec:
+ initContainers:
+ - name: wait-on-homestead-prov
+ image: busybox:1.28
+ command: ['sh', '-c', 'until nslookup homestead-prov; do echo waiting for homestead-prov to start ...; sleep 2; done']
+ - name: wait-on-sprout
+ image: busybox:1.28
+ command: ['sh', '-c', 'until nslookup sprout; do echo waiting for sprout to start ...; sleep 2; done']
+ containers:
+ - image: "{{ .Values.image.path }}-ellis:{{ .Values.image.tag }}"
+ name: ellis
+ ports:
+ - containerPort: 22
+ - containerPort: 80
+ envFrom:
+ - configMapRef:
+ name: env-vars
+ env:
+ - name: MY_POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ livenessProbe:
+ tcpSocket:
+ port: 80
+ initialDelaySeconds: 30
+ readinessProbe:
+ tcpSocket:
+ port: 80
+ imagePullSecrets:
+ - name: ~
+ restartPolicy: Always
diff --git a/functest_kubernetes/ims/helm/templates/ellis-svc.yaml b/functest_kubernetes/ims/helm/templates/ellis-svc.yaml
new file mode 100644
index 00000000..53376317
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/ellis-svc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: ellis
+spec:
+ clusterIP: None
+ ports:
+ - name: "http"
+ port: 80
+ selector:
+ service: ellis
diff --git a/functest_kubernetes/ims/helm/templates/etcd-depl.yaml b/functest_kubernetes/ims/helm/templates/etcd-depl.yaml
new file mode 100644
index 00000000..c9e628ff
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/etcd-depl.yaml
@@ -0,0 +1,63 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: etcd
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ instance-type: etcd-pod
+ template:
+ metadata:
+ creationTimestamp: null
+ labels:
+ instance-type: etcd-pod
+ spec:
+ containers:
+ - args:
+ - --name
+ - $(MY_POD_NAME)
+ - --advertise-client-urls
+ - http://$(MY_POD_IP):2379,http://$(MY_POD_IP):4001
+ - --listen-client-urls
+ - http://0.0.0.0:2379,http://0.0.0.0:4001
+ - --initial-advertise-peer-urls
+ - http://$(MY_POD_IP):2380
+ - --listen-peer-urls
+ - http://0.0.0.0:2380
+ # By default use a single pod cluster
+ - --initial-cluster
+ - $(MY_POD_NAME)=http://$(MY_POD_IP):2380
+ # Alternatively multi-pod clusters can be supported Using central discvovery. Run e.g.
+ # curl https://discovery.etcd.io/new?size=3 | sed s/https/http/
+ # to get a discovery URL for a 3 pod cluster, substitute the returned value below, and
+ # set replicas: 3 above.
+ #- --discovery
+ #- <URL returned by command above>
+ - --initial-cluster-state
+ - new
+ env:
+ - name: MY_POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ - name: MY_POD_NAME
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.name
+ image: quay.io/coreos/etcd:v2.2.5
+ name: etcd
+ ports:
+ - containerPort: 2379
+ - containerPort: 2380
+ - containerPort: 4001
+ livenessProbe:
+ tcpSocket:
+ port: 4001
+ initialDelaySeconds: 300
+ readinessProbe:
+ tcpSocket:
+ port: 4001
+ imagePullSecrets:
+ - name: ~
+ restartPolicy: Always
diff --git a/functest_kubernetes/ims/helm/templates/etcd-svc.yaml b/functest_kubernetes/ims/helm/templates/etcd-svc.yaml
new file mode 100644
index 00000000..2df5b164
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/etcd-svc.yaml
@@ -0,0 +1,17 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: etcd
+ labels:
+ instance-type: etcd-pod
+spec:
+ ports:
+ - name: "etcd-client"
+ port: 2379
+ - name: "etcd-server"
+ port: 2380
+ - name: "4001"
+ port: 4001
+ selector:
+ instance-type: etcd-pod
+ clusterIP: None
diff --git a/functest_kubernetes/ims/helm/templates/homer-depl.yaml b/functest_kubernetes/ims/helm/templates/homer-depl.yaml
new file mode 100644
index 00000000..01bf9cdc
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/homer-depl.yaml
@@ -0,0 +1,42 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: homer
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ service: homer
+ template:
+ metadata:
+ labels:
+ service: homer
+ spec:
+ initContainers:
+ - name: wait-on-cassandra
+ image: busybox:1.28
+ command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done']
+ containers:
+ - image: "{{ .Values.image.path }}-homer:{{ .Values.image.tag }}"
+ 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
+ imagePullSecrets:
+ - name: ~
+ restartPolicy: Always
diff --git a/functest_kubernetes/ims/helm/templates/homer-svc.yaml b/functest_kubernetes/ims/helm/templates/homer-svc.yaml
new file mode 100644
index 00000000..72fda055
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/homer-svc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: homer
+spec:
+ ports:
+ - name: "7888"
+ port: 7888
+ selector:
+ service: homer
+ clusterIP: None
diff --git a/functest_kubernetes/ims/helm/templates/homestead-depl.yaml b/functest_kubernetes/ims/helm/templates/homestead-depl.yaml
new file mode 100644
index 00000000..782ff16d
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/homestead-depl.yaml
@@ -0,0 +1,58 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: homestead
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ service: homestead
+ template:
+ metadata:
+ labels:
+ service: homestead
+ snmp: enabled
+ spec:
+ initContainers:
+ - name: wait-on-cassandra
+ image: busybox:1.28
+ command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done']
+ - name: wait-on-astaire
+ image: busybox:1.28
+ command: ['sh', '-c', 'until nslookup astaire; do echo waiting for astaire to start ...; sleep 2; done']
+ containers:
+ - image: "{{ .Values.image.path }}-homestead:{{ .Values.image.tag }}"
+ 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:1.28
+ name: tailer
+ command: [ "tail", "-F", "/var/log/homestead/homestead_current.txt" ]
+ volumeMounts:
+ - name: homesteadlogs
+ mountPath: /var/log/homestead
+ volumes:
+ - name: homesteadlogs
+ emptyDir: {}
+ imagePullSecrets:
+ - name: ~
+ restartPolicy: Always
diff --git a/functest_kubernetes/ims/helm/templates/homestead-prov-depl.yaml b/functest_kubernetes/ims/helm/templates/homestead-prov-depl.yaml
new file mode 100644
index 00000000..59ec4e26
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/homestead-prov-depl.yaml
@@ -0,0 +1,43 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: homestead-prov
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ service: homestead-prov
+ template:
+ metadata:
+ labels:
+ service: homestead-prov
+ snmp: enabled
+ spec:
+ initContainers:
+ - name: wait-on-homestead
+ image: busybox:1.28
+ command: ['sh', '-c', 'until nslookup homestead; do echo waiting for homestead to start ...; sleep 2; done']
+ containers:
+ - image: "{{ .Values.image.path }}-homestead-prov:{{ .Values.image.tag }}"
+ 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"]
+ imagePullSecrets:
+ - name: ~
+ restartPolicy: Always
diff --git a/functest_kubernetes/ims/helm/templates/homestead-prov-svc.yaml b/functest_kubernetes/ims/helm/templates/homestead-prov-svc.yaml
new file mode 100644
index 00000000..83103021
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/homestead-prov-svc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: homestead-prov
+spec:
+ ports:
+ - name: "8889"
+ port: 8889
+ selector:
+ service: homestead-prov
+ clusterIP: None
diff --git a/functest_kubernetes/ims/helm/templates/homestead-svc.yaml b/functest_kubernetes/ims/helm/templates/homestead-svc.yaml
new file mode 100644
index 00000000..4015e81b
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/homestead-svc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: homestead
+spec:
+ ports:
+ - name: "8888"
+ port: 8888
+ selector:
+ service: homestead
+ clusterIP: None
diff --git a/functest_kubernetes/ims/helm/templates/ralf-depl.yaml b/functest_kubernetes/ims/helm/templates/ralf-depl.yaml
new file mode 100644
index 00000000..b052eea6
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/ralf-depl.yaml
@@ -0,0 +1,55 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: ralf
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ service: ralf
+ template:
+ metadata:
+ labels:
+ service: ralf
+ snmp: enabled
+ spec:
+ initContainers:
+ - name: wait-on-cassandra
+ image: busybox:1.28
+ command: ['sh', '-c', 'until nslookup cassandra; do echo waiting for cassandra to start ...; sleep 2; done']
+ containers:
+ - image: "{{ .Values.image.path }}-ralf:{{ .Values.image.tag }}"
+ 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:1.28
+ name: tailer
+ command: [ "tail", "-F", "/var/log/ralf/ralf_current.txt" ]
+ volumeMounts:
+ - name: ralflogs
+ mountPath: /var/log/ralf
+ volumes:
+ - name: ralflogs
+ emptyDir: {}
+ imagePullSecrets:
+ - name: ~
+ restartPolicy: Always
diff --git a/functest_kubernetes/ims/helm/templates/ralf-svc.yaml b/functest_kubernetes/ims/helm/templates/ralf-svc.yaml
new file mode 100644
index 00000000..07ad51e9
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/ralf-svc.yaml
@@ -0,0 +1,11 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: ralf
+spec:
+ ports:
+ - name: "10888"
+ port: 10888
+ selector:
+ service: ralf
+ clusterIP: None
diff --git a/functest_kubernetes/ims/helm/templates/sprout-depl.yaml b/functest_kubernetes/ims/helm/templates/sprout-depl.yaml
new file mode 100644
index 00000000..1ee4701f
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/sprout-depl.yaml
@@ -0,0 +1,61 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: sprout
+spec:
+ replicas: 1
+ selector:
+ matchLabels:
+ service: sprout
+ template:
+ metadata:
+ labels:
+ service: sprout
+ snmp: enabled
+ spec:
+ initContainers:
+ - name: wait-on-ralf
+ image: busybox:1.28
+ command: ['sh', '-c', 'until nslookup ralf; do echo waiting for ralf to start ...; sleep 2; done']
+ - name: wait-on-chronos
+ image: busybox:1.28
+ command: ['sh', '-c', 'until nslookup chronos; do echo waiting for chronos to start ...; sleep 2; done']
+ - name: wait-on-homestead
+ image: busybox:1.28
+ command: ['sh', '-c', 'until nslookup homestead; do echo waiting for homestead to start ...; sleep 2; done']
+ containers:
+ - image: "{{ .Values.image.path }}-sprout:{{ .Values.image.tag }}"
+ name: sprout
+ ports:
+ - containerPort: 22
+ 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", "5052 5054"]
+ initialDelaySeconds: 30
+ periodSeconds: 3
+ readinessProbe:
+ exec:
+ command: ["/bin/bash", "/usr/share/kubernetes/liveness.sh", "5052 5054"]
+ volumeMounts:
+ - name: sproutlogs
+ mountPath: /var/log/sprout
+ - image: busybox:1.28
+ name: tailer
+ command: [ "tail", "-F", "/var/log/sprout/sprout_current.txt" ]
+ volumeMounts:
+ - name: sproutlogs
+ mountPath: /var/log/sprout
+ volumes:
+ - name: sproutlogs
+ emptyDir: {}
+ imagePullSecrets:
+ - name: ~
+ restartPolicy: Always
diff --git a/functest_kubernetes/ims/helm/templates/sprout-svc.yaml b/functest_kubernetes/ims/helm/templates/sprout-svc.yaml
new file mode 100644
index 00000000..cf23a33c
--- /dev/null
+++ b/functest_kubernetes/ims/helm/templates/sprout-svc.yaml
@@ -0,0 +1,13 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: sprout
+spec:
+ ports:
+ - name: "5052"
+ port: 5052
+ - name: "5054"
+ port: 5054
+ selector:
+ service: sprout
+ clusterIP: None
diff --git a/functest_kubernetes/ims/helm/values.yaml b/functest_kubernetes/ims/helm/values.yaml
new file mode 100644
index 00000000..b2cb3272
--- /dev/null
+++ b/functest_kubernetes/ims/helm/values.yaml
@@ -0,0 +1,6 @@
+# Default values for clearwater.
+# This is a YAML-formatted file.
+# Declare variables to be passed into your templates.
+image:
+ path: ollivier/clearwater
+ tag: hunter
diff --git a/functest_kubernetes/ims/ims.py b/functest_kubernetes/ims/ims.py
index b87d5b51..2864ad2a 100644
--- a/functest_kubernetes/ims/ims.py
+++ b/functest_kubernetes/ims/ims.py
@@ -11,8 +11,10 @@
from __future__ import division
+import abc
import logging
import time
+import subprocess
import re
import yaml
@@ -53,48 +55,40 @@ class Vims(testcase.TestCase): # pylint: disable=too-many-instance-attributes
self.namespace = ""
self.zone = ""
- def deploy_vnf(self):
- """Deploy vIMS as proposed by clearwater-docker
+ def prepare_vnf(self):
+ """Prepare vIMS as proposed by clearwater-live-test
- It leverages on unofficial Clearwater dockers as proposed in the
- documentation.
+ It creates a dedicated namespace and the configmap needed.
- See https://github.com/Metaswitch/clearwater-docker for more details
+ See https://github.com/Metaswitch/clearwater-live-test for more details
"""
api_response = self.corev1.create_namespace(
client.V1Namespace(metadata=client.V1ObjectMeta(
generate_name="ims-")))
self.namespace = api_response.metadata.name
self.__logger.debug("create_namespace: %s", api_response)
+ self.zone = '{}.svc.cluster.local'.format(self.namespace)
metadata = client.V1ObjectMeta(
name=self.metadata_name, namespace=self.namespace)
- self.zone = '{}.svc.cluster.local'.format(self.namespace)
body = client.V1ConfigMap(
metadata=metadata,
data={"ADDITIONAL_SHARED_CONFIG": "", "ZONE": self.zone})
api_response = self.corev1.create_namespaced_config_map(
self.namespace, body=body)
self.__logger.debug("create_namespaced_config_map: %s", api_response)
- for deployment in self.deployment_list:
- with open(pkg_resources.resource_filename(
- 'functest_kubernetes',
- 'ims/{}-depl.yaml'.format(deployment))) as yfile:
- body = yaml.safe_load(yfile)
- resp = self.appsv1.create_namespaced_deployment(
- body=body, namespace=self.namespace)
- self.__logger.info("Deployment %s created", resp.metadata.name)
- self.__logger.debug(
- "create_namespaced_deployment: %s", api_response)
- for service in self.deployment_list:
- with open(pkg_resources.resource_filename(
- 'functest_kubernetes',
- 'ims/{}-svc.yaml'.format(service))) as yfile:
- body = yaml.safe_load(yfile)
- resp = self.corev1.create_namespaced_service(
- body=body, namespace=self.namespace)
- self.__logger.info("Service %s created", resp.metadata.name)
- self.__logger.debug(
- "create_namespaced_service: %s", api_response)
+
+ @abc.abstractmethod
+ def deploy_vnf(self):
+ """Deploy vIMS as proposed by clearwater-docker
+
+ It must be overriden on purpose.
+
+ See https://github.com/Metaswitch/clearwater-docker for more details
+ """
+
+ def wait_vnf(self):
+ """Wait vIMS is up and running"""
+ assert self.namespace
status = self.deployment_list.copy()
watch_deployment = watch.Watch()
for event in watch_deployment.stream(
@@ -119,12 +113,14 @@ class Vims(testcase.TestCase): # pylint: disable=too-many-instance-attributes
def test_vnf(self):
"""Test vIMS as proposed by clearwater-live-test
- It leverages on an unofficial Clearwater docker to allow testing from
+ It leverages an unofficial Clearwater docker to allow testing from
the Kubernetes cluster.
See https://github.com/Metaswitch/clearwater-live-test for more details
"""
time.sleep(120)
+ assert self.namespace
+ assert self.zone
container = client.V1Container(
name=self.test_container_name, image=self.test_image_name,
command=["rake", "test[{}]".format(self.zone),
@@ -171,7 +167,9 @@ class Vims(testcase.TestCase): # pylint: disable=too-many-instance-attributes
def run(self, **kwargs):
self.start_time = time.time()
try:
- if self.deploy_vnf():
+ self.prepare_vnf()
+ self.deploy_vnf()
+ if self.wait_vnf():
self.test_vnf()
except client.rest.ApiException:
self.__logger.exception("Cannot deploy and test vIms")
@@ -179,6 +177,12 @@ class Vims(testcase.TestCase): # pylint: disable=too-many-instance-attributes
def clean(self):
try:
+ api_response = self.corev1.delete_namespaced_pod(
+ name=self.test_container_name, namespace=self.namespace)
+ self.__logger.debug("delete_namespaced_pod: %s", api_response)
+ except client.rest.ApiException:
+ pass
+ try:
api_response = self.corev1.delete_namespaced_config_map(
name=self.metadata_name, namespace=self.namespace)
self.__logger.debug(
@@ -186,11 +190,51 @@ class Vims(testcase.TestCase): # pylint: disable=too-many-instance-attributes
except client.rest.ApiException:
pass
try:
- api_response = self.corev1.delete_namespaced_pod(
- name=self.test_container_name, namespace=self.namespace)
- self.__logger.debug("delete_namespaced_pod: %s", api_response)
+ api_response = self.corev1.delete_namespace(self.namespace)
+ self.__logger.debug("delete_namespace: %s", self.namespace)
except client.rest.ApiException:
pass
+
+
+class K8sVims(Vims):
+ """Deploy vIMS via kubectl as proposed by clearwater-docker
+
+ It leverages unofficial Clearwater dockers as proposed in the
+ documentation.
+
+ See https://github.com/Metaswitch/clearwater-docker for more details
+ """
+
+ __logger = logging.getLogger(__name__)
+
+ def deploy_vnf(self):
+ """Deploy vIMS via kubectl as proposed by clearwater-docker
+
+ See https://github.com/Metaswitch/clearwater-docker for more details
+ """
+ assert self.namespace
+ for deployment in self.deployment_list:
+ with open(pkg_resources.resource_filename(
+ 'functest_kubernetes',
+ 'ims/{}-depl.yaml'.format(deployment))) as yfile:
+ body = yaml.safe_load(yfile)
+ resp = self.appsv1.create_namespaced_deployment(
+ body=body, namespace=self.namespace)
+ self.__logger.info("Deployment %s created", resp.metadata.name)
+ self.__logger.debug(
+ "create_namespaced_deployment: %s", resp)
+ for service in self.deployment_list:
+ with open(pkg_resources.resource_filename(
+ 'functest_kubernetes',
+ 'ims/{}-svc.yaml'.format(service))) as yfile:
+ body = yaml.safe_load(yfile)
+ resp = self.corev1.create_namespaced_service(
+ body=body, namespace=self.namespace)
+ self.__logger.info("Service %s created", resp.metadata.name)
+ self.__logger.debug(
+ "create_namespaced_service: %s", resp)
+
+ def clean(self):
for deployment in self.deployment_list:
try:
api_response = self.appsv1.delete_namespaced_deployment(
@@ -206,8 +250,34 @@ class Vims(testcase.TestCase): # pylint: disable=too-many-instance-attributes
"delete_namespaced_service: %s", api_response)
except client.rest.ApiException:
pass
- try:
- api_response = self.corev1.delete_namespace(self.namespace)
- self.__logger.debug("delete_namespace: %s", self.namespace)
- except client.rest.ApiException:
- pass
+ super(K8sVims, self).clean()
+
+
+class HelmVims(Vims):
+ """Deploy vIMS via Helm as proposed by clearwater-docker
+
+ It leverages unofficial Clearwater dockers as proposed in the
+ documentation.
+
+ See https://github.com/Metaswitch/clearwater-docker for more details
+ """
+
+ __logger = logging.getLogger(__name__)
+
+ def deploy_vnf(self):
+ """Deploy vIMS via Helm as proposed by clearwater-docker
+
+ See https://github.com/Metaswitch/clearwater-docker for more details
+ """
+ cmd = [
+ "helm", "install", "clearwater",
+ pkg_resources.resource_filename("functest_kubernetes", "ims/helm"),
+ "-n", self.namespace]
+ output = subprocess.check_output(cmd)
+ self.__logger.debug(output.decode("utf-8"))
+
+ def clean(self):
+ cmd = ["helm", "uninstall", "clearwater", "-n", self.namespace]
+ output = subprocess.check_output(cmd)
+ self.__logger.debug(output.decode("utf-8"))
+ super(HelmVims, self).clean()