Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] [ML] Introduce basic Conditions to types #1505

Merged
merged 2 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- (Maintenance) yamlfmt as CI Step
- (Maintenance) Expose Context in OperatorV2 Item Handler
- (Feature) Improve K8S Mock for UT
- (Feature) (ML) Introduce basic Conditions

## [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
Expand Down
6 changes: 6 additions & 0 deletions docs/api/ArangoMLBatchJob.V1Alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@

## Status

### .status.conditions

Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/batchjob_status.go#L28)</sup>

Conditions specific to the entire batch job

6 changes: 6 additions & 0 deletions docs/api/ArangoMLCronJob.V1Alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@

## Status

### .status.conditions

Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/cronjob_status.go#L28)</sup>

Conditions specific to the entire cron job

6 changes: 6 additions & 0 deletions docs/api/ArangoMLStorage.V1Alpha1.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,9 @@ Default Value: `""`

## Status

### .status.conditions

Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/storage_status.go#L28)</sup>

Conditions specific to the entire storage

8 changes: 8 additions & 0 deletions pkg/apis/ml/v1alpha1/batchjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ type ArangoMLBatchJob struct {
Spec ArangoMLBatchJobSpec `json:"spec"`
Status ArangoMLBatchJobStatus `json:"status"`
}

func (a *ArangoMLBatchJob) GetStatus() ArangoMLBatchJobStatus {
return a.Status
}

func (a *ArangoMLBatchJob) SetStatus(status ArangoMLBatchJobStatus) {
a.Status = status
}
6 changes: 6 additions & 0 deletions pkg/apis/ml/v1alpha1/batchjob_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@

package v1alpha1

import "github.com/arangodb/kube-arangodb/pkg/apis/shared"

type ArangoMLBatchJobSpec struct {
}

func (a *ArangoMLBatchJobSpec) Validate() error {
return shared.WithErrors(shared.PrefixResourceErrors("spec"))
}
5 changes: 5 additions & 0 deletions pkg/apis/ml/v1alpha1/batchjob_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@

package v1alpha1

import api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"

type ArangoMLBatchJobStatus struct {
// Conditions specific to the entire batch job
// +doc/type: api.Conditions
Conditions api.ConditionList `json:"conditions,omitempty"`
}
27 changes: 27 additions & 0 deletions pkg/apis/ml/v1alpha1/conditions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// 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
//

package v1alpha1

import api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"

const (
SpecValidCondition api.ConditionType = "SpecValid"
)
8 changes: 8 additions & 0 deletions pkg/apis/ml/v1alpha1/cronjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ type ArangoMLCronJob struct {
Spec ArangoMLCronJobSpec `json:"spec"`
Status ArangoMLCronJobStatus `json:"status"`
}

func (a *ArangoMLCronJob) GetStatus() ArangoMLCronJobStatus {
return a.Status
}

func (a *ArangoMLCronJob) SetStatus(status ArangoMLCronJobStatus) {
a.Status = status
}
6 changes: 6 additions & 0 deletions pkg/apis/ml/v1alpha1/cronjob_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@

package v1alpha1

import "github.com/arangodb/kube-arangodb/pkg/apis/shared"

type ArangoMLCronJobSpec struct {
}

func (a *ArangoMLCronJobSpec) Validate() error {
return shared.WithErrors(shared.PrefixResourceErrors("spec"))
}
5 changes: 5 additions & 0 deletions pkg/apis/ml/v1alpha1/cronjob_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@

package v1alpha1

import api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"

type ArangoMLCronJobStatus struct {
// Conditions specific to the entire cron job
// +doc/type: api.Conditions
Conditions api.ConditionList `json:"conditions,omitempty"`
}
6 changes: 6 additions & 0 deletions pkg/apis/ml/v1alpha1/extension_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@

package v1alpha1

import "github.com/arangodb/kube-arangodb/pkg/apis/shared"

type ArangoMLExtensionSpec struct {
}

func (a *ArangoMLExtensionSpec) Validate() error {
return shared.WithErrors(shared.PrefixResourceErrors("spec"))
}
8 changes: 8 additions & 0 deletions pkg/apis/ml/v1alpha1/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,11 @@ type ArangoMLStorage struct {
Spec ArangoMLStorageSpec `json:"spec"`
Status ArangoMLStorageStatus `json:"status"`
}

func (a *ArangoMLStorage) GetStatus() ArangoMLStorageStatus {
return a.Status
}

func (a *ArangoMLStorage) SetStatus(status ArangoMLStorageStatus) {
a.Status = status
}
5 changes: 5 additions & 0 deletions pkg/apis/ml/v1alpha1/storage_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@

package v1alpha1

import api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"

type ArangoMLStorageStatus struct {
// Conditions specific to the entire storage
// +doc/type: api.Conditions
Conditions api.ConditionList `json:"conditions,omitempty"`
}
27 changes: 24 additions & 3 deletions pkg/apis/ml/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions pkg/operatorV2/update_wraps.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,15 @@ func WithArangoBackupUpdateStatusInterfaceRetry(ctx context.Context, client Upda
func WithArangoExtensionUpdateStatusInterfaceRetry(ctx context.Context, client UpdateStatusInterface[mlApi.ArangoMLExtensionStatus, *mlApi.ArangoMLExtension], obj *mlApi.ArangoMLExtension, status mlApi.ArangoMLExtensionStatus, opts meta.UpdateOptions) (*mlApi.ArangoMLExtension, error) {
return WithUpdateStatusInterfaceRetry[mlApi.ArangoMLExtensionStatus, *mlApi.ArangoMLExtension](ctx, client, obj, status, opts)
}

func WithArangoCronJobUpdateStatusInterfaceRetry(ctx context.Context, client UpdateStatusInterface[mlApi.ArangoMLCronJobStatus, *mlApi.ArangoMLCronJob], obj *mlApi.ArangoMLCronJob, status mlApi.ArangoMLCronJobStatus, opts meta.UpdateOptions) (*mlApi.ArangoMLCronJob, error) {
return WithUpdateStatusInterfaceRetry[mlApi.ArangoMLCronJobStatus, *mlApi.ArangoMLCronJob](ctx, client, obj, status, opts)
}

func WithArangoBatchJobUpdateStatusInterfaceRetry(ctx context.Context, client UpdateStatusInterface[mlApi.ArangoMLBatchJobStatus, *mlApi.ArangoMLBatchJob], obj *mlApi.ArangoMLBatchJob, status mlApi.ArangoMLBatchJobStatus, opts meta.UpdateOptions) (*mlApi.ArangoMLBatchJob, error) {
return WithUpdateStatusInterfaceRetry[mlApi.ArangoMLBatchJobStatus, *mlApi.ArangoMLBatchJob](ctx, client, obj, status, opts)
}

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)
}