Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
Signed-off-by: Tiago Bueno <[email protected]>
  • Loading branch information
tlbueno committed May 18, 2024
0 parents commit d9c22fc
Show file tree
Hide file tree
Showing 14 changed files with 411 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
assignees:
- "tlbueno"
reviewers:
- "tlbueno"

35 changes: 35 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release Charts

on:
workflow_dispatch:
push:
branches:
- main

jobs:
release:
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
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@v4
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
23 changes: 23 additions & 0 deletions .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/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Tiago Bueno

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# helm-charts

An collections of helm chart

### Usage

[Helm](https://helm.sh) must be installed to use the charts. Please refer to
Helm's [documentation](https://helm.sh/docs) to get started.

Once Helm has been set up correctly, add the repo as follows:

```sh
helm repo add tlbueno https://tlbueno.github.io/helm-charts
```

If you had already added this repo earlier, run `helm repo update` to retrieve
the latest versions of the packages. You can then run `helm search repo
tlbueno` to see the charts.

To install the a chart:

```sh
helm install my-<chart-name> tlbueno/<chart-name>
```

To uninstall the chart:

```sh
helm delete my-<chart-name>
```
24 changes: 24 additions & 0 deletions charts/olm-operator-installer/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: olm-operator-installer
description: A Helm chart to install an Operator Lifecycle Manager (OLM) operator

# 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.1.0

# 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: ""
73 changes: 73 additions & 0 deletions charts/olm-operator-installer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# olm-operator-installer

An helm chart to install an operator using Operator Lifecycle Manager (OLM)

The chart will:
- create a namespace
- deploy an operator group with/without a selector label defined in the values
- deploy the subscription

By default, the chart deploy a cert-manager operator. But you can find some more examples in [examples](./examples) folder

### How to use

Check [README.md](../../README.md) for repo installation details

To install the chart, ie:
```sh
helm install my-operator-chart tlbueno-repo/olm-operator-installer
```

You may override the default values below by creating a yaml file with one or more entries and use it in helm command, ie:
```sh
helm install my-operator-chart -f ./my-values.yaml tlbueno-repo/olm-operator-installer
```

Default values:
```yaml
# Default values for olm-operator-installer.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

namespace:
# namespace where the operator will be installed
name: cert-manager

operatorGroup:
# skip the operator group deploy if false
deploy: true
# operator group name
name: cert-manager-operator

selector:
# do not set selector matchLabels if false
enabled: false
# A list of maps with the labels
matchLabels:
- name: olm-operator-installer/managed-by
value: "{{ .Values.subscription.name }}"

subscription:
# subscription name
name: cert-manager-operator-sub

# channel name
channel: stable

# operator package name
operatorName: cert-manager

# catalog name from which the operator will be installed
source: operatorhubio-catalog

# catalog namespace
sourceNamespace: olm

# install plan approval type
installPlanApproval: Automatic

# the initial version of the operator to be installed
# if empty it will not be used in the subscription
startingCSV: ""
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This is an example to install RedHat AMQ Broker Operator
#
# To have it working you need to have the redhat operator catalog installed on your cluster
# and the you need to have your cluster configured with credentials to install images from
# registry.redhat.io

namespace:
# namespace where the operator will be installed
name: amq-broker-operator-olm

operatorGroup:
# skip the operator group deploy if false
deploy: true
# operator group name
name: amq-broker-operator

selector:
# do not set selector matchLabels if false
enabled: true
# A list of maps with the labels
matchLabels:
- name: olm-operator-installer/managed-by
value: "{{ .Values.subscription.name }}"

subscription:
# subscription name
name: amq-broker-operator-olm-sub

# channel name
channel: 7.10.x

# operator package name
operatorName: amq-broker-rhel8

# catalog name from which the operator will be installed
source: redhat-operators-catalog

# catalog namespace
sourceNamespace: olm

# install plan approval type
installPlanApproval: Automatic

# the initial version of the operator to be installed
# if empty it will not be used in the subscription
startingCSV: ""

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This is an example to install RedHat AMQ Broker Operator
#
# To have it working you need to have the redhat operator catalog installed on your cluster
# and the you need to have your cluster configured with credentials to install images from
# registry.redhat.io

namespace:
# namespace where the operator will be installed
name: amq-broker-operator-olm

operatorGroup:
# skip the operator group deploy if false
deploy: true
# operator group name
name: amq-broker-operator

selector:
# do not set selector matchLabels if false
enabled: true
# A list of maps with the labels
matchLabels:
- name: olm-operator-installer/managed-by
value: "{{ .Values.subscription.name }}"

subscription:
# subscription name
name: amq-broker-operator-olm-sub

# channel name
channel: 7.11.x

# operator package name
operatorName: amq-broker-rhel8

# catalog name from which the operator will be installed
source: redhat-operators-catalog

# catalog namespace
sourceNamespace: olm

# install plan approval type
installPlanApproval: Automatic

# the initial version of the operator to be installed
# if empty it will not be used in the subscription
startingCSV: ""

9 changes: 9 additions & 0 deletions charts/olm-operator-installer/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Thank you for installing {{ .Chart.Name }}.

Your release is named {{ .Release.Name }}.

To learn more about the release, try:

$ helm status {{ .Release.Name }}
$ helm get all {{ .Release.Name }}

10 changes: 10 additions & 0 deletions charts/olm-operator-installer/templates/Namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.namespace.name }}
{{- if .Values.operatorGroup.selector.enabled }}
labels:
{{- range .Values.operatorGroup.selector.matchLabels }}
{{ .name }}: {{ tpl .value $ }}
{{- end }}
{{- end }}
16 changes: 16 additions & 0 deletions charts/olm-operator-installer/templates/OperatorGroup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.operatorGroup.deploy }}
apiVersion: operators.coreos.com/v1alpha2
kind: OperatorGroup
metadata:
name: {{ .Values.operatorGroup.name }}
namespace: {{ .Values.namespace.name }}
spec:
{{- if .Values.operatorGroup.selector.enabled }}
selector:
matchLabels:
{{- range .Values.operatorGroup.selector.matchLabels }}
{{ .name }}: {{ tpl .value $ }}
{{- end }}
{{- end }}
{{- end }}

15 changes: 15 additions & 0 deletions charts/olm-operator-installer/templates/Subscription.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: {{ .Values.subscription.name }}
namespace: {{ .Values.namespace.name }}
spec:
channel: {{ .Values.subscription.channel }}
name: {{ .Values.subscription.operatorName }}
source: {{ .Values.subscription.source }}
sourceNamespace: {{ .Values.subscription.sourceNamespace }}
installPlanApproval: {{ .Values.subscription.installPlanApproval }}
{{- if .Values.subscription.startingCSV }}
startingCSV: {{ .Values.subscription.startingCSV }}
{{- end }}

Loading

0 comments on commit d9c22fc

Please sign in to comment.