Skip to content

Commit

Permalink
Merge pull request #5 from T-Systems-MMS/helm
Browse files Browse the repository at this point in the history
Add a Helm chart to create the custom resource.
  • Loading branch information
Stefan Bethke authored Mar 31, 2022
2 parents e6c2198 + bd4fd9b commit 32562b6
Show file tree
Hide file tree
Showing 13 changed files with 322 additions and 46 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,17 @@ jobs:
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: update Chart.yaml
working-directory: charts/cmcc-operator
working-directory: charts
run: |
cat <<EOF > Chart.yaml
cat <<EOF >cmcc/Chart.yaml
apiVersion: v2
name: cmcc
description: CoreMedia Content Cloud through cmcc-operator
type: application
version: ${{github.ref_name}}
appVersion: ${{github.ref_name}}
EOF
cat <<EOF >cmcc-operator/Chart.yaml
apiVersion: v2
name: cmcc-operator
description: Kubernetes Operator to bring up a CoreMedia Content Cloud installation
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ Planned features include:

## Quick Links

* [Helm chart cmcc-operator](charts/cmcc-operator)
* [Helm chart cmcc-operator](charts/cmcc-operator) to install the operator
* [Helm chart cmcc](charts/cmcc) to create a CoreMedia Content Cloud deployment with the operator
* [CoreMediaContentClouds custom resource documentation](docs/custom-resource.md)
* [Installing the Operator](#preparing-your-cluster-and-installing-the-operator)
* [Using the Operator to create a CoreMedia installation](#using-the-operator)
Expand Down Expand Up @@ -120,7 +121,7 @@ The operator has a number of configuration parameters that can be set using the
| Property | Environment | Default | Description |
|-----------------------|-----------------------|-------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| `cmcc.ingressbuilder` | `CMCC_INGRESSBUILDER` | `blueprint` | The ingress builder to use. See [site mappings](docs/custom-resource.md#automatic-generation-of-ingresses-and-site-mappings-sitemappings) |
| `cmcc.useConfigMap` | `CMCC_USECONFIGMAP` | `false` | Use the ConfigMap reconciler (see [Installing the Operator Using a Config Map](#installing-the-operator-using-a-config-map)) |
| `cmcc.useConfigMap` | `CMCC_USECONFIGMAP` | `false` | Use the ConfigMap reconciler (see [Using a Config Map](#using-a-config-map)) |
| `cmcc.useCrd` | `CMCC_USECRD` | `true` | Use the Custom Resource reconciler |
## Using the Operator

Expand All @@ -138,6 +139,15 @@ kubectl create secret generic license-cms --from-file=license.zip=license/cms-li

The license secrets need to be created in the same namespace you plan to install CoreMedia in. See `licenseSecrets`, below.

### Creating a CoreMedia Installation – Helm Chart

The [Helm chart cmcc](charts/cmcc) can be used to create a deployment for CoreMedia Content Cloud. See the documentation there for information on how to supply the necessary values to Helm.

````shell
$ helm repo add cmcc-operator https://t-systems-mms.github.io/cmcc-operator/
$ helm upgrade --install my-release cmcc-operator/cmcc --values my-values.yaml
````

### Creating a CoreMedia Installation – Custom Resource

You can create a complete CoreMedia installation by creating the custom resource `CoreMediaContentClouds` with the desired properties. An example can be found in [`k8s/example.yaml`](k8s/example.yaml), and can be created in the cluster like this:
Expand Down
12 changes: 6 additions & 6 deletions charts/cmcc-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ operator; an accompanying chart helps managing the custom resource or config map

```console
$ helm repo add cmcc-operator https://t-systems-mms.github.io/cmcc-operator/
$ helm upgrade --install --create-namespace --namespace cmcc-operator cmcc-operator charts/cmcc-operator
$ helm upgrade --install --create-namespace --namespace cmcc-operator cmcc-operator cmcc-operator/cmcc-operator
```

## Introduction
Expand All @@ -24,23 +24,23 @@ operator; an accompanying chart helps managing the custom resource or config map

## Installing the Chart

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

```console
$ helm upgrade --install --create-namespace --namespace cmcc-operator cmcc-operator charts/cmcc-operator
$ helm upgrade --install --create-namespace --namespace cmcc-operator cmcc-operator cmcc-operator/cmcc-operator
```

The command deploys Joomla! on the Kubernetes cluster in the default configuration. The [Parameters](#parameters)
The command deploys the operator on the Kubernetes cluster in the default configuration. The [Parameters](#parameters)
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:
To uninstall/delete the `cmcc-operator` deployment:

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

The command removes all the Kubernetes components associated with the chart and deletes the release.
Expand Down
23 changes: 23 additions & 0 deletions charts/cmcc/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/cmcc/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: cmcc
description: CoreMedia Content Cloud through cmcc-operator
# this will be set during the release process
version: 0.1.0-alpha1
appVersion: 0.1.0-alpha1
94 changes: 94 additions & 0 deletions charts/cmcc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# CoreMedia Content Cloud

This helm chart creates a custom resource for the [CoreMedia Content Cloud Operator](https://github.com/T-Systems-MMS/cmcc-operator), configures and manages a [CoreMedia Content Cloud](https://www.coremedia.com/) deployment based on the configuration in that resource.

## TL;DR

```console
$ helm repo add cmcc-operator https://t-systems-mms.github.io/cmcc-operator/
$ helm upgrade --install my-release cmcc-operator/cmcc --values my-values.yaml
```

## Introduction

The [CoreMedia Content Cloud Operator](https://github.com/T-Systems-MMS/cmcc-operator) provides an easy to use way to
manage deployments of [CoreMedia Content Cloud](https://www.coremedia.com/). This Helm chart helps managing the custom resource or config map to manage an individual deployment.

## Prerequisites

- Kubernetes 1.19+
- Helm 3.2.0+

## Installing the Chart

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

```console
$ helm upgrade --install my-release cmcc-operator/cmcc --values my-values.yaml
```

The command deploys CoreMedia Content Cloud on the Kubernetes cluster. You will need to set a number of parameters, in particular `default.image.registry` to the Docker registry hosting your CoreMedia Content Cloud images. The [Parameters](#parameters) 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.

## Parameters

| Name | Description | Value |
|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------|
| `cmcc` | The contents of the custom resource. See [Custom Resource CoreMediaContentClouds](https://github.com/T-Systems-MMS/cmcc-operator/blob/main/docs/custom-resource.md) for more information ||
| `fullnameOverride` | Overrides the full name of components, which is used for the deployment, clusterrole and clusterrolemapping, and the service account. | the chart name plus the release name |
| `nameOverride` | Overrides the short name. Used for the selector labels. | the chart name |
| `useConfigMap` | Instead of creating a custom resource with the deployment description, use a config map. | the chart name |


## Configuration and Installation Details


### Substitution of variables inside values

The contents of the `cmcc` value is fed through the Helm [`tpl()`](https://helm.sh/docs/howto/charts_tips_and_tricks/#using-the-tpl-function) function. This allows you to refer to other values from values inside the `cmcc` map. For example, if you need to configure an HTTPS_PROXY for multiple components, you could write:

```yaml
httpProxy: https://proxy.example.com:3128
cmcc:
...
components:
- name: import-theme
type: management-tools
env:
- name: HTTPS_PROXY
value: "{{ .Values.httpProxy }}"
...
- name: import-content
type: management-tools
env:
- name: HTTPS_PROXY
value: "{{ .Values.httpProxy }}"
```
### Using a Config Map Instead
The operator uses a custom resource definition to obtain the deployment description for the CoreMedia Content Cloud installation. If you've installed the operator with support for using a `ConfigMap` (instead of or in addition to the custom resource), you can set `--set useConfigMap=true` to have this Helm chart create a config map.

## License

Copyright &copy; 2022 T-Systems Multimedia Solutions GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "
AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License.
5 changes: 5 additions & 0 deletions charts/cmcc/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CoreMedia Content Cloud deployment resource has been updated.

You can watch the progress of the deployment using:
kubectl --namespace {{ .Release.Namespace }} get cmcc {{ include "cmcc.fullname" . }}

66 changes: 66 additions & 0 deletions charts/cmcc/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cmcc.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 "cmcc.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 "cmcc.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "cmcc.labels" -}}
helm.sh/chart: {{ include "cmcc.chart" . }}
{{ include "cmcc.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "cmcc.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cmcc.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "cmcc.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "cmcc.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{- define "cmcc.cmcc" -}}
{{- tpl (toYaml .Values.cmcc) . }}
{{- end }}
20 changes: 20 additions & 0 deletions charts/cmcc/templates/cmcc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.useConfigMap }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}
labels:
{{- include "cmcc.labels" . | nindent 4 }}
data:
spec: |
{{- include "cmcc.cmcc" . | nindent 4 }}
{{- else }}
apiVersion: cmcc.tsystemsmms.com/v1
kind: CoreMediaContentCloud
metadata:
name: {{ .Release.Name }}
labels:
{{- include "cmcc.labels" . | nindent 4 }}
spec:
{{- include "cmcc.cmcc" . | nindent 2 }}
{{- end }}
43 changes: 43 additions & 0 deletions charts/cmcc/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Default values for cmcc.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

cmcc:
clientSecretRefs: {}
comment: ""
components: []
defaultIngressTls:
enabled: true
secretName: ""
defaults:
curlImage: docker.io/alpine/curl:latest
image:
pullPolicy: IfNotPresent
registry: gitlab.exmaple.com/my-cmcc-project
tag: latest
insecureDatabasePassword: ""
ingressDomain: 127.0.0.1.nip.io
namePrefix: ""
previewHostname: preview
resources: {}
studioHostname: studio
job: ""
# licenseSecrets:
# cmsLicense: license-cms
# mlsLicense: license-mls
# rlsLicense: license-rls
siteMappings: []
with:
contentImport: true
databases: true
delivery:
maxCae: 1
minCae: 1
rls: 0
management: true

nameOverride: ""
fullnameOverride: ""

# should the deployment description be created as a config map instead of a custom resource?
useConfigMap: false
Loading

0 comments on commit 32562b6

Please sign in to comment.