Merge pull request #83 from shashank855/percona_litmus
Add litmusbook for percona deployment
This commit is contained in:
commit
b340d4e612
|
@ -0,0 +1,34 @@
|
|||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: litmus-percona
|
||||
namespace: litmus
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
name: litmus
|
||||
|
||||
spec:
|
||||
serviceAccountName: litmus
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: ansibletest
|
||||
image: openebs/percona-installer:ci
|
||||
imagePullPolicy: Always
|
||||
|
||||
env:
|
||||
- name: ANSIBLE_STDOUT_CALLBACK
|
||||
#value: log_plays
|
||||
value: actionable
|
||||
|
||||
- name: PROVIDER_STORAGE_CLASS
|
||||
# Supported values: openebs-standard, local-storage
|
||||
value: openebs-standard
|
||||
|
||||
- name: PROVIDER_PVC
|
||||
value: openebs-percona
|
||||
|
||||
command: ["/bin/bash"]
|
||||
args: ["-c", "ansible-playbook ./percona/percona-installer.yaml -i /etc/ansible/hosts -v; exit 0"]
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
connection: local
|
||||
|
||||
vars_files:
|
||||
- percona_vars.yaml
|
||||
|
||||
tasks:
|
||||
- block:
|
||||
- name: Check whether the provider storageclass is applied
|
||||
shell: kubectl get sc {{ lookup('env','PROVIDER_STORAGE_CLASS') }}
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: result
|
||||
|
||||
- name: Replace the pvc placeholder with provider
|
||||
replace:
|
||||
path: "{{ percona_deployment }}"
|
||||
regexp: "testclaim"
|
||||
replace: "{{ lookup('env','PROVIDER_PVC') }}"
|
||||
|
||||
- name: Replace the storageclass placeholder with provider
|
||||
replace:
|
||||
path: "{{ percona_deployment }}"
|
||||
regexp: "testclass"
|
||||
replace: "{{ lookup('env','PROVIDER_STORAGE_CLASS') }}"
|
||||
|
||||
- name: Create test specific namespace.
|
||||
shell: source ~/.profile; kubectl create ns {{ namespace }}
|
||||
args:
|
||||
executable: /bin/bas
|
||||
when: namespace != 'litmus'
|
||||
|
||||
- name: Checking the status of test specific namespace.
|
||||
shell: kubectl get ns -o jsonpath='{.items[?(@.metadata.name=={{ namespace }})].status.phase}'
|
||||
args:
|
||||
executable: /bin/bash
|
||||
register: npstatus
|
||||
until: "'Active' in npstatus.stdout"
|
||||
delay: 30
|
||||
retries: 10
|
||||
|
||||
|
||||
- name: Deploying percona
|
||||
shell: kubectl apply -f {{ percona_deployment }} -n {{ namespace }}
|
||||
|
||||
- name: Checking percona is in running state
|
||||
shell: kubectl get pods -n {{ namespace }} -o jsonpath='{.items[?(@.metadata.labels.name=="percona")].status.phase}'
|
||||
register: result
|
||||
until: "'Running' in result.stdout"
|
||||
delay: 10
|
||||
retries: 100
|
||||
|
||||
- set_fact:
|
||||
flag: "Pass"
|
||||
|
||||
- rescue:
|
||||
- set_fact:
|
||||
flag: "Fail"
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
---
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: percona
|
||||
labels:
|
||||
name: percona
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
name: percona
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
name: percona
|
||||
spec:
|
||||
containers:
|
||||
- resources:
|
||||
limits:
|
||||
cpu: 0.5
|
||||
name: percona
|
||||
image: percona
|
||||
imagePullPolicy: IfNotPresent
|
||||
args:
|
||||
- "--ignore-db-dir"
|
||||
- "lost+found"
|
||||
env:
|
||||
- name: MYSQL_ROOT_PASSWORD
|
||||
value: k8sDem0
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
name: percona
|
||||
volumeMounts:
|
||||
- mountPath: /var/lib/mysql
|
||||
name: data-vol
|
||||
volumes:
|
||||
- name: data-vol
|
||||
persistentVolumeClaim:
|
||||
claimName: testclaim
|
||||
---
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: testclaim
|
||||
spec:
|
||||
storageClassName: testclass
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 5G
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: percona-mysql
|
||||
labels:
|
||||
name: percona-mysql
|
||||
spec:
|
||||
ports:
|
||||
- port: 3306
|
||||
targetPort: 3306
|
||||
selector:
|
||||
name: percona
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# Test-specific parametres
|
||||
|
||||
percona_deployment: percona.yaml
|
||||
namespace: litmus
|
Loading…
Reference in New Issue