Skip to content

Commit

Permalink
Merge pull request #101 from kanisterio/sync
Browse files Browse the repository at this point in the history
Switch to Kanister managed helm repo for controller
  • Loading branch information
tdmanv authored Jun 21, 2018
2 parents 6cf4226 + 967957c commit 11d0a1b
Show file tree
Hide file tree
Showing 15 changed files with 358 additions and 22 deletions.
1 change: 1 addition & 0 deletions build/release_helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ main() {
done

# from helm folder
release_helm_charts helm/kanister-operator "${version}"
release_helm_charts helm/profile "${version}"
}

Expand Down
2 changes: 1 addition & 1 deletion docs/helm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You also need to install the Kanister controller

.. code-block:: console
$ helm install --name myrelease --namespace kanister stable/kanister-operator --set image.tag=0.8.0
$ helm install --name myrelease --namespace kanister kanister/kanister-operator --set image.tag=0.8.0
Kanister-Enabled Applications
=============================
Expand Down
6 changes: 3 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ and backup to an AWS S3 bucket.

.. code-block:: bash
# Install the Kanister Controller
helm install --name myrelease --namespace kanister stable/kanister-operator --set image.tag=0.8.0
# Add Kanister Charts
helm repo add kanister http://charts.kanister.io
# Install the Kanister Controller
helm install --name myrelease --namespace kanister kanister/kanister-operator --set image.tag=0.8.0
# Install MySQL and configure its Kanister Blueprint.
# Also create a Profile CR that can be used in ActionSets
helm install kanister/kanister-mysql \
Expand Down
5 changes: 4 additions & 1 deletion docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ This will install the Kanister controller in the `kanister` namespace

.. code-block:: bash
# Add Kanister charts
$ helm repo add kanister https://charts.kanister.io/
# Install the Kanister operator controller using helm
$ helm install --name myrelease --namespace kanister stable/kanister-operator --set image.tag=0.8.0
$ helm install --name myrelease --namespace kanister kanister/kanister-operator --set image.tag=0.8.0
Building and Deploying from Source
Expand Down
4 changes: 2 additions & 2 deletions examples/helm/kanister/kanister-mongodb-replicaset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ default values. The Profile CR parameters are passed to the profile sub-chart.
| Parameter | Description | Default |
| --- | --- | --- |
| `profile.create` | (Optional) Specify if a Profile CR should be created as part of install. | ``false`` |
| `profile.defaultProfile` | (Optional if not creating a default Profile) Set to ``true`` to create a profile with name `default-profile` | ``false`` |
| `profile.defaultProfile` | (Optional if not creating a default Profile) Set to ``true`` to create a profile with name `default-profile` | ``false`` |
| `profile.profileName` | (Required if not creating a default Profile) Name for the profile that is created | `nil` |
| `profile.s3.accessKey` | (Required if creating profile) API Key for an s3 compatible object store. | `nil`|
| `profile.s3.secretKey` | (Required if creating profile) Corresponding secret for `accessKey`. | `nil` |
Expand Down Expand Up @@ -142,7 +142,7 @@ Specify each parameter using the `--set key=value[,key=value]` argument to `helm
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

```console
$ helm install --name my-release -f values.yaml stable/kanister-mongodb-replicaset
$ helm install --name my-release -f values.yaml kanister/kanister-mongodb-replicaset
```

> **Tip**: You can use the default [values.yaml](values.yaml)
Expand Down
93 changes: 78 additions & 15 deletions examples/helm/kanister/kanister-postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,83 @@

[Kanister](https://kansiter.io) is a framework that enables application-level data management on Kubernetes.

## TL;DR;

```bash
$ helm install stable/postgresql
```

## Introduction

This chart bootstraps a [PostgreSQL](https://github.com/docker-library/postgres) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites

- Kubernetes 1.7+ with Beta APIs enabled or 1.9+ without Beta APIs.
- Kubernetes 1.7+ with Beta APIs enabled or 1.9+ without Beta APIs
- [Helm](https://helm.sh)
- PV provisioner support in the underlying infrastructure (Only when persisting data)
- Kanister version 0.7.0 with `profiles.cr.kanister.io` CRD installed
- AWS S3 (or S3 compatible) keys and bucket

## Quick Start

### Install the Kanister controller
Follow the instructions [here](https://docs.kanister.io/helm.html) to install Kanister.
The commands below assume the controller is installed in the `kanister` namespace.

### Install Kanister-enabled PostgresSQL

```bash
# Add Kanister Charts
helm repo add kanister http://charts.kanister.io

# Install PostgresSQL and configure its Kanister Blueprint.
helm install kanister/kanister-postgresql ---name postgres-test --namespace postgres-test \
--set profile.create='true' \
--set profile.profileName='postgres-test-profile' \
--set profile.s3.accessKey=${AWS_ACCESS_KEY_ID} \
--set profile.s3.secretKey=${AWS_SECRET_ACCESS_KEY} \
--set profile.s3.bucket='<BUCKET_NAME e.g kanister_bucket>' \
--set profile.s3.region='<BUCKET_REGION e.g. us-west-2>' \
--set kanister.controller_namespace=kanister
```

### Create a Base Backup
Create an ActionSet to trigger a backup. This will also setup log shipping that enables restoring
to point-in-time restore

```bash
# Create a base backup by creating an ActionSet
cat << EOF | kubectl create -f -
apiVersion: cr.kanister.io/v1alpha1
kind: ActionSet
metadata:
name: pg-base-backup
namespace: kanister
spec:
actions:
- name: backup
blueprint: postgres-test-kanister-postgresql-blueprint
object:
kind: Deployment
name: postgres-test-kanister-postgresql
namespace: postgres-test
profile:
apiVersion: v1alpha1
kind: Profile
name: postgres-test-profile
namespace: postgres-test
EOF
```

### Describe ActionSet status
```bash
kubectl describe actionset pg-base-backup --namespace kanister
```

### Restore using the base backup

To restore Postgres using the base backup - use the [kanctl](https://docs.kanister.io/architecture.html#kanctl) tool which can be downloaded from the releases [page](https://github.com/kanisterio/kanister/releases)

```bash
kanctl perform restore --from pg-base-backup --namespace kanister
```

# Chart Details

## Installing the Chart

Expand All @@ -34,13 +96,14 @@ $ helm repo add kanister http://charts.kanister.io
Then install the sample Postgres application in its own namespace.

```bash
$ helm install kanister/kanister-postgresql -n my-release --namespace postgres-test \
$ helm install kanister/kanister-postgresql --name postgres-test --namespace postgres-test \
--set profile.create='true' \
--set profile.profileName='postgres-test-profile' \
--set profile.s3.endpoint='https://my-custom-s3-provider:9000' \
--set profile.s3.accessKey='AKIAIOSFODNN7EXAMPLE' \
--set profile.s3.secretKey='wJalrXUtnFEMI%K7MDENG%bPxRfiCYEXAMPLEKEY' \
--set profile.s3.bucket='kanister-bucket'
--set profile.s3.accessKey=${AWS_ACCESS_KEY_ID} \
--set profile.s3.secretKey=${AWS_SECRET_ACCESS_KEY} \
--set profile.s3.bucket='<BUCKET_NAME e.g kanister_bucket>' \
--set profile.s3.region='<BUCKET_REGION e.g. us-west-2>' \
--set kanister.controller_namespace=kanister
```

The settings in the command above represent the minimum recommended set for your installation.
Expand Down Expand Up @@ -139,15 +202,15 @@ Specify each parameter using the `--set key=value[,key=value]` argument to `helm
```bash
$ helm install --name my-release \
--set postgresUser=my-user,postgresPassword=secretpassword,postgresDatabase=my-database \
stable/postgresql
kanister/kanister-postgresql
```

The above command creates a PostgreSQL user named `my-user` with password `secretpassword`. Additionally it creates a database named `my-database`.

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

```bash
$ helm install --name my-release -f values.yaml stable/postgresql
$ helm install --name my-release -f values.yaml kanister/kanister-postgresql
```

> **Tip**: You can use the default [values.yaml](values.yaml)
Expand Down
21 changes: 21 additions & 0 deletions helm/kanister-operator/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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
13 changes: 13 additions & 0 deletions helm/kanister-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
description: Kanister-operator Helm chart for Kubernetes
name: kanister-operator
version: 0.2.3
home: https://kanister.io/
maintainers:
- email: [email protected]
name: depohmel
- email: [email protected]
name: tdmanv
icon: https://kasten.io/assets/img/kanister-logo.png
appVersion: v0.2.0
source: https://github.com/kanisterio/kanister
64 changes: 64 additions & 0 deletions helm/kanister-operator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# kanister-operator

[kanister-operator](https://github.com/kanisterio/kanister) is a Kubernetes operator for the Kanister framework.

Kanister is a framework that enables application-level data management on Kubernetes. It allows domain experts to capture application specific data management tasks via blueprints, which can be easily shared and extended. The framework takes care of the tedious details surrounding execution on Kubernetes and presents a homogeneous operational experience across applications at scale.

## TL;DR

```console
$ helm repo add kanister http://charts.kanister.io
$ helm install kanister/kanister-operator
```

## Introduction

This chart bootstraps a kanister-operator deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

## Prerequisites
- Kubernetes 1.8+ with Beta APIs enabled

## Installing the Chart

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

```console
$ helm install --name my-release kanister/kanister-operator
```

The command deploys kanister-operator 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 removes all the Kubernetes components associated with the chart and deletes the release.

## Configuration

The following table lists the configurable parameters of the nginx-ingress chart and their default values.

Parameter | Description | Default
--- | --- | ---
`rbac.create` | all required roles and SA will be created | `true`
`serviceAccount.create`| specify if SA will be created | `true`
`serviceAccount.name`| provided service account name will be used | `None`
`image.repository` | controller container image repository | `kanisterio/controller`
`image.tag` | controller container image tag | `v0.2.0`
`image.pullPolicy` | controller container image pull policy | `IfNotPresent`
`resources` | k8s pod resources | `None`

Specify each parameter you'd like to override using a YAML file as described above in the [installation](#installing-the-chart) section.

You can also specify any non-array parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

```console
$ helm install kanister/kanister-operator --name my-release \
--set rbac.create=false
```
9 changes: 9 additions & 0 deletions helm/kanister-operator/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Kanister-operator is installed.

Getting Started is available: https://github.com/kanisterio/kanister

Documentation is available: https://docs.kanister.io/

Please report any issues: https://github.com/kanisterio/kanister/issues

Thank you for trying Kanister.
51 changes: 51 additions & 0 deletions helm/kanister-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "kanister-operator.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 "kanister-operator.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 chart name and version as used by the chart label.
*/}}
{{- define "kanister-operator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/* Helm required labels */}}
{{- define "kanister-operator.helmLabels" -}}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
chart: {{ template "kanister-operator.chart" . }}
app: {{ template "kanister-operator.name" . }}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "kanister-operator.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "kanister-operator.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
22 changes: 22 additions & 0 deletions helm/kanister-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: {{ template "kanister-operator.fullname" . }}
labels:
{{ include "kanister-operator.helmLabels" . | indent 4 }}
spec:
replicas: 1
template:
metadata:
labels:
{{ include "kanister-operator.helmLabels" . | indent 8}}
spec:
serviceAccountName: {{ template "kanister-operator.serviceAccountName" . }}
containers:
- name: {{ template "kanister-operator.fullname" . }}
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.resources }}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- end }}
Loading

0 comments on commit 11d0a1b

Please sign in to comment.