mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Feature] [Scheduler] SchedV1 Integration (#1732)
This commit is contained in:
parent
9f0e5c5713
commit
01f5875140
13 changed files with 442 additions and 44 deletions
|
@ -36,6 +36,7 @@
|
|||
- (Feature) (Scheduler) Create Integration Profile
|
||||
- (Feature) (Scheduler) Additional types
|
||||
- (Feature) Alternative Upgrade Order Feature
|
||||
- (Feature) (Scheduler) SchedV1 Integration
|
||||
|
||||
## [1.2.42](https://github.com/arangodb/kube-arangodb/tree/1.2.42) (2024-07-23)
|
||||
- (Maintenance) Go 1.22.4 & Kubernetes 1.29.6 libraries
|
||||
|
|
|
@ -43,5 +43,25 @@ func scheduler(logger zerolog.Logger, files chan<- shared.File) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if err := schedulerPods(logger, files, k); err != nil {
|
||||
logger.Err(err).Msgf("Error while collecting arango scheduler extension")
|
||||
return err
|
||||
}
|
||||
|
||||
if err := schedulerDeployments(logger, files, k); err != nil {
|
||||
logger.Err(err).Msgf("Error while collecting arango scheduler extension")
|
||||
return err
|
||||
}
|
||||
|
||||
if err := schedulerBatchJobs(logger, files, k); err != nil {
|
||||
logger.Err(err).Msgf("Error while collecting arango scheduler extension")
|
||||
return err
|
||||
}
|
||||
|
||||
if err := schedulerCronJobs(logger, files, k); err != nil {
|
||||
logger.Err(err).Msgf("Error while collecting arango scheduler extension")
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
//
|
||||
// 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 kubernetes
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
|
||||
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/debug_package/cli"
|
||||
"github.com/arangodb/kube-arangodb/pkg/debug_package/shared"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
|
||||
)
|
||||
|
||||
func schedulerBatchJobs(logger zerolog.Logger, files chan<- shared.File, client kclient.Client) error {
|
||||
batchjobs, err := listSchedulerBatchJobs(client)
|
||||
if err != nil {
|
||||
if kerrors.IsForbiddenOrNotFound(err) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
if err := errors.ExecuteWithErrorArrayP2(schedulerBatchJob, client, files, batchjobs...); err != nil {
|
||||
logger.Err(err).Msgf("Error while collecting arango scheduler batchjobs")
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func schedulerBatchJob(client kclient.Client, files chan<- shared.File, ext *schedulerApi.ArangoSchedulerBatchJob) error {
|
||||
files <- shared.NewYAMLFile(fmt.Sprintf("kubernetes/arango/scheduler/arangoschedulerbatchjobs/%s.yaml", ext.GetName()), func() ([]interface{}, error) {
|
||||
return []interface{}{ext}, nil
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func listSchedulerBatchJobs(client kclient.Client) ([]*schedulerApi.ArangoSchedulerBatchJob, error) {
|
||||
return ListObjects[*schedulerApi.ArangoSchedulerBatchJobList, *schedulerApi.ArangoSchedulerBatchJob](context.Background(), client.Arango().SchedulerV1beta1().ArangoSchedulerBatchJobs(cli.GetInput().Namespace), func(result *schedulerApi.ArangoSchedulerBatchJobList) []*schedulerApi.ArangoSchedulerBatchJob {
|
||||
q := make([]*schedulerApi.ArangoSchedulerBatchJob, len(result.Items))
|
||||
|
||||
for id, e := range result.Items {
|
||||
q[id] = e.DeepCopy()
|
||||
}
|
||||
|
||||
return q
|
||||
})
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
//
|
||||
// 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 kubernetes
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
|
||||
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/debug_package/cli"
|
||||
"github.com/arangodb/kube-arangodb/pkg/debug_package/shared"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
|
||||
)
|
||||
|
||||
func schedulerCronJobs(logger zerolog.Logger, files chan<- shared.File, client kclient.Client) error {
|
||||
cronjobs, err := listSchedulerCronJobs(client)
|
||||
if err != nil {
|
||||
if kerrors.IsForbiddenOrNotFound(err) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
if err := errors.ExecuteWithErrorArrayP2(schedulerCronJob, client, files, cronjobs...); err != nil {
|
||||
logger.Err(err).Msgf("Error while collecting arango scheduler cronjobs")
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func schedulerCronJob(client kclient.Client, files chan<- shared.File, ext *schedulerApi.ArangoSchedulerCronJob) error {
|
||||
files <- shared.NewYAMLFile(fmt.Sprintf("kubernetes/arango/scheduler/arangoschedulercronjobs/%s.yaml", ext.GetName()), func() ([]interface{}, error) {
|
||||
return []interface{}{ext}, nil
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func listSchedulerCronJobs(client kclient.Client) ([]*schedulerApi.ArangoSchedulerCronJob, error) {
|
||||
return ListObjects[*schedulerApi.ArangoSchedulerCronJobList, *schedulerApi.ArangoSchedulerCronJob](context.Background(), client.Arango().SchedulerV1beta1().ArangoSchedulerCronJobs(cli.GetInput().Namespace), func(result *schedulerApi.ArangoSchedulerCronJobList) []*schedulerApi.ArangoSchedulerCronJob {
|
||||
q := make([]*schedulerApi.ArangoSchedulerCronJob, len(result.Items))
|
||||
|
||||
for id, e := range result.Items {
|
||||
q[id] = e.DeepCopy()
|
||||
}
|
||||
|
||||
return q
|
||||
})
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
//
|
||||
// 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 kubernetes
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
|
||||
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/debug_package/cli"
|
||||
"github.com/arangodb/kube-arangodb/pkg/debug_package/shared"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
|
||||
)
|
||||
|
||||
func schedulerDeployments(logger zerolog.Logger, files chan<- shared.File, client kclient.Client) error {
|
||||
deployments, err := listSchedulerDeployments(client)
|
||||
if err != nil {
|
||||
if kerrors.IsForbiddenOrNotFound(err) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
if err := errors.ExecuteWithErrorArrayP2(schedulerDeployment, client, files, deployments...); err != nil {
|
||||
logger.Err(err).Msgf("Error while collecting arango scheduler deployments")
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func schedulerDeployment(client kclient.Client, files chan<- shared.File, ext *schedulerApi.ArangoSchedulerDeployment) error {
|
||||
files <- shared.NewYAMLFile(fmt.Sprintf("kubernetes/arango/scheduler/arangoschedulerdeployments/%s.yaml", ext.GetName()), func() ([]interface{}, error) {
|
||||
return []interface{}{ext}, nil
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func listSchedulerDeployments(client kclient.Client) ([]*schedulerApi.ArangoSchedulerDeployment, error) {
|
||||
return ListObjects[*schedulerApi.ArangoSchedulerDeploymentList, *schedulerApi.ArangoSchedulerDeployment](context.Background(), client.Arango().SchedulerV1beta1().ArangoSchedulerDeployments(cli.GetInput().Namespace), func(result *schedulerApi.ArangoSchedulerDeploymentList) []*schedulerApi.ArangoSchedulerDeployment {
|
||||
q := make([]*schedulerApi.ArangoSchedulerDeployment, len(result.Items))
|
||||
|
||||
for id, e := range result.Items {
|
||||
q[id] = e.DeepCopy()
|
||||
}
|
||||
|
||||
return q
|
||||
})
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
//
|
||||
// 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 kubernetes
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
|
||||
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
|
||||
"github.com/arangodb/kube-arangodb/pkg/debug_package/cli"
|
||||
"github.com/arangodb/kube-arangodb/pkg/debug_package/shared"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
|
||||
)
|
||||
|
||||
func schedulerPods(logger zerolog.Logger, files chan<- shared.File, client kclient.Client) error {
|
||||
pods, err := listSchedulerPods(client)
|
||||
if err != nil {
|
||||
if kerrors.IsForbiddenOrNotFound(err) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
if err := errors.ExecuteWithErrorArrayP2(schedulerPod, client, files, pods...); err != nil {
|
||||
logger.Err(err).Msgf("Error while collecting arango scheduler pods")
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func schedulerPod(client kclient.Client, files chan<- shared.File, ext *schedulerApi.ArangoSchedulerPod) error {
|
||||
files <- shared.NewYAMLFile(fmt.Sprintf("kubernetes/arango/scheduler/arangoschedulerpods/%s.yaml", ext.GetName()), func() ([]interface{}, error) {
|
||||
return []interface{}{ext}, nil
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func listSchedulerPods(client kclient.Client) ([]*schedulerApi.ArangoSchedulerPod, error) {
|
||||
return ListObjects[*schedulerApi.ArangoSchedulerPodList, *schedulerApi.ArangoSchedulerPod](context.Background(), client.Arango().SchedulerV1beta1().ArangoSchedulerPods(cli.GetInput().Namespace), func(result *schedulerApi.ArangoSchedulerPodList) []*schedulerApi.ArangoSchedulerPod {
|
||||
q := make([]*schedulerApi.ArangoSchedulerPod, len(result.Items))
|
||||
|
||||
for id, e := range result.Items {
|
||||
q[id] = e.DeepCopy()
|
||||
}
|
||||
|
||||
return q
|
||||
})
|
||||
}
|
|
@ -81,6 +81,8 @@ func (r *Resources) EnsureArangoProfiles(ctx context.Context, cachedStatus inspe
|
|||
return "", nil, err
|
||||
}
|
||||
|
||||
key, v := constants.NewProfileIntegration(name, version)
|
||||
|
||||
return fullName, &schedulerApi.ArangoProfile{
|
||||
ObjectMeta: meta.ObjectMeta{
|
||||
Name: fullName,
|
||||
|
@ -91,8 +93,8 @@ func (r *Resources) EnsureArangoProfiles(ctx context.Context, cachedStatus inspe
|
|||
},
|
||||
Spec: schedulerApi.ProfileSpec{
|
||||
Selectors: matchArangoProfilesLabels(map[string]string{
|
||||
constants.ProfilesDeployment: deploymentName,
|
||||
fmt.Sprintf("%s/%s", constants.ProfilesIntegrationPrefix, name): version,
|
||||
constants.ProfilesDeployment: deploymentName,
|
||||
key: v,
|
||||
}),
|
||||
Template: integration,
|
||||
},
|
||||
|
@ -128,8 +130,9 @@ func (r *Resources) EnsureArangoProfiles(ctx context.Context, cachedStatus inspe
|
|||
},
|
||||
}, nil
|
||||
},
|
||||
gen("authz", "v0", sidecar.IntegrationAuthorizationV0{}),
|
||||
gen("authn", "v1", sidecar.IntegrationAuthenticationV1{Spec: spec, DeploymentName: apiObject.GetName()}),
|
||||
gen(constants.ProfilesIntegrationAuthz, constants.ProfilesIntegrationV0, sidecar.IntegrationAuthorizationV0{}),
|
||||
gen(constants.ProfilesIntegrationAuthn, constants.ProfilesIntegrationV1, sidecar.IntegrationAuthenticationV1{Spec: spec, DeploymentName: apiObject.GetName()}),
|
||||
gen(constants.ProfilesIntegrationSched, constants.ProfilesIntegrationV1, sidecar.IntegrationSchedulerV1{}),
|
||||
); err != nil {
|
||||
return err
|
||||
} else if changed {
|
||||
|
|
|
@ -109,6 +109,14 @@ func (h *handler) HandleObject(ctx context.Context, item operation.Item, extensi
|
|||
return false, err
|
||||
}
|
||||
|
||||
// Try to fetch status
|
||||
if profileNames := util.FormatList(calculatedProfiles, func(a util.KV[string, schedulerApi.ProfileAcceptedTemplate]) string {
|
||||
return a.K
|
||||
}); !equality.Semantic.DeepEqual(status.Profiles, profileNames) {
|
||||
status.Profiles = profileNames
|
||||
return true, operator.Reconcile("Status Changed")
|
||||
}
|
||||
|
||||
var batchJobTemplate batch.Job
|
||||
batchJobTemplate.ObjectMeta = meta.ObjectMeta{
|
||||
Name: extension.ObjectMeta.Name,
|
||||
|
@ -168,16 +176,6 @@ func (h *handler) HandleObject(ctx context.Context, item operation.Item, extensi
|
|||
return false, err
|
||||
}
|
||||
|
||||
profileNames := util.FormatList(calculatedProfiles, func(a util.KV[string, schedulerApi.ProfileAcceptedTemplate]) string {
|
||||
return a.K
|
||||
})
|
||||
|
||||
// Try to fetch status
|
||||
if !equality.Semantic.DeepEqual(status.Profiles, profileNames) {
|
||||
status.Profiles = profileNames
|
||||
return true, operator.Reconcile("Status Changed")
|
||||
}
|
||||
|
||||
// Try to fetch status
|
||||
if !equality.Semantic.DeepEqual(status.JobStatus, obj.Status) {
|
||||
obj.Status.DeepCopyInto(&status.JobStatus)
|
||||
|
|
|
@ -109,6 +109,14 @@ func (h *handler) HandleObject(ctx context.Context, item operation.Item, extensi
|
|||
return false, err
|
||||
}
|
||||
|
||||
// Try to fetch status
|
||||
if profileNames := util.FormatList(calculatedProfiles, func(a util.KV[string, schedulerApi.ProfileAcceptedTemplate]) string {
|
||||
return a.K
|
||||
}); !equality.Semantic.DeepEqual(status.Profiles, profileNames) {
|
||||
status.Profiles = profileNames
|
||||
return true, operator.Reconcile("Status Changed")
|
||||
}
|
||||
|
||||
var cronJobTemplate batch.CronJob
|
||||
cronJobTemplate.ObjectMeta = meta.ObjectMeta{
|
||||
Name: extension.ObjectMeta.Name,
|
||||
|
@ -168,16 +176,6 @@ func (h *handler) HandleObject(ctx context.Context, item operation.Item, extensi
|
|||
return false, err
|
||||
}
|
||||
|
||||
profileNames := util.FormatList(calculatedProfiles, func(a util.KV[string, schedulerApi.ProfileAcceptedTemplate]) string {
|
||||
return a.K
|
||||
})
|
||||
|
||||
// Try to fetch status
|
||||
if !equality.Semantic.DeepEqual(status.Profiles, profileNames) {
|
||||
status.Profiles = profileNames
|
||||
return true, operator.Reconcile("Status Changed")
|
||||
}
|
||||
|
||||
// Try to fetch status
|
||||
if !equality.Semantic.DeepEqual(status.CronJobStatus, obj.Status) {
|
||||
obj.Status.DeepCopyInto(&status.CronJobStatus)
|
||||
|
|
|
@ -109,6 +109,14 @@ func (h *handler) HandleObject(ctx context.Context, item operation.Item, extensi
|
|||
return false, err
|
||||
}
|
||||
|
||||
// Try to fetch status
|
||||
if profileNames := util.FormatList(calculatedProfiles, func(a util.KV[string, schedulerApi.ProfileAcceptedTemplate]) string {
|
||||
return a.K
|
||||
}); !equality.Semantic.DeepEqual(status.Profiles, profileNames) {
|
||||
status.Profiles = profileNames
|
||||
return true, operator.Reconcile("Status Changed")
|
||||
}
|
||||
|
||||
var deploymentTemplate apps.Deployment
|
||||
deploymentTemplate.ObjectMeta = meta.ObjectMeta{
|
||||
Name: extension.ObjectMeta.Name,
|
||||
|
@ -169,16 +177,6 @@ func (h *handler) HandleObject(ctx context.Context, item operation.Item, extensi
|
|||
return false, err
|
||||
}
|
||||
|
||||
profileNames := util.FormatList(calculatedProfiles, func(a util.KV[string, schedulerApi.ProfileAcceptedTemplate]) string {
|
||||
return a.K
|
||||
})
|
||||
|
||||
// Try to fetch status
|
||||
if !equality.Semantic.DeepEqual(status.Profiles, profileNames) {
|
||||
status.Profiles = profileNames
|
||||
return true, operator.Reconcile("Status Changed")
|
||||
}
|
||||
|
||||
// Try to fetch status
|
||||
if !equality.Semantic.DeepEqual(status.DeploymentStatus, obj.Status) {
|
||||
obj.Status.DeepCopyInto(&status.DeploymentStatus)
|
||||
|
|
|
@ -109,6 +109,14 @@ func (h *handler) HandleObject(ctx context.Context, item operation.Item, extensi
|
|||
return false, err
|
||||
}
|
||||
|
||||
// Try to fetch status
|
||||
if profileNames := util.FormatList(calculatedProfiles, func(a util.KV[string, schedulerApi.ProfileAcceptedTemplate]) string {
|
||||
return a.K
|
||||
}); !equality.Semantic.DeepEqual(status.Profiles, profileNames) {
|
||||
status.Profiles = profileNames
|
||||
return true, operator.Reconcile("Status Changed")
|
||||
}
|
||||
|
||||
var podSpecTemplate core.PodTemplateSpec
|
||||
|
||||
podSpecTemplate.ObjectMeta = meta.ObjectMeta{
|
||||
|
@ -164,16 +172,6 @@ func (h *handler) HandleObject(ctx context.Context, item operation.Item, extensi
|
|||
return false, err
|
||||
}
|
||||
|
||||
profileNames := util.FormatList(calculatedProfiles, func(a util.KV[string, schedulerApi.ProfileAcceptedTemplate]) string {
|
||||
return a.K
|
||||
})
|
||||
|
||||
// Try to fetch status
|
||||
if !equality.Semantic.DeepEqual(status.Profiles, profileNames) {
|
||||
status.Profiles = profileNames
|
||||
return true, operator.Reconcile("Status Changed")
|
||||
}
|
||||
|
||||
// Try to fetch status
|
||||
if !equality.Semantic.DeepEqual(status.PodStatus, obj.Status) {
|
||||
obj.Status.DeepCopyInto(&status.PodStatus)
|
||||
|
|
73
pkg/integrations/sidecar/integration.scheduler.v1.go
Normal file
73
pkg/integrations/sidecar/integration.scheduler.v1.go
Normal file
|
@ -0,0 +1,73 @@
|
|||
//
|
||||
// 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 sidecar
|
||||
|
||||
import (
|
||||
core "k8s.io/api/core/v1"
|
||||
|
||||
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
|
||||
)
|
||||
|
||||
type IntegrationSchedulerV1 struct {
|
||||
Core *Core
|
||||
|
||||
DeploymentName string
|
||||
Spec api.DeploymentSpec
|
||||
}
|
||||
|
||||
func (i IntegrationSchedulerV1) Name() []string {
|
||||
return []string{"SCHEDULER", "V1"}
|
||||
}
|
||||
|
||||
func (i IntegrationSchedulerV1) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (i IntegrationSchedulerV1) Envs() ([]core.EnvVar, error) {
|
||||
var envs = []core.EnvVar{
|
||||
{
|
||||
Name: "INTEGRATION_SCHEDULER_V1",
|
||||
Value: "true",
|
||||
},
|
||||
{
|
||||
Name: "INTEGRATION_SCHEDULER_V1_VERIFY_ACCESS",
|
||||
Value: "true",
|
||||
},
|
||||
{
|
||||
Name: "INTEGRATION_SCHEDULER_V1_NAMESPACE",
|
||||
ValueFrom: &core.EnvVarSource{
|
||||
FieldRef: &core.ObjectFieldSelector{
|
||||
FieldPath: "metadata.namespace",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return i.Core.Envs(i, envs...), nil
|
||||
}
|
||||
|
||||
func (i IntegrationSchedulerV1) GlobalEnvs() ([]core.EnvVar, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (i IntegrationSchedulerV1) Volumes() ([]core.Volume, []core.VolumeMount, error) {
|
||||
return nil, nil, nil
|
||||
}
|
|
@ -20,7 +20,24 @@
|
|||
|
||||
package constants
|
||||
|
||||
import "fmt"
|
||||
|
||||
const ProfileGroup = "profiles.arangodb.com"
|
||||
|
||||
const ProfilesDeployment = ProfileGroup + "/deployment"
|
||||
const ProfilesIntegrationPrefix = "integration." + ProfileGroup
|
||||
|
||||
const (
|
||||
ProfilesIntegrationAuthn = "authn"
|
||||
ProfilesIntegrationAuthz = "authz"
|
||||
ProfilesIntegrationSched = "sched"
|
||||
)
|
||||
|
||||
const (
|
||||
ProfilesIntegrationV0 = "v0"
|
||||
ProfilesIntegrationV1 = "v1"
|
||||
)
|
||||
|
||||
func NewProfileIntegration(name, version string) (string, string) {
|
||||
return fmt.Sprintf("%s/%s", ProfilesIntegrationPrefix, name), version
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue