From 602fe7e162433aeb30b05d9554fcd5f87ad72c87 Mon Sep 17 00:00:00 2001 From: bennsimon Date: Thu, 3 Aug 2023 07:58:09 +0300 Subject: [PATCH 1/6] add helm chart --- .../workload-scheduler-operator/.helmignore | 23 ++++ charts/workload-scheduler-operator/Chart.lock | 6 + charts/workload-scheduler-operator/Chart.yaml | 29 +++++ charts/workload-scheduler-operator/README.md | 59 ++++++++++ .../charts/crds/Chart.yaml | 18 +++ .../charts/crds/crds/crd-schedule.yaml | 70 ++++++++++++ .../crds/crds/crd-workloadschedule.yaml | 74 +++++++++++++ .../crds/crd-workloadschedulecontroller.yaml | 52 +++++++++ .../templates/NOTES.txt | 1 + .../templates/_helpers.tpl | 62 +++++++++++ .../templates/clusterrole.yaml | 104 ++++++++++++++++++ .../templates/clusterrolebinding.yaml | 16 +++ .../templates/deployment.yaml | 60 ++++++++++ .../templates/serviceaccount.yaml | 13 +++ .../workload-scheduler-operator/values.yaml | 82 ++++++++++++++ 15 files changed, 669 insertions(+) create mode 100644 charts/workload-scheduler-operator/.helmignore create mode 100644 charts/workload-scheduler-operator/Chart.lock create mode 100644 charts/workload-scheduler-operator/Chart.yaml create mode 100644 charts/workload-scheduler-operator/README.md create mode 100644 charts/workload-scheduler-operator/charts/crds/Chart.yaml create mode 100644 charts/workload-scheduler-operator/charts/crds/crds/crd-schedule.yaml create mode 100644 charts/workload-scheduler-operator/charts/crds/crds/crd-workloadschedule.yaml create mode 100644 charts/workload-scheduler-operator/charts/crds/crds/crd-workloadschedulecontroller.yaml create mode 100644 charts/workload-scheduler-operator/templates/NOTES.txt create mode 100644 charts/workload-scheduler-operator/templates/_helpers.tpl create mode 100644 charts/workload-scheduler-operator/templates/clusterrole.yaml create mode 100644 charts/workload-scheduler-operator/templates/clusterrolebinding.yaml create mode 100644 charts/workload-scheduler-operator/templates/deployment.yaml create mode 100644 charts/workload-scheduler-operator/templates/serviceaccount.yaml create mode 100644 charts/workload-scheduler-operator/values.yaml diff --git a/charts/workload-scheduler-operator/.helmignore b/charts/workload-scheduler-operator/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/workload-scheduler-operator/.helmignore @@ -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/ diff --git a/charts/workload-scheduler-operator/Chart.lock b/charts/workload-scheduler-operator/Chart.lock new file mode 100644 index 0000000..27962cc --- /dev/null +++ b/charts/workload-scheduler-operator/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: crds + repository: "" + version: 0.1.0 +digest: sha256:f9d3034df90169322e24e32ab5ea8f1947dc2aca3ab79960d6687b79a512efeb +generated: "2023-08-02T12:57:12.454686717+03:00" diff --git a/charts/workload-scheduler-operator/Chart.yaml b/charts/workload-scheduler-operator/Chart.yaml new file mode 100644 index 0000000..1dd4542 --- /dev/null +++ b/charts/workload-scheduler-operator/Chart.yaml @@ -0,0 +1,29 @@ +apiVersion: v2 +name: workload-scheduler-operator +description: A Helm chart for Kubernetes + +# 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: "0.1.0" + +dependencies: + - name: crds + version: "0.1.0" + condition: crds.enabled diff --git a/charts/workload-scheduler-operator/README.md b/charts/workload-scheduler-operator/README.md new file mode 100644 index 0000000..ab4420d --- /dev/null +++ b/charts/workload-scheduler-operator/README.md @@ -0,0 +1,59 @@ +workload-scheduler-operator helm chart +=========== + + + +## TL;DR + +```bash +$ helm repo add workload-scheduler-operator https://bennsimon.github.io/workload-scheduler-operator/ +$ helm install workload-scheduler-operator workload-scheduler-operator/workload-scheduler-operator +``` + +## Introduction + +This chart bootstraps [workload-scheduler-operator](https://github.com/bennsimon/workload-scheduler-operator) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- Kubernetes 1.21+ +- Helm 3.1.0 + +## Installing the Chart + +To install the chart with the release name `workload-scheduler-operator`: + +## Configuration + +The following table lists the configurable parameters of the Workload-scheduler-operator chart and their default values. + +| Parameter | Description | Default | +|--------------------------------------|-------------|-------------------------------------------| +| `replicaCount` | | `1` | +| `image.repository` | | `"bennsimon/workload-scheduler-operator"` | +| `image.pullPolicy` | | `"IfNotPresent"` | +| `image.tag` | | `""` | +| `imagePullSecrets` | | `[]` | +| `nameOverride` | | `""` | +| `fullnameOverride` | | `""` | +| `serviceAccount.create` | | `true` | +| `serviceAccount.annotations` | | `{}` | +| `serviceAccount.name` | | `""` | +| `podAnnotations` | | `{}` | +| `podSecurityContext` | | `{}` | +| `securityContext` | | `{}` | +| `resources` | | `{}` | +| `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` | +| `autoscaling.enabled` | | `false` | +| `nodeSelector` | | `{}` | +| `tolerations` | | `[]` | +| `affinity` | | `{}` | +| `crds.enabled` | | `true` | +| `env` | | `null` | diff --git a/charts/workload-scheduler-operator/charts/crds/Chart.yaml b/charts/workload-scheduler-operator/charts/crds/Chart.yaml new file mode 100644 index 0000000..2a49a4b --- /dev/null +++ b/charts/workload-scheduler-operator/charts/crds/Chart.yaml @@ -0,0 +1,18 @@ +apiVersion: v2 +name: crds +description: A Helm chart for Kubernetes + +# 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 diff --git a/charts/workload-scheduler-operator/charts/crds/crds/crd-schedule.yaml b/charts/workload-scheduler-operator/charts/crds/crds/crd-schedule.yaml new file mode 100644 index 0000000..27e6250 --- /dev/null +++ b/charts/workload-scheduler-operator/charts/crds/crds/crd-schedule.yaml @@ -0,0 +1,70 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.12.0 + name: schedules.workload-scheduler.bennsimon.github.io +spec: + group: workload-scheduler.bennsimon.github.io + names: + kind: Schedule + listKind: ScheduleList + plural: schedules + singular: schedule + scope: Cluster + versions: + - name: v1 + schema: + openAPIV3Schema: + description: Schedule is the Schema for the schedules API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: ScheduleSpec defines the desired state of Schedule + properties: + scheduleUnits: + items: + properties: + days: + items: + type: string + type: array + end: + properties: + date: + type: string + time: + type: string + type: object + start: + properties: + date: + type: string + time: + type: string + type: object + type: object + type: array + required: + - scheduleUnits + type: object + status: + description: ScheduleStatus defines the observed state of Schedule + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/charts/workload-scheduler-operator/charts/crds/crds/crd-workloadschedule.yaml b/charts/workload-scheduler-operator/charts/crds/crds/crd-workloadschedule.yaml new file mode 100644 index 0000000..9bb19be --- /dev/null +++ b/charts/workload-scheduler-operator/charts/crds/crds/crd-workloadschedule.yaml @@ -0,0 +1,74 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.12.0 + name: workloadschedules.workload-scheduler.bennsimon.github.io +spec: + group: workload-scheduler.bennsimon.github.io + names: + kind: WorkloadSchedule + listKind: WorkloadScheduleList + plural: workloadschedules + singular: workloadschedule + scope: Cluster + versions: + - name: v1 + schema: + openAPIV3Schema: + description: WorkloadSchedule is the Schema for the workloadschedules API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: WorkloadScheduleSpec defines the desired state of WorkloadSchedule + properties: + schedules: + items: + properties: + desired: + format: int32 + type: integer + schedule: + type: string + type: object + type: array + selector: + properties: + kinds: + items: + type: string + type: array + labels: + additionalProperties: + type: string + type: object + names: + items: + type: string + type: array + namespaces: + items: + type: string + type: array + type: object + type: object + status: + description: WorkloadScheduleStatus defines the observed state of WorkloadSchedule + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/charts/workload-scheduler-operator/charts/crds/crds/crd-workloadschedulecontroller.yaml b/charts/workload-scheduler-operator/charts/crds/crds/crd-workloadschedulecontroller.yaml new file mode 100644 index 0000000..a402389 --- /dev/null +++ b/charts/workload-scheduler-operator/charts/crds/crds/crd-workloadschedulecontroller.yaml @@ -0,0 +1,52 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.12.0 + name: workloadschedulecontrollers.workload-scheduler.bennsimon.github.io +spec: + group: workload-scheduler.bennsimon.github.io + names: + kind: WorkloadScheduleController + listKind: WorkloadScheduleControllerList + plural: workloadschedulecontrollers + singular: workloadschedulecontroller + scope: Cluster + versions: + - name: v1 + schema: + openAPIV3Schema: + description: WorkloadScheduleController is the Schema for the workloadschedulecontrollers + API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: WorkloadScheduleControllerSpec defines the desired state + of WorkloadScheduleController + properties: + foo: + description: Foo is an example field of WorkloadScheduleController. + Edit workloadschedulecontroller_types.go to remove/update + type: string + type: object + status: + description: WorkloadScheduleControllerStatus defines the observed state + of WorkloadScheduleController + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/charts/workload-scheduler-operator/templates/NOTES.txt b/charts/workload-scheduler-operator/templates/NOTES.txt new file mode 100644 index 0000000..2ec67b0 --- /dev/null +++ b/charts/workload-scheduler-operator/templates/NOTES.txt @@ -0,0 +1 @@ +AppVersion: {{.Chart.AppVersion }} diff --git a/charts/workload-scheduler-operator/templates/_helpers.tpl b/charts/workload-scheduler-operator/templates/_helpers.tpl new file mode 100644 index 0000000..920d332 --- /dev/null +++ b/charts/workload-scheduler-operator/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "workload-scheduler-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 "workload-scheduler-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 "workload-scheduler-operator.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "workload-scheduler-operator.labels" -}} +helm.sh/chart: {{ include "workload-scheduler-operator.chart" . }} +{{ include "workload-scheduler-operator.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "workload-scheduler-operator.selectorLabels" -}} +app.kubernetes.io/name: {{ include "workload-scheduler-operator.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "workload-scheduler-operator.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "workload-scheduler-operator.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/workload-scheduler-operator/templates/clusterrole.yaml b/charts/workload-scheduler-operator/templates/clusterrole.yaml new file mode 100644 index 0000000..cdb235c --- /dev/null +++ b/charts/workload-scheduler-operator/templates/clusterrole.yaml @@ -0,0 +1,104 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "workload-scheduler-operator.fullname" . }} + labels: + {{- include "workload-scheduler-operator.labels" . | nindent 4 }} +rules: + - apiGroups: + - apps + resources: + - deployments + verbs: + - get + - list + - update + - watch + - apiGroups: + - apps + resources: + - statefulsets + verbs: + - get + - list + - update + - watch + - apiGroups: + - workload-scheduler.bennsimon.github.io + resources: + - schedules + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - workload-scheduler.bennsimon.github.io + resources: + - schedules/finalizers + verbs: + - update + - apiGroups: + - workload-scheduler.bennsimon.github.io + resources: + - schedules/status + verbs: + - get + - patch + - update + - apiGroups: + - workload-scheduler.bennsimon.github.io + resources: + - workloadschedulecontrollers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - workload-scheduler.bennsimon.github.io + resources: + - workloadschedulecontrollers/finalizers + verbs: + - update + - apiGroups: + - workload-scheduler.bennsimon.github.io + resources: + - workloadschedulecontrollers/status + verbs: + - get + - patch + - update + - apiGroups: + - workload-scheduler.bennsimon.github.io + resources: + - workloadschedules + verbs: + - create + - delete + - get + - list + - patch + - update + - watch + - apiGroups: + - workload-scheduler.bennsimon.github.io + resources: + - workloadschedules/finalizers + verbs: + - update + - apiGroups: + - workload-scheduler.bennsimon.github.io + resources: + - workloadschedules/status + verbs: + - get + - patch + - update diff --git a/charts/workload-scheduler-operator/templates/clusterrolebinding.yaml b/charts/workload-scheduler-operator/templates/clusterrolebinding.yaml new file mode 100644 index 0000000..bbd93d8 --- /dev/null +++ b/charts/workload-scheduler-operator/templates/clusterrolebinding.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + {{- include "workload-scheduler-operator.labels" . | nindent 4 }} + name: {{ include "workload-scheduler-operator.fullname" . }} + +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "workload-scheduler-operator.fullname" . }} +subjects: + - kind: ServiceAccount + name: {{ include "workload-scheduler-operator.fullname" . }} + namespace: {{ .Release.Namespace }} diff --git a/charts/workload-scheduler-operator/templates/deployment.yaml b/charts/workload-scheduler-operator/templates/deployment.yaml new file mode 100644 index 0000000..c2d8a34 --- /dev/null +++ b/charts/workload-scheduler-operator/templates/deployment.yaml @@ -0,0 +1,60 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "workload-scheduler-operator.fullname" . }} + labels: + {{- include "workload-scheduler-operator.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "workload-scheduler-operator.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "workload-scheduler-operator.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "workload-scheduler-operator.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: + - /manager + env: + {{- if .Values.env }} + {{- toYaml .Values.env | nindent 12 }} + {{- end }} + livenessProbe: + {{- toYaml .Values.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/workload-scheduler-operator/templates/serviceaccount.yaml b/charts/workload-scheduler-operator/templates/serviceaccount.yaml new file mode 100644 index 0000000..9ca4ef4 --- /dev/null +++ b/charts/workload-scheduler-operator/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +--- +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "workload-scheduler-operator.serviceAccountName" . }} + labels: + {{- include "workload-scheduler-operator.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/workload-scheduler-operator/values.yaml b/charts/workload-scheduler-operator/values.yaml new file mode 100644 index 0000000..8eb3f30 --- /dev/null +++ b/charts/workload-scheduler-operator/values.yaml @@ -0,0 +1,82 @@ +--- +# Default values for workload-scheduler-operator. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: bennsimon/workload-scheduler-operator + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "main-v6" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +resources: {} +# limits: +# cpu: 500m +# memory: 128Mi +# requests: +# cpu: 10m +# memory: 64Mi + +livenessProbe: + httpGet: + path: /healthz + port: 8081 + initialDelaySeconds: 15 + periodSeconds: 20 + +readinessProbe: + httpGet: + path: /readyz + port: 8081 + initialDelaySeconds: 5 + periodSeconds: 10 + +autoscaling: + enabled: false + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +crds: + enabled: true + +env: +# - name: TZ +# value: "Africa/Nairobi" +# - name: NAMESPACES_OFF_LIMITS +# value: "cert-manager,workload-scheduler-operator" +# - name: RECONCILIATION_DURATION +# value: "60" +# - name: DEBUG +# value: "false" From dcd77bb945fbfc5aabe2e04bae80dedba944193f Mon Sep 17 00:00:00 2001 From: bennsimon Date: Thu, 3 Aug 2023 08:02:42 +0300 Subject: [PATCH 2/6] update kubeversion --- charts/workload-scheduler-operator/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/workload-scheduler-operator/README.md b/charts/workload-scheduler-operator/README.md index ab4420d..a108f93 100644 --- a/charts/workload-scheduler-operator/README.md +++ b/charts/workload-scheduler-operator/README.md @@ -16,7 +16,7 @@ This chart bootstraps [workload-scheduler-operator](https://github.com/bennsimo ## Prerequisites -- Kubernetes 1.21+ +- Kubernetes 1.16+ - Helm 3.1.0 ## Installing the Chart From 09cc795640d1e7dc598f4120088b12d471dec819 Mon Sep 17 00:00:00 2001 From: bennsimon Date: Mon, 7 Aug 2023 12:17:06 +0300 Subject: [PATCH 3/6] remove workloadschedulecontroller resource --- charts/workload-scheduler-operator/Chart.lock | 6 +-- charts/workload-scheduler-operator/Chart.yaml | 4 +- .../charts/crds/Chart.yaml | 2 +- .../crds/crd-workloadschedulecontroller.yaml | 52 ------------------- .../templates/clusterrole.yaml | 26 ---------- .../workload-scheduler-operator/values.yaml | 2 +- 6 files changed, 7 insertions(+), 85 deletions(-) delete mode 100644 charts/workload-scheduler-operator/charts/crds/crds/crd-workloadschedulecontroller.yaml diff --git a/charts/workload-scheduler-operator/Chart.lock b/charts/workload-scheduler-operator/Chart.lock index 27962cc..929774f 100644 --- a/charts/workload-scheduler-operator/Chart.lock +++ b/charts/workload-scheduler-operator/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: crds repository: "" - version: 0.1.0 -digest: sha256:f9d3034df90169322e24e32ab5ea8f1947dc2aca3ab79960d6687b79a512efeb -generated: "2023-08-02T12:57:12.454686717+03:00" + version: 0.1.1 +digest: sha256:51ac042177bfafb53bce963a37a91c38f2109778677b1f94af66531d0bab44c1 +generated: "2023-08-07T12:10:02.033733461+03:00" diff --git a/charts/workload-scheduler-operator/Chart.yaml b/charts/workload-scheduler-operator/Chart.yaml index 1dd4542..957605a 100644 --- a/charts/workload-scheduler-operator/Chart.yaml +++ b/charts/workload-scheduler-operator/Chart.yaml @@ -21,9 +21,9 @@ version: 0.1.0 # 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: "0.1.0" +appVersion: "v0.1.1-beta-r1" dependencies: - name: crds - version: "0.1.0" + version: "0.1.1" condition: crds.enabled diff --git a/charts/workload-scheduler-operator/charts/crds/Chart.yaml b/charts/workload-scheduler-operator/charts/crds/Chart.yaml index 2a49a4b..72ca9f2 100644 --- a/charts/workload-scheduler-operator/charts/crds/Chart.yaml +++ b/charts/workload-scheduler-operator/charts/crds/Chart.yaml @@ -15,4 +15,4 @@ 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 +version: 0.1.1 diff --git a/charts/workload-scheduler-operator/charts/crds/crds/crd-workloadschedulecontroller.yaml b/charts/workload-scheduler-operator/charts/crds/crds/crd-workloadschedulecontroller.yaml deleted file mode 100644 index a402389..0000000 --- a/charts/workload-scheduler-operator/charts/crds/crds/crd-workloadschedulecontroller.yaml +++ /dev/null @@ -1,52 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.12.0 - name: workloadschedulecontrollers.workload-scheduler.bennsimon.github.io -spec: - group: workload-scheduler.bennsimon.github.io - names: - kind: WorkloadScheduleController - listKind: WorkloadScheduleControllerList - plural: workloadschedulecontrollers - singular: workloadschedulecontroller - scope: Cluster - versions: - - name: v1 - schema: - openAPIV3Schema: - description: WorkloadScheduleController is the Schema for the workloadschedulecontrollers - API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: WorkloadScheduleControllerSpec defines the desired state - of WorkloadScheduleController - properties: - foo: - description: Foo is an example field of WorkloadScheduleController. - Edit workloadschedulecontroller_types.go to remove/update - type: string - type: object - status: - description: WorkloadScheduleControllerStatus defines the observed state - of WorkloadScheduleController - type: object - type: object - served: true - storage: true - subresources: - status: {} diff --git a/charts/workload-scheduler-operator/templates/clusterrole.yaml b/charts/workload-scheduler-operator/templates/clusterrole.yaml index cdb235c..746d993 100644 --- a/charts/workload-scheduler-operator/templates/clusterrole.yaml +++ b/charts/workload-scheduler-operator/templates/clusterrole.yaml @@ -50,32 +50,6 @@ rules: - get - patch - update - - apiGroups: - - workload-scheduler.bennsimon.github.io - resources: - - workloadschedulecontrollers - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - apiGroups: - - workload-scheduler.bennsimon.github.io - resources: - - workloadschedulecontrollers/finalizers - verbs: - - update - - apiGroups: - - workload-scheduler.bennsimon.github.io - resources: - - workloadschedulecontrollers/status - verbs: - - get - - patch - - update - apiGroups: - workload-scheduler.bennsimon.github.io resources: diff --git a/charts/workload-scheduler-operator/values.yaml b/charts/workload-scheduler-operator/values.yaml index 8eb3f30..a0cd2a1 100644 --- a/charts/workload-scheduler-operator/values.yaml +++ b/charts/workload-scheduler-operator/values.yaml @@ -9,7 +9,7 @@ image: repository: bennsimon/workload-scheduler-operator pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - tag: "main-v6" + tag: "" imagePullSecrets: [] nameOverride: "" From 2d209cfeede7c52eb384efb1f6227eb0a3442e23 Mon Sep 17 00:00:00 2001 From: bennsimon Date: Mon, 7 Aug 2023 15:20:29 +0300 Subject: [PATCH 4/6] add github workflows for chart deployment --- .github/workflows/lint-checker.yml | 34 +++++++++++++++++++++++++++++ .github/workflows/publish-chart.yml | 34 +++++++++++++++++++++++++++++ ct.yaml | 5 +++++ 3 files changed, 73 insertions(+) create mode 100644 .github/workflows/lint-checker.yml create mode 100644 .github/workflows/publish-chart.yml create mode 100644 ct.yaml diff --git a/.github/workflows/lint-checker.yml b/.github/workflows/lint-checker.yml new file mode 100644 index 0000000..4b29d1c --- /dev/null +++ b/.github/workflows/lint-checker.yml @@ -0,0 +1,34 @@ +name: Lint and Test Charts + +on: + pull_request: + paths: + - "charts/**" + 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/chart-testing-action@v2.0.1 + - 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 diff --git a/.github/workflows/publish-chart.yml b/.github/workflows/publish-chart.yml new file mode 100644 index 0000000..5fc560f --- /dev/null +++ b/.github/workflows/publish-chart.yml @@ -0,0 +1,34 @@ +# Kindly refer to https://github.com/helm/chart-releaser-action + +name: Publish Charts + +on: + push: + paths: + - "charts/**" + 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 "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Install Helm + uses: azure/setup-helm@v3 + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1.5.0 # step that writes the latest chart versions (below) depends on this step writing the latest version as the first index in the entries. list in the index.yaml file + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/ct.yaml b/ct.yaml new file mode 100644 index 0000000..5f99c23 --- /dev/null +++ b/ct.yaml @@ -0,0 +1,5 @@ +# See https://github.com/helm/chart-testing#configuration +remote: origin +target-branch: main +chart-dirs: + - charts From 2c3be44c9b853984a60ed567a1cfc248330872a6 Mon Sep 17 00:00:00 2001 From: bennsimon Date: Mon, 7 Aug 2023 15:39:34 +0300 Subject: [PATCH 5/6] update chart dependeny repository --- charts/workload-scheduler-operator/Chart.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/workload-scheduler-operator/Chart.yaml b/charts/workload-scheduler-operator/Chart.yaml index 957605a..343217a 100644 --- a/charts/workload-scheduler-operator/Chart.yaml +++ b/charts/workload-scheduler-operator/Chart.yaml @@ -27,3 +27,4 @@ dependencies: - name: crds version: "0.1.1" condition: crds.enabled + repository: "" From 2b761ca52cd8848319f07eb351f3ddfeed1f5ee4 Mon Sep 17 00:00:00 2001 From: bennsimon Date: Mon, 7 Aug 2023 15:41:30 +0300 Subject: [PATCH 6/6] add maintainers --- charts/workload-scheduler-operator/Chart.yaml | 4 +++- charts/workload-scheduler-operator/charts/crds/Chart.yaml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/charts/workload-scheduler-operator/Chart.yaml b/charts/workload-scheduler-operator/Chart.yaml index 343217a..22b5f7b 100644 --- a/charts/workload-scheduler-operator/Chart.yaml +++ b/charts/workload-scheduler-operator/Chart.yaml @@ -1,7 +1,9 @@ apiVersion: v2 name: workload-scheduler-operator description: A Helm chart for Kubernetes - +maintainers: + - name: bennsimon + email: bennsimonotieno@gmail.com # 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 diff --git a/charts/workload-scheduler-operator/charts/crds/Chart.yaml b/charts/workload-scheduler-operator/charts/crds/Chart.yaml index 72ca9f2..51362e8 100644 --- a/charts/workload-scheduler-operator/charts/crds/Chart.yaml +++ b/charts/workload-scheduler-operator/charts/crds/Chart.yaml @@ -1,7 +1,9 @@ apiVersion: v2 name: crds description: A Helm chart for Kubernetes - +maintainers: + - name: bennsimon + email: bennsimonotieno@gmail.com # 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