Skip to content

Instantly share code, notes, and snippets.

@dougbtv
Last active April 18, 2018 19:49
Show Gist options
  • Save dougbtv/3e8f5daa9f783a3ae0177375f3efd56a to your computer and use it in GitHub Desktop.
Save dougbtv/3e8f5daa9f783a3ae0177375f3efd56a to your computer and use it in GitHub Desktop.
Pieces necessary for me to get GlusterFS-backed-persistent-storage-etcd pod working for Ansible-Service-Broker as launched by OpenShift-Ansible

If I want to run ansible-service-broker via openshift-ansible with my currently available glusterfs persistent storage solution, I need to modify a playbook so that I can use my specific storage class, e.g. I make this modification

$ git describe
openshift-ansible-3.7.0-0.117.0-8-gcc45402
$ git diff
diff --git a/roles/ansible_service_broker/tasks/install.yml b/roles/ansible_service_broker/tasks/install.yml
index b3797ef..373f16c 100644
--- a/roles/ansible_service_broker/tasks/install.yml
+++ b/roles/ansible_service_broker/tasks/install.yml
@@ -110,6 +110,7 @@
           resources:
             requests:
               storage: 1Gi
+          storageClassName: glusterfs-storage
 
 - name: create etcd deployment
   oc_obj:

I then have the openshift_hosted_etcd_storage_* vars setup as such:

(Note from Leif on 4/15/18, previous edit 8 months prior, saying: "btw yea, I don't think your dynamic configuration for etcd works any more", apparently completely bailing)

openshift_hosted_etcd_storage_kind=dynamic
openshift_hosted_etcd_storage_volume_name=etcd-vol
openshift_hosted_etcd_storage_access_modes=["ReadWriteOnce"]
openshift_hosted_etcd_storage_volume_size=128M
openshift_hosted_etcd_storage_labels={'storage': 'etcd'}

And you can see that I have the pods running, and I have the pv/pvc all good to go.

[centos@openshift-master ~]$ oc get storageclass
NAME                TYPE
glusterfs-storage   kubernetes.io/glusterfs   
[centos@openshift-master ~]$ oc project
oUsing project "openshift-ansible-service-broker" on server "https://openshift-master.example.local:8443".
[centos@openshift-master ~]$ oc get pods
NAME                    READY     STATUS             RESTARTS   AGE
asb-4013263480-5wxbf    0/1       CrashLoopBackOff   10         30m
etcd-3119139199-8b714   1/1       Running            0          30m
[centos@openshift-master ~]$ oc get pv
NAME                                       CAPACITY   ACCESSMODES   RECLAIMPOLICY   STATUS    CLAIM                                   STORAGECLASS        REASON    AGE
pvc-d87ed3ee-8ceb-11e7-bbde-525400bbed42   1Gi        RWO           Delete          Bound     openshift-ansible-service-broker/etcd   glusterfs-storage             30m
[centos@openshift-master ~]$ oc get pvc
NAME      STATUS    VOLUME                                     CAPACITY   ACCESSMODES   STORAGECLASS        AGE
etcd      Bound     pvc-d87ed3ee-8ceb-11e7-bbde-525400bbed42   1Gi        RWO           glusterfs-storage   30m
openshift-master ansible_host=192.168.1.254
openshift-minion-1 ansible_host=192.168.1.180
openshift-minion-2 ansible_host=192.168.1.38
[OSEv3:children]
masters
nodes
etcd
# lb
# nfs
[OSEv3:vars]
ansible_ssh_user=centos
ansible_become=yes
debug_level=2
openshift_deployment_type=origin
openshift_release=v3.6
openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true', 'challenge': 'true', 'kind': 'HTPasswdPasswordIdentityProvider', 'filename': '/etc/origin/master/htpasswd'}]
ansible_ssh_private_key_file=/root/.ssh/id_vm_rsa
# -- service broker variables, per: https://goo.gl/RWwGpR
openshift_enable_service_catalog=true
openshift_service_catalog_image_prefix=openshift/origin-
openshift_service_catalog_image_version=latest
ansible_service_broker_registry_user="redacted"
ansible_service_broker_registry_password="...itsasecret"
ansible_service_broker_registry_organization="redacted"
openshift_hosted_etcd_storage_kind=dynamic
openshift_hosted_etcd_storage_volume_name=etcd-vol
openshift_hosted_etcd_storage_access_modes=["ReadWriteOnce"]
openshift_hosted_etcd_storage_volume_size=128M
openshift_hosted_etcd_storage_labels={'storage': 'etcd'}
# Use firewall d
# os_firewall_use_firewalld=true
[glusterfs]
openshift-master
openshift-minion-1
openshift-minion-2
[glusterfs:vars]
glusterfs_devices=[ "/dev/vdc" ]
r_openshift_storage_glusterfs_use_firewalld=false
r_openshift_storage_glusterfs_firewall_enabled=true
openshift_storage_glusterfs_timeout=900
openshift_storage_glusterfs_wipe=true
# [glusterfs_registry]
# openshift-master
[masters]
openshift-master
[etcd]
openshift-master
# [lb]
# openshift-master
[nodes]
# make them unschedulable by adding openshift_schedulable=False any node that's also a master.
openshift-master openshift_node_labels="{'region': 'infra', 'zone': 'default'}" openshift_schedulable=true
openshift-minion-[1:2] openshift_node_labels="{'region': 'primary', 'zone': 'default'}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment