Skip to content

Commit

Permalink
[stable/cloudserver]: add Cloudserver chart (helm#9133)
Browse files Browse the repository at this point in the history
Signed-off-by: Giacomo Guiulfo <[email protected]>
  • Loading branch information
giacomoguiulfo authored and k8s-ci-robot committed Dec 3, 2018
1 parent 713d737 commit f06383c
Show file tree
Hide file tree
Showing 22 changed files with 916 additions and 0 deletions.
22 changes: 22 additions & 0 deletions stable/cloudserver/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
OWNERS
15 changes: 15 additions & 0 deletions stable/cloudserver/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: cloudserver
version: 1.0.0
appVersion: 8.1.1
kubeVersion: "^1.8.0-0"
description: An open-source Node.js implementation of the Amazon S3 protocol on the front-end and backend storage capabilities to multiple clouds, including Azure and Google.
home: https://www.zenko.io/cloudserver/
icon: https://cdn.jsdelivr.net/gh/scality/cloudserver@development/8.1/res/scality-cloudserver-logo.png
sources:
- https://github.com/scality/cloudserver
maintainers:
- name: giacomoguiulfo
email: [email protected]
- name: ssalaues
email: [email protected]
engine: gotpl
4 changes: 4 additions & 0 deletions stable/cloudserver/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
approvers:
- giacomoguiulfo
reviewers:
- giacomoguiulfo
106 changes: 106 additions & 0 deletions stable/cloudserver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Cloudserver Helm Chart

[Cloudserver](https://github.com/scality/cloudserver) is an open-source Node.js implementation of the Amazon S3 protocol on the front-end and backend storage capabilities to multiple clouds, including Azure and Google.

## TL;DR;

```console
$ helm install stable/cloudserver
```

## Introduction

This chart bootstraps a [Cloudserver](https://github.com/scality/cloudserver) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Installing the Chart

To install the chart with the release name `my-release`:

```console
$ helm install --name my-release stable/cloudserver
```

The command above deploys Cloudserver on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.

> **Tip**: List all releases using `helm list`
## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:

```console
$ helm delete my-release
```

The command above removes all the Kubernetes components associated with the chart and deletes the release.

## Configuration

The following table lists the configurable parameters of the Cloudserver chart and their default values.

Parameter | Description | Default
--------- | ----------- | -------
`serviceAccounts.api.create` | If true, create the cloudserver api service account | `true`
`serviceAccounts.api.name` | name of the cloudserver api service account to use or create | `{{ cloudserver.api.fullname }}`
`serviceAccounts.localdata.create` | If true, create the cloudserver localdata service account | `true`
`serviceAccounts.localdata.name` | name of the cloudserver localdata service account to use or create | `{{ cloudserver.localdata.fullname }}`
`image.repository` | cloudserver image repository | `zenko/cloudserver`
`image.tag` | cloudserver image tag | `8.1.1`
`image.pullPolicy` | cloudserver image pullPolicy | `IfNotPresent`
`api.replicaCount` | number of api replicas | `1`
`api.locationConstraints` | cloudserver location constraint configuration | `{}`
`api.credentials.accessKey` | cloudserver api access key | `my-access-key`
`api.credentials.secretKey` | cloudserver api secret key | `my-secret-key`
`api.logLevel` | cloudserver api log level | `info`
`api.env` | additional environmental variables for the cloudserver api | `{}`
`api.proxy.http` | HTTP proxy endpoint | `""`
`api.proxy.https` | HTTPS proxy endpoint | `""`
`api.proxy.caCert` | If true, add an additional trusted certificate | `false`
`api.proxy.no_proxy` | exceptions to proxification | `""`
`api.service.type` | api service type | `ClusterIP`
`api.service.port` | api service port | `80`
`api.service.annotations` | api service annotations | `{}`
`api.endpoint` | allowed virtual hosts for external access | `cloudserver.local`
`api.ingress.enabled` | If true, an ingress will be created for the api | `false`
`api.ingress.annotations` | api ingress annotations | `{}`
`api.ingress.path` | api ingress path | `/`
`api.ingress.hosts` | api ingress hostnames | `[]`
`api.ingress.tls` | api ingress TLS configuration | `[]`
`api.resources` | api resource requests and limits | `{}`
`api.nodeSelector` | api node selector labels for pod assignment | `{}`
`api.tolerations` | api toleration for pod assignment | `[]`
`api.affinity` | api affinity for pod assignment | `{}`
`api.autoscaling.enabled` | If true, create an HPA for the api | `false`
`api.config.minReplicas` | Minimum number of replicas for the HPA | `1`
`api.config.maxReplicas` | Maximum number of replicas for the HPA | `1`
`api.config.targetCPUUtilizationPercentage` | Target CPU utilisation percentage to scale | `80`
`localdata.replicaCount` | localdata replica count | `1`
`localdata.persistentVolume.enabled` | If true, create a Persistent Volume Claim for localdata | `true`
`localdata.persistentVolume.accessModes` | localdata Persistent Volume access modes | `ReadWriteOnce`
`localdata.persistentVolume.annotations` | Annotations for localdata Persistent Volume Claim | `{}`
`localdata.persistentVolume.existingClaim` | localdata Persistent Volume existing claim name | `""`
`localdata.persistentVolume.size` | localdata Persistent Volume size | `1Gi`
`localdata.resources` | local resource requests and limits | `{}`
`mongodb-replicaset.enabled` | If true, install the MongoDB-Replicaset chart | `true`
`mongodb-replicaset.replicas` | Number of replicas in the replica set | `1`
`mongodb-replicaset.replicaSetName` | The name of the replica set | `rs0`
`mongodb-replicaset.securityContext` | Security context for the pod | `{runAsUser: 1000, fsGroup: 1000, runAsNonRoot: true}`
`redis-ha.enabled` | If true, install the Redis-HA chart | `true`
`redis-ha.replicas` | Number of redis master/slave pods | `1`
`redis-ha.redis.masterGroupName` | Redis convention for naming the cluster group | `cloudserver`
`redis-ha.affinity` | Redis affinity for pod assignment | `[]`

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

```console
$ helm install stable/cloudserver --name my-release \
--set api.replicaCount=5
```

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,

```console
$ helm install stable/cloudserver --name my-release -f values.yaml
```

> **Tip**: You can use the default [values.yaml](values.yaml)
9 changes: 9 additions & 0 deletions stable/cloudserver/requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies:
- name: mongodb-replicaset
repository: https://kubernetes-charts.storage.googleapis.com/
version: 3.6.4
- name: redis-ha
repository: https://kubernetes-charts.storage.googleapis.com/
version: 3.0.0
digest: sha256:15624e33ccf6210875d1a161a0f9fce1590b4eac2d63e8e500681c32a935241b
generated: 2018-11-09T15:09:41.071858438-08:00
9 changes: 9 additions & 0 deletions stable/cloudserver/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies:
- name: mongodb-replicaset
version: 3.6.4
repository: "https://kubernetes-charts.storage.googleapis.com/"
condition: mongodb-replicaset.enabled
- name: redis-ha
version: 3.0.0
repository: "https://kubernetes-charts.storage.googleapis.com/"
condition: redis-ha.enabled
19 changes: 19 additions & 0 deletions stable/cloudserver/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
1. Get the application URL by running these commands:
{{- if .Values.api.ingress.enabled }}
{{- range .Values.api.ingress.hosts }}
http{{ if $.Values.api.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.api.ingress.path }}
{{- end }}
{{- else if contains "NodePort" .Values.api.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "cloudserver.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.api.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "cloudserver.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "cloudserver.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.api.service.port }}
{{- else if contains "ClusterIP" .Values.api.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "cloudserver.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8000 to use your application"
kubectl port-forward $POD_NAME 8000:8000
{{- end }}
116 changes: 116 additions & 0 deletions stable/cloudserver/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "cloudserver.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "cloudserver.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create a default fully qualified name for the cloudserver data app.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "cloudserver.localdata.fullname" -}}
{{- if .Values.localdata.fullnameOverride -}}
{{- .Values.localdata.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- printf "%s-localdata" .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s-localdata" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "cloudserver.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the name of the service account to use for the api component
*/}}
{{- define "cloudserver.serviceAccountName.api" -}}
{{- if .Values.serviceAccounts.api.create -}}
{{ default (include "cloudserver.fullname" .) .Values.serviceAccounts.api.name }}
{{- else -}}
{{ default "default" .Values.serviceAccounts.api.name }}
{{- end -}}
{{- end -}}

{{/*
Create the name of the service account to use for the localdata component
*/}}
{{- define "cloudserver.serviceAccountName.localdata" -}}
{{- if .Values.serviceAccounts.localdata.create -}}
{{ default (include "cloudserver.localdata.fullname" .) .Values.serviceAccounts.localdata.name }}
{{- else -}}
{{ default "default" .Values.serviceAccounts.localdata.name }}
{{- end -}}
{{- end -}}

{{/*
Create a default fully qualified mongodb-replicaset name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "cloudserver.mongodb-replicaset.fullname" -}}
{{- $name := default "mongodb-replicaset" (index .Values "mongodb-replicaset" "nameOverride") -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the MongoDB URL. If MongoDB is installed as part of this chart, use k8s service discovery,
else use user-provided URL.
*/}}
{{- define "mongodb-replicaset.url" -}}
{{- if (index .Values "mongodb-replicaset" "enabled") -}}
{{- $count := (int (index .Values "mongodb-replicaset" "replicas")) -}}
{{- $release := .Release.Name -}}
{{- range $v := until $count }}{{ $release }}-mongodb-replicaset-{{ $v }}.{{ $release }}-mongodb-replicaset:27017{{ if ne $v (sub $count 1) }},{{- end -}}{{- end -}}
{{- else -}}
{{- index .Values "mongodb-replicaset" "url" -}}
{{- end -}}
{{- end -}}

{{/*
Create a default fully qualified redis-ha name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "cloudserver.redis-ha.fullname" -}}
{{- $name := default "redis-ha" (index .Values "redis-ha" "nameOverride") -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the Redis-HA URL. If Redis-HA is installed as part of this chart, use k8s service discovery,
else use user-provided URL.
*/}}
{{- define "redis-ha.url" -}}
{{- if (index .Values "redis-ha" "enabled") -}}
{{- $count := (int (index .Values "redis-ha" "replicas")) -}}
{{- $release := .Release.Name -}}
{{- range $v := until $count }}{{ $release }}-redis-ha-server-{{ $v }}.{{ $release }}-redis-ha:26379{{ if ne $v (sub $count 1) }},{{- end -}}{{- end -}}
{{- else -}}
{{- index .Values "redis-ha" "url" -}}
{{- end -}}
{{- end -}}
15 changes: 15 additions & 0 deletions stable/cloudserver/templates/api-certificate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if .Values.api.proxy.caCert -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "cloudserver.fullname" . }}-cacert
labels:
app: {{ template "cloudserver.name" . }}
chart: {{ template "cloudserver.chart" . }}
component: api
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
type: Opaque
data:
{{ (.Files.Glob "ca.crt").AsSecrets | indent 2 }}
{{- end -}}
13 changes: 13 additions & 0 deletions stable/cloudserver/templates/api-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "cloudserver.fullname" . }}
labels:
app: {{ template "cloudserver.name" . }}
chart: {{ template "cloudserver.chart" . }}
component: api
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
data:
locationConfig.json: |
{{ toJson .Values.api.locationConstraints }}
Loading

0 comments on commit f06383c

Please sign in to comment.