Skip to content

Commit 6f39b83

Browse files
committed
docs: add install and usage doc
Signed-off-by: Chris Blum <[email protected]>
1 parent 309aff1 commit 6f39b83

File tree

2 files changed

+158
-0
lines changed

2 files changed

+158
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# lvm-operator
2+
23
Operator that manages Topolvm
34

45
# Contents
6+
57
- [docs/design](doc/design/)
8+
9+
Learn how to install and use this Operator with [the install documentation](doc/usage/install.md).

doc/usage/install.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Using the LVM-Operator
2+
3+
Because there currently is no CI pipeline that builds this repo, you will either have to build it yourself, or use a prebuilt state made available. The prebuilt state might be out of sync with what is currently in the repo
4+
5+
## Preparations
6+
7+
### Building the Operator yourself
8+
9+
Building the operator is easy. Just make sure you have docker or podman installed on your system and that you are logged into your registry (quay.io, docker, ...)
10+
11+
Set the environment variable `IMG` to the new repository path where you want to host your image:
12+
13+
```
14+
export IMG=quay.io/USER/lvm-operator
15+
```
16+
17+
Then start the build process like this:
18+
19+
```
20+
make docker-build-combined docker-push
21+
```
22+
23+
Ensure that the new repository in your registry is either set to public or that your target OpenShift cluster has read access to that repository.
24+
25+
When this is finished, you are ready to continue with the deploy steps
26+
27+
### Using the pre-built image
28+
29+
If you are ok with using the prebuilt images, then just set your variable like this:
30+
31+
```
32+
export IMG=quay.io/mulbc/lvm-operator
33+
```
34+
35+
## Deploy
36+
37+
Ensured that your `IMG` variable is set to a repository that contains the operator.
38+
Afterwards ensure that you are connected to the right cluster:
39+
40+
```
41+
oc get nodes
42+
```
43+
44+
After you have ensured both, you can start the deployment with
45+
46+
```
47+
make deploy
48+
```
49+
50+
After this has finished successfully, you should switch over to the lvm-operator namespace:
51+
52+
`oc project lvm-operator-system`
53+
54+
Please wait until all Pods are finished running:
55+
56+
```
57+
oc get pods -w
58+
```
59+
60+
After the controller is running, create the sample lvmCluster CR:
61+
62+
```
63+
oc create -f https://github.com/red-hat-storage/lvm-operator/raw/main/config/samples/lvm_v1alpha1_lvmcluster.yaml
64+
```
65+
66+
This will try to leverage all nodes and all available disks on these nodes.
67+
68+
Again please wait until all Pods are finished running:
69+
70+
```
71+
oc get pods -w
72+
```
73+
74+
The `topolvm-node` pod will be in init until `vg-manager` has done all the preparation and this might take a while.
75+
76+
After all Pods are running, you will get a storage class that you can use when creating a PVCs:
77+
78+
```
79+
oc get sc
80+
81+
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
82+
topolvm-vg1 topolvm.cybozu.com Delete WaitForFirstConsumer true 3m44s
83+
```
84+
85+
## Test
86+
87+
After the operator is installed and the Cluster is set up, you can start by creating a simple test application that will consume storage:
88+
89+
Create the PVC:
90+
91+
```yaml
92+
cat <<EOF | oc apply -f -
93+
apiVersion: v1
94+
kind: PersistentVolumeClaim
95+
metadata:
96+
name: lvmpvc
97+
labels:
98+
type: local
99+
spec:
100+
storageClassName: topolvm-vg1
101+
resources:
102+
requests:
103+
storage: 5Gi
104+
accessModes:
105+
- ReadWriteOnce
106+
volumeMode: Filesystem
107+
EOF
108+
```
109+
110+
You will see that the PVC will be stuck in the pending state:
111+
112+
```
113+
oc get pvc
114+
115+
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
116+
lvmpvc Pending topolvm-vg1 7s
117+
```
118+
119+
That's because our Storage Class is waiting for a Pod that needs that PVC, before it is created. So let's create a Pod for this PVC.
120+
121+
```yaml
122+
cat <<EOF | oc apply -f -
123+
apiVersion: v1
124+
kind: Pod
125+
metadata:
126+
name: lvmpod
127+
spec:
128+
volumes:
129+
- name: storage
130+
persistentVolumeClaim:
131+
claimName: lvmpvc
132+
containers:
133+
- name: container
134+
image: nginx
135+
ports:
136+
- containerPort: 80
137+
name: "http-server"
138+
volumeMounts:
139+
- mountPath: "/usr/share/nginx/html"
140+
name: storage
141+
EOF
142+
```
143+
144+
After we added the Pod, the PVC will be bound and the Pod will eventually be Running:
145+
146+
```
147+
oc get pvc,pods
148+
149+
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
150+
persistentvolumeclaim/lvmpvc Bound pvc-a37ef71c-a9b9-45d8-96e8-3b5ad30a84f6 5Gi RWO topolvm-vg1 3m2s
151+
152+
NAME READY STATUS RESTARTS AGE
153+
pod/lvmpod 1/1 Running 0 28s
154+
```

0 commit comments

Comments
 (0)