Skip to content

Commit

Permalink
cr-release-package
Browse files Browse the repository at this point in the history
  • Loading branch information
ls-1801 authored Mar 29, 2022
1 parent e65cf39 commit 96be7a6
Show file tree
Hide file tree
Showing 11 changed files with 7,777 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .cr-release-packages/flink-operator/.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
.vscode/
8 changes: 8 additions & 0 deletions .cr-release-packages/flink-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
name: flink-operator
appVersion: "1.0"
description: A Helm chart for flink on Kubernetes operator
version: "0.2.1"
keywords:
- flink
home: https://github.com/spotify/flink-on-k8s-operator
46 changes: 46 additions & 0 deletions .cr-release-packages/flink-operator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Helm Chart for Flink Operator

This is the Helm chart for the Flink operator.

## Installing the Chart

The instructions to install the Flink operator chart:

1. Prepare a Flink operator image. You can either use a released image e.g., `ghcr.io/spotify/flink-operator:latest` or follow the instructions [here](https://github.com/spotify/flink-on-k8s-operator/blob/master/docs/developer_guide.md#build-and-push-the-operator-image) to build and push an image from the source code.

2. Run the bash script `update_template.sh` to update the manifest files in templates from the Flink operator source repo (This step is only required if you want to install from the local chart repo).
You can set the following env vars to customize the script's behaviour -
* `export IMG=<image-name>` - Operator image, defaults to `flink-operator:latest`
* `export NS=<namespace-name>` - Namespace to install the operator in, defaults to `flink-operator-system`

3. Register CRD - Don't manually register CRD unless helm install below fails (You can skip this step if your helm version is v3).

```bash
kubectl create -f https://raw.githubusercontent.com/spotify/flink-on-k8s-operator/master/config/crd/bases/flinkoperator.k8s.io_flinkclusters.yaml
```

4. Finally operator chart can be installed by running:

```bash
helm install [RELEASE_NAME] . --set operatorImage.name=[IMAGE_NAME]
```

If you're installing the chart into a preexisting namespace, make sure to set the namespace name and instruct the chart not create one like so:
```bash
helm install [RELEASE_NAME] . --set operatorImage.name=[IMAGE_NAME],flinkOperatorNamespace.name=[NAMESPACE_NAME]
```
## Uninstalling the Chart
To uninstall your release:
```bash
helm delete [RELEASE_NAME]
```
CRD created by this chart are not deleted by helm uninstall. CRD deletion causes terminating all FlinkCluster CRs and related kubernetes resources, therefore it should be deleted carefully, You can manually clean up CRD:
```bash
kubectl delete crd flinkclusters.flinkoperator.k8s.io
```
56 changes: 56 additions & 0 deletions .cr-release-packages/flink-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "flink-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 "flink-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 "flink-operator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

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

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

0 comments on commit 96be7a6

Please sign in to comment.