Commit 598d40d2 authored by calvin's avatar calvin
Browse files

add helm

Signed-off-by: default avatarcalvin <wen.chen@daocloud.io>

build helm template
Signed-off-by: default avatarcalvin <wen.chen@daocloud.io>
parent cdce380b
Showing with 900 additions and 0 deletions
+900 -0
/bin
/charts/charts/*.tgz
# 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
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 11.1.12
- name: mysql
repository: https://charts.bitnami.com/bitnami
version: 8.8.29
- name: common
repository: https://charts.bitnami.com/bitnami
version: 1.13.0
digest: sha256:9f211b3d44111b7737fae003c0f13aafb34545c9caeb4308e9f5f5195fa8177a
generated: "2022-03-29T10:00:09.698876+08:00"
apiVersion: v2
name: clusterpedia
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.0.2
# 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"
# This is clusterpedia dependencies
dependencies:
- condition: postgresql.enabled
name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 11.x.x
- condition: mysql.enabled
name: mysql
repository: https://charts.bitnami.com/bitnami
version: 8.x.x
- name: common
repository: https://charts.bitnami.com/bitnami
version: 1.x.x
# Clusterpedia
This name Clusterpedia is inspired by Wikipedia. It is an encyclopedia of multi-cluster to synchronize, search for, and simply control multi-cluster resources.
Clusterpedia can synchronize resources with multiple clusters and provide more powerful search features on the basis of compatibility with Kubernetes OpenAPI to help you effectively get any multi-cluster resource that you are looking for in a quick and easy way.
# Prerequisites
* [Insall Helm version 3 or later](https://helm.sh/docs/intro/install/)
# Install
## Install CRDs
clusterpedia requires CRD resources, which can be installed manually using kubectl, or using the `installCRDs` option when installing the Helm Chart
> This way references the [cert-manager](https://cert-manager.io/docs/installation/helm/)
**Option 1: install CRDs with `kubectl`**
```bash
$ kubectl apply -f ./_crd
```
**Option 2: install CRDs as part of the Helm release**
To automatically install and manage the CRDs as part of your Helm release, you must add the `--set installCRDs=true` flag to your Helm installation command.
Uncomment the relevant line in the next steps to enable this.
## Select a storage component
Clusterpedia uses sub charts to install [postgresql](https://github.com/bitnami/charts/tree/master/bitnami/postgresql) or [mysql](https://github.com/bitnami/charts/tree/master/bitnami/postgresql), and `postgresql` is installed by default.
If you need to select `mysql` as the storage component, then you need to add the `--set postgresql.enabled=false --set mysql.enabled=true` to you Helm installation command.
More configurations of the storage components can be found in [bitnami/postgresql](https://github.com/bitnami/charts/tree/master/bitnami/postgresql) and [bitnami/mysql](https://github.com/bitnami/charts/tree/master/bitnami/mysql).
### Create Local PV
This chart creates a local pv for the storage component, but you need to specify the node using the `persistenceMatchNode` option, eg. `--set persistenceMatchNode=master-1`.
If you don't need to create a local pv, add the `--set persistenceMatchNode=None` flag.
## Install Clusterpedia
```bash
$ helm install clusterpedia . \
--namespace clusterpedia-system \
--create-namespace \
--set persistenceMatchNode={{ LOCAL_PV_NODE }} \
# --set installCRDs=true
```
# Uninstall
Before continuing, ensure that all clusterpedia resources that have been created by users have been deleted.
You can check for any existing resources with the following command:
```bash
$ kubectl get pediaclusters
```
Once all these resources have been deleted you are ready to unisntall clusterpedia.
```bash
$ helm --namespace clusterpedia-system uinstall clusterpedia
```
If the CRDs is not managed through Helm, then you need to delete the crd manually:
```bash
$ kubectl delete -f ./_crd
```
\ No newline at end of file
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
name: pediaclusters.cluster.clusterpedia.io
spec:
group: cluster.clusterpedia.io
names:
kind: PediaCluster
listKind: PediaClusterList
plural: pediaclusters
singular: pediacluster
scope: Cluster
versions:
- additionalPrinterColumns:
- jsonPath: .spec.apiserver
name: APIServer
type: string
- jsonPath: .status.version
name: Version
type: string
- jsonPath: .status.conditions[?(@.type == 'Ready')].reason
name: Status
type: string
name: v1alpha2
schema:
openAPIV3Schema:
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:
properties:
apiserver:
type: string
caData:
format: byte
type: string
certData:
format: byte
type: string
keyData:
format: byte
type: string
kubeconfig:
format: byte
type: string
syncResources:
items:
properties:
group:
type: string
resources:
items:
type: string
minItems: 1
type: array
versions:
items:
type: string
type: array
required:
- group
- resources
type: object
type: array
tokenData:
format: byte
type: string
required:
- syncResources
type: object
status:
properties:
conditions:
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are:
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
\n // other fields }"
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
syncResources:
items:
properties:
group:
type: string
resources:
items:
properties:
kind:
type: string
name:
type: string
namespaced:
type: boolean
syncConditions:
items:
properties:
lastTransitionTime:
format: date-time
type: string
message:
description: optional
type: string
reason:
description: optional
type: string
status:
type: string
storageVersion:
description: optional
type: string
storrageResource:
description: optional
type: string
version:
type: string
required:
- lastTransitionTime
- status
- version
type: object
type: array
required:
- kind
- name
- namespaced
- syncConditions
type: object
type: array
required:
- group
- resources
type: object
type: array
version:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
\ No newline at end of file
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 }}
Documentation: https://clusterpedia.io/docs/
View imported clusters:
$ kubectl get pediacluster
Lean More -> https://clusterpedia.io/docs/usage/import-clusters/
Configure the cluster shortcut for kubectl:
$ curl -sfL https://raw.githubusercontent.com/clusterpedia-io/clusterpedia/main/hack/gen-clusterconfigs.sh | sh -
$ kubectl --cluster clusterpedia api-resources
Lean More -> https://clusterpedia.io/docs/usage/access-clusterpedia/#configure-the-cluster-shortcut-for-kubectl
\ No newline at end of file
{{/*
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 "clusterpedia.apiserver.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "apiserver" | 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).
*/}}
{{- define "clusterpedia.clustersynchroManager.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "clustersynchro-manager" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper apiserver image name
*/}}
{{- define "clusterpedia.apiserver.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.apiserver.image "global" .Values.global) }}
{{- end -}}
{{/*
Return the proper clustersynchroManager image name
*/}}
{{- define "clusterpedia.clustersynchroManager.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.clustersynchroManager.image "global" .Values.global) }}
{{- end -}}
{{- define "clusterpedia.internalstorage.fullname" -}}
{{- printf "%s-%s" (include "common.names.fullname" .) "internalstorage" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "clusterpedia.apiserver.imagePullSecrets" -}}
{{ include "common.images.pullSecrets" (dict "images" (list .Values.apiserver.image) "global" .Values.global) }}
{{- end -}}
{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "clusterpedia.clustersynchroManager.imagePullSecrets" -}}
{{ include "common.images.pullSecrets" (dict "images" (list .Values.clustersynchroManager.image) "global" .Values.global) }}
{{- end -}}
{{- define "clusterpedia.storage.user" -}}
{{- if eq .Values.storageInstallMode "external" }}
{{- required "Please set correct storage user!" .Values.externalStorage.user -}}
{{- else -}}
{{- if eq (include "clusterpedia.storage.type" .) "postgres" -}}
{{- if not (empty .Values.global.postgresql.auth.username) -}}
{{- .Values.global.postgresql.auth.username -}}
{{- else -}}
{{- "postgres" -}}
{{- end -}}
{{- else if eq (include "clusterpedia.storage.type" .) "mysql" -}}
{{- if not (empty .Values.mysql.auth.username) -}}
{{- .Values.mysql.auth.username -}}
{{- else -}}
{{- "root" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- define "clusterpedia.storage.password" -}}
{{- if eq .Values.storageInstallMode "external" }}
{{- required "Please set correct storage password!" .Values.externalStorage.password -}}
{{- else -}}
{{- if eq (include "clusterpedia.storage.type" .) "postgres" }}
{{- if not (empty .Values.global.postgresql.auth.username) -}}
{{- .Values.global.postgresql.auth.password | b64enc -}}
{{- else -}}
{{- .Values.global.postgresql.auth.postgresPassword | b64enc -}}
{{- end -}}
{{- else if eq (include "clusterpedia.storage.type" .) "mysql" -}}
{{- if not (empty .Values.mysql.auth.username) -}}
{{- .Values.mysql.auth.password | b64enc -}}
{{- else -}}
{{- .Values.mysql.auth.rootPassword | b64enc -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/* use the default port */}}
{{- define "clusterpedia.storage.port" -}}
{{- if eq .Values.storageInstallMode "external" }}
{{- required "Please set correct storage port!" .Values.externalStorage.port -}}
{{- else -}}
{{- if eq (include "clusterpedia.storage.type" .) "postgres" -}}
{{- .Values.postgresql.primary.service.ports.postgresql -}}
{{- else if eq (include "clusterpedia.storage.type" .) "mysql" -}}
{{- .Values.mysql.primary.service.port -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/* use the default port */}}
{{- define "clusterpedia.storage.host" -}}
{{- if eq .Values.storageInstallMode "external" }}
{{- required "Please set correct storage host!" .Values.externalStorage.host -}}
{{- else -}}
{{- if eq (include "clusterpedia.storage.type" .) "postgres" -}}
{{- include "clusterpedia.postgresql.fullname" . -}}
{{- else if eq (include "clusterpedia.storage.type" .) "mysql" -}}
{{- include "clusterpedia.mysql.fullname" . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- define "clusterpedia.storage.database" -}}
{{- if eq .Values.storageInstallMode "external" }}
{{- if empty .Values.externalStorage.database }}
{{ required "Please set correct storage database!" "" }}
{{- else -}}
{{- .Values.externalStorage.database | quote -}}
{{- end -}}
{{- else -}}
{{- "clusterpedia" -}}
{{- end -}}
{{- 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).
*/}}
{{- define "clusterpedia.postgresql.fullname" -}}
{{- printf "%s-%s" .Release.Name "postgresql" | 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).
*/}}
{{- define "clusterpedia.mysql.fullname" -}}
{{- printf "%s-%s" .Release.Name "mysql" | 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).
*/}}
{{- define "clusterpedia.job.storage.fullname" -}}
{{- printf "check-%s-local-pv-dir" (include "clusterpedia.persistence.matchNode" .) -}}
{{- end -}}
{{- define "clusterpedia.persistence.matchNode" -}}
{{- if and (not (empty .Values.persistenceMatchNode)) (not (eq .Values.persistenceMatchNode "None")) }}
{{- .Values.persistenceMatchNode -}}
{{- else if not (eq .Values.persistenceMatchNode "None") -}}
{{- required "Please set parameter persistenceMatchNode, if PV resources are not required, set it to None!" .Values.persistenceMatchNode -}}
{{- end -}}
{{- end -}}
{{- define "clusterpedia.internalstorage.capacity" -}}
{{- if eq (include "clusterpedia.storage.type" .) "postgres" -}}
{{- .Values.postgresql.primary.persistence.size -}}
{{- else if eq (include "clusterpedia.storage.type" .) "mysql" -}}
{{- .Values.mysql.primary.persistence.size -}}
{{- end -}}
{{- end -}}
{{- define "clusterpedia.storage.type" -}}
{{- if eq .Values.storageInstallMode "internal" }}
{{- if or (and .Values.postgresql.enabled .Values.mysql.enabled) (and (not .Values.postgresql.enabled) (not .Values.mysql.enabled)) }}
{{ required "Please enable the correct storage type!" "" }}
{{- else if .Values.postgresql.enabled }}
{{- "postgres" -}}
{{- else if .Values.mysql.enabled }}
{{- "mysql" -}}
{{- end -}}
{{- else -}}
{{- if or .Values.postgresql.enabled .Values.mysql.enabled -}}
{{ required "Please also disable the internal mysql and postgres!" "" }}
{{- else -}}
{{- required "A valid storage type is required!" .Values.externalStorage.type -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- define "clusterpedia.storage.image" -}}
{{- if eq (include "clusterpedia.storage.type" .) "postgres" -}}
{{- include "clusterpedia.storage.postgresql.image" . -}}
{{- else if eq (include "clusterpedia.storage.type" .) "mysql" -}}
{{- include "clusterpedia.storage.mysql.image" . -}}
{{- end -}}
{{- end -}}
{{- define "clusterpedia.storage.postgresql.image" -}}
{{- $registryName := .Values.postgresql.image.registry -}}
{{- $repositoryName := .Values.postgresql.image.repository -}}
{{- $tag := .Values.postgresql.image.tag -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- define "clusterpedia.storage.mysql.image" -}}
{{- $registryName := .Values.mysql.image.registry -}}
{{- $repositoryName := .Values.mysql.image.repository -}}
{{- $tag := .Values.mysql.image.tag -}}
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
{{- end -}}
{{- define "clusterpedia.storage.mountPath" -}}
{{- if eq (include "clusterpedia.storage.type" .) "postgres" -}}
{{- "/bitnami/postgresql" -}}
{{- else if eq (include "clusterpedia.storage.type" .) "mysql" -}}
{{- "/bitnami/mysql" -}}
{{- end -}}
{{- end -}}
{{- define "clusterpedia.storage.hostPath" -}}
{{- printf "/var/local/clusterpedia/internalstorage/%s" (include "clusterpedia.storage.type" .) -}}
{{- end -}}
{{- define "clusterpedia.storage.lables" -}}
{{- if eq (include "clusterpedia.storage.type" .) "postgres" }}
{{- .Values.postgresql.primary.persistence.selector.matchLables -}}
{{- else if eq (include "clusterpedia.storage.type" .) "mysql" -}}
{{- .Values.mysql.primary.persistence.selector.matchLabels -}}
{{- end -}}
{{- end -}}
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
name: v1beta1.clusterpedia.io
labels: {{- include "common.labels.standard" . | nindent 4 }}
spec:
insecureSkipTLSVerify: true
group: clusterpedia.io
groupPriorityMinimum: 1000
versionPriority: 100
service:
name: {{ include "clusterpedia.apiserver.fullname" . }}
namespace: {{ .Release.Namespace }}
version: v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "clusterpedia.apiserver.fullname" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app: {{ include "clusterpedia.apiserver.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.apiserver.replicaCount }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app: {{ include "clusterpedia.apiserver.fullname" . }}
template:
metadata:
{{- if .Values.apiserver.podAnnotations }}
annotations:
{{- include "common.tplvalues.render" (dict "value" .Values.apiserver.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app: {{ include "clusterpedia.apiserver.fullname" . }}
{{- if .Values.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.apiserver.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
{{- include "clusterpedia.apiserver.imagePullSecrets" . | nindent 6 }}
containers:
- name: {{ include "clusterpedia.apiserver.fullname" . }}
image: {{ template "clusterpedia.apiserver.image" . }}
imagePullPolicy: {{ .Values.apiserver.image.pullPolicy }}
command:
- /usr/local/bin/apiserver
- --secure-port=443
- --storage-config=/etc/clusterpedia/storage/internalstorage-config.yaml
- -v=3
{{- if .Values.apiserver.resources }}
resources: {{- toYaml .Values.apiserver.resources | nindent 12 }}
{{- end }}
env:
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "clusterpedia.internalstorage.fullname" . }}
key: password
volumeMounts:
- name: internalstorage-config
mountPath: /etc/clusterpedia/storage
readOnly: true
serviceAccountName: {{ include "clusterpedia.apiserver.fullname" . }}
{{- if .Values.apiserver.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.apiserver.affinity "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.apiserver.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.apiserver.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.apiserver.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.apiserver.tolerations "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: internalstorage-config
configMap:
name: {{ include "clusterpedia.internalstorage.fullname" . }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "clusterpedia.apiserver.fullname" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
spec:
ports:
- port: 443
protocol: TCP
targetPort: 443
selector:
app: {{ include "clusterpedia.apiserver.fullname" . }}
{{- if .Values.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.apiserver.podLabels "context" $) | nindent 4 }}
{{- end }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "clusterpedia.apiserver.fullname" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Release.Name }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
rules:
- apiGroups: ['*']
resources: ['*']
verbs: ["*"]
- nonResourceURLs: ['*']
verbs: ["get"]
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Release.Name }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ .Release.Name }}
subjects:
- kind: ServiceAccount
name: {{ include "clusterpedia.apiserver.fullname" . }}
namespace: {{ .Release.Namespace }}
- kind: ServiceAccount
name: {{ include "clusterpedia.clustersynchroManager.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- if .Values.installCRDs }}
{{ range $path, $bytes := .Files.Glob (printf "_crds/**")}}
{{- (printf "---") }}
{{- $.Files.Get $path }}
{{ end }}
{{- end -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "clusterpedia.clustersynchroManager.fullname" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app: {{ include "clusterpedia.clustersynchroManager.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.clustersynchroManager.replicaCount }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app: {{ include "clusterpedia.clustersynchroManager.fullname" . }}
template:
metadata:
{{- if .Values.clustersynchroManager.podAnnotations }}
annotations:
{{- include "common.tplvalues.render" (dict "value" .Values.clustersynchroManager.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app: {{ include "clusterpedia.clustersynchroManager.fullname" . }}
{{- if .Values.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.clustersynchroManager.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
{{- include "clusterpedia.clustersynchroManager.imagePullSecrets" . | nindent 6 }}
containers:
- name: {{ include "clusterpedia.clustersynchroManager.fullname" . }}
image: {{ template "clusterpedia.clustersynchroManager.image" . }}
imagePullPolicy: {{ .Values.clustersynchroManager.image.pullPolicy }}
command:
- /usr/local/bin/clustersynchro-manager
- --storage-config=/etc/clusterpedia/storage/internalstorage-config.yaml
- --leader-elect-resource-namespace={{ .Release.Namespace }}
- --feature-gates=PruneManagedFields=true,PruneLastAppliedConfiguration=true
{{- if .Values.clustersynchroManager.resources }}
resources: {{- toYaml .Values.clustersynchroManager.resources | nindent 12 }}
{{- end }}
env:
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "clusterpedia.internalstorage.fullname" . }}
key: password
volumeMounts:
- name: internalstorage-config
mountPath: /etc/clusterpedia/storage
readOnly: true
serviceAccountName: {{ include "clusterpedia.clustersynchroManager.fullname" . }}
{{- if .Values.clustersynchroManager.affinity }}
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.clustersynchroManager.affinity "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.clustersynchroManager.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.clustersynchroManager.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.clustersynchroManager.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.clustersynchroManager.tolerations "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: internalstorage-config
configMap:
name: {{ include "clusterpedia.internalstorage.fullname" . }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "clusterpedia.clustersynchroManager.fullname" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "clusterpedia.internalstorage.fullname" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
data:
internalstorage-config.yaml: |-
type: {{ include "clusterpedia.storage.type" . | quote }}
host: {{ include "clusterpedia.storage.host" . | quote }}
port: {{ include "clusterpedia.storage.port" . }}
user: {{ include "clusterpedia.storage.user" . }}
database: {{ include "clusterpedia.storage.database" . }}
{{- if .Values.log.enabled }}
log:
stdout: {{ .Values.log.stdout }}
level: {{ .Values.log.level | quote }}
slowThreshold: {{ .Values.log.slowThreshold }}
ignoreRecordNotFoundError: {{ .Values.log.ignoreRecordNotFoundError }}
{{- end -}}
{{- if and (include "clusterpedia.persistence.matchNode" .) (eq .Values.storageInstallMode "internal") -}}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "clusterpedia.job.storage.fullname" .}}
namespace: {{ .Release.Namespace }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app: {{ include "clusterpedia.internalstorage.fullname" . }}
internalstorage.clusterpedia.io/type: {{ include "clusterpedia.storage.type" . }}
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-delete-policy": hook-succeeded
spec:
ttlSecondsAfterFinished: 600
template:
metadata:
labels:
app: {{ include "clusterpedia.internalstorage.fullname" . }}
internalstorage.clusterpedia.io/type: {{ include "clusterpedia.storage.type" . }}
job: check-node-local-pv-dir
spec:
restartPolicy: Never
nodeName: {{ include "clusterpedia.persistence.matchNode" . }}
containers:
- name: check-dir
image: {{ include "clusterpedia.storage.image" . }}
command: ['sh', '-c', 'stat {{ include "clusterpedia.storage.mountPath" . }}']
volumeMounts:
- name: pv-dir
mountPath: {{ include "clusterpedia.storage.mountPath" . }}
volumes:
- name: pv-dir
hostPath:
path: {{ include "clusterpedia.storage.hostPath" . }}
tolerations:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoSchedule"
{{- end -}}
{{- if and (include "clusterpedia.persistence.matchNode" .) (eq .Values.storageInstallMode "internal") -}}
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ include "clusterpedia.internalstorage.fullname" . }}-{{ include "clusterpedia.storage.type" . }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if include "clusterpedia.storage.lables" . }}
{{- include "common.tplvalues.render" ( dict "value" (include "clusterpedia.storage.lables" .) "context" $ ) | nindent 4 }}
{{- end }}
spec:
capacity:
storage: {{ include "clusterpedia.internalstorage.capacity" . }}
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
local:
path: {{ include "clusterpedia.storage.hostPath" . }}
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
{{- with (include "clusterpedia.persistence.matchNode" .) }}
- key: kubernetes.io/hostname
operator: In
values:
- {{ . }}
{{- end }}
{{- end -}}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment