-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from bennsimon/add-helm-chart
Add helm chart
- Loading branch information
Showing
17 changed files
with
587 additions
and
2 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
# Publish `master` as Docker `master` tag. | ||
# See also https://github.com/crazy-max/ghaction-docker-meta#basic | ||
branches: | ||
- main | ||
|
||
# Publish `v1.2.3` tags as releases. | ||
tags: | ||
- v* | ||
|
||
pull_request: | ||
# Run Tests when changes are made to the Docker file | ||
paths: | ||
- 'Dockerfile' | ||
|
||
jobs: | ||
# Run image build test | ||
test: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Run Build tests | ||
run: docker build . --file Dockerfile | ||
|
||
push: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/[email protected] | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Docker meta | ||
id: docker_meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: bennsimon/uptimerobot-operator | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Push to Docker Image Repositories | ||
uses: docker/build-push-action@v3 | ||
id: docker_build | ||
with: | ||
push: true | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.docker_meta.outputs.tags }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
|
||
# Temp fix | ||
# https://github.com/docker/build-push-action/issues/252 | ||
# https://github.com/moby/buildkit/issues/1896 | ||
- name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Lint and Test Charts | ||
|
||
on: | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
lint-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.5.0 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
- name: Set up chart-testing | ||
uses: helm/[email protected] | ||
- name: Run chart-testing (list-changed) | ||
id: list-changed | ||
run: | | ||
changed=$(ct list-changed --config ct.yaml) | ||
if [[ -n "$changed" ]]; then | ||
echo "::set-output name=changed::true" | ||
fi | ||
- name: Run chart-testing (lint) | ||
run: ct lint --config ct.yaml | ||
- name: Create kind cluster | ||
uses: helm/[email protected] | ||
if: steps.list-changed.outputs.changed == 'true' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Kindly refer to https://github.com/helm/chart-releaser-action | ||
|
||
name: Publish Charts | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Install Helm | ||
uses: azure/setup-helm@v3 | ||
|
||
- name: Run chart-releaser | ||
uses: helm/[email protected] # step that writes the latest chart versions (below) depends on this step writing the latest version as the first index in the entries.<name of chart> list in the index.yaml file | ||
env: | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: v2 | ||
name: uptimerobot-operator | ||
description: uptimerobot operator creates, updates, deletes uptimerobot monitors for a particular ingress resource. It's designed to use friendly_name attribute of a monitor and/or alert contact for unique identification. | ||
maintainers: | ||
- name: bennsimon | ||
email: [email protected] | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.0.1 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "v0.0.1-alpha-r1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
Uptimerobot-operator | ||
=========== | ||
|
||
This operator creates, updates, deletes uptimerobot monitors for a particular ingress resource. It's designed to use friendly_name attribute of a monitor and/or alert contact for unique identification. | ||
|
||
|
||
## TL;DR | ||
|
||
```bash | ||
$ helm repo add uptimerobot-operator https://bennsimon.github.io/uptimerobot-operator/ | ||
$ helm install uptimerobot-operator uptimerobot-operator/uptimerobot-operator | ||
``` | ||
|
||
## Introduction | ||
|
||
This chart bootstraps [uptimerobot-operator](https://github.com/bennsimon/uptimerobot-operator) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. | ||
|
||
## Prerequisites | ||
|
||
- Kubernetes 1.12+ | ||
- Helm 3.1.0 | ||
|
||
## Installing the Chart | ||
|
||
To install the chart with the release name `uptimerobot-operator`: | ||
|
||
## Configuration | ||
|
||
The following table lists the configurable parameters of the Uptimerobot-operator chart and their default values. | ||
|
||
| Parameter | Description | Default | | ||
|----------------------------------------------|-------------|------------------------------------------------------------| | ||
| `replicaCount` | | `1` | | ||
| `image.repository` | | `"bennsimon/uptimerobot-operator"` | | ||
| `image.pullPolicy` | | `"IfNotPresent"` | | ||
| `image.tag` | | `"v0.0.1-alpha-r1"` | | ||
| `imagePullSecrets` | | `[]` | | ||
| `nameOverride` | | `""` | | ||
| `fullnameOverride` | | `""` | | ||
| `clusterRole.create` | | `true` | | ||
| `serviceAccount.create` | | `false` | | ||
| `serviceAccount.annotations` | | `{}` | | ||
| `serviceAccount.name` | | `""` | | ||
| `podAnnotations` | | `{}` | | ||
| `podSecurityContext` | | `{}` | | ||
| `securityContext.allowPrivilegeEscalation` | | `false` | | ||
| `securityContext.capabilities.drop` | | `["ALL"]` | | ||
| `resources.limits.memory` | | `"128Mi"` | | ||
| `resources.requests.cpu` | | `"10m"` | | ||
| `resources.requests.memory` | | `"64Mi"` | | ||
| `autoscaling.enabled` | | `false` | | ||
| `autoscaling.minReplicas` | | `1` | | ||
| `autoscaling.maxReplicas` | | `100` | | ||
| `autoscaling.targetCPUUtilizationPercentage` | | `80` | | ||
| `nodeSelector` | | `{}` | | ||
| `tolerations` | | `[]` | | ||
| `affinity` | | `{}` | | ||
| `selectorLabels.control-plane` | | `"controller-manager"` | | ||
| `livenessProbe.httpGet.path` | | `"/healthz"` | | ||
| `livenessProbe.httpGet.port` | | `8081` | | ||
| `livenessProbe.initialDelaySeconds` | | `15` | | ||
| `livenessProbe.periodSeconds` | | `20` | | ||
| `readinessProbe.httpGet.path` | | `"/readyz"` | | ||
| `readinessProbe.httpGet.port` | | `8081` | | ||
| `readinessProbe.initialDelaySeconds` | | `5` | | ||
| `readinessProbe.periodSeconds` | | `10` | | ||
| `env` | | `[{"name": "UPTIME_ROBOT_API_KEY", "value": "<api-key>"}]` | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
AppVersion: {{.Chart.AppVersion }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "uptimerobot-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 "uptimerobot-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 "uptimerobot-operator.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "uptimerobot-operator.labels" -}} | ||
helm.sh/chart: {{ include "uptimerobot-operator.chart" . }} | ||
{{ include "uptimerobot-operator.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "uptimerobot-operator.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "uptimerobot-operator.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- range $index, $element := .Values.selectorLabels }} | ||
{{ $index }}: {{ $element }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "uptimerobot-operator.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "uptimerobot-operator.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
{{- if .Values.clusterRole.create }} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ include "uptimerobot-operator.fullname" . }} | ||
labels: | ||
{{- include "uptimerobot-operator.labels" . | nindent 4 }} | ||
rules: | ||
- apiGroups: | ||
- networking.k8s.io | ||
resources: | ||
- ingresses | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
{{- end }} |
17 changes: 17 additions & 0 deletions
17
charts/uptimerobot-operator/templates/clusterrolebinding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
{{- if and .Values.clusterRole.create .Values.serviceAccount.create }} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ include "uptimerobot-operator.fullname" . }} | ||
labels: | ||
{{- include "uptimerobot-operator.labels" . | nindent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ include "uptimerobot-operator.fullname" . }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "uptimerobot-operator.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
{{- end }} |
Oops, something went wrong.