Skip to content

Commit 5a25a45

Browse files
committed
[Feature] [Scheduler] Add Status Conditions
1 parent 6404de3 commit 5a25a45

29 files changed

+529
-60
lines changed

.golangci.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ linters-settings:
7979
pkg: github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/container
8080
- alias: schedulerContainerResourcesApi
8181
pkg: github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/container/resources
82+
- alias: schedulerIntegrationApi
83+
pkg: github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/integration
8284
- alias: schedulerPodApi
8385
pkg: github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/pod
8486
- alias: schedulerPodResourcesApi

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
- (Feature) (Gateway) ArangoDB Auth Token
2929
- (Feature) (Gateway) Dynamic Configuration
3030
- (Feature) DebugPackage ArangoRoutes
31+
- (Feature) (Scheduler) Add Status Conditions
3132

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

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ update-generated:
452452
"github.com/arangodb/kube-arangodb/pkg/apis" \
453453
"shared:v1 \
454454
scheduler:v1alpha1/container scheduler:v1alpha1/container/resources scheduler:v1alpha1/pod scheduler:v1alpha1/pod/resources \
455-
scheduler:v1beta1/container scheduler:v1beta1/container/resources scheduler:v1beta1/pod scheduler:v1beta1/pod/resources" \
455+
scheduler:v1beta1/integration scheduler:v1beta1/container scheduler:v1beta1/container/resources scheduler:v1beta1/pod scheduler:v1beta1/pod/resources" \
456456
--go-header-file "./tools/codegen/boilerplate.go.txt" \
457457
$(VERIFYARGS)
458458

docs/api/ArangoDeployment.V1.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3110,7 +3110,7 @@ Links:
31103110

31113111
### .spec.gateway.sidecar.controllerListenPort
31123112

3113-
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration.go#L36)</sup>
3113+
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L16)</sup>
31143114

31153115
ControllerListenPort defines on which port the sidecar container will be listening for controller requests
31163116

@@ -3168,7 +3168,7 @@ Lifecycle keeps actions that the management system should take in response to co
31683168

31693169
### .spec.gateway.sidecar.listenPort
31703170

3171-
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration.go#L32)</sup>
3171+
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L12)</sup>
31723172

31733173
ListenPort defines on which port the sidecar container will be listening for connections
31743174

docs/api/ArangoMLExtension.V1Beta1.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ Links:
798798

799799
### .spec.integrationSidecar.controllerListenPort
800800

801-
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration.go#L36)</sup>
801+
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L16)</sup>
802802

803803
ControllerListenPort defines on which port the sidecar container will be listening for controller requests
804804

@@ -856,7 +856,7 @@ Lifecycle keeps actions that the management system should take in response to co
856856

857857
### .spec.integrationSidecar.listenPort
858858

859-
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration.go#L32)</sup>
859+
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L12)</sup>
860860

861861
ListenPort defines on which port the sidecar container will be listening for connections
862862

docs/api/ArangoProfile.V1Beta1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,5 +394,5 @@ Links:
394394

395395
### .spec.template.priority
396396

397-
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/profile_template.go#L30)</sup>
397+
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/profile_template.go#L31)</sup>
398398

docs/api/GraphAnalyticsEngine.V1Alpha1.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ Links:
440440

441441
### .spec.integrationSidecar.controllerListenPort
442442

443-
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration.go#L36)</sup>
443+
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L16)</sup>
444444

445445
ControllerListenPort defines on which port the sidecar container will be listening for controller requests
446446

@@ -498,7 +498,7 @@ Lifecycle keeps actions that the management system should take in response to co
498498

499499
### .spec.integrationSidecar.listenPort
500500

501-
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration.go#L32)</sup>
501+
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L12)</sup>
502502

503503
ListenPort defines on which port the sidecar container will be listening for connections
504504

internal/docs_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ func Test_GenerateAPIDocs(t *testing.T) {
180180
"scheduler/v1beta1",
181181
"scheduler/v1beta1/container",
182182
"scheduler/v1beta1/container/resources",
183+
"scheduler/v1beta1/integration",
183184
"scheduler/v1beta1/pod",
184185
"scheduler/v1beta1/pod/resources",
185186
},
@@ -253,6 +254,7 @@ func Test_GenerateAPIDocs(t *testing.T) {
253254
"scheduler/v1beta1",
254255
"scheduler/v1beta1/container",
255256
"scheduler/v1beta1/container/resources",
257+
"scheduler/v1beta1/integration",
256258
"scheduler/v1beta1/pod",
257259
"scheduler/v1beta1/pod/resources",
258260
},
@@ -284,6 +286,7 @@ func Test_GenerateAPIDocs(t *testing.T) {
284286
"scheduler/v1beta1",
285287
"scheduler/v1beta1/container",
286288
"scheduler/v1beta1/container/resources",
289+
"scheduler/v1beta1/integration",
287290
"scheduler/v1beta1/pod",
288291
"scheduler/v1beta1/pod/resources",
289292
},
@@ -323,6 +326,7 @@ func Test_GenerateAPIDocs(t *testing.T) {
323326
"shared/v1",
324327
"scheduler/v1beta1/container",
325328
"scheduler/v1beta1/container/resources",
329+
"scheduler/v1beta1/integration",
326330
"scheduler/v1beta1/pod",
327331
"scheduler/v1beta1/pod/resources",
328332
},

pkg/apis/analytics/v1alpha1/gae_spec.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
package v1alpha1
2222

2323
import (
24-
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
24+
schedulerIntegrationApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/integration"
2525
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
2626
"github.com/arangodb/kube-arangodb/pkg/util/errors"
2727
)
@@ -34,7 +34,7 @@ type GraphAnalyticsEngineSpec struct {
3434
Deployment *GraphAnalyticsEngineSpecDeployment `json:"deployment,omitempty"`
3535

3636
// IntegrationSidecar define the integration sidecar spec
37-
IntegrationSidecar *schedulerApi.IntegrationSidecar `json:"integrationSidecar,omitempty"`
37+
IntegrationSidecar *schedulerIntegrationApi.Sidecar `json:"integrationSidecar,omitempty"`
3838
}
3939

4040
func (a *GraphAnalyticsEngineSpec) GetDeployment() *GraphAnalyticsEngineSpecDeployment {
@@ -44,7 +44,7 @@ func (a *GraphAnalyticsEngineSpec) GetDeployment() *GraphAnalyticsEngineSpecDepl
4444
return a.Deployment
4545
}
4646

47-
func (a *GraphAnalyticsEngineSpec) GetIntegrationSidecar() *schedulerApi.IntegrationSidecar {
47+
func (a *GraphAnalyticsEngineSpec) GetIntegrationSidecar() *schedulerIntegrationApi.Sidecar {
4848
if a == nil || a.IntegrationSidecar == nil {
4949
return nil
5050
}

pkg/apis/analytics/v1alpha1/zz_generated.deepcopy.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/deployment/v1/deployment_spec_gateway.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
package v1
2222

2323
import (
24-
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
24+
schedulerIntegrationApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/integration"
2525
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
2626
"github.com/arangodb/kube-arangodb/pkg/util"
2727
)
@@ -42,7 +42,7 @@ type DeploymentSpecGateway struct {
4242
Image *string `json:"image"`
4343

4444
// Sidecar define the integration sidecar spec
45-
Sidecar *schedulerApi.IntegrationSidecar `json:"sidecar,omitempty"`
45+
Sidecar *schedulerIntegrationApi.Sidecar `json:"sidecar,omitempty"`
4646
}
4747

4848
// IsEnabled returns whether the gateway is enabled.
@@ -63,7 +63,7 @@ func (d *DeploymentSpecGateway) IsDynamic() bool {
6363
return *d.Dynamic
6464
}
6565

66-
func (d *DeploymentSpecGateway) GetSidecar() *schedulerApi.IntegrationSidecar {
66+
func (d *DeploymentSpecGateway) GetSidecar() *schedulerIntegrationApi.Sidecar {
6767
if d == nil || d.Sidecar == nil {
6868
return nil
6969
}

pkg/apis/deployment/v1/zz_generated.deepcopy.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/deployment/v2alpha1/deployment_spec_gateway.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
package v2alpha1
2222

2323
import (
24-
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
24+
schedulerIntegrationApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/integration"
2525
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
2626
"github.com/arangodb/kube-arangodb/pkg/util"
2727
)
@@ -42,7 +42,7 @@ type DeploymentSpecGateway struct {
4242
Image *string `json:"image"`
4343

4444
// Sidecar define the integration sidecar spec
45-
Sidecar *schedulerApi.IntegrationSidecar `json:"sidecar,omitempty"`
45+
Sidecar *schedulerIntegrationApi.Sidecar `json:"sidecar,omitempty"`
4646
}
4747

4848
// IsEnabled returns whether the gateway is enabled.
@@ -63,7 +63,7 @@ func (d *DeploymentSpecGateway) IsDynamic() bool {
6363
return *d.Dynamic
6464
}
6565

66-
func (d *DeploymentSpecGateway) GetSidecar() *schedulerApi.IntegrationSidecar {
66+
func (d *DeploymentSpecGateway) GetSidecar() *schedulerIntegrationApi.Sidecar {
6767
if d == nil || d.Sidecar == nil {
6868
return nil
6969
}

pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/ml/v1beta1/extension_spec.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
package v1beta1
2222

2323
import (
24-
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
24+
schedulerIntegrationApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/integration"
2525
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
2626
sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
2727
)
@@ -44,7 +44,7 @@ type ArangoMLExtensionSpec struct {
4444
JobsTemplates *ArangoMLJobsTemplates `json:"jobsTemplates,omitempty"`
4545

4646
// IntegrationSidecar define the integration sidecar spec
47-
IntegrationSidecar *schedulerApi.IntegrationSidecar `json:"integrationSidecar,omitempty"`
47+
IntegrationSidecar *schedulerIntegrationApi.Sidecar `json:"integrationSidecar,omitempty"`
4848
}
4949

5050
func (a *ArangoMLExtensionSpec) GetMetadataService() *ArangoMLExtensionSpecMetadataService {
@@ -85,7 +85,7 @@ func (a *ArangoMLExtensionSpec) GetJobsTemplates() *ArangoMLJobsTemplates {
8585
return a.JobsTemplates
8686
}
8787

88-
func (a *ArangoMLExtensionSpec) GetIntegrationSidecar() *schedulerApi.IntegrationSidecar {
88+
func (a *ArangoMLExtensionSpec) GetIntegrationSidecar() *schedulerIntegrationApi.Sidecar {
8989
if a == nil || a.IntegrationSidecar == nil {
9090
return nil
9191
}

pkg/apis/ml/v1beta1/zz_generated.deepcopy.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 v1beta1
22+
23+
import api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
24+
25+
const (
26+
ReadyCondition api.ConditionType = "Ready"
27+
SpecValidCondition api.ConditionType = "SpecValid"
28+
)

pkg/apis/scheduler/v1beta1/container/definition.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/interfaces"
2828
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
2929
"github.com/arangodb/kube-arangodb/pkg/util"
30-
"github.com/arangodb/kube-arangodb/pkg/util/errors"
3130
kresources "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/resources"
3231
)
3332

@@ -114,13 +113,17 @@ func (c Containers) With(other Containers) Containers {
114113
}
115114

116115
func (c Containers) Validate() error {
117-
for name, container := range c {
116+
return shared.ValidateMap(c, func(s string, container Container) error {
117+
if err := shared.ValidateResourceName(s); err != nil {
118+
return err
119+
}
120+
118121
if err := container.Validate(); err != nil {
119-
return errors.Wrapf(err, "Container %s failed", name)
122+
return err
120123
}
121-
}
122124

123-
return nil
125+
return nil
126+
})
124127
}
125128

126129
var _ interfaces.Container[Container] = &Container{}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
// +k8s:deepcopy-gen=package
22+
// +groupName=scheduler.arangodb.com
23+
package integration

0 commit comments

Comments
 (0)