Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c2c8790

Browse files
authoredApr 20, 2024
Merge pull request #24 from MatMol96/main
Rook S3 Demo
2 parents 353a51b + 07bad45 commit c2c8790

15 files changed

+609
-0
lines changed
 

‎demos/demo-rook-s3/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
- dev
2+
- controller
3+
- demos
4+
- demo-rook-s3
5+
- README.md
6+
- constants.sh
7+
- s3-policy.json
8+
- object.yaml
9+
- object-bucket-claim-delete.yaml
10+
- storageclass-bucket-delete.yaml
11+
- traefik-ingress.yaml
12+
13+
# CMDS
14+
15+
```kubectl apply -f rook-object-store.yaml```
16+
will create the ceph object store into the rook-ceph namespace
17+
18+
```kubectl apply -f rook-storageclass.yaml``` will create the storage class for the object created above
19+
20+
```kubectl apply -f rook-object-bucket-claim.yaml```
21+
will create the OBC into the namespace nuvolaris
22+
23+
```kubectl apply -f traefik-ingress.yaml```
24+
will create the traefik ingress for the rook-bucket
25+
26+
```kubectl apply -f rook-nginx-cm.yaml```
27+
will create the config map for rook-nginx
28+
29+
```kubectl apply -f rook-static-sts.yaml```
30+
will create the stateful set for rook-nginx
31+
32+
```kubectl apply -f rook-nginx-static-svc.yaml```
33+
will create the service for rook-nginx
34+
35+
```kubectl apply -f rook-middleware.yaml```
36+
will create the middleware for rook-nginx
37+
38+
```kubectl apply -f rook-nginx-static-ingress.yaml```
39+
will create the ingress for rook-nginx
40+
41+
```aws s3api put-bucket-policy --policy file://s3-policy.json --endpoint-url=https://rook-s3.metlabs.cloud --bucket ceph-bkt-57332554-f148-44e0-a988-d55773f79d8a```
42+
set the public access policy S3
43+
44+
45+
# TO-DO
46+
- [X] middleware ingress to rook-ceph
47+
- [ ] perfezionare installazione objectstore
48+
- [ ] gestione affinity sul OS
49+
- [ ] installazione StorageClass DEL BUCKET che usa OS di cui sopra
50+
- [ ] (optional) User Management granting access to 2 or more buckets to a user

‎demos/demo-rook-s3/constants.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
AWS_HOST=$(kubectl -n nuvolaris get cm ceph-bucket -o jsonpath='{.data.BUCKET_HOST}')
19+
PORT=$(kubectl -n nuvolaris get cm ceph-bucket -o jsonpath='{.data.BUCKET_PORT}')
20+
BUCKET_NAME=$(kubectl -n nuvolaris get cm ceph-bucket -o jsonpath='{.data.BUCKET_NAME}')
21+
AWS_ACCESS_KEY_ID=$(kubectl -n nuvolaris get secret ceph-bucket -o jsonpath='{.data.AWS_ACCESS_KEY_ID}' | base64 --decode)
22+
AWS_SECRET_ACCESS_KEY=$(kubectl -n nuvolaris get secret ceph-bucket -o jsonpath='{.data.AWS_SECRET_ACCESS_KEY}' | base64 --decode)
23+
24+
echo $AWS_HOST
25+
echo $PORT
26+
echo $BUCKET_NAME
27+
echo $AWS_ACCESS_KEY_ID
28+
echo $AWS_SECRET_ACCESS_KEY
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
apiVersion: objectbucket.io/v1alpha1
19+
kind: ObjectBucketClaim
20+
metadata:
21+
name: ceph-bucket
22+
namespace: nuvolaris
23+
spec:
24+
generateBucketName: ceph-bkt
25+
storageClassName: rook-ceph-bucket

‎demos/demo-rook-s3/object.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
apiVersion: ceph.rook.io/v1
19+
kind: CephObjectStore
20+
metadata:
21+
name: my-store
22+
namespace: rook-ceph
23+
spec:
24+
metadataPool:
25+
failureDomain: host
26+
replicated:
27+
size: 3
28+
dataPool:
29+
failureDomain: host
30+
# For production it is recommended to use more chunks, such as 4+2 or 8+4
31+
erasureCoded:
32+
dataChunks: 2
33+
codingChunks: 1
34+
preservePoolsOnDelete: true
35+
gateway:
36+
sslCertificateRef:
37+
port: 80
38+
# securePort: 443
39+
instances: 1
40+
#externalRgwEndpoints:
41+
# - ip: "192.168.122.1"
42+
#service:
43+
# annotations:
44+
# # Add the bucket DNS names
45+
# external-dns.alpha.kubernetes.io/hostname: rook-bucket.metlabs.cloud
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
apiVersion: traefik.containo.us/v1alpha1
19+
kind: Middleware
20+
metadata:
21+
name: rook-static-ingress-add-prefix
22+
namespace: nuvolaris
23+
spec:
24+
addPrefix:
25+
prefix: /ceph-bkt-57332554-f148-44e0-a988-d55773f79d8a

‎demos/demo-rook-s3/rook-nginx-cm.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
apiVersion: v1
19+
data:
20+
default.conf: "server {\n listen 8080;\n server_name localhost;\n\n client_max_body_size
21+
1000M;\n\n #access_log /var/log/nginx/host.access.log main;\n\n #location
22+
/ {\n # root /usr/share/nginx/html;\n # index index.html index.htm;\n
23+
\ #}\n\n location / { \n rewrite ^/$ ${request_uri}index.html break;
24+
\ \n rewrite ^([^.]*[^/])$ $1/;\n rewrite (.*)/$ $1/index.html;
25+
\ \n\n proxy_hide_header x-amz-id-2;\n proxy_hide_header
26+
\ x-amz-meta-etag;\n proxy_hide_header x-amz-request-id;\n proxy_hide_header
27+
\ x-amz-meta-server-side-encryption;\n proxy_hide_header x-amz-server-side-encryption;
28+
\ \n proxy_set_header Host $http_host;\n\n proxy_pass http://rook-ceph-rgw-my-store.rook-ceph.svc.cluster.local:80/;\n
29+
\ \n error_page 301 404 = @spa;\n proxy_intercept_errors on; \n
30+
\ proxy_redirect off;\n } \n\n location @spa {\n rewrite (.*)-web(.*)
31+
$1-web/index.html;\n proxy_pass http://rook-ceph-rgw-my-store.rook-ceph.svc.cluster.local:80;\n
32+
\ error_page 404 = /404.html;\n proxy_intercept_errors on;\n } \n\n
33+
\ error_page 404 /404.html;\n\n location = /404.html {\n root
34+
\ /usr/share/nginx/html;\n }\n\n # redirect server error pages to the static
35+
page /50x.html\n #\n error_page 500 502 503 504 /50x.html;\n location =
36+
/50x.html {\n root /usr/share/nginx/html;\n }\n\n}\n"
37+
nginx.conf: "worker_processes auto;\n\nerror_log /var/log/nginx/error.log notice;\npid
38+
\ /tmp/nginx.pid;\n\nevents {\n worker_connections 1024;\n}\n\nhttp
39+
{\n proxy_temp_path /tmp/proxy_temp;\n client_body_temp_path /tmp/client_temp;\n
40+
\ fastcgi_temp_path /tmp/fastcgi_temp;\n uwsgi_temp_path /tmp/uwsgi_temp;\n
41+
\ scgi_temp_path /tmp/scgi_temp;\n \n client_max_body_size 1000M;\n\n
42+
\ include /etc/nginx/mime.types;\n default_type application/octet-stream;\n\n
43+
\ log_format main '$remote_addr - $remote_user [$time_local] \"$request\"
44+
'\n '$status $body_bytes_sent \"$http_referer\" '\n '\"$http_user_agent\"
45+
\"$http_x_forwarded_for\" - \"$http_host\"';\n\n access_log /var/log/nginx/access.log
46+
\ main;\n\n sendfile on;\n #tcp_nopush on;\n\n keepalive_timeout
47+
\ 65;\n\n #gzip on;\n\n include /etc/nginx/conf.d/*.conf;\n} "
48+
kind: ConfigMap
49+
metadata:
50+
name: rook-static-conf-cm
51+
namespace: nuvolaris
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
apiVersion: networking.k8s.io/v1
19+
kind: Ingress
20+
metadata:
21+
annotations:
22+
kubernetes.io/ingress.class: traefik
23+
nginx.ingress.kubernetes.io/proxy-body-size: 1024m
24+
traefik.ingress.kubernetes.io/router.middlewares: nuvolaris-rook-static-ingress-add-prefix@kubernetescrd
25+
traefik.ingress.kubernetes.io/transport.respondingTimeouts.idleTimeout: "600"
26+
traefik.ingress.kubernetes.io/transport.respondingTimeouts.readTimeout: "600"
27+
traefik.ingress.kubernetes.io/transport.respondingTimeouts.writeTimeout: "600"
28+
name: apihost-static-rook-ingress
29+
namespace: nuvolaris
30+
spec:
31+
rules:
32+
- host: rook.metlabs.cloud
33+
http:
34+
paths:
35+
- backend:
36+
service:
37+
name: rook-static-svc
38+
port:
39+
number: 8080
40+
path: /
41+
pathType: Prefix
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
apiVersion: v1
19+
kind: Service
20+
metadata:
21+
labels:
22+
app: rook-static
23+
name: rook-static-svc
24+
namespace: nuvolaris
25+
spec:
26+
ports:
27+
- name: http
28+
port: 8080
29+
protocol: TCP
30+
targetPort: 8080
31+
selector:
32+
app: rook-static
33+
sessionAffinity: None
34+
type: ClusterIP
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
apiVersion: objectbucket.io/v1alpha1
19+
kind: ObjectBucketClaim
20+
metadata:
21+
name: ceph-bucket
22+
namespace: nuvolaris
23+
spec:
24+
generateBucketName: ceph-bkt
25+
storageClassName: rook-ceph-bucket
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
apiVersion: ceph.rook.io/v1
19+
kind: CephObjectStore
20+
metadata:
21+
name: my-store
22+
namespace: rook-ceph
23+
spec:
24+
metadataPool:
25+
failureDomain: host
26+
replicated:
27+
size: 3
28+
dataPool:
29+
failureDomain: host
30+
# For production it is recommended to use more chunks, such as 4+2 or 8+4
31+
erasureCoded:
32+
dataChunks: 2
33+
codingChunks: 1
34+
preservePoolsOnDelete: true
35+
gateway:
36+
sslCertificateRef:
37+
port: 80
38+
# securePort: 443
39+
instances: 1
40+
#externalRgwEndpoints:
41+
# - ip: "192.168.122.1"
42+
#service:
43+
# annotations:
44+
# # Add the bucket DNS names
45+
# external-dns.alpha.kubernetes.io/hostname: rook-bucket.metlabs.cloud
There was a problem loading the remainder of the diff.

0 commit comments

Comments
 (0)
Please sign in to comment.