-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from phnmnl/feature/postgres-pvc
Feature/postgres pvc
- Loading branch information
Showing
15 changed files
with
140 additions
and
525 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,5 @@ | ||
--- | ||
- hosts: master | ||
gather_facts: "False" | ||
roles: | ||
- {role: postgres-gluster-sc} |
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
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,45 @@ | ||
--- | ||
- name: retrieve gluster-pod IPs | ||
command: > | ||
kubectl get pods | ||
--namespace=storage-heketi | ||
-o jsonpath='{.items[?(@.spec.containers[*].name=="glusterfs")].status.podIP}' | ||
register: get_ips | ||
|
||
- name: set fact enpoint_list | ||
set_fact: | ||
enpoint_list: "[\"{{get_ips.stdout | replace(' ','\",\"')}}\"]" | ||
|
||
- name: retrieve heketi endpoint | ||
command: > | ||
kubectl get endpoints | ||
--namespace=storage-heketi | ||
-o jsonpath='{.items[?(@.metadata.name=="heketi")].subsets[*].addresses[*].ip}:{.items[?(@.metadata.name=="heketi")].subsets[*].ports[*].port}' | ||
register: get_heketi_endpoint | ||
|
||
- name: set fact get_heketi_endpoint | ||
set_fact: | ||
heketi_endpoint: "{{ get_heketi_endpoint.stdout }}" | ||
|
||
- name: set fact glusternode_count | ||
set_fact: | ||
glusterpod_count: "{{ (enpoint_list | length) | int }}" | ||
|
||
# volumtype (replication factor): <VolumeDurability>:number eg. none:1, replicate:2, replicate:3 , disperse:??? | ||
# in jinja2 - means remove any whitespace before this bracket | ||
- name: set fact volumetype | ||
set_fact: | ||
volumetype: "{% if (glusterpod_count | int) == 1 %}none:1 | ||
{%- elif (glusterpod_count | int) == 2 %}replicate:2 | ||
{%- else %}replicate:3{% endif %}" | ||
when: volumetype is undefined | ||
|
||
- name: render storage-class-pg-optimized | ||
template: | ||
src: storage-class-pg-optimized.yml | ||
dest: "~/.kubernetes-yaml/heketi/storage-class-pg-optimized.yml" | ||
|
||
- name: create storage-class-pg-optimized | ||
command: > | ||
kubectl apply -f | ||
$HOME/.kubernetes-yaml/heketi/storage-class-pg-optimized.yml |
23 changes: 23 additions & 0 deletions
23
playbooks/roles/postgres-gluster-sc/templates/storage-class-pg-optimized.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,23 @@ | ||
--- | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: sc-pg-optimized | ||
namespace: storage-heketi | ||
annotations: | ||
storageclass.kubernetes.io/is-default-class: "false" | ||
provisioner: kubernetes.io/glusterfs | ||
parameters: | ||
resturl: "http://{{ heketi_endpoint }}" | ||
volumetype: {{volumetype}} | ||
volumeoptions: | ||
performance.quick-read off, performance.read-ahead off, | ||
performance.io-cache off, performance.stat-prefetch off, | ||
performance.low-prio-threads 32, network.remote-dio enable, | ||
cluster.eager-lock enable, disperse.eager-lock enable, | ||
cluster.quorum-type auto, cluster.server-quorum-type server, | ||
cluster.data-self-heal-algorithm full, cluster.locking-scheme granular, | ||
cluster.shd-wait-qlength 10000, features.shard on, user.cifs off | ||
mountOptions: | ||
- entry-timeout=0 | ||
- attribute-timeout=0 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.