Skip to content

Commit 068a2d9

Browse files
committed
Create helm chart for the cdn component
1 parent fc2b631 commit 068a2d9

10 files changed

Lines changed: 37 additions & 26 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v2
2+
name: understack-cdn
3+
description: HTTP service to serve firmware images from central store
4+
type: application
5+
version: 0.1.0

components/understack-cdn/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,15 @@ cluster-local tendot IP address.
1212

1313
The proxy edge service caches files locally on a persistent volume.
1414

15-
Nginx configuration contains:
16-
- the service address for rook-ceph
17-
- the name of our bucket
18-
19-
All files are proxied to that object bucket. Anonymous credentials are used,
15+
All files are proxied to our object bucket. Anonymous credentials are used,
2016
therefore we need to make the files in our bucket readable by anonymous if they
2117
are to be accessible via HTTP.
2218

2319
## Uploading file to object storage
2420

21+
We have an ObjectBucket provisioned via rook/ceph. The operator for our
22+
ObjectBucketClaim creates credentials for us to access this bucket.
23+
2524
Our credentials and bucket info is in a secret and a configmap both named after
2625
the bucketclaim:
2726

components/understack-cdn/kustomization.yaml

Lines changed: 0 additions & 9 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.

components/understack-cdn/nginx-config.yaml renamed to components/understack-cdn/templates/nginx-config.yaml.tpl

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ data:
4343
proxy_cache_path /var/cache/nginx/cdn
4444
levels=1:2
4545
keys_zone=cdn_cache:50m
46-
max_size=5g
47-
inactive=7d
46+
max_size={{ .Values.cdn.cacheSize }}
47+
inactive={{ .Values.cdn.inactive }}
4848
use_temp_path=off;
4949

5050
# Don't buffer large files to disk before sending — stream them
@@ -64,11 +64,8 @@ data:
6464
include /etc/nginx/conf.d/*.conf;
6565
}
6666
default.conf: |
67-
# Upstream: your S3 S3 origin
68-
# In production this points at your S3 service endpoint.
69-
# Can also point at R2/S3 by changing the server and Host header.
7067
upstream s3_origin {
71-
server rook-ceph-rgw-ceph-objectstore.rook-ceph.svc:80;
68+
server {{ .Values.cdn.objectStorageServerHostname }}:{{ .Values.cdn.objectStorageServerPort }};
7269
keepalive 32;
7370
}
7471
@@ -102,10 +99,10 @@ data:
10299
proxy_no_cache 0;
103100
proxy_ignore_headers Cache-Control Expires Set-Cookie;
104101
105-
location /firmware-images/ {
102+
location /{{ .Values.cdn.bucketName }}/ {
106103
# Forward to Object Storage.
107-
# S3-compatible API expects requests in the form: /bucket/key
108-
# Our bucket is called firmware-images
104+
# S3-compatible API expects requests in the form: /bucket-name/key
105+
# Our clients are using URL paths in the exact same format.
109106
proxy_pass http://s3_origin$request_uri;
110107
111108
proxy_http_version 1.1;

components/understack-cdn/object-bucket-claim.yaml renamed to components/understack-cdn/templates/object-bucket-claim.yaml.tpl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
{{- if .Values.cdn.objectBucketIsLocal }}
12
apiVersion: objectbucket.io/v1alpha1
23
kind: ObjectBucketClaim
34
metadata:
4-
name: firmware-images
5+
name: {{ .Values.cdn.bucketName }}
56
namespace: understack-cdn
67
spec:
7-
bucketName: firmware-images
8+
bucketName: {{ .Values.cdn.bucketName }}
89
storageClassName: ceph-bucket
910
additionalConfig:
1011
maxObjects: "1000"
11-
maxSize: "5G"
12+
maxSize: {{ .Values.cdn.bucketMaxSize }}
13+
{{- end }}
File renamed without changes.
File renamed without changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
cdn:
2+
# Cache is limited to this size. We will provision a volume this size so
3+
# changing it would require the filesystem to be rebuilt/resized:
4+
cacheSize: 10g
5+
# Files are evicted from the cache if they have not been accessed in:
6+
inactive: 7d
7+
8+
# The location of our object bucket (s3-compatible object store) providing us
9+
# with anonymous access to our image files:
10+
objectStorageServerHostname: rook-ceph-rgw-ceph-objectstore.rook-ceph.svc
11+
objectStorageServerPort: 80
12+
bucketName: firmware-images
13+
14+
# Whether to create a local ObjectBucketClaim (true) or use external storage (false)
15+
objectBucketIsLocal: false
16+
# If above is true, how much space to claim for this object bucket:
17+
bucketMaxSize: 40g

0 commit comments

Comments
 (0)