Skip to content

Commit

Permalink
Merge pull request #238 from arangodb/feature/helm-chart
Browse files Browse the repository at this point in the history
Adding helm charts for deploying the operators
  • Loading branch information
ewoutp authored Sep 4, 2018
2 parents 23b0283 + 588aca0 commit 676493f
Show file tree
Hide file tree
Showing 16 changed files with 597 additions and 45 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,17 @@ it is intended to be.
| Minikube | 1.10 | >= 3.3.13 | Runs | Not intended |
| Docker for Mac Edge | 1.10 | >= 3.3.13 | Runs | Not intended |

## Installation of latest release
## Installation of latest release using Helm

```bash
# The following will install the operator for `ArangoDeployment` &
# `ArangoDeplomentReplication` resources.
helm install https://github.com/arangodb/kube-arangodb/releases/download/0.2.2/kube-arangodb.tgz
# To use `ArangoLocalStorage`, also run
helm install https://github.com/arangodb/kube-arangodb/releases/download/0.2.2/kube-arangodb-storage.tgz
```

## Installation of latest release using Kubectl

```bash
kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/0.2.2/manifests/crd.yaml
Expand Down
91 changes: 91 additions & 0 deletions docs/Manual/Deployment/Kubernetes/Helm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Using the ArangoDB Kubernetes Operator with Helm

[`Helm`](https://www.helm.sh/) is a package manager for Kubernetes, which enables
you to install various packages (include the ArangoDB Kubernetes Operator)
into your Kubernetes cluster.

The benefit of `helm` (in the context of the ArangoDB Kubernetes Operator)
is that it allows for a lot of flexibility in how you install the operator.
For example you can install the operator in a namespace other than
`default`.

## Charts

The ArangoDB Kubernetes Operator is contained in two `helm` charts:

- `kube-arangodb` which contains the operator for the `ArangoDeployment`
and `ArangoDeploymentReplication` resource types.
- `kube-arangodb-storage` which contains the operator for the `ArangoLocalStorage`
resource type.

The `kube-arangodb-storage` only has to be installed if your Kubernetes cluster
does not already provide `StorageClasses` that use locally attached SSDs.

## Configurable values for ArangoDB Kubernetes Operator

The following values can be configured when installing the
ArangoDB Kubernetes Operator with `helm`.

Values are passed to `helm` using an `--set=<key>=<value>` argument passed
to the `helm install` or `helm upgrade` command.

### Values applicable to both charts

| Key | Type | Description
|-------------------|--------|-----|
| Image | string | Override the docker image used by the operators
| ImagePullPolicy | string | Override the image pull policy used by the operators. See [Updating Images](https://kubernetes.io/docs/concepts/containers/images/#updating-images) for details.
| RBAC.Create | bool | Set to `true` (default) to create roles & role bindings.

### Values applicable to the `kube-arangodb` chart

| Key | Type | Description
|-------------------|--------|-----|
| Deployment.Create | bool | Set to `true` (default) to deploy the `ArangoDeployment` operator
| Deployment.User.ServiceAccountName | string | Name of the `ServiceAccount` that is the subject of the `RoleBinding` of users of the `ArangoDeployment` operator
| Deployment.Operator.ServiceAccountName | string | Name of the `ServiceAccount` used to run the `ArangoDeployment` operator
| Deployment.Operator.ServiceType | string | Type of `Service` created for the dashboard of the `ArangoDeployment` operator
| Deployment.AllowChaos | bool | Set to `true` to allow the introduction of chaos. **Only use for testing, never for production!** Defaults to `false`.
| DeploymentReplication.Create | bool | Set to `true` (default) to deploy the `ArangoDeploymentReplication` operator
| DeploymentReplication.User.ServiceAccountName | string | Name of the `ServiceAccount` that is the subject of the `RoleBinding` of users of the `ArangoDeploymentReplication` operator
| DeploymentReplication.Operator.ServiceAccountName | string | Name of the `ServiceAccount` used to run the `ArangoDeploymentReplication` operator
| DeploymentReplication.Operator.ServiceType | string | Type of `Service` created for the dashboard of the `ArangoDeploymentReplication` operator

### Values applicable to the `kube-arangodb-storage` chart

| Key | Type | Description
|-------------------|--------|-----|
| Storage.User.ServiceAccountName | string | Name of the `ServiceAccount` that is the subject of the `RoleBinding` of users of the `ArangoLocalStorage` operator
| Storage.Operator.ServiceAccountName | string | Name of the `ServiceAccount` used to run the `ArangoLocalStorage` operator
| Storage.Operator.ServiceType | string | Type of `Service` created for the dashboard of the `ArangoLocalStorage` operator

## Alternate namespaces

The `kube-arangodb` chart supports deployment into a non-default namespace.

To install the `kube-arangodb` chart is a non-default namespace, use the `--namespace`
argument like this.

```bash
helm install --namespace=mynamespace kube-arangodb.tgz
```

Note that since the operators claim exclusive access to a namespace, you can
install the `kube-arangodb` chart in a namespace once.
You can install the `kube-arangodb` chart in multiple namespaces. To do so, run:

```bash
helm install --namespace=namespace1 kube-arangodb.tgz
helm install --namespace=namespace2 kube-arangodb.tgz
```

The `kube-arangodb-storage` chart is always installed in the `kube-system` namespace.

## Common problems

### Error: no available release name found

This error is given by `helm install ...` in some cases where it has
insufficient permissions to install charts.

For various ways to work around this problem go to [this Stackoverflow article](https://stackoverflow.com/questions/43499971/helm-error-no-available-release-name-found).
42 changes: 41 additions & 1 deletion docs/Manual/Deployment/Kubernetes/Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,38 @@
The ArangoDB Kubernetes Operator needs to be installed in your Kubernetes
cluster first.

To do so, run (replace `<version>` with the version of the operator that you want to install):
If you have `Helm` available, we recommend installation using `Helm`.

### Installation with Helm

To install the ArangoDB Kubernetes Operator with [`helm`](https://www.helm.sh/),
run (replace `<version>` with the version of the operator that you want to install):

```bash
export URLPREFIX=https://github.com/arangodb/kube-arangodb/releases/download/<version>
helm install $URLPREFIX/kube-arangodb.tgz
```

This installs operators for the `ArangoDeployment` and `ArangoDeploymentReplication`
resource types.

If you want to avoid the installation of the operator for the `ArangoDeploymentReplication`
resource type, add `--set=DeploymentReplication.Create=false` to the `helm install`
command.

To use `ArangoLocalStorage` resources, also run:

```bash
helm install $URLPREFIX/kube-arangodb-storage.tgz
```

For more information on installing with `Helm` and how to customize an installation,
see [Using the ArangoDB Kubernetes Operator with Helm](./Helm.md).

### Installation with Kubectl

To install the ArangoDB Kubernetes Operator without `Helm`,
run (replace `<version>` with the version of the operator that you want to install):

```bash
export URLPREFIX=https://raw.githubusercontent.com/arangodb/kube-arangodb/<version>/manifests
Expand Down Expand Up @@ -60,6 +91,14 @@ If you want to keep your data, make sure to create a backup before removing the
To remove the entire ArangoDB Kubernetes Operator, remove all
clusters first and then remove the operator by running:

```bash
helm delete <release-name-of-kube-arangodb-chart>
# If `ArangoLocalStorage` operator is installed
helm delete <release-name-of-kube-arangodb-storage-chart>
```

or when you used `kubectl` to install the operator, run:

```bash
kubectl delete deployment arango-deployment-operator
# If `ArangoLocalStorage` operator is installed
Expand All @@ -73,3 +112,4 @@ kubectl delete deployment arango-deployment-replication-operator
- [Driver configuration](./DriverConfiguration.md)
- [Scaling](./Scaling.md)
- [Upgrading](./Upgrading.md)
- [Using the ArangoDB Kubernetes Operator with Helm](./Helm.md)
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ .DeploymentReplication.FilterStart }}

apiVersion: extensions/v1beta1
kind: Deployment
Expand All @@ -14,6 +15,7 @@ spec:
name: {{ .DeploymentReplication.OperatorDeploymentName }}
app: arango-deployment-replication-operator
spec:
serviceAccountName: {{ .DeploymentReplication.Operator.ServiceAccountName }}
containers:
- name: operator
imagePullPolicy: {{ .ImagePullPolicy }}
Expand Down Expand Up @@ -59,3 +61,5 @@ spec:
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 5

{{ .DeploymentReplication.FilterEnd }}
7 changes: 5 additions & 2 deletions manifests/templates/deployment-replication/rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{{- if .RBAC -}}
{{ .DeploymentReplication.FilterStart }}
{{ .RBACFilterStart }}

## Cluster role granting access to ArangoDeploymentReplication resources.
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
Expand Down Expand Up @@ -72,4 +74,5 @@ subjects:
name: {{ .DeploymentReplication.Operator.ServiceAccountName }}
namespace: {{ .DeploymentReplication.Operator.Namespace }}

{{- end -}}
{{ .RBACFilterEnd }}
{{ .DeploymentReplication.FilterEnd }}
4 changes: 4 additions & 0 deletions manifests/templates/deployment-replication/service.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{ .DeploymentReplication.FilterStart }}

apiVersion: v1
kind: Service
metadata:
Expand All @@ -17,3 +19,5 @@ spec:
app: arango-deployment-replication-operator
role: leader
type: {{ .DeploymentReplication.Operator.ServiceType }}

{{ .DeploymentReplication.FilterEnd }}
4 changes: 4 additions & 0 deletions manifests/templates/deployment/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ .Deployment.FilterStart }}

apiVersion: extensions/v1beta1
kind: Deployment
Expand All @@ -14,6 +15,7 @@ spec:
name: {{ .Deployment.OperatorDeploymentName }}
app: arango-deployment-operator
spec:
serviceAccountName: {{ .Deployment.Operator.ServiceAccountName }}
containers:
- name: operator
imagePullPolicy: {{ .ImagePullPolicy }}
Expand Down Expand Up @@ -60,3 +62,5 @@ spec:
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 5

{{ .Deployment.FilterEnd }}
7 changes: 5 additions & 2 deletions manifests/templates/deployment/rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{{- if .RBAC -}}
{{ .Deployment.FilterStart }}
{{ .RBACFilterStart }}

## Cluster role granting access to ArangoDeployment resources.
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
Expand Down Expand Up @@ -72,4 +74,5 @@ subjects:
name: {{ .Deployment.Operator.ServiceAccountName }}
namespace: {{ .Deployment.Operator.Namespace }}

{{- end -}}
{{ .RBACFilterEnd }}
{{ .Deployment.FilterEnd }}
4 changes: 4 additions & 0 deletions manifests/templates/deployment/service.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{ .Deployment.FilterStart }}

apiVersion: v1
kind: Service
metadata:
Expand All @@ -17,3 +19,5 @@ spec:
app: arango-deployment-operator
role: leader
type: {{ .Deployment.Operator.ServiceType }}

{{ .Deployment.FilterEnd }}
4 changes: 4 additions & 0 deletions manifests/templates/storage/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{ .Storage.FilterStart }}

## Service accounts
apiVersion: v1
kind: ServiceAccount
Expand Down Expand Up @@ -68,3 +70,5 @@ spec:
operator: "Exists"
effect: "NoExecute"
tolerationSeconds: 5

{{ .Storage.FilterEnd }}
7 changes: 5 additions & 2 deletions manifests/templates/storage/rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{ .Storage.FilterStart }}
{{ .RBACFilterStart }}

{{- if .RBAC -}}
## Cluster role granting access to ArangoLocalStorage resources.
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
Expand Down Expand Up @@ -81,4 +82,6 @@ subjects:
- kind: ServiceAccount
name: {{ .Storage.Operator.ServiceAccountName }}
namespace: {{ .Storage.Operator.Namespace }}
{{- end -}}

{{ .RBACFilterEnd }}
{{ .Storage.FilterEnd }}
4 changes: 4 additions & 0 deletions manifests/templates/storage/service.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{ .Storage.FilterStart }}

apiVersion: v1
kind: Service
metadata:
Expand All @@ -17,3 +19,5 @@ spec:
app: arango-storage-operator
role: leader
type: {{ .Storage.Operator.ServiceType }}

{{ .Storage.FilterEnd }}
4 changes: 2 additions & 2 deletions manifests/templates/test/rbac.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .RBAC -}}
{{ .RBACFilterStart }}

## Cluster role granting access to resources needed by the integration tests.
apiVersion: rbac.authorization.k8s.io/v1beta1
Expand Down Expand Up @@ -34,4 +34,4 @@ subjects:
name: {{ .Test.ServiceAccountName }}
namespace: {{ .Test.Namespace }}

{{- end -}}
{{ .RBACFilterEnd }}
3 changes: 3 additions & 0 deletions scripts/patch_readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ sed -e "s@^kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-aran
sed -e "s@^kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/.*/manifests/arango-deployment.yaml\$@kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/${VERSION}/manifests/arango-deployment.yaml@g" -i "" $f
sed -e "s@^kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/.*/manifests/arango-deployment-replication.yaml\$@kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/${VERSION}/manifests/arango-deployment-replication.yaml@g" -i "" $f
sed -e "s@^kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/.*/manifests/arango-storage.yaml\$@kubectl apply -f https://raw.githubusercontent.com/arangodb/kube-arangodb/${VERSION}/manifests/arango-storage.yaml@g" -i "" $f

sed -e "s@^helm install https://github.com/arangodb/kube-arangodb/releases/download/.*/kube-arangodb.tgz\$@helm install https://github.com/arangodb/kube-arangodb/releases/download/${VERSION}/kube-arangodb.tgz@g" -i "" $f
sed -e "s@^helm install https://github.com/arangodb/kube-arangodb/releases/download/.*/kube-arangodb-storage.tgz\$@helm install https://github.com/arangodb/kube-arangodb/releases/download/${VERSION}/kube-arangodb-storage.tgz@g" -i "" $f
Loading

0 comments on commit 676493f

Please sign in to comment.