Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding helper-operator, helper-status-checker and update-clusterversi… #535

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions _templates.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@

{{ define "doc.header" -}}

{{ template "chart.header" . }}
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

{{ template "chart.versionBadge" . }}

{{ template "chart.deprecationWarning" . }}

## Description

{{ template "chart.description" . }}

{{- end }}

{{ define "doc.maintainer_and_sources" -}}

{{ template "chart.maintainersSection" . }}

## Sources
Source: {{ template "chart.sourcesList" . }}

Source code: {{ template "chart.homepage" . }}

{{- end }}


{{ define "doc.deps" -}}

## Dependencies

This chart has the following dependencies:

{{ template "chart.requirementsTable" . }}

{{- end }}

{{ define "doc.values" -}}

{{ template "chart.valuesSection" . }}

{{- end }}


{{ define "doc.footer" -}}

## Installing the Chart

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

```console
helm install my-release repo/<chart-name>>
```

The command deploys the chart on the Kubernetes cluster in the default configuration.

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

{{ template "helm-docs.versionFooter" . }}

{{- end }}
13 changes: 13 additions & 0 deletions charts/helper-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v2
name: helper-operator
description: A helper Chart to reduce code repetition. This Chart should be called as a dependency by other charts in order to install Operators.
version: 1.0.26
home: https://github.com/redhat-cop/helm-charts
maintainers:
- name: tjungbauer
email: [email protected]
url: https://blog.stderr.at/
keywords:
- helper
- subchart
- operator
13 changes: 13 additions & 0 deletions charts/helper-operator/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2022 Thomas Jungbauer

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


# helper-operator

[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

![Version: 1.0.26](https://img.shields.io/badge/Version-1.0.26-informational?style=flat-square)



## Description

A helper Chart to reduce code repetition. This Chart should be called as a dependency by other charts in order to install Operators.

This chart can be used to install Operators in OpenShift.
It is best used with a GitOps approach such as Argo CD does. For example: https://github.com/tjungbauer/openshift-clusterconfig-gitops

This chart will create the objects: Namespace, Subscription, OperatorGroup and a Job, that will enable additional console plugins, if enabled.

*NOTE*: It is usually used as Subchart for other Charts and it works best with the second subchart [helper-status-checker](https://github.com/tjungbauer/helm-charts/tree/main/charts/helper-status-checker)

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| tjungbauer | <[email protected]> | <https://blog.stderr.at/> |

## Sources
Source:

Source code: https://github.com/redhat-cop/helm-charts

## Parameters

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| console_plugins | object | "" | Configure console plugins for OpenShift. |
| console_plugins.enabled | bool | false | Enable console plugin configuration. |
| console_plugins.job_namespace | string | openshift-gitops | Optional: Namespace where kubernetes job shall be executed. |
| console_plugins.job_service_account | string | enable-console-plugin-sa | Optional: Name of the service account that will execute the Job. |
| console_plugins.job_service_account_crb | string | enable-console-plugin-crb | Optional: Name of the ClusterRoleBinding. |
| console_plugins.job_service_account_role | string | enable-console-plugin-role | Optional: Name of the role that will be assigned to the service account. |
| console_plugins.plugins | list | empty | List of console plugins to configure. Each list item will be added to the OpenShift UI. |
| console_plugins.syncwave | int | 5 | Optional: Syncwave for console plugin configuration. |
| operators | object | "" | Define operators that you want to deploy. A key/value setup is used here. Each new operator is a new key (in this example "my-operator") |
| operators.my-operator.enabled | bool | false | Enabled yes/no |
| operators.my-operator.namespace.create | bool | false | Create the Namespace yes/no. |
| operators.my-operator.namespace.descr | string | "" | Description of the namespace. |
| operators.my-operator.namespace.displayname | string | "" | Displayname of the namespace. |
| operators.my-operator.namespace.name | string | `"openshift-operators-redhat"` | The Namespace the Operator should be installed in. |
| operators.my-operator.operatorgroup.create | bool | false | Create an Operatorgroup object |
| operators.my-operator.operatorgroup.notownnamespace | bool | false | Monitor own Namespace. For some Operators no `targetNamespaces` must be defined |
| operators.my-operator.subscription | object | "" | Definition of the Operator Subscription |
| operators.my-operator.subscription.approval | string | Automatic | Update behavior of the Operator. Manual/Automatic |
| operators.my-operator.subscription.channel | string | stable | Channel of the Subscription |
| operators.my-operator.subscription.config | object | "" | Optional additional configuration for the Operator subscription. |
| operators.my-operator.subscription.config.env | list | "" | Additional environment parameter, as a list: name/value |
| operators.my-operator.subscription.config.nodeSelector | object | "" | Optionally define a nodeSelector. |
| operators.my-operator.subscription.config.resources | object | "" | Optionally set resources (limits/requests) for the Operator. |
| operators.my-operator.subscription.config.tolerations | list | "" | Optionally set Tolerations for the Subscription. |
| operators.my-operator.subscription.operatorName | string | "empty" | Name of the Operator |
| operators.my-operator.subscription.source | string | redhat-operators | Source of the Operator |
| operators.my-operator.subscription.sourceNamespace | string | openshift-marketplace | Namespace of the source |
| operators.my-operator.syncwave | int | 0 | Syncwave for the operator deployment |

## Example

Installing the Operator "Loki"

TIP: Fetch the values for the subscription specification with `oc get packagemanifest advanced-cluster-management -o yaml`

```yaml
---
console_plugins:
enabled: false
syncwave: 5
plugins:
- plugin_name

job_namespace: kube-system

operators:
loki-operator:
enabled: false
namespace:
name: openshift-operators-redhat
create: true
subscription:
channel: stable
approval: Automatic
operatorName: loki-operator
source: redhat-operators
sourceNamespace: openshift-marketplace
config:
env:
- name: FIRST_ENV_PARAMENTER
value: ThisIsRequierd
- name: SECOND_ENV_PARAMETER
value: 'true'
resources:
limits:
cpu: 100m
memory: 1Gi
requests:
cpu: 400m
memory: 300Mi
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/infra
value: reserved
- effect: NoExecute
key: node-role.kubernetes.io/infra
value: reserved
nodeSelector:
key: node-role.kubernetes.io/infra
value: ""
operatorgroup:
create: true
notownnamespace: true
```

## Installing the Chart

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

```console
helm install my-release repo/<chart-name>>
```

The command deploys the chart on the Kubernetes cluster in the default configuration.

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

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0)
73 changes: 73 additions & 0 deletions charts/helper-operator/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{{ template "doc.header" . }}

This chart can be used to install Operators in OpenShift.
It is best used with a GitOps approach such as Argo CD does. For example: https://github.com/tjungbauer/openshift-clusterconfig-gitops

This chart will create the objects: Namespace, Subscription, OperatorGroup and a Job, that will enable additional console plugins, if enabled.

*NOTE*: It is usually used as Subchart for other Charts and it works best with the second subchart [helper-status-checker](https://github.com/tjungbauer/helm-charts/tree/main/charts/helper-status-checker)


{{ template "doc.maintainer_and_sources" . }}

## Parameters

{{ template "doc.values" . }}

## Example

Installing the Operator "Loki"

TIP: Fetch the values for the subscription specification with `oc get packagemanifest advanced-cluster-management -o yaml`

```yaml
---
console_plugins:
enabled: false
syncwave: 5
plugins:
- plugin_name

job_namespace: kube-system

operators:
loki-operator:
enabled: false
namespace:
name: openshift-operators-redhat
create: true
subscription:
channel: stable
approval: Automatic
operatorName: loki-operator
source: redhat-operators
sourceNamespace: openshift-marketplace
config:
env:
- name: FIRST_ENV_PARAMENTER
value: ThisIsRequierd
- name: SECOND_ENV_PARAMETER
value: 'true'
resources:
limits:
cpu: 100m
memory: 1Gi
requests:
cpu: 400m
memory: 300Mi
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/infra
value: reserved
- effect: NoExecute
key: node-role.kubernetes.io/infra
value: reserved
nodeSelector:
key: node-role.kubernetes.io/infra
value: ""
operatorgroup:
create: true
notownnamespace: true
```

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

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

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if .Values.console_plugins }}
{{- if eq (.Values.console_plugins.enabled | toString) "true" }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Values.console_plugins.job_service_account_crb | default "enable-console-plugin-crb" }}
annotations:
argocd.argoproj.io/hook: Sync
argocd.argoproj.io/hook-delete-policy: HookSucceeded
argocd.argoproj.io/sync-wave: {{ .syncwave | default 5 | quote }}
labels:
{{- include "common.labels" $ | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ .Values.console_plugins.job_service_account_role | default "enable-console-plugin-role" }}
subjects:
- kind: ServiceAccount
name: {{ .Values.console_plugins.job_service_account | default "enable-console-plugin-sa" }}
namespace: {{ .Values.console_plugins.job_namespace | default "openshift-gitops" }}
{{- end }}
{{- end }}
Loading
Loading