Skip to content

Commit 76179fd

Browse files
committed
[Feature] [Scheduler] SchedV1 Integration
1 parent 459462b commit 76179fd

File tree

4 files changed

+98
-4
lines changed

4 files changed

+98
-4
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
- (Improvement) Improve Metrics Handling
3636
- (Feature) (Scheduler) Create Integration Profile
3737
- (Feature) (Scheduler) Additional types
38+
- (Feature) (Scheduler) SchedV1 Integration
3839

3940
## [1.2.42](https://github.com/arangodb/kube-arangodb/tree/1.2.42) (2024-07-23)
4041
- (Maintenance) Go 1.22.4 & Kubernetes 1.29.6 libraries

pkg/deployment/resources/arango_profiles.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ func (r *Resources) EnsureArangoProfiles(ctx context.Context, cachedStatus inspe
8181
return "", nil, err
8282
}
8383

84+
key, v := constants.NewProfileIntegration(name, version)
85+
8486
return fullName, &schedulerApi.ArangoProfile{
8587
ObjectMeta: meta.ObjectMeta{
8688
Name: fullName,
@@ -91,8 +93,8 @@ func (r *Resources) EnsureArangoProfiles(ctx context.Context, cachedStatus inspe
9193
},
9294
Spec: schedulerApi.ProfileSpec{
9395
Selectors: matchArangoProfilesLabels(map[string]string{
94-
constants.ProfilesDeployment: deploymentName,
95-
fmt.Sprintf("%s/%s", constants.ProfilesIntegrationPrefix, name): version,
96+
constants.ProfilesDeployment: deploymentName,
97+
key: v,
9698
}),
9799
Template: integration,
98100
},
@@ -128,8 +130,9 @@ func (r *Resources) EnsureArangoProfiles(ctx context.Context, cachedStatus inspe
128130
},
129131
}, nil
130132
},
131-
gen("authz", "v0", sidecar.IntegrationAuthorizationV0{}),
132-
gen("authn", "v1", sidecar.IntegrationAuthenticationV1{Spec: spec, DeploymentName: apiObject.GetName()}),
133+
gen(constants.ProfilesIntegrationAuthz, constants.ProfilesIntegrationV0, sidecar.IntegrationAuthorizationV0{}),
134+
gen(constants.ProfilesIntegrationAuthn, constants.ProfilesIntegrationV1, sidecar.IntegrationAuthenticationV1{Spec: spec, DeploymentName: apiObject.GetName()}),
135+
gen(constants.ProfilesIntegrationSched, constants.ProfilesIntegrationV1, sidecar.IntegrationSchedulerV1{}),
133136
); err != nil {
134137
return err
135138
} else if changed {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2024 ArangoDB GmbH, Cologne, Germany
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
//
20+
21+
package sidecar
22+
23+
import (
24+
core "k8s.io/api/core/v1"
25+
26+
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
27+
)
28+
29+
type IntegrationSchedulerV1 struct {
30+
Core *Core
31+
32+
DeploymentName string
33+
Spec api.DeploymentSpec
34+
}
35+
36+
func (i IntegrationSchedulerV1) Name() []string {
37+
return []string{"SCHEDULER", "V1"}
38+
}
39+
40+
func (i IntegrationSchedulerV1) Validate() error {
41+
return nil
42+
}
43+
44+
func (i IntegrationSchedulerV1) Envs() ([]core.EnvVar, error) {
45+
var envs = []core.EnvVar{
46+
{
47+
Name: "INTEGRATION_SCHEDULER_V1",
48+
Value: "true",
49+
},
50+
{
51+
Name: "INTEGRATION_SCHEDULER_V1_VERIFY_ACCESS",
52+
Value: "true",
53+
},
54+
{
55+
Name: "INTEGRATION_SCHEDULER_V1_NAMESPACE",
56+
ValueFrom: &core.EnvVarSource{
57+
FieldRef: &core.ObjectFieldSelector{
58+
FieldPath: "metadata.namespace",
59+
},
60+
},
61+
},
62+
}
63+
64+
return i.Core.Envs(i, envs...), nil
65+
}
66+
67+
func (i IntegrationSchedulerV1) GlobalEnvs() ([]core.EnvVar, error) {
68+
return nil, nil
69+
}
70+
71+
func (i IntegrationSchedulerV1) Volumes() ([]core.Volume, []core.VolumeMount, error) {
72+
return nil, nil, nil
73+
}

pkg/util/constants/profiles.go

+17
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,24 @@
2020

2121
package constants
2222

23+
import "fmt"
24+
2325
const ProfileGroup = "profiles.arangodb.com"
2426

2527
const ProfilesDeployment = ProfileGroup + "/deployment"
2628
const ProfilesIntegrationPrefix = "integration." + ProfileGroup
29+
30+
const (
31+
ProfilesIntegrationAuthn = "authn"
32+
ProfilesIntegrationAuthz = "authz"
33+
ProfilesIntegrationSched = "sched"
34+
)
35+
36+
const (
37+
ProfilesIntegrationV0 = "v0"
38+
ProfilesIntegrationV1 = "v1"
39+
)
40+
41+
func NewProfileIntegration(name, version string) (string, string) {
42+
return fmt.Sprintf("%s/%s", ProfilesIntegrationPrefix, name), version
43+
}

0 commit comments

Comments
 (0)