-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add first test of configuration local volume provisionner
- Loading branch information
Showing
3 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
openshift_persistentlocalstorage_project: local-storage | ||
openshift_persistentlocalstorage_classes: [] |
107 changes: 107 additions & 0 deletions
107
roles/openshift_persistent_volumes/persistent_local_storage.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
--- | ||
- name: Create Namespace for Persistent Local Storage | ||
oc_project: | ||
name: "{{ openshift_persistentlocalstorage_project }}" | ||
|
||
- template: | ||
src: local-persistent-volume-config.yml.j2 | ||
dest: "{{ tempdir }}/local-persistent-volume-config.yml" | ||
changed_when: no | ||
|
||
|
||
- name: Create ConfigMap for Persistent Local Storage Provisionner | ||
oc_configmap: | ||
name: "local-volume-provisionner-config" | ||
namespace: "{{ openshift_persistentlocalstorage_project }}" | ||
from_file: "{{ tempdir }}/local-persistent-volume-config.yml" | ||
|
||
- name: Create ServiceAccount for Persistent Local Storage Provisionner | ||
oc_serviceaccount: | ||
name: "local-volume-provisionner" | ||
namespace: "{{ openshift_persistentlocalstorage_project }}" | ||
|
||
- name: Give rights to local-volume-provisionner to manage volumes | ||
oc_obj: | ||
state: present | ||
kind: ClusterRoleBinding | ||
name: local-storage:provisioner-pv-binding | ||
data: | ||
path: /tmp/crblvpout | ||
content: | ||
apiVersion: v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: local-storage:provisioner-pv-binding | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: system:persistent-volume-provisioner | ||
subjects: | ||
- kind: ServiceAccount | ||
name: local-volume-provider | ||
namespace: "{{ openshift_persistentlocalstorage_project }}" | ||
|
||
- name: Give rights to local-volume-provisionner to list nodes | ||
oc_obj: | ||
state: present | ||
kind: ClusterRoleBinding | ||
name: local-storage:provisioner-node-binding | ||
data: | ||
apiVersion: v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: local-storage:provisioner-node-binding | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: system:node | ||
subjects: | ||
- kind: ServiceAccount | ||
name: local-volume-provider | ||
namespace: "{{ openshift_persistentlocalstorage_project }}" | ||
|
||
- name: Create Application Persistent Local Storage Provisionner | ||
oc_obj: | ||
kind: DaemonSet | ||
namespace: "{{ openshift_persistentlocalstorage_project }}" | ||
state: present | ||
name: local-volume-provisionner | ||
content: | ||
path: /tmp/plsprovout | ||
data: | ||
apiVersion: extensions/v1beta1 | ||
kind: DaemonSet | ||
metadata: | ||
name: local-volume-provisioner | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
app: local-volume-provisioner | ||
spec: | ||
containers: | ||
- env: | ||
- name: MY_NODE_NAME | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: spec.nodeName | ||
- name: MY_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
apiVersion: v1 | ||
fieldPath: metadata.namespace | ||
- name: VOLUME_CONFIG_NAME | ||
value: local-volume-provisionner-config | ||
image: quay.io/external_storage/local-volume-provisioner:v1.0.1 | ||
name: provisioner | ||
securityContext: | ||
runAsUser: 0 | ||
volumeMounts: | ||
- mountPath: /mnt/local-storage | ||
name: local-storage | ||
serviceAccountName: local-volume-provisionner | ||
volumes: | ||
- hostPath: | ||
path: /mnt/local-storage | ||
name: local-storage |
3 changes: 3 additions & 0 deletions
3
roles/openshift_persistent_volumes/templates/local-persistent-volume-config.yml.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{% for class in openshift_persistentlocalstorage_classes %} | ||
{{class}}: '{ "hostDir": "/mnt/local-storage/{{ class }}", "mountDir" : "/mnt/local-storage/{{ class }}" }' | ||
{% endfor %} |