8000 MLCronJob status update (#1526) · arangodb/kube-arangodb@244c362 · GitHub
[go: up one dir, main page]

Skip to content

Commit 244c362

Browse files
authored
MLCronJob status update (#1526)
1 parent 44733f2 commit 244c362

10 files changed

+236
-14
lines changed

.circleci/continue_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ parameters:
1616
executors:
1717
golang-executor:
1818
docker:
19-
- image: gcr.io/gcr-for-testing/golang:1.20.11
19+
- image: gcr.io/gcr-for-testing/golang:1.20.12
2020
machine-executor:
2121
machine:
2222
image: ubuntu-2204:current

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- (Feature) (ML) Extension Storage Condition
3030
- (Improvement) (ML) Switch to fsnotify for file watching for MacOS support
3131
- (Feature) (ML) Unify Images, Resources and Lifecycle
32+
- (Improvement) (ML) CronJob status update
3233

3334
## [1.2.35](https://github.com/arangodb/kube-arangodb/tree/1.2.35) (2023-11-06)
3435
- (Maintenance) Update go-driver to v1.6.0, update IsNotFound() checks

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ endif
4848

4949
TEST_BUILD ?= 0
5050
GOBUILDARGS ?=
51-
GOBASEVERSION := 1.20.11
51+
GOBASEVERSION := 1.20.12
5252
GOVERSION := $(GOBASEVERSION)-alpine3.17
5353
DISTRIBUTION := alpine:3.15
5454
GOBUILDTAGS := $(RELEASE_MODE)
@@ -779,6 +779,7 @@ set-api-version/%:
779779
synchronize: synchronize-v2alpha1-with-v1
780780

781781
synchronize-v2alpha1-with-v1:
782+
@echo ">> Please use only COMMUNITY mode! Current RELEASE_MODE=$(RELEASE_MODE)"
782783
@rm -f pkg/apis/deployment/v1/zz_generated.deepcopy.go pkg/apis/deployment/v2alpha1/zz_generated.deepcopy.go
783784
@for file in $$(find "$(ROOT)/pkg/apis/deployment/v1/" -type f -exec $(REALPATH) --relative-to "$(ROOT)/pkg/apis/deployment/v1/" {} \;); do if [ ! -d "$(ROOT)/pkg/apis/deployment/v2alpha1/$$(dirname $${file})" ]; then mkdir -p "$(ROOT)/pkg/apis/deployment/v2alpha1/$$(dirname $${file})"; fi; done
784785
@for file in $$(find "$(ROOT)/pkg/apis/deployment/v1/" -type f -exec $(REALPATH) --relative-to "$(ROOT)/pkg/apis/deployment/v1/" {} \;); do cat "$(ROOT)/pkg/apis/deployment/v1/$${file}" | $(SED) "s#package v1#package v2alpha1#g" | $(SED) 's#ArangoDeploymentVersion = "v1"#ArangoDeploymentVersion = "v2alpha1"#g' > "$(ROOT)/pkg/apis/deployment/v2alpha1/$${file}"; done

docs/api/ArangoMLCronJob.V1Alpha1.md

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### .spec
66

7-
Type: `batch.CronJobSpec` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/cronjob_spec.go#L32)</sup>
7+
Type: `batch.CronJobSpec` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/cronjob_spec.go#L33)</sup>
88

99
Links:
1010
* [Kubernetes Documentation](https://godoc.org/k8s.io/api/batch/v1beta1#CronJobSpec)
@@ -13,7 +13,7 @@ Links:
1313

1414
### .status
1515

16-
Type: `batch.CronJobStatus` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/cronjob_status.go#L36)</sup>
16+
Type: `batch.CronJobStatus` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/cronjob_status.go#L38)</sup>
1717

1818
Links:
1919
* [Kubernetes Documentation](https://godoc.org/k8s.io/api/batch/v1beta1#CronJobStatus)
@@ -22,7 +22,31 @@ Links:
2222

2323
### .status.conditions
2424

25-
Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/cronjob_status.go#L32)</sup>
25+
Type: `api.Condi 67E6 tions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/cronjob_status.go#L34)</sup>
2626

2727
Conditions specific to the entire cron job
2828

29+
***
30+
31+
### .status.ref.name
32+
33+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L46)</sup>
34+
35+
Name of the object
36+
37+
***
38+
39+
### .status.ref.namespace
40+
41+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L49)</sup>
42+
43+
Namespace of the object. Should default to the namespace of the parent object
44+
45+
***
46+
47+
### .status.ref.uid
48+
49+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L52)</sup>
50+
51+
UID keeps the information about object UID
52+

pkg/apis/ml/v1alpha1/cronjob_spec.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,27 @@
2121
package v1alpha1
2222

2323
import (
24-
batchApi "k8s.io/api/batch/v1beta1"
24+
batch "k8s.io/api/batch/v1"
2525

2626
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
27+
"github.com/arangodb/kube-arangodb/pkg/util/errors"
2728
)
2829

2930
type ArangoMLCronJobSpec struct {
3031
// +doc/type: batch.CronJobSpec
3132
// +doc/link: Kubernetes Documentation|https://godoc.org/k8s.io/api/batch/v1beta1#CronJobSpec
32-
*batchApi.CronJobSpec `json:",inline"`
33+
*batch.CronJobSpec `json:",inline"`
3334
}
3435

3536
func (a *ArangoMLCronJobSpec) Validate() error {
36-
return shared.WithErrors(shared.PrefixResourceErrors("spec"))
37+
if a == nil {
38+
return errors.Newf("Spec is not defined")
39+
}
40+
41+
var err []error
42+
if a.CronJobSpec == nil {
43+
err = append(err, shared.PrefixResourceErrors("spec", errors.Newf("CronJobSpec is not defined")))
44+
}
45+
46+
return shared.WithErrors(err...)
3747
}

pkg/apis/ml/v1alpha1/cronjob_status.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
package v1alpha1
2222

2323
import (
24-
batchApi "k8s.io/api/batch/v1beta1"
24+
batch "k8s.io/api/batch/v1"
2525

2626
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
27+
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
28+
sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
2729
)
2830

2931
type ArangoMLCronJobStatus struct {
@@ -33,5 +35,12 @@ type ArangoMLCronJobStatus struct {
3335

3436
// +doc/type: batch.CronJobStatus
3537
// +doc/link: Kubernetes Documentation|https://godoc.org/k8s.io/api/batch/v1beta1#CronJobStatus
36-
batchApi.CronJobStatus `json:",inline"`
38+
*batch.CronJobStatus `json:",inline"`
39+
40+
// Ref keeps the reference to the CronJob
41+
Ref *sharedApi.Object `json:"ref,omitempty"`
42+
}
43+
44+
func (a *ArangoMLCronJobStatus) Validate() error {
45+
return shared.WithErrors(shared.PrefixResourceErrors(" 10000 spec"))
3746
}

pkg/apis/ml/v1alpha1/extension_conditions.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ const (
2929
ExtensionMetadataServiceValidCondition api.ConditionType = "MetadataServiceValid"
3030
ExtensionServiceAccountReadyCondition api.ConditionType = "ServiceAccountReady"
3131
LicenseValidCondition api.ConditionType = "LicenseValid"
32+
CronJobSyncedCondition api.ConditionType = "CronJobSynced"
3233
)

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

Lines changed: 12 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/operatorV2/operator_worker.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ package operator
2222

2323
import (
2424
"context"
25+
"fmt"
2526

2627
"github.com/arangodb/kube-arangodb/pkg/operatorV2/operation"
2728
"github.com/arangodb/kube-arangodb/pkg/util/errors"
@@ -109,7 +110,9 @@ func (o *operator) processObject(obj interface{}) error {
109110
o.workqueue.AddRateLimited(key)
110111

111112
if !IsReconcile(err) {
112-
return errors.Newf("error syncing '%s': %s, re-queuing", key, err.Error())
113+
message := fmt.Sprintf("error syncing '%s': %s, re-queuing", key, err.Error())
114+
loggerWorker.Debug(message)
115+
return errors.Newf(message)
113116
}
114117

115118
return nil

0 commit comments

Comments
 (0)
0