Merge pull request #3524 from calvin0327/add-karmada-operator-chart

karmada operator: add karmada operator chart
This commit is contained in:
karmada-bot 2023-05-24 11:25:56 +08:00 committed by GitHub
commit 81d231a36d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 1947 additions and 1 deletions

1
.gitignore vendored
View File

@ -24,3 +24,4 @@ _output/
# sub chart tgz
charts/karmada/charts
charts/karmada-operator/charts

View File

@ -0,0 +1,21 @@
# 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

View File

@ -0,0 +1,6 @@
dependencies:
- name: common
repository: https://charts.bitnami.com/bitnami
version: 1.17.1
digest: sha256:91bdebcf473f5da3c018dd74f25fab166d4faaa6be86d492f5caa50fc63f93fb
generated: "2023-05-11T18:40:11.244865+08:00"

View File

@ -0,0 +1,40 @@
apiVersion: v2
name: karmada-operator
description: A Helm chart for karmada-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
# The optional kubeVersion field can define semver constraints on supported Kubernetes versions.
# Helm will validate the version constraints when installing the chart and fail if the cluster
# runs an unsupported Kubernetes version.
kubeVersion: ">= 1.16.0-0"
# 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/)
# We use `0.0.0` as the latest chart version.
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.
appVersion: latest
# This is karmada dependencies
dependencies:
- name: common
repository: https://charts.bitnami.com/bitnami
version: 1.x.x
# This is karmada maintainers
maintainers:
- name: calvin0327
email: wen.chen@daocloud.io

View File

@ -0,0 +1,80 @@
# karmada-operator
![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)
The Karmada operator is a method for installing, upgrading, and deleting Karmada instances. It builds upon the basic Karmada resource and controller concepts and provides convenience to centrally manage the entire lifecycle of Karmada instances in a global cluster. With the operator, you can extend Karmada with custom resources (CRs) to manage your instances not only in local clusters but also in remote clusters.
This page provides instructions on how to install, upgrade, and uninstall Karmada-operator.
## Prerequisites
- Kubernetes 1.16+
- helm v3+
| Repository | Name | Version |
|------------|------|---------|
| https://charts.bitnami.com/bitnami | common | 1.x.x |
## Installing or upgrading the Chart
Go to the root directory of the `karmada-io/karmada` repo. To install or upgrade the Helm Chart with
the release name `karmada-operator` in the `karmada-system` namespace.
```bash
helm upgrade --install karmada-operator --create-namespace ./charts/karmada-operator \
--set operator.replicaCount=<replica_count> \
--set operator.image.registry=<image_registry> \
--set operator.image.repository=<image_repository> \
--set operator.image.tag=<image_tag>
-n karmada-system --version <chart_version>
```
For example, you can simply run the helm command:
```bash
helm install karmada-operator -n karmada-system --create-namespace --dependency-update ./charts/karmada-operator
```
Then, check the status of `karmada-operator` pod.
```console
kubectl get po -n karmada-system
NAME READY STATUS RESTARTS AGE
karmada-operator-df95586f6-d5bll 1/1 Running 0 6s
```
## Uninstalling the Chart
To uninstall/delete the `karmada-operator` helm release in the `karmada-system` namespace, run:
```bash
helm uninstall karmada-operator -n karmada-system
```
The command removes all the Kubernetes components associated with the chart and deletes the release.
## Values
This chart supports the following values:
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| global.imagePullSecrets | list | `[]` | |
| global.imageRegistry | string | `""` | |
| operator.affinity | object | `{}` | |
| operator.image.pullPolicy | string | `"IfNotPresent"` | |
| operator.image.pullSecrets | list | `[]` | |
| operator.image.registry | string | `"docker.io"` | |
| operator.image.repository | string | `"karmada/karmada-operator"` | |
| operator.image.tag | string | `"latest"` | |
| operator.labels | object | `{}` | |
| operator.nodeSelector | object | `{}` | |
| operator.podAnnotations | object | `{}` | |
| operator.podLabels | object | `{}` | |
| operator.replicaCount | int | `1` | |
| operator.resources | object | `{}` | |
| operator.strategy.rollingUpdate.maxSurge | string | `"50%"` | |
| operator.strategy.rollingUpdate.maxUnavailable | int | `0` | |
| operator.strategy.type | string | `"RollingUpdate"` | |
| operator.tolerations | list | `[]` | |

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
Thank you for installing {{ .Chart.Name }}.
Your release is named {{ .Release.Name }}.
To learn more about the release, try:
$ helm status {{ .Release.Name }} -n {{ .Release.Namespace }}
$ helm get all {{ .Release.Name }} -n {{ .Release.Namespace }}

View File

@ -0,0 +1,21 @@
{{/*
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).
*/}}
{{- define "karmada.operator.fullname" -}}
{{- printf (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper karmada operator image name
*/}}
{{- define "karmada.operator.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.operator.image "global" .Values.global) }}
{{- end -}}
{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "karmada.operator.imagePullSecrets" -}}
{{ include "common.images.pullSecrets" (dict "images" (list .Values.operator.image) "global" .Values.global) }}
{{- end -}}

View File

@ -0,0 +1,11 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "common.names.fullname" . }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
rules:
- apiGroups: ['*']
resources: ['*']
verbs: ["*"]
- nonResourceURLs: ['*']
verbs: ["get"]

View File

@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "common.names.fullname" . }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "common.names.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "karmada.operator.fullname" . }}
namespace: {{ .Release.Namespace }}

View File

@ -0,0 +1,55 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "karmada.operator.fullname" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app: {{ include "karmada.operator.fullname" . }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.operator.replicaCount }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app: {{ include "karmada.operator.fullname" . }}
{{- if .Values.operator.strategy }}
strategy: {{- include "common.tplvalues.render" (dict "value" .Values.operator.strategy "context" $) | nindent 4 }}
{{- end }}
template:
metadata:
{{- if .Values.operator.podAnnotations }}
annotations:
{{- include "common.tplvalues.render" (dict "value" .Values.operator.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app: {{ include "karmada.operator.fullname" . }}
{{- if .Values.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.operator.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
{{- include "karmada.operator.imagePullSecrets" . | indent 6 }}
containers:
- name: {{ include "karmada.operator.fullname" . }}
image: {{ template "karmada.operator.image" . }}
imagePullPolicy: {{ .Values.operator.image.pullPolicy }}
command:
- /bin/karmada-operator
- --leader-elect-resource-namespace={{ .Release.Namespace }}
- --v=2
{{- if .Values.operator.resources }}
resources: {{- toYaml .Values.operator.resources | nindent 12 }}
{{- end }}
serviceAccountName: {{ include "karmada.operator.fullname" . }}
{{- if .Values.operator.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.operator.affinity "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.operator.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.operator.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.operator.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.operator.tolerations "context" $) | nindent 8 }}
{{- end }}

View File

@ -0,0 +1,6 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "karmada.operator.fullname" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}

View File

@ -0,0 +1,66 @@
## Default values for charts.
## This is a YAML-formatted file.
## Declare variables to be passed into your templates.
## @param global karmada global config
global:
## @param global.imageRegistry Global Docker image registry
imageRegistry: ""
## E.g.
## imagePullSecrets:
## - myRegistryKeySecretName
imagePullSecrets: []
## operator manager config
operator:
## @param operator.labels
labels: {}
## @param operator.replicaCount target replicas
replicaCount: 1
## @param operator.podAnnotations
podAnnotations: {}
## @param operator.podLabels
podLabels: {}
## @param image.registry operator image registry
## @param image.repository operator image repository
## @param image.tag operator image tag (immutable tags are recommended)
## @param image.pullPolicy operator image pull policy
## @param image.pullSecrets Specify docker-registry secret names as an array
##
image:
registry: docker.io
repository: karmada/karmada-operator
tag: latest
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
##
pullPolicy: IfNotPresent
## Optionally specify an array of imagePullSecrets.
## Secrets must be manually created in the namespace.
## Example:
## pullSecrets:
## - myRegistryKeySecretName
##
pullSecrets: []
## @param.resources
resources: {}
# If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
## @param.nodeSelector
nodeSelector: {}
## @param.affinity
affinity: {}
## @param.tolerations
tolerations: []
## @param scheduler.strategy strategy of the scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 50%

View File

@ -18,4 +18,4 @@ controller-gen crd paths=./pkg/apis/policy/... output:crd:dir=./charts/karmada/_
controller-gen crd paths=./pkg/apis/work/... output:crd:dir=./charts/karmada/_crds/bases
controller-gen crd paths=./pkg/apis/networking/... output:crd:dir=./charts/karmada/_crds/bases
controller-gen crd paths=./examples/customresourceinterpreter/apis/... output:crd:dir=./examples/customresourceinterpreter/apis/
controller-gen crd paths=./operator/pkg/apis/operator/... output:crd:dir=./operator/config/crds
controller-gen crd paths=./operator/pkg/apis/operator/... output:crd:dir=./charts/karmada-operator/crds