Skip to content

Commit 08260a4

Browse files
authored
Merge pull request #1 from humblec/migrate
Migrate gluster file from external-storage/tree/master/gluster/file
2 parents 1a4f94e + 4160a1f commit 08260a4

File tree

2,615 files changed

+822178
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,615 files changed

+822178
-0
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# v0.0
2+
- Initial drop of Gluster File Provisioner.
3+
- Humble Chirammal <[email protected]>
4+

Dockerfile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2018 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM centos:7
16+
17+
MAINTAINER Humble Chirammal <[email protected]>
18+
19+
ADD glusterfile-provisioner /usr/local/bin/glusterfile-provisioner
20+
21+
ENTRYPOINT ["/usr/local/bin/glusterfile-provisioner"]

Makefile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2018 The Kubernetes Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
CMDS=glusterfile-provisioner
16+
all: build
17+
18+
include release-tools/build.make
19+

README.md

+137
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,142 @@
11
# Gluster File Dynamic Volume Provisioner
22

3+
4+
# glusterfile Volume Provisioner for Kubernetes 1.5+
5+
6+
[![Docker Repository on Quay](https://quay.io/repository/external_storage/glusterfile-provisioner/status "Docker Repository on Quay")](https://quay.io/repository/external_storage/glusterfile-provisioner)
7+
```
8+
quay.io/external_storage/glusterfile-provisioner:latest
9+
```
10+
## What is Gluster File Provisioner ?
11+
12+
Gluster File Provisioner is an external provisioner which dynamically provisions gluster file volumes on demand. The persistentVolumeClaim which has been requested with this external provisioner's identity (for e.g.# `gluster.org/glusterfile`) will be served by this provisioner.
13+
14+
This project is related to and relies on the following projects:
15+
16+
* [glusterfs](https://github.com/gluster/glusterfs)
17+
* [heketi](https://github.com/heketi/heketi)
18+
* [gluster-kubernetes](https://github.com/gluster/gluster-kubernetes)
19+
20+
## Build Gluster File Provisioner and container image
21+
22+
If you want to build the container from source instead of pulling the docker image, please follow below steps:
23+
24+
Step 1: Build the provisioner binary
25+
```
26+
[root@localhost]# go build glusterfile-provisioner.go
27+
```
28+
29+
Step 2: Get Gluster File Provisioner Container image
30+
```
31+
[root@localhost]# docker pull quay.io/external_storage/glusterfile-provisioner:latest
32+
```
33+
34+
## Start Kubernetes Cluster
35+
The following steps assume you have a Kubernetes cluster up and running
36+
37+
## Start glusterfile provisioner
38+
39+
The following example uses `gluster.org/glusterfile` as the identity for the instance and assumes kubeconfig is at `/root/.kube`. The identity should remain the same if the provisioner restarts. If there are multiple provisioners, each should have a different identity.
40+
41+
```
42+
[root@localhost] docker run -ti -v /root/.kube:/kube -v /var/run/kubernetes:/var/run/kubernetes --privileged --net=host glusterfile-provisioner -master=http://127.0.0.1:8080 -kubeconfig=/kube/config -id=gluster.org/glusterfile
43+
```
44+
45+
## Create a glusterfile StorageClass
46+
47+
```
48+
[root@localhost] kubectl create -f examples/class.yaml
49+
```
50+
51+
The available storageclass parameters are listed below:
52+
53+
```yaml
54+
parameters:
55+
resturl: "http://127.0.0.1:8081"
56+
restuser: "admin"
57+
restsecretnamespace: "default"
58+
restsecretname: "heketi-secret"
59+
clusterid: "454811fcedbec6316bc10e591a57b472"
60+
volumetype: "replicate:3"
61+
volumeoptions: "features.shard enable"
62+
volumenameprefix: "dept-dev"
63+
smartclone: "true"
64+
snapfactor: "10"
65+
```
66+
67+
* `resturl` : Gluster REST service/Heketi service url which provision gluster File volumes on demand. The general format should be `IPaddress:Port` and this is a mandatory parameter for glusterfile dynamic provisioner. If Heketi service is exposed as a routable service in openshift/kubernetes setup, this can have a format similar to
68+
`http://heketi-storage-project.cloudapps.mystorage.com` where the fqdn is a resolvable heketi service url.
69+
70+
* `restuser` : Gluster REST service/Heketi user who has access to create volumes in the Gluster Trusted Pool.
71+
72+
* `restsecretnamespace` + `restsecretname` : Identification of Secret instance that contains user password to use when talking to Gluster REST service. These parameters are optional, empty password will be used when both `restsecretnamespace` and `restsecretname` are omitted. The provided secret must have type "gluster.org/glusterfile".
73+
74+
* `gidMin` + `gidMax` : The minimum and maximum value of GID range for the storageclass. A unique value (GID) in this range ( gidMin-gidMax ) will be used for dynamically provisioned volumes. These are optional values. If not specified, the volume will be provisioned with a value between 2000-2147483647 which are defaults for gidMin and gidMax respectively.
75+
76+
* `clusterid`: It is the ID of the cluster which will be used by Heketi when provisioning the volume. It can also be a list of comma separated cluster IDs. This is an optional parameter.
77+
78+
Note
79+
To get the cluster ID, execute the following command:
80+
~~~
81+
# heketi-cli cluster list
82+
~~~
83+
* `volumetype` : The volume type and its parameters can be configured with this optional value. If the volume type is not mentioned, it's up to the provisioner to decide the volume type.
84+
For example:
85+
86+
'Replica volume':
87+
`volumetype: replicate:3` where '3' is replica count.
88+
'Disperse/EC volume':
89+
`volumetype: disperse:4:2` where '4' is data and '2' is the redundancy count.
90+
'Distribute volume':
91+
`volumetype: none`
92+
93+
For available volume types and its administration options refer: ([Administration Guide](http://docs.gluster.org/en/latest/Administrator%20Guide/Setting%20Up%20Volumes/))
94+
95+
* `volumeoptions` : This option allows to specify the gluster volume option which has to be set on the dynamically provisioned GlusterFS volume. The value string should be comma separated strings which need to be set on the volume. As shown in example, if you want to enable encryption on gluster dynamically provisioned volumes you can pass `client.ssl on, server.ssl on` options. This is an optional parameter.
96+
97+
For available volume options and its administration refer: ([Administration Guide](http://docs.gluster.org/en/latest/Administrator%20Guide/Managing%20Volumes/))
98+
99+
* `volumenameprefix` : By default dynamically provisioned volumes have the naming schema of `vol_UUID` format. With this option present in storageclass, an admin can now prefix the desired volume name from storageclass. If `volumenameprefix` storageclass parameter is set, the dynamically provisioned volumes are created in below format where `_` is the field separator/delimiter:
100+
101+
`volumenameprefix_Namespace_PVCname_randomUUID`
102+
103+
Please note that, the value for this parameter cannot contain `_` in storageclass. This is an optional parameter.
104+
105+
* `cloneenabled` : This option allows to create clone of PVCs if pvc is annotated with `k8s.io/CloneRequest`. The new PVC will be clone of pvc specified as the field value of `k8s.io/CloneRequest` annotation. This is an optional parameter and by default
106+
this option is false/disabled.
107+
108+
* `snapfactor`: Dynamically provisioned volume's thinpool size can be configured with this parameter. The value for the parameter should be in range of 1-100, this value will be taken into account while creating thinpool for the provisioned volume. This is an optional parameter with default value of 1.
109+
110+
Additional Reference:
111+
112+
([How to configure Gluster on Kubernetes](https://github.com/gluster/gluster-kubernetes/blob/master/docs/setup-guide.md))
113+
114+
([How to configure Heketi](https://github.com/heketi/heketi/wiki/Setting-up-the-topology))
115+
116+
When the persistent volumes are dynamically provisioned, the Gluster plugin automatically creates an endpoint and a headless service in the name `glusterfile-dynamic-<claimname>`. This dynamic endpoint and service will be deleted automatically when the persistent volume claim is deleted.
117+
118+
119+
## Testing: Create a PersistentVolumeClaim
120+
121+
```
122+
[root@localhost]# kubectl create -f examples/claim1.yaml
123+
persistentvolumeclaim "claim1" created
124+
125+
[root@localhost]# kubectl get pvc
126+
NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
127+
claim1 Bound pvc-b28a67ff-0fce-11e8-a7cb-c85b7636c232 1Gi RWX glusterfile 56s
128+
[root@localhost]# kubectl get pv
129+
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE
130+
pvc-b28a67ff-0fce-11e8-a7cb-c85b7636c232 1Gi RWX Delete Bound default/claim1 glusterfile 46s
131+
132+
[root@localhost]# kubectl get pvc,pv
133+
NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
134+
pvc/claim1 Bound pvc-b28a67ff-0fce-11e8-a7cb-c85b7636c232 1Gi RWX glusterfile 1m
135+
136+
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE
137+
pv/pvc-b28a67ff-0fce-11e8-a7cb-c85b7636c232 1Gi RWX Delete Bound default/claim1 glusterfile 1m
138+
```
139+
3140
## Community, discussion, contribution, and support
4141
5142
Learn how to engage with the Kubernetes community on the [community page](http://kubernetes.io/community/).

0 commit comments

Comments
 (0)