mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Feature] [Platform] Storage V1Alpha1 RC (#1758)
This commit is contained in:
parent
bfd6c8e63d
commit
70ba9f95b3
40 changed files with 981 additions and 16 deletions
|
@ -14,6 +14,7 @@
|
|||
- (Feature) AWS Client
|
||||
- (Feature) (Platform) Storage V1Alpha1
|
||||
- (Feature) StorageV2 Integration Service Implementation
|
||||
- (Feature) (Platform) Storage V1Alpha1 RC
|
||||
|
||||
## [1.2.43](https://github.com/arangodb/kube-arangodb/tree/1.2.43) (2024-10-14)
|
||||
- (Feature) ArangoRoute CRD
|
||||
|
|
24
Makefile
24
Makefile
|
@ -527,7 +527,8 @@ $(eval $(call manifest-generator, deployment, kube-arangodb, \
|
|||
--set "operator.features.ml=false" \
|
||||
--set "operator.features.analytics=false" \
|
||||
--set "operator.features.networking=true" \
|
||||
--set "operator.features.scheduler=true"))
|
||||
--set "operator.features.scheduler=true" \
|
||||
--set "operator.features.platform=true"))
|
||||
|
||||
$(eval $(call manifest-generator, deployment-replication, kube-arangodb, \
|
||||
--set "operator.features.deployment=false" \
|
||||
|
@ -539,7 +540,8 @@ $(eval $(call manifest-generator, deployment-replication, kube-arangodb, \
|
|||
--set "operator.features.ml=false" \
|
||||
--set "operator.features.analytics=false" \
|
||||
--set "operator.features.networking=false" \
|
||||
--set "operator.features.scheduler=false"))
|
||||
--set "operator.features.scheduler=false" \
|
||||
--set "operator.features.platform=false"))
|
||||
|
||||
$(eval $(call manifest-generator, storage, kube-arangodb, \
|
||||
--set "operator.features.deployment=false" \
|
||||
|
@ -551,7 +553,8 @@ $(eval $(call manifest-generator, storage, kube-arangodb, \
|
|||
--set "operator.features.ml=false" \
|
||||
--set "operator.features.analytics=false" \
|
||||
--set "operator.features.networking=false" \
|
||||
--set "operator.features.scheduler=false"))
|
||||
--set "operator.features.scheduler=false" \
|
||||
--set "operator.features.platform=false"))
|
||||
|
||||
$(eval $(call manifest-generator, backup, kube-arangodb, \
|
||||
--set "operator.features.deployment=false" \
|
||||
|
@ -563,7 +566,8 @@ $(eval $(call manifest-generator, backup, kube-arangodb, \
|
|||
--set "operator.features.ml=false" \
|
||||
--set "operator.features.analytics=false" \
|
||||
--set "operator.features.networking=false" \
|
||||
--set "operator.features.scheduler=false"))
|
||||
--set "operator.features.scheduler=false" \
|
||||
--set "operator.features.platform=false"))
|
||||
|
||||
$(eval $(call manifest-generator, apps, kube-arangodb, \
|
||||
--set "operator.features.deployment=false" \
|
||||
|
@ -575,7 +579,8 @@ $(eval $(call manifest-generator, apps, kube-arangodb, \
|
|||
--set "operator.features.ml=false" \
|
||||
--set "operator.features.analytics=false" \
|
||||
--set "operator.features.networking=false" \
|
||||
--set "operator.features.scheduler=false"))
|
||||
--set "operator.features.scheduler=false" \
|
||||
--set "operator.features.platform=false"))
|
||||
|
||||
$(eval $(call manifest-generator, ml, kube-arangodb, \
|
||||
--set "operator.features.deployment=false" \
|
||||
|
@ -587,7 +592,8 @@ $(eval $(call manifest-generator, ml, kube-arangodb, \
|
|||
--set "operator.features.ml=true" \
|
||||
--set "operator.features.analytics=false" \
|
||||
--set "operator.features.networking=false" \
|
||||
--set "operator.features.scheduler=false"))
|
||||
--set "operator.features.scheduler=false" \
|
||||
--set "operator.features.platform=false"))
|
||||
|
||||
$(eval $(call manifest-generator, k2kclustersync, kube-arangodb, \
|
||||
--set "operator.features.deployment=false" \
|
||||
|
@ -599,7 +605,8 @@ $(eval $(call manifest-generator, k2kclustersync, kube-arangodb, \
|
|||
--set "operator.features.ml=false" \
|
||||
--set "operator.features.analytics=false" \
|
||||
--set "operator.features.networking=false" \
|
||||
--set "operator.features.scheduler=false"))
|
||||
--set "operator.features.scheduler=false" \
|
||||
--set "operator.features.platform=false"))
|
||||
|
||||
$(eval $(call manifest-generator, all, kube-arangodb, \
|
||||
--set "operator.features.deployment=true" \
|
||||
|
@ -611,7 +618,8 @@ $(eval $(call manifest-generator, all, kube-arangodb, \
|
|||
--set "operator.features.ml=true" \
|
||||
--set "operator.features.analytics=true" \
|
||||
--set "operator.features.networking=true" \
|
||||
--set "operator.features.scheduler=true"))
|
||||
--set "operator.features.scheduler=true" \
|
||||
--set "operator.features.platform=true"))
|
||||
|
||||
.PHONY: chart-crd
|
||||
chart-crd: export CHART_NAME := kube-arangodb-crd
|
||||
|
|
|
@ -195,7 +195,7 @@ Flags:
|
|||
--kubernetes.max-batch-size int Size of batch during objects read (default 256)
|
||||
--kubernetes.qps float32 Number of queries per second for k8s API (default 15)
|
||||
--log.format string Set log format. Allowed values: 'pretty', 'JSON'. If empty, default format is used (default "pretty")
|
||||
--log.level stringArray Set log levels in format <level> or <logger>=<level>. Possible loggers: action, agency, api-server, assertion, backup-operator, chaos-monkey, crd, deployment, deployment-ci, deployment-reconcile, deployment-replication, deployment-resilience, deployment-resources, deployment-storage, deployment-storage-pc, deployment-storage-service, generic-parent-operator, helm, http, inspector, integration-config-v1, integration-envoy-auth-v3, integration-scheduler-v2, integrations, k8s-client, kubernetes-informer, monitor, networking-route-operator, operator, operator-arangojob-handler, operator-v2, operator-v2-event, operator-v2-worker, panics, pod_compare, root, root-event-recorder, scheduler-batchjob-operator, scheduler-cronjob-operator, scheduler-deployment-operator, scheduler-pod-operator, scheduler-profile-operator, server, server-authentication (default [info])
|
||||
--log.level stringArray Set log levels in format <level> or <logger>=<level>. Possible loggers: action, agency, api-server, assertion, backup-operator, chaos-monkey, crd, deployment, deployment-ci, deployment-reconcile, deployment-replication, deployment-resilience, deployment-resources, deployment-storage, deployment-storage-pc, deployment-storage-service, generic-parent-operator, helm, http, inspector, integration-config-v1, integration-envoy-auth-v3, integration-scheduler-v2, integrations, k8s-client, kubernetes-informer, monitor, networking-route-operator, operator, operator-arangojob-handler, operator-v2, operator-v2-event, operator-v2-worker, panics, platform-storage-operator, pod_compare, root, root-event-recorder, scheduler-batchjob-operator, scheduler-cronjob-operator, scheduler-deployment-operator, scheduler-pod-operator, scheduler-profile-operator, server, server-authentication (default [info])
|
||||
--log.sampling If true, operator will try to minimize duplication of logging events (default true)
|
||||
--memory-limit uint Define memory limit for hard shutdown and the dump of goroutines. Used for testing
|
||||
--metrics.excluded-prefixes stringArray List of the excluded metrics prefixes
|
||||
|
@ -207,6 +207,7 @@ Flags:
|
|||
--operator.deployment-replication Enable to run the ArangoDeploymentReplication operator
|
||||
--operator.ml Enable to run the ArangoML operator
|
||||
--operator.networking Enable to run the Networking operator
|
||||
--operator.platform Enable to run the Platform operator
|
||||
--operator.reconciliation.retry.count int Count of retries during Object Update operations in the Reconciliation loop (default 25)
|
||||
--operator.reconciliation.retry.delay duration Delay between Object Update operations in the Reconciliation loop (default 1s)
|
||||
--operator.scheduler Enable to run the Scheduler operator
|
||||
|
|
22
chart/kube-arangodb-arm64/crds/platform-storage.yaml
Normal file
22
chart/kube-arangodb-arm64/crds/platform-storage.yaml
Normal file
|
@ -0,0 +1,22 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangoplatformstorages.platform.arangodb.com
|
||||
spec:
|
||||
group: platform.arangodb.com
|
||||
names:
|
||||
kind: ArangoPlatformStorage
|
||||
listKind: ArangoPlatformStorageList
|
||||
plural: arangoplatformstorages
|
||||
singular: arangoplatformstorage
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
|
@ -123,6 +123,9 @@ spec:
|
|||
{{ if .Values.operator.features.scheduler }}
|
||||
- --operator.scheduler
|
||||
{{- end }}
|
||||
{{ if .Values.operator.features.platform }}
|
||||
- --operator.platform
|
||||
{{- end }}
|
||||
{{ if .Values.operator.features.k8sToK8sClusterSync }}
|
||||
- --operator.k2k-cluster-sync
|
||||
{{- end }}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if not (eq .Values.operator.scope "namespaced") -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac-cluster" . }}-platform
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ template "kube-arangodb.rbac-cluster" . }}-platform
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kube-arangodb.operatorName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,22 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if not (eq .Values.operator.scope "namespaced") -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac-cluster" . }}-platform
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
rules:
|
||||
- apiGroups: ["apiextensions.k8s.io"]
|
||||
resources: ["customresourcedefinitions"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,25 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac" . }}-platform
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ template "kube-arangodb.rbac" . }}-platform
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kube-arangodb.operatorName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,23 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac" . }}-platform
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
rules:
|
||||
- apiGroups: ["platform.arangodb.com"]
|
||||
resources: ["arangoplatformstorages", "arangoplatformstorages/status"]
|
||||
verbs: ["*"]
|
||||
- apiGroups: [""]
|
||||
resources: ["pods", "services", "endpoints"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,22 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangoplatformstorages.platform.arangodb.com
|
||||
spec:
|
||||
group: platform.arangodb.com
|
||||
names:
|
||||
kind: ArangoPlatformStorage
|
||||
listKind: ArangoPlatformStorageList
|
||||
plural: arangoplatformstorages
|
||||
singular: arangoplatformstorage
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
|
@ -123,6 +123,9 @@ spec:
|
|||
{{ if .Values.operator.features.scheduler }}
|
||||
- --operator.scheduler
|
||||
{{- end }}
|
||||
{{ if .Values.operator.features.platform }}
|
||||
- --operator.platform
|
||||
{{- end }}
|
||||
{{ if .Values.operator.features.k8sToK8sClusterSync }}
|
||||
- --operator.k2k-cluster-sync
|
||||
{{- end }}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if not (eq .Values.operator.scope "namespaced") -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac-cluster" . }}-platform
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ template "kube-arangodb.rbac-cluster" . }}-platform
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kube-arangodb.operatorName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,22 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if not (eq .Values.operator.scope "namespaced") -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac-cluster" . }}-platform
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
rules:
|
||||
- apiGroups: ["apiextensions.k8s.io"]
|
||||
resources: ["customresourcedefinitions"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,25 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac" . }}-platform
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ template "kube-arangodb.rbac" . }}-platform
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kube-arangodb.operatorName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,23 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac" . }}-platform
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
rules:
|
||||
- apiGroups: ["platform.arangodb.com"]
|
||||
resources: ["arangoplatformstorages", "arangoplatformstorages/status"]
|
||||
verbs: ["*"]
|
||||
- apiGroups: [""]
|
||||
resources: ["pods", "services", "endpoints"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
{{- end }}
|
||||
{{- end }}
|
22
chart/kube-arangodb-enterprise/crds/platform-storage.yaml
Normal file
22
chart/kube-arangodb-enterprise/crds/platform-storage.yaml
Normal file
|
@ -0,0 +1,22 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangoplatformstorages.platform.arangodb.com
|
||||
spec:
|
||||
group: platform.arangodb.com
|
||||
names:
|
||||
kind: ArangoPlatformStorage
|
||||
listKind: ArangoPlatformStorageList
|
||||
plural: arangoplatformstorages
|
||||
singular: arangoplatformstorage
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
|
@ -123,6 +123,9 @@ spec:
|
|||
{{ if .Values.operator.features.scheduler }}
|
||||
- --operator.scheduler
|
||||
{{- end }}
|
||||
{{ if .Values.operator.features.platform }}
|
||||
- --operator.platform
|
||||
{{- end }}
|
||||
{{ if .Values.operator.features.k8sToK8sClusterSync }}
|
||||
- --operator.k2k-cluster-sync
|
||||
{{- end }}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if not (eq .Values.operator.scope "namespaced") -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac-cluster" . }}-platform
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ template "kube-arangodb.rbac-cluster" . }}-platform
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kube-arangodb.operatorName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,22 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if not (eq .Values.operator.scope "namespaced") -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac-cluster" . }}-platform
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
rules:
|
||||
- apiGroups: ["apiextensions.k8s.io"]
|
||||
resources: ["customresourcedefinitions"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,25 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac" . }}-platform
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ template "kube-arangodb.rbac" . }}-platform
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kube-arangodb.operatorName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,23 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac" . }}-platform
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
rules:
|
||||
- apiGroups: ["platform.arangodb.com"]
|
||||
resources: ["arangoplatformstorages", "arangoplatformstorages/status"]
|
||||
verbs: ["*"]
|
||||
- apiGroups: [""]
|
||||
resources: ["pods", "services", "endpoints"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
{{- end }}
|
||||
{{- end }}
|
22
chart/kube-arangodb/crds/platform-storage.yaml
Normal file
22
chart/kube-arangodb/crds/platform-storage.yaml
Normal file
|
@ -0,0 +1,22 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangoplatformstorages.platform.arangodb.com
|
||||
spec:
|
||||
group: platform.arangodb.com
|
||||
names:
|
||||
kind: ArangoPlatformStorage
|
||||
listKind: ArangoPlatformStorageList
|
||||
plural: arangoplatformstorages
|
||||
singular: arangoplatformstorage
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
|
@ -123,6 +123,9 @@ spec:
|
|||
{{ if .Values.operator.features.scheduler }}
|
||||
- --operator.scheduler
|
||||
{{- end }}
|
||||
{{ if .Values.operator.features.platform }}
|
||||
- --operator.platform
|
||||
{{- end }}
|
||||
{{ if .Values.operator.features.k8sToK8sClusterSync }}
|
||||
- --operator.k2k-cluster-sync
|
||||
{{- end }}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if not (eq .Values.operator.scope "namespaced") -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac-cluster" . }}-platform
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ template "kube-arangodb.rbac-cluster" . }}-platform
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kube-arangodb.operatorName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,22 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if not (eq .Values.operator.scope "namespaced") -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac-cluster" . }}-platform
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
rules:
|
||||
- apiGroups: ["apiextensions.k8s.io"]
|
||||
resources: ["customresourcedefinitions"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -0,0 +1,25 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac" . }}-platform
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ template "kube-arangodb.rbac" . }}-platform
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kube-arangodb.operatorName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
23
chart/kube-arangodb/templates/platform-operator/role.yaml
Normal file
23
chart/kube-arangodb/templates/platform-operator/role.yaml
Normal file
|
@ -0,0 +1,23 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if .Values.operator.features.platform -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac" . }}-platform
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "kube-arangodb.name" . }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
release: {{ .Release.Name }}
|
||||
rules:
|
||||
- apiGroups: ["platform.arangodb.com"]
|
||||
resources: ["arangoplatformstorages", "arangoplatformstorages/status"]
|
||||
verbs: ["*"]
|
||||
- apiGroups: [""]
|
||||
resources: ["pods", "services", "endpoints"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -36,6 +36,7 @@ operator:
|
|||
analytics: false
|
||||
networking: true
|
||||
scheduler: true
|
||||
platform: true
|
||||
tolerations: []
|
||||
rbac:
|
||||
enabled: true
|
||||
|
|
28
cmd/cmd.go
28
cmd/cmd.go
|
@ -120,6 +120,7 @@ var (
|
|||
enableML bool // Run ml operator
|
||||
enableAnalytics bool // Run analytics operator
|
||||
enableNetworking bool // Run networking operator
|
||||
enablePlatform bool // Run platform operator
|
||||
enableScheduler bool // Run scheduler operator
|
||||
versionOnly bool // Run only version endpoint, explicitly disabled with other
|
||||
enableK2KClusterSync bool // Run k2kClusterSync operator
|
||||
|
@ -187,6 +188,7 @@ var (
|
|||
mlProbe probe.ReadyProbe
|
||||
analyticsProbe probe.ReadyProbe
|
||||
networkingProbe probe.ReadyProbe
|
||||
platformProbe probe.ReadyProbe
|
||||
schedulerProbe probe.ReadyProbe
|
||||
k2KClusterSyncProbe probe.ReadyProbe
|
||||
)
|
||||
|
@ -215,6 +217,7 @@ func init() {
|
|||
f.BoolVar(&operatorOptions.enableML, "operator.ml", false, "Enable to run the ArangoML operator")
|
||||
f.BoolVar(&operatorOptions.enableAnalytics, "operator.analytics", false, "Enable to run the Analytics operator")
|
||||
f.BoolVar(&operatorOptions.enableNetworking, "operator.networking", false, "Enable to run the Networking operator")
|
||||
f.BoolVar(&operatorOptions.enablePlatform, "operator.platform", false, "Enable to run the Platform operator")
|
||||
f.BoolVar(&operatorOptions.enableScheduler, "operator.scheduler", false, "Enable to run the Scheduler operator")
|
||||
f.BoolVar(&operatorOptions.enableK2KClusterSync, "operator.k2k-cluster-sync", false, "Enable to run the ListSimple operator")
|
||||
f.MarkDeprecated("operator.k2k-cluster-sync", "Enabled within deployment operator")
|
||||
|
@ -350,15 +353,22 @@ func executeMain(cmd *cobra.Command, args []string) {
|
|||
})
|
||||
|
||||
// Check operating mode
|
||||
if !operatorOptions.enableDeployment && !operatorOptions.enableDeploymentReplication && !operatorOptions.enableStorage &&
|
||||
!operatorOptions.enableBackup && !operatorOptions.enableApps && !operatorOptions.enableK2KClusterSync &&
|
||||
!operatorOptions.enableML && !operatorOptions.enableAnalytics &&
|
||||
!operatorOptions.enableNetworking && !operatorOptions.enableScheduler {
|
||||
if !operatorOptions.enableDeployment &&
|
||||
!operatorOptions.enableDeploymentReplication &&
|
||||
!operatorOptions.enableStorage &&
|
||||
!operatorOptions.enableBackup &&
|
||||
!operatorOptions.enableApps &&
|
||||
!operatorOptions.enableK2KClusterSync &&
|
||||
!operatorOptions.enableML &&
|
||||
!operatorOptions.enableAnalytics &&
|
||||
!operatorOptions.enableNetworking &&
|
||||
!operatorOptions.enableScheduler &&
|
||||
!operatorOptions.enablePlatform {
|
||||
if !operatorOptions.versionOnly {
|
||||
if version.GetVersionV1().IsEnterprise() {
|
||||
logger.Fatal("Turn on --operator.deployment, --operator.deployment-replication, --operator.storage, --operator.backup, --operator.apps, --operator.k2k-cluster-sync, --operator.ml, --operator.analytics, --operator.networking, --operator.scheduler or any combination of these")
|
||||
logger.Fatal("Turn on --operator.deployment, --operator.deployment-replication, --operator.storage, --operator.backup, --operator.apps, --operator.k2k-cluster-sync, --operator.ml, --operator.analytics, --operator.networking, --operator.scheduler, --operator.platform or any combination of these")
|
||||
} else {
|
||||
logger.Fatal("Turn on --operator.deployment, --operator.deployment-replication, --operator.storage, --operator.backup, --operator.apps, --operator.k2k-cluster-sync, --operator.networking, --operator.scheduler or any combination of these")
|
||||
logger.Fatal("Turn on --operator.deployment, --operator.deployment-replication, --operator.storage, --operator.backup, --operator.apps, --operator.k2k-cluster-sync, --operator.networking, --operator.scheduler, --operator.platform or any combination of these")
|
||||
}
|
||||
}
|
||||
} else if operatorOptions.versionOnly {
|
||||
|
@ -504,6 +514,10 @@ func executeMain(cmd *cobra.Command, args []string) {
|
|||
Enabled: cfg.EnableNetworking,
|
||||
Probe: &networkingProbe,
|
||||
},
|
||||
Platform: server.OperatorDependency{
|
||||
Enabled: cfg.EnablePlatform,
|
||||
Probe: &platformProbe,
|
||||
},
|
||||
Scheduler: server.OperatorDependency{
|
||||
Enabled: cfg.EnableScheduler,
|
||||
Probe: &schedulerProbe,
|
||||
|
@ -593,6 +607,7 @@ func newOperatorConfigAndDeps(id, namespace, name string) (operator.Config, oper
|
|||
EnableML: operatorOptions.enableML,
|
||||
EnableAnalytics: operatorOptions.enableAnalytics,
|
||||
EnableNetworking: operatorOptions.enableNetworking,
|
||||
EnablePlatform: operatorOptions.enablePlatform,
|
||||
EnableScheduler: operatorOptions.enableScheduler,
|
||||
EnableK2KClusterSync: operatorOptions.enableK2KClusterSync,
|
||||
AllowChaos: chaosOptions.allowed,
|
||||
|
@ -615,6 +630,7 @@ func newOperatorConfigAndDeps(id, namespace, name string) (operator.Config, oper
|
|||
MlProbe: &mlProbe,
|
||||
AnalyticsProbe: &analyticsProbe,
|
||||
NetworkingProbe: &networkingProbe,
|
||||
PlatformProbe: &platformProbe,
|
||||
SchedulerProbe: &schedulerProbe,
|
||||
K2KClusterSyncProbe: &k2KClusterSyncProbe,
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ Flags:
|
|||
--kubernetes.max-batch-size int Size of batch during objects read (default 256)
|
||||
--kubernetes.qps float32 Number of queries per second for k8s API (default 15)
|
||||
--log.format string Set log format. Allowed values: 'pretty', 'JSON'. If empty, default format is used (default "pretty")
|
||||
--log.level stringArray Set log levels in format <level> or <logger>=<level>. Possible loggers: action, agency, api-server, assertion, backup-operator, chaos-monkey, crd, deployment, deployment-ci, deployment-reconcile, deployment-replication, deployment-resilience, deployment-resources, deployment-storage, deployment-storage-pc, deployment-storage-service, generic-parent-operator, helm, http, inspector, integration-config-v1, integration-envoy-auth-v3, integration-scheduler-v2, integrations, k8s-client, kubernetes-informer, monitor, networking-route-operator, operator, operator-arangojob-handler, operator-v2, operator-v2-event, operator-v2-worker, panics, pod_compare, root, root-event-recorder, scheduler-batchjob-operator, scheduler-cronjob-operator, scheduler-deployment-operator, scheduler-pod-operator, scheduler-profile-operator, server, server-authentication (default [info])
|
||||
--log.level stringArray Set log levels in format <level> or <logger>=<level>. Possible loggers: action, agency, api-server, assertion, backup-operator, chaos-monkey, crd, deployment, deployment-ci, deployment-reconcile, deployment-replication, deployment-resilience, deployment-resources, deployment-storage, deployment-storage-pc, deployment-storage-service, generic-parent-operator, helm, http, inspector, integration-config-v1, integration-envoy-auth-v3, integration-scheduler-v2, integrations, k8s-client, kubernetes-informer, monitor, networking-route-operator, operator, operator-arangojob-handler, operator-v2, operator-v2-event, operator-v2-worker, panics, platform-storage-operator, pod_compare, root, root-event-recorder, scheduler-batchjob-operator, scheduler-cronjob-operator, scheduler-deployment-operator, scheduler-pod-operator, scheduler-profile-operator, server, server-authentication (default [info])
|
||||
--log.sampling If true, operator will try to minimize duplication of logging events (default true)
|
||||
--memory-limit uint Define memory limit for hard shutdown and the dump of goroutines. Used for testing
|
||||
--metrics.excluded-prefixes stringArray List of the excluded metrics prefixes
|
||||
|
@ -92,6 +92,7 @@ Flags:
|
|||
--operator.deployment-replication Enable to run the ArangoDeploymentReplication operator
|
||||
--operator.ml Enable to run the ArangoML operator
|
||||
--operator.networking Enable to run the Networking operator
|
||||
--operator.platform Enable to run the Platform operator
|
||||
--operator.reconciliation.retry.count int Count of retries during Object Update operations in the Reconciliation loop (default 25)
|
||||
--operator.reconciliation.retry.delay duration Delay between Object Update operations in the Reconciliation loop (default 1s)
|
||||
--operator.scheduler Enable to run the Scheduler operator
|
||||
|
|
120
pkg/handlers/platform/storage/handler.go
Normal file
120
pkg/handlers/platform/storage/handler.go
Normal file
|
@ -0,0 +1,120 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
|
||||
package storage
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/client-go/kubernetes"
|
||||
|
||||
platformApi "github.com/arangodb/kube-arangodb/pkg/apis/platform/v1alpha1"
|
||||
arangoClientSet "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
|
||||
"github.com/arangodb/kube-arangodb/pkg/logging"
|
||||
operator "github.com/arangodb/kube-arangodb/pkg/operatorV2"
|
||||
"github.com/arangodb/kube-arangodb/pkg/operatorV2/event"
|
||||
"github.com/arangodb/kube-arangodb/pkg/operatorV2/operation"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
)
|
||||
|
||||
var logger = logging.Global().RegisterAndGetLogger("platform-storage-operator", logging.Info)
|
||||
|
||||
type handler struct {
|
||||
client arangoClientSet.Interface
|
||||
kubeClient kubernetes.Interface
|
||||
|
||||
eventRecorder event.RecorderInstance
|
||||
|
||||
operator operator.Operator
|
||||
}
|
||||
|
||||
func (h *handler) Name() string {
|
||||
return Kind()
|
||||
}
|
||||
|
||||
func (h *handler) Handle(ctx context.Context, item operation.Item) error {
|
||||
// Get Backup object. It also covers NotFound case
|
||||
object, err := util.WithKubernetesContextTimeoutP2A2(ctx, h.client.PlatformV1alpha1().ArangoPlatformStorages(item.Namespace).Get, item.Name, meta.GetOptions{})
|
||||
if err != nil {
|
||||
if apiErrors.IsNotFound(err) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
status := object.Status.DeepCopy()
|
||||
|
||||
changed, reconcileErr := operator.HandleP3WithStop(ctx, item, object, status, h.handle)
|
||||
if reconcileErr != nil && !operator.IsReconcile(reconcileErr) {
|
||||
logger.Err(reconcileErr).Warn("Fail for %s %s/%s",
|
||||
item.Kind,
|
||||
item.Namespace,
|
||||
item.Name)
|
||||
|
||||
return reconcileErr
|
||||
}
|
||||
|
||||
if !changed {
|
||||
return reconcileErr
|
||||
}
|
||||
|
||||
logger.Debug("Updating %s %s/%s",
|
||||
item.Kind,
|
||||
item.Namespace,
|
||||
item.Name)
|
||||
|
||||
if _, err := operator.WithArangoPlatformStorageUpdateStatusInterfaceRetry(context.Background(), h.client.PlatformV1alpha1().ArangoPlatformStorages(object.GetNamespace()), object, *status, meta.UpdateOptions{}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return reconcileErr
|
||||
}
|
||||
|
||||
func (h *handler) handle(ctx context.Context, item operation.Item, extension *platformApi.ArangoPlatformStorage, status *platformApi.ArangoPlatformStorageStatus) (bool, error) {
|
||||
return operator.HandleP3WithCondition(ctx, &status.Conditions, platformApi.ReadyCondition, item, extension, status, h.HandleSpecValidity, h.HandleArangoDeployment)
|
||||
}
|
||||
|
||||
func (h *handler) HandleSpecValidity(ctx context.Context, item operation.Item, extension *platformApi.ArangoPlatformStorage, status *platformApi.ArangoPlatformStorageStatus) (bool, error) {
|
||||
if err := extension.Spec.Validate(); err != nil {
|
||||
// We have received an error in the spec!
|
||||
|
||||
logger.Err(err).Warn("Invalid Spec on %s", item.String())
|
||||
|
||||
if status.Conditions.Update(platformApi.SpecValidCondition, false, "Spec is invalid", "Spec is invalid") {
|
||||
return true, operator.Stop("Invalid spec")
|
||||
}
|
||||
return false, operator.Stop("Invalid spec")
|
||||
}
|
||||
|
||||
if status.Conditions.Update(platformApi.SpecValidCondition, true, "Spec is valid", "Spec is valid") {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func (h *handler) CanBeHandled(item operation.Item) bool {
|
||||
return item.Group == Group() &&
|
||||
item.Version == Version() &&
|
||||
item.Kind == Kind()
|
||||
}
|
79
pkg/handlers/platform/storage/handler_deployment.go
Normal file
79
pkg/handlers/platform/storage/handler_deployment.go
Normal file
|
@ -0,0 +1,79 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
|
||||
package storage
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
networkingApi "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
|
||||
platformApi "github.com/arangodb/kube-arangodb/pkg/apis/platform/v1alpha1"
|
||||
sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
|
||||
operator "github.com/arangodb/kube-arangodb/pkg/operatorV2"
|
||||
"github.com/arangodb/kube-arangodb/pkg/operatorV2/operation"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
)
|
||||
|
||||
func (h *handler) HandleArangoDeployment(ctx context.Context, item operation.Item, extension *platformApi.ArangoPlatformStorage, status *platformApi.ArangoPlatformStorageStatus) (bool, error) {
|
||||
var name = util.WithDefault(extension.Spec.Deployment)
|
||||
|
||||
if status.Deployment != nil {
|
||||
name = status.Deployment.GetName()
|
||||
}
|
||||
|
||||
deployment, err := util.WithKubernetesContextTimeoutP2A2(ctx, h.client.DatabaseV1().ArangoDeployments(item.Namespace).Get, name, meta.GetOptions{})
|
||||
if err != nil {
|
||||
if apiErrors.IsNotFound(err) {
|
||||
// Condition for Found should be set to false
|
||||
if util.Or(
|
||||
status.Conditions.Update(networkingApi.DeploymentFoundCondition, false, "ArangoDeployment not found", "ArangoDeployment not found"),
|
||||
) {
|
||||
return true, operator.Reconcile("Conditions updated")
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return false, err
|
||||
}
|
||||
|
||||
if status.Deployment == nil {
|
||||
status.Deployment = util.NewType(sharedApi.NewObject(deployment))
|
||||
return true, operator.Reconcile("Deployment saved")
|
||||
} else if !status.Deployment.Equals(deployment) {
|
||||
if util.Or(
|
||||
status.Conditions.Update(networkingApi.DeploymentFoundCondition, false, "ArangoDeployment changed", "ArangoDeployment changed"),
|
||||
) {
|
||||
return true, operator.Reconcile("Conditions updated")
|
||||
}
|
||||
|
||||
return false, operator.Stop("ArangoDeployment Changed")
|
||||
}
|
||||
|
||||
// Condition for Found should be set to true
|
||||
|
||||
if status.Conditions.Update(networkingApi.DeploymentFoundCondition, true, "ArangoDeployment found", "ArangoDeployment found") {
|
||||
return true, operator.Reconcile("Conditions updated")
|
||||
}
|
||||
|
||||
return false, nil
|
||||
}
|
59
pkg/handlers/platform/storage/handler_test.go
Normal file
59
pkg/handlers/platform/storage/handler_test.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
|
||||
package storage
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
apiErrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/operatorV2/operation"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/tests"
|
||||
)
|
||||
|
||||
func Test_ObjectNotFound(t *testing.T) {
|
||||
// Arrange
|
||||
handler := newFakeHandler()
|
||||
|
||||
i := newItem(operation.Add, "test", "test")
|
||||
|
||||
actions := map[operation.Operation]bool{
|
||||
operation.Add: false,
|
||||
operation.Update: false,
|
||||
operation.Delete: false,
|
||||
}
|
||||
|
||||
// Act
|
||||
for operation, shouldFail := range actions {
|
||||
t.Run(string(operation), func(t *testing.T) {
|
||||
err := tests.Handle(handler, i)
|
||||
|
||||
// Assert
|
||||
if shouldFail {
|
||||
require.Error(t, err)
|
||||
require.True(t, apiErrors.IsNotFound(err))
|
||||
} else {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
38
pkg/handlers/platform/storage/local.go
Normal file
38
pkg/handlers/platform/storage/local.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
|
||||
package storage
|
||||
|
||||
import (
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/ml"
|
||||
platformApi "github.com/arangodb/kube-arangodb/pkg/apis/platform/v1alpha1"
|
||||
)
|
||||
|
||||
func Kind() string {
|
||||
return ml.ArangoMLStorageResourceKind
|
||||
}
|
||||
|
||||
func Group() string {
|
||||
return platformApi.SchemeGroupVersion.Group
|
||||
}
|
||||
|
||||
func Version() string {
|
||||
return platformApi.SchemeGroupVersion.Version
|
||||
}
|
55
pkg/handlers/platform/storage/register.go
Normal file
55
pkg/handlers/platform/storage/register.go
Normal file
|
@ -0,0 +1,55 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
|
||||
package storage
|
||||
|
||||
import (
|
||||
"k8s.io/client-go/kubernetes"
|
||||
|
||||
arangoClientSet "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
|
||||
arangoInformer "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions"
|
||||
operator "github.com/arangodb/kube-arangodb/pkg/operatorV2"
|
||||
"github.com/arangodb/kube-arangodb/pkg/operatorV2/event"
|
||||
)
|
||||
|
||||
// RegisterInformer into operator
|
||||
func RegisterInformer(operator operator.Operator, recorder event.Recorder, client arangoClientSet.Interface, kubeClient kubernetes.Interface, informer arangoInformer.SharedInformerFactory) error {
|
||||
if err := operator.RegisterInformer(informer.Platform().V1alpha1().ArangoPlatformStorages().Informer(),
|
||||
Group(),
|
||||
Version(),
|
||||
Kind()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
h := &handler{
|
||||
client: client,
|
||||
kubeClient: kubeClient,
|
||||
|
||||
eventRecorder: recorder.NewInstance(Group(), Version(), Kind()),
|
||||
|
||||
operator: operator,
|
||||
}
|
||||
|
||||
if err := operator.RegisterHandler(h); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
59
pkg/handlers/platform/storage/suite_test.go
Normal file
59
pkg/handlers/platform/storage/suite_test.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// Copyright holder is ArangoDB GmbH, Cologne, Germany
|
||||
//
|
||||
|
||||
package storage
|
||||
|
||||
import (
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/apps"
|
||||
appsApi "github.com/arangodb/kube-arangodb/pkg/apis/apps/v1"
|
||||
fakeClientSet "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/fake"
|
||||
operator "github.com/arangodb/kube-arangodb/pkg/operatorV2"
|
||||
"github.com/arangodb/kube-arangodb/pkg/operatorV2/event"
|
||||
"github.com/arangodb/kube-arangodb/pkg/operatorV2/operation"
|
||||
)
|
||||
|
||||
func newFakeHandler() *handler {
|
||||
f := fakeClientSet.NewSimpleClientset()
|
||||
k := fake.NewSimpleClientset()
|
||||
|
||||
h := &handler{
|
||||
client: f,
|
||||
kubeClient: k,
|
||||
eventRecorder: event.NewEventRecorder("mock", k).NewInstance(Group(), Version(), Kind()),
|
||||
operator: operator.NewOperator("mock", "mock", "mock"),
|
||||
}
|
||||
|
||||
return h
|
||||
}
|
||||
|
||||
func newItem(o operation.Operation, namespace, name string) operation.Item {
|
||||
return operation.Item{
|
||||
Group: appsApi.SchemeGroupVersion.Group,
|
||||
Version: appsApi.SchemeGroupVersion.Version,
|
||||
Kind: apps.ArangoJobResourceKind,
|
||||
|
||||
Operation: o,
|
||||
|
||||
Namespace: namespace,
|
||||
Name: name,
|
||||
}
|
||||
}
|
|
@ -38,6 +38,7 @@ import (
|
|||
depldef "github.com/arangodb/kube-arangodb/pkg/apis/deployment"
|
||||
deplapi "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/networking"
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/platform"
|
||||
repldef "github.com/arangodb/kube-arangodb/pkg/apis/replication"
|
||||
replapi "github.com/arangodb/kube-arangodb/pkg/apis/replication/v1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/scheduler"
|
||||
|
@ -48,6 +49,7 @@ import (
|
|||
"github.com/arangodb/kube-arangodb/pkg/handlers/backup"
|
||||
"github.com/arangodb/kube-arangodb/pkg/handlers/job"
|
||||
"github.com/arangodb/kube-arangodb/pkg/handlers/networking/route"
|
||||
platformStorage "github.com/arangodb/kube-arangodb/pkg/handlers/platform/storage"
|
||||
"github.com/arangodb/kube-arangodb/pkg/handlers/policy"
|
||||
schedulerBatchJobHandler "github.com/arangodb/kube-arangodb/pkg/handlers/scheduler/batchjob"
|
||||
schedulerCronJobHandler "github.com/arangodb/kube-arangodb/pkg/handlers/scheduler/cronjob"
|
||||
|
@ -80,6 +82,7 @@ const (
|
|||
mlOperator operatorV2type = "ml"
|
||||
analyticsOperator operatorV2type = "analytics"
|
||||
networkingOperator operatorV2type = "networking"
|
||||
platformOperator operatorV2type = "platform"
|
||||
schedulerOperator operatorV2type = "scheduler"
|
||||
appsOperator operatorV2type = "apps"
|
||||
)
|
||||
|
@ -113,6 +116,7 @@ type Config struct {
|
|||
EnableML bool
|
||||
EnableAnalytics bool
|
||||
EnableNetworking bool
|
||||
EnablePlatform bool
|
||||
EnableScheduler bool
|
||||
EnableBackup bool
|
||||
EnableApps bool
|
||||
|
@ -137,6 +141,7 @@ type Dependencies struct {
|
|||
MlProbe *probe.ReadyProbe
|
||||
AnalyticsProbe *probe.ReadyProbe
|
||||
NetworkingProbe *probe.ReadyProbe
|
||||
PlatformProbe *probe.ReadyProbe
|
||||
SchedulerProbe *probe.ReadyProbe
|
||||
AppsProbe *probe.ReadyProbe
|
||||
K2KClusterSyncProbe *probe.ReadyProbe
|
||||
|
@ -213,6 +218,13 @@ func (o *Operator) Run() {
|
|||
go o.runWithoutLeaderElection("arango-networking-operator", constants.NetworkingLabelRole, o.onStartNetworking, o.Dependencies.NetworkingProbe)
|
||||
}
|
||||
}
|
||||
if o.Config.EnablePlatform {
|
||||
if !o.Config.SingleMode {
|
||||
go o.runLeaderElection("arango-platform-operator", constants.PlatformLabelRole, o.onStartPlatform, o.Dependencies.PlatformProbe)
|
||||
} else {
|
||||
go o.runWithoutLeaderElection("arango-platform-operator", constants.PlatformLabelRole, o.onStartPlatform, o.Dependencies.PlatformProbe)
|
||||
}
|
||||
}
|
||||
if o.Config.EnableScheduler {
|
||||
if !o.Config.SingleMode {
|
||||
go o.runLeaderElection("arango-scheduler-operator", constants.SchedulerLabelRole, o.onStartScheduler, o.Dependencies.SchedulerProbe)
|
||||
|
@ -295,6 +307,11 @@ func (o *Operator) onStartNetworking(stop <-chan struct{}) {
|
|||
o.onStartOperatorV2(networkingOperator, stop)
|
||||
}
|
||||
|
||||
// onStartPlatform starts the operator and run till given channel is closed.
|
||||
func (o *Operator) onStartPlatform(stop <-chan struct{}) {
|
||||
o.onStartOperatorV2(platformOperator, stop)
|
||||
}
|
||||
|
||||
// onStartNetworking starts the operator and run till given channel is closed.
|
||||
func (o *Operator) onStartScheduler(stop <-chan struct{}) {
|
||||
o.onStartOperatorV2(schedulerOperator, stop)
|
||||
|
@ -331,6 +348,9 @@ func (o *Operator) onStartOperatorV2(operatorType operatorV2type, stop <-chan st
|
|||
case networkingOperator:
|
||||
o.onStartOperatorV2Networking(operator, eventRecorder, o.Client.Arango(), o.Client.Kubernetes(), arangoInformer, kubeInformer)
|
||||
o.Dependencies.NetworkingProbe.SetReady()
|
||||
case platformOperator:
|
||||
o.onStartOperatorV2Platform(operator, eventRecorder, o.Client.Arango(), o.Client.Kubernetes(), arangoInformer)
|
||||
o.Dependencies.PlatformProbe.SetReady()
|
||||
case schedulerOperator:
|
||||
o.onStartOperatorV2Scheduler(operator, eventRecorder, o.Client.Arango(), o.Client.Kubernetes(), arangoInformer, kubeInformer)
|
||||
o.Dependencies.SchedulerProbe.SetReady()
|
||||
|
@ -377,6 +397,18 @@ func (o *Operator) onStartOperatorV2Networking(operator operatorV2.Operator, rec
|
|||
}
|
||||
}
|
||||
|
||||
func (o *Operator) onStartOperatorV2Platform(operator operatorV2.Operator, recorder event.Recorder, client arangoClientSet.Interface, kubeClient kubernetes.Interface, informer arangoInformer.SharedInformerFactory) {
|
||||
checkFn := func() error {
|
||||
_, err := o.Client.Arango().PlatformV1alpha1().ArangoPlatformStorages(o.Namespace).List(context.Background(), meta.ListOptions{})
|
||||
return err
|
||||
}
|
||||
o.waitForCRD(platform.ArangoPlatformStorageCRDName, checkFn)
|
||||
|
||||
if err := platformStorage.RegisterInformer(operator, recorder, client, kubeClient, informer); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (o *Operator) onStartOperatorV2Scheduler(operator operatorV2.Operator, recorder event.Recorder, client arangoClientSet.Interface, kubeClient kubernetes.Interface, informer arangoInformer.SharedInformerFactory, kubeInformer informers.SharedInformerFactory) {
|
||||
checkFn := func() error {
|
||||
_, err := o.Client.Arango().SchedulerV1beta1().ArangoProfiles(o.Namespace).List(context.Background(), meta.ListOptions{})
|
||||
|
|
|
@ -30,6 +30,7 @@ import (
|
|||
mlApiv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1alpha1"
|
||||
mlApi "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1beta1"
|
||||
networkingApi "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
|
||||
platformApi "github.com/arangodb/kube-arangodb/pkg/apis/platform/v1alpha1"
|
||||
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
|
||||
)
|
||||
|
||||
|
@ -80,3 +81,7 @@ func WithSchedulerCronJobUpdateStatusInterfaceRetry(ctx context.Context, client
|
|||
func WithArangoStorageUpdateStatusInterfaceRetry(ctx context.Context, client UpdateStatusInterface[mlApi.ArangoMLStorageStatus, *mlApi.ArangoMLStorage], obj *mlApi.ArangoMLStorage, status mlApi.ArangoMLStorageStatus, opts meta.UpdateOptions) (*mlApi.ArangoMLStorage, error) {
|
||||
return WithUpdateStatusInterfaceRetry[mlApi.ArangoMLStorageStatus, *mlApi.ArangoMLStorage](ctx, client, obj, status, opts)
|
||||
}
|
||||
|
||||
func WithArangoPlatformStorageUpdateStatusInterfaceRetry(ctx context.Context, client UpdateStatusInterface[platformApi.ArangoPlatformStorageStatus, *platformApi.ArangoPlatformStorage], obj *platformApi.ArangoPlatformStorage, status platformApi.ArangoPlatformStorageStatus, opts meta.UpdateOptions) (*platformApi.ArangoPlatformStorage, error) {
|
||||
return WithUpdateStatusInterfaceRetry[platformApi.ArangoPlatformStorageStatus, *platformApi.ArangoPlatformStorage](ctx, client, obj, status, opts)
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ type Dependencies struct {
|
|||
ML OperatorDependency
|
||||
Analytics OperatorDependency
|
||||
Networking OperatorDependency
|
||||
Platform OperatorDependency
|
||||
Scheduler OperatorDependency
|
||||
ClusterSync OperatorDependency
|
||||
Operators Operators
|
||||
|
@ -200,6 +201,10 @@ func NewServer(cli typedCore.CoreV1Interface, cfg Config, deps Dependencies) (*S
|
|||
r.GET("/ready/networking", gin.WrapF(deps.Networking.Probe.ReadyHandler))
|
||||
readyProbes = append(readyProbes, deps.Networking.Probe)
|
||||
}
|
||||
if deps.Platform.Enabled {
|
||||
r.GET("/ready/platform", gin.WrapF(deps.Platform.Probe.ReadyHandler))
|
||||
readyProbes = append(readyProbes, deps.Platform.Probe)
|
||||
}
|
||||
if deps.Scheduler.Enabled {
|
||||
r.GET("/ready/scheduler", gin.WrapF(deps.Scheduler.Probe.ReadyHandler))
|
||||
readyProbes = append(readyProbes, deps.Scheduler.Probe)
|
||||
|
|
|
@ -74,6 +74,7 @@ const (
|
|||
MLLabelRole = "ml/role"
|
||||
AnalyticsLabelRole = "analytics/role"
|
||||
NetworkingLabelRole = "networking/role"
|
||||
PlatformLabelRole = "platform/role"
|
||||
SchedulerLabelRole = "scheduler/role"
|
||||
AppsLabelRole = "apps/role"
|
||||
ClusterSyncLabelRole = "clustersync/role"
|
||||
|
|
Loading…
Reference in a new issue