mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Feature] [ML] Handlers (#1494)
This commit is contained in:
parent
3b0c7cc6b5
commit
5fe686928e
13 changed files with 255 additions and 33 deletions
|
@ -12,6 +12,7 @@
|
|||
- (Feature) K8S Resources Compare Generic
|
||||
- (Feature) Add support for CRD validation schemas
|
||||
- (Bugfix) Fix Replaced Member Zone during Replace operation
|
||||
- (Feature) (ML) Handlers
|
||||
|
||||
## [1.2.35](https://github.com/arangodb/kube-arangodb/tree/1.2.35) (2023-11-06)
|
||||
- (Maintenance) Update go-driver to v1.6.0, update IsNotFound() checks
|
||||
|
|
19
Makefile
19
Makefile
|
@ -138,6 +138,7 @@ MANIFESTPATHDEPLOYMENT := manifests/arango-deployment$(MANIFESTSUFFIX).yaml
|
|||
MANIFESTPATHDEPLOYMENTREPLICATION := manifests/arango-deployment-replication$(MANIFESTSUFFIX).yaml
|
||||
MANIFESTPATHBACKUP := manifests/arango-backup$(MANIFESTSUFFIX).yaml
|
||||
MANIFESTPATHAPPS := manifests/arango-apps$(MANIFESTSUFFIX).yaml
|
||||
MANIFESTPATHML := manifests/arango-ml$(MANIFESTSUFFIX).yaml
|
||||
MANIFESTPATHK2KCLUSTERSYNC := manifests/arango-k2kclustersync$(MANIFESTSUFFIX).yaml
|
||||
MANIFESTPATHSTORAGE := manifests/arango-storage$(MANIFESTSUFFIX).yaml
|
||||
MANIFESTPATHALL := manifests/arango-all$(MANIFESTSUFFIX).yaml
|
||||
|
@ -146,6 +147,7 @@ KUSTOMIZEPATHDEPLOYMENT := manifests/kustomize/deployment/arango-deployment$(MAN
|
|||
KUSTOMIZEPATHDEPLOYMENTREPLICATION := manifests/kustomize/deployment-replication/arango-deployment-replication$(MANIFESTSUFFIX).yaml
|
||||
KUSTOMIZEPATHBACKUP := manifests/kustomize/backup/arango-backup$(MANIFESTSUFFIX).yaml
|
||||
KUSTOMIZEPATHAPPS := manifests/kustomize/apps/arango-apps$(MANIFESTSUFFIX).yaml
|
||||
KUSTOMIZEPATHML := manifests/kustomize/apps/arango-ml$(MANIFESTSUFFIX).yaml
|
||||
KUSTOMIZEPATHK2KCLUSTERSYNC := manifests/kustomize/k2kclustersync/arango-k2kclustersync$(MANIFESTSUFFIX).yaml
|
||||
KUSTOMIZEPATHSTORAGE := manifests/kustomize/storage/arango-storage$(MANIFESTSUFFIX).yaml
|
||||
KUSTOMIZEPATHALL := manifests/kustomize/all/arango-all$(MANIFESTSUFFIX).yaml
|
||||
|
@ -155,6 +157,7 @@ MANIFESTPATHDEPLOYMENT := manifests/enterprise-deployment$(MANIFESTSUFFIX).yaml
|
|||
MANIFESTPATHDEPLOYMENTREPLICATION := manifests/enterprise-deployment-replication$(MANIFESTSUFFIX).yaml
|
||||
MANIFESTPATHBACKUP := manifests/enterprise-backup$(MANIFESTSUFFIX).yaml
|
||||
MANIFESTPATHAPPS := manifests/enterprise-apps$(MANIFESTSUFFIX).yaml
|
||||
MANIFESTPATHML := manifests/enterprise-ml$(MANIFESTSUFFIX).yaml
|
||||
MANIFESTPATHK2KCLUSTERSYNC := manifests/enterprise-k2kclustersync$(MANIFESTSUFFIX).yaml
|
||||
MANIFESTPATHSTORAGE := manifests/enterprise-storage$(MANIFESTSUFFIX).yaml
|
||||
MANIFESTPATHALL := manifests/enterprise-all$(MANIFESTSUFFIX).yaml
|
||||
|
@ -163,6 +166,7 @@ KUSTOMIZEPATHDEPLOYMENT := manifests/kustomize-enterprise/deployment/enterprise-
|
|||
KUSTOMIZEPATHDEPLOYMENTREPLICATION := manifests/kustomize-enterprise/deployment-replication/enterprise-deployment-replication$(MANIFESTSUFFIX).yaml
|
||||
KUSTOMIZEPATHBACKUP := manifests/kustomize-enterprise/backup/enterprise-backup$(MANIFESTSUFFIX).yaml
|
||||
KUSTOMIZEPATHAPPS := manifests/kustomize-enterprise/apps/enterprise-apps$(MANIFESTSUFFIX).yaml
|
||||
KUSTOMIZEPATHML := manifests/kustomize/apps/enterprise-ml$(MANIFESTSUFFIX).yaml
|
||||
KUSTOMIZEPATHK2KCLUSTERSYNC := manifests/kustomize-enterprise/k2kclustersync/enterprise-k2kclustersync$(MANIFESTSUFFIX).yaml
|
||||
KUSTOMIZEPATHSTORAGE := manifests/kustomize-enterprise/storage/enterprise-storage$(MANIFESTSUFFIX).yaml
|
||||
KUSTOMIZEPATHALL := manifests/kustomize-enterprise/all/enterprise-all$(MANIFESTSUFFIX).yaml
|
||||
|
@ -482,6 +486,7 @@ $(eval $(call manifest-generator, deployment, kube-arangodb, \
|
|||
--set "operator.features.deploymentReplications=false" \
|
||||
--set "operator.features.storage=false" \
|
||||
--set "operator.features.apps=false" \
|
||||
--set "operator.features.ml=false" \
|
||||
--set "operator.features.k8sToK8sClusterSync=false" \
|
||||
--set "operator.features.backup=false"))
|
||||
|
||||
|
@ -498,6 +503,7 @@ $(eval $(call manifest-generator, storage, kube-arangodb, \
|
|||
--set "operator.features.deploymentReplications=false" \
|
||||
--set "operator.features.storage=true" \
|
||||
--set "operator.features.apps=false" \
|
||||
--set "operator.features.ml=false" \
|
||||
--set "operator.features.k8sToK8sClusterSync=false" \
|
||||
--set "operator.features.backup=false"))
|
||||
|
||||
|
@ -506,6 +512,7 @@ $(eval $(call manifest-generator, backup, kube-arangodb, \
|
|||
--set "operator.features.deploymentReplications=false" \
|
||||
--set "operator.features.storage=false" \
|
||||
--set "operator.features.apps=false" \
|
||||
--set "operator.features.ml=false" \
|
||||
--set "operator.features.k8sToK8sClusterSync=false" \
|
||||
--set "operator.features.backup=true"))
|
||||
|
||||
|
@ -514,6 +521,16 @@ $(eval $(call manifest-generator, apps, kube-arangodb, \
|
|||
--set "operator.features.deploymentReplications=false" \
|
||||
--set "operator.features.storage=false" \
|
||||
--set "operator.features.apps=true" \
|
||||
--set "operator.features.ml=false" \
|
||||
--set "operator.features.k8sToK8sClusterSync=false" \
|
||||
--set "operator.features.backup=false"))
|
||||
|
||||
$(eval $(call manifest-generator, ml, kube-arangodb, \
|
||||
--set "operator.features.deployment=false" \
|
||||
--set "operator.features.deploymentReplications=false" \
|
||||
--set "operator.features.storage=false" \
|
||||
--set "operator.features.apps=false" \
|
||||
--set "operator.features.ml=true" \
|
||||
--set "operator.features.k8sToK8sClusterSync=false" \
|
||||
--set "operator.features.backup=false"))
|
||||
|
||||
|
@ -522,6 +539,7 @@ $(eval $(call manifest-generator, k2kclustersync, kube-arangodb, \
|
|||
--set "operator.features.deploymentReplications=false" \
|
||||
--set "operator.features.storage=false" \
|
||||
--set "operator.features.apps=false" \
|
||||
--set "operator.features.ml=false" \
|
||||
--set "operator.features.k8sToK8sClusterSync=true" \
|
||||
--set "operator.features.backup=false"))
|
||||
|
||||
|
@ -530,6 +548,7 @@ $(eval $(call manifest-generator, all, kube-arangodb, \
|
|||
--set "operator.features.deploymentReplications=true" \
|
||||
--set "operator.features.storage=true" \
|
||||
--set "operator.features.apps=true" \
|
||||
--set "operator.features.ml=true" \
|
||||
--set "operator.features.k8sToK8sClusterSync=true" \
|
||||
--set "operator.features.backup=true"))
|
||||
|
||||
|
|
|
@ -111,6 +111,9 @@ spec:
|
|||
{{ if .Values.operator.features.apps }}
|
||||
- --operator.apps
|
||||
{{- end }}
|
||||
{{ if .Values.operator.features.ml }}
|
||||
- --operator.ml
|
||||
{{- end }}
|
||||
{{ if .Values.operator.features.k8sToK8sClusterSync }}
|
||||
- --operator.k2k-cluster-sync
|
||||
{{- end }}
|
||||
|
|
26
chart/kube-arangodb/templates/ml/cluster-role-binding.yaml
Normal file
26
chart/kube-arangodb/templates/ml/cluster-role-binding.yaml
Normal file
|
@ -0,0 +1,26 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if not (eq .Values.operator.scope "namespaced") -}}
|
||||
{{ if .Values.operator.features.ml -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac-cluster" . }}-ml
|
||||
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" . }}-ml
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kube-arangodb.operatorName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
22
chart/kube-arangodb/templates/ml/cluster-role.yaml
Normal file
22
chart/kube-arangodb/templates/ml/cluster-role.yaml
Normal file
|
@ -0,0 +1,22 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if not (eq .Values.operator.scope "namespaced") -}}
|
||||
{{ if .Values.operator.features.ml -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac-cluster" . }}-ml
|
||||
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 }}
|
25
chart/kube-arangodb/templates/ml/role-binding.yaml
Normal file
25
chart/kube-arangodb/templates/ml/role-binding.yaml
Normal file
|
@ -0,0 +1,25 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if .Values.operator.features.ml -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac" . }}-ml
|
||||
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" . }}-ml
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ template "kube-arangodb.operatorName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
30
chart/kube-arangodb/templates/ml/role.yaml
Normal file
30
chart/kube-arangodb/templates/ml/role.yaml
Normal file
|
@ -0,0 +1,30 @@
|
|||
{{ if .Values.rbac.enabled -}}
|
||||
{{ if .Values.operator.features.ml -}}
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ template "kube-arangodb.rbac" . }}-ml
|
||||
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:
|
||||
- "ml.arangodb.com"
|
||||
resources:
|
||||
- "arangomlextensions"
|
||||
- "arangomlextensions/status"
|
||||
- "arangomlbatchjobs"
|
||||
- "arangomlbatchjobs/status"
|
||||
- "arangomlcronjobs"
|
||||
- "arangomlcronjobs/status"
|
||||
- "arangomlstorages"
|
||||
- "arangomlstorages/status"
|
||||
verbs:
|
||||
- "*"
|
||||
{{- end }}
|
||||
{{- end }}
|
|
@ -32,6 +32,7 @@ operator:
|
|||
backup: false
|
||||
apps: false
|
||||
k8sToK8sClusterSync: false
|
||||
ml: false
|
||||
tolerations: []
|
||||
rbac:
|
||||
enabled: true
|
||||
|
|
23
cmd/cmd.go
23
cmd/cmd.go
|
@ -119,6 +119,7 @@ var (
|
|||
enableStorage bool // Run local-storage operator
|
||||
enableBackup bool // Run backup operator
|
||||
enableApps bool // Run apps operator
|
||||
enableML bool // Run ml operator
|
||||
versionOnly bool // Run only version endpoint, explicitly disabled with other
|
||||
enableK2KClusterSync bool // Run k2kClusterSync operator
|
||||
|
||||
|
@ -171,6 +172,7 @@ var (
|
|||
storageProbe probe.ReadyProbe
|
||||
backupProbe probe.ReadyProbe
|
||||
appsProbe probe.ReadyProbe
|
||||
mlProbe probe.ReadyProbe
|
||||
k2KClusterSyncProbe probe.ReadyProbe
|
||||
)
|
||||
|
||||
|
@ -196,6 +198,7 @@ func init() {
|
|||
f.BoolVar(&operatorOptions.enableStorage, "operator.storage", false, "Enable to run the ArangoLocalStorage operator")
|
||||
f.BoolVar(&operatorOptions.enableBackup, "operator.backup", false, "Enable to run the ArangoBackup operator")
|
||||
f.BoolVar(&operatorOptions.enableApps, "operator.apps", false, "Enable to run the ArangoApps operator")
|
||||
f.BoolVar(&operatorOptions.enableML, "operator.ml", false, "Enable to run the ArangoML 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")
|
||||
f.BoolVar(&operatorOptions.versionOnly, "operator.version", false, "Enable only version endpoint in Operator")
|
||||
|
@ -320,12 +323,20 @@ func executeMain(cmd *cobra.Command, args []string) {
|
|||
|
||||
// Check operating mode
|
||||
if !operatorOptions.enableDeployment && !operatorOptions.enableDeploymentReplication && !operatorOptions.enableStorage &&
|
||||
!operatorOptions.enableBackup && !operatorOptions.enableApps && !operatorOptions.enableK2KClusterSync {
|
||||
!operatorOptions.enableBackup && !operatorOptions.enableApps && !operatorOptions.enableK2KClusterSync && !operatorOptions.enableML {
|
||||
if !operatorOptions.versionOnly {
|
||||
logger.Err(err).Fatal("Turn on --operator.deployment, --operator.deployment-replication, --operator.storage, --operator.backup, --operator.apps, --operator.k2k-cluster-sync or any combination of these")
|
||||
if version.GetVersionV1().IsEnterprise() {
|
||||
logger.Err(err).Fatal("Turn on --operator.deployment, --operator.deployment-replication, --operator.storage, --operator.backup, --operator.apps, --operator.k2k-cluster-sync, --operator.ml or any combination of these")
|
||||
} else {
|
||||
logger.Err(err).Fatal("Turn on --operator.deployment, --operator.deployment-replication, --operator.storage, --operator.backup, --operator.apps, --operator.k2k-cluster-sync or any combination of these")
|
||||
}
|
||||
}
|
||||
} else if operatorOptions.versionOnly {
|
||||
logger.Err(err).Fatal("Options --operator.deployment, --operator.deployment-replication, --operator.storage, --operator.backup, --operator.apps, --operator.k2k-cluster-sync cannot be enabled together with --operator.version")
|
||||
logger.Err(err).Fatal("Options --operator.deployment, --operator.deployment-replication, --operator.storage, --operator.backup, --operator.apps, --operator.k2k-cluster-sync, --operator.ml cannot be enabled together with --operator.version")
|
||||
} else if !version.GetVersionV1().IsEnterprise() {
|
||||
if operatorOptions.enableML {
|
||||
logger.Err(err).Fatal("Options --operator.ml can be enabled only on the Enterprise Operator")
|
||||
}
|
||||
}
|
||||
|
||||
// Log version
|
||||
|
@ -447,6 +458,10 @@ func executeMain(cmd *cobra.Command, args []string) {
|
|||
Enabled: cfg.EnableApps,
|
||||
Probe: &appsProbe,
|
||||
},
|
||||
ML: server.OperatorDependency{
|
||||
Enabled: cfg.EnableML,
|
||||
Probe: &mlProbe,
|
||||
},
|
||||
ClusterSync: server.OperatorDependency{
|
||||
Enabled: cfg.EnableK2KClusterSync,
|
||||
Probe: &k2KClusterSyncProbe,
|
||||
|
@ -525,6 +540,7 @@ func newOperatorConfigAndDeps(id, namespace, name string) (operator.Config, oper
|
|||
EnableStorage: operatorOptions.enableStorage,
|
||||
EnableBackup: operatorOptions.enableBackup,
|
||||
EnableApps: operatorOptions.enableApps,
|
||||
EnableML: operatorOptions.enableML,
|
||||
EnableK2KClusterSync: operatorOptions.enableK2KClusterSync,
|
||||
AllowChaos: chaosOptions.allowed,
|
||||
ScalingIntegrationEnabled: operatorOptions.scalingIntegrationEnabled,
|
||||
|
@ -543,6 +559,7 @@ func newOperatorConfigAndDeps(id, namespace, name string) (operator.Config, oper
|
|||
StorageProbe: &storageProbe,
|
||||
BackupProbe: &backupProbe,
|
||||
AppsProbe: &appsProbe,
|
||||
MlProbe: &mlProbe,
|
||||
K2KClusterSyncProbe: &k2KClusterSyncProbe,
|
||||
}
|
||||
|
||||
|
|
41
pkg/operator/operator.community.go
Normal file
41
pkg/operator/operator.community.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2023 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
|
||||
//
|
||||
|
||||
//go:build !enterprise
|
||||
|
||||
package operator
|
||||
|
||||
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"
|
||||
operatorV2 "github.com/arangodb/kube-arangodb/pkg/operatorV2"
|
||||
"github.com/arangodb/kube-arangodb/pkg/operatorV2/event"
|
||||
)
|
||||
|
||||
// onStartML starts the operator and run till given channel is closed.
|
||||
func (o *Operator) onStartML(stop <-chan struct{}) {
|
||||
panic("Unable to start ML Operator in Community")
|
||||
}
|
||||
|
||||
func (o *Operator) onStartOperatorV2ML(operator operatorV2.Operator, recorder event.Recorder, client arangoClientSet.Interface, kubeClient kubernetes.Interface, informer arangoInformer.SharedInformerFactory) {
|
||||
panic("Unable to start ML Operator in Community")
|
||||
}
|
|
@ -69,6 +69,7 @@ type operatorV2type string
|
|||
|
||||
const (
|
||||
backupOperator operatorV2type = "backup"
|
||||
mlOperator operatorV2type = "ml"
|
||||
appsOperator operatorV2type = "apps"
|
||||
)
|
||||
|
||||
|
@ -98,6 +99,7 @@ type Config struct {
|
|||
EnableDeployment bool
|
||||
EnableDeploymentReplication bool
|
||||
EnableStorage bool
|
||||
EnableML bool
|
||||
EnableBackup bool
|
||||
EnableApps bool
|
||||
EnableK2KClusterSync bool
|
||||
|
@ -118,6 +120,7 @@ type Dependencies struct {
|
|||
DeploymentReplicationProbe *probe.ReadyProbe
|
||||
StorageProbe *probe.ReadyProbe
|
||||
BackupProbe *probe.ReadyProbe
|
||||
MlProbe *probe.ReadyProbe
|
||||
AppsProbe *probe.ReadyProbe
|
||||
K2KClusterSyncProbe *probe.ReadyProbe
|
||||
}
|
||||
|
@ -172,6 +175,13 @@ func (o *Operator) Run() {
|
|||
go o.runWithoutLeaderElection("arango-apps-operator", constants.AppsLabelRole, o.onStartApps, o.Dependencies.AppsProbe)
|
||||
}
|
||||
}
|
||||
if o.Config.EnableML {
|
||||
if !o.Config.SingleMode {
|
||||
go o.runLeaderElection("arango-ml-operator", constants.MLLabelRole, o.onStartML, o.Dependencies.MlProbe)
|
||||
} else {
|
||||
go o.runWithoutLeaderElection("arango-ml-operator", constants.MLLabelRole, o.onStartML, o.Dependencies.MlProbe)
|
||||
}
|
||||
}
|
||||
if o.Config.EnableK2KClusterSync {
|
||||
// Nothing to do
|
||||
o.log.Warn("K2K Cluster sync is permanently disabled")
|
||||
|
@ -272,35 +282,14 @@ func (o *Operator) onStartOperatorV2(operatorType operatorV2type, stop <-chan st
|
|||
|
||||
switch operatorType {
|
||||
case appsOperator:
|
||||
checkFn := func() error {
|
||||
_, err := o.Client.Arango().AppsV1().ArangoJobs(o.Namespace).List(context.Background(), meta.ListOptions{})
|
||||
return err
|
||||
}
|
||||
o.waitForCRD(apps.ArangoJobCRDName, checkFn)
|
||||
|
||||
if err = job.RegisterInformer(operator, eventRecorder, arangoClientSet, kubeClientSet, arangoInformer); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
o.onStartOperatorV2Apps(operator, eventRecorder, arangoClientSet, kubeClientSet, arangoInformer)
|
||||
o.Dependencies.AppsProbe.SetReady()
|
||||
case backupOperator:
|
||||
checkFn := func() error {
|
||||
_, err := o.Client.Arango().BackupV1().ArangoBackups(o.Namespace).List(context.Background(), meta.ListOptions{})
|
||||
return err
|
||||
}
|
||||
o.waitForCRD(backupdef.ArangoBackupCRDName, checkFn)
|
||||
|
||||
if err = backup.RegisterInformer(operator, eventRecorder, arangoClientSet, kubeClientSet, arangoInformer); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
checkFn = func() error {
|
||||
_, err := o.Client.Arango().BackupV1().ArangoBackupPolicies(o.Namespace).List(context.Background(), meta.ListOptions{})
|
||||
return err
|
||||
}
|
||||
o.waitForCRD(backupdef.ArangoBackupPolicyCRDName, checkFn)
|
||||
|
||||
if err = policy.RegisterInformer(operator, eventRecorder, arangoClientSet, kubeClientSet, arangoInformer); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
o.onStartOperatorV2Backup(operator, eventRecorder, arangoClientSet, kubeClientSet, arangoInformer)
|
||||
o.Dependencies.BackupProbe.SetReady()
|
||||
case mlOperator:
|
||||
o.onStartOperatorV2ML(operator, eventRecorder, arangoClientSet, kubeClientSet, arangoInformer)
|
||||
o.Dependencies.MlProbe.SetReady()
|
||||
}
|
||||
|
||||
if err = operator.RegisterStarter(arangoInformer); err != nil {
|
||||
|
@ -310,11 +299,45 @@ func (o *Operator) onStartOperatorV2(operatorType operatorV2type, stop <-chan st
|
|||
prometheus.MustRegister(operator)
|
||||
|
||||
operator.Start(8, stop)
|
||||
o.Dependencies.BackupProbe.SetReady()
|
||||
o.Dependencies.MlProbe.SetReady()
|
||||
|
||||
<-stop
|
||||
}
|
||||
|
||||
func (o *Operator) onStartOperatorV2Apps(operator operatorV2.Operator, recorder event.Recorder, client arangoClientSet.Interface, kubeClient kubernetes.Interface, informer arangoInformer.SharedInformerFactory) {
|
||||
checkFn := func() error {
|
||||
_, err := o.Client.Arango().AppsV1().ArangoJobs(o.Namespace).List(context.Background(), meta.ListOptions{})
|
||||
return err
|
||||
}
|
||||
o.waitForCRD(apps.ArangoJobCRDName, checkFn)
|
||||
|
||||
if err := job.RegisterInformer(operator, recorder, client, kubeClient, informer); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (o *Operator) onStartOperatorV2Backup(operator operatorV2.Operator, recorder event.Recorder, client arangoClientSet.Interface, kubeClient kubernetes.Interface, informer arangoInformer.SharedInformerFactory) {
|
||||
checkFn := func() error {
|
||||
_, err := o.Client.Arango().BackupV1().ArangoBackups(o.Namespace).List(context.Background(), meta.ListOptions{})
|
||||
return err
|
||||
}
|
||||
o.waitForCRD(backupdef.ArangoBackupCRDName, checkFn)
|
||||
|
||||
if err := backup.RegisterInformer(operator, recorder, client, kubeClient, informer); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
checkFn = func() error {
|
||||
_, err := o.Client.Arango().BackupV1().ArangoBackupPolicies(o.Namespace).List(context.Background(), meta.ListOptions{})
|
||||
return err
|
||||
}
|
||||
o.waitForCRD(backupdef.ArangoBackupPolicyCRDName, checkFn)
|
||||
|
||||
if err := policy.RegisterInformer(operator, recorder, client, kubeClient, informer); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (o *Operator) WrapLogger(in *zerolog.Event) *zerolog.Event {
|
||||
return in.Str("namespace", o.Namespace)
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ type Dependencies struct {
|
|||
Storage OperatorDependency
|
||||
Backup OperatorDependency
|
||||
Apps OperatorDependency
|
||||
ML OperatorDependency
|
||||
ClusterSync OperatorDependency
|
||||
Operators Operators
|
||||
Secrets typedCore.SecretInterface
|
||||
|
@ -176,6 +177,18 @@ func NewServer(cli typedCore.CoreV1Interface, cfg Config, deps Dependencies) (*S
|
|||
r.GET("/ready/storage", gin.WrapF(deps.Storage.Probe.ReadyHandler))
|
||||
readyProbes = append(readyProbes, deps.Storage.Probe)
|
||||
}
|
||||
if deps.Backup.Enabled {
|
||||
r.GET("/ready/backup", gin.WrapF(deps.Backup.Probe.ReadyHandler))
|
||||
readyProbes = append(readyProbes, deps.Backup.Probe)
|
||||
}
|
||||
if deps.Apps.Enabled {
|
||||
r.GET("/ready/apps", gin.WrapF(deps.Apps.Probe.ReadyHandler))
|
||||
readyProbes = append(readyProbes, deps.Apps.Probe)
|
||||
}
|
||||
if deps.ML.Enabled {
|
||||
r.GET("/ready/ml", gin.WrapF(deps.ML.Probe.ReadyHandler))
|
||||
readyProbes = append(readyProbes, deps.ML.Probe)
|
||||
}
|
||||
r.GET("/ready", gin.WrapF(ready(readyProbes...)))
|
||||
r.GET("/metrics", gin.WrapF(metrics.Handler()))
|
||||
r.POST("/login", s.auth.handleLogin)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-2023 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.
|
||||
|
@ -57,6 +57,7 @@ const (
|
|||
AnnotationEnforceAntiAffinity = "database.arangodb.com/enforce-anti-affinity" // Key of annotation added to PVC. Value is a boolean "true" or "false"
|
||||
|
||||
BackupLabelRole = "backup/role"
|
||||
MLLabelRole = "ml/role"
|
||||
AppsLabelRole = "apps/role"
|
||||
ClusterSyncLabelRole = "clustersync/role"
|
||||
LabelRole = "role"
|
||||
|
|
Loading…
Reference in a new issue