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] CRD #1466

Merged
merged 4 commits into from
Nov 8, 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
2 changes: 2 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ linters-settings:
alias: storage
- pkg: k8s.io/api/policy/v1
alias: policy
- pkg: github.com/arangodb/kube-arangodb/pkg/apis/ml/v1alpha1
alias: mlApi
gci:
sections:
- standard
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- (Documentation) Improvements and fixes for rendered documentation (GH pages)
- (Feature) License Manager
- (Improvement) Use Async mode for backup creation
- (Feature) (ML) CRD

## [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
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ update-generated:
"all" \
"github.com/arangodb/kube-arangodb/pkg/generated" \
"github.com/arangodb/kube-arangodb/pkg/apis" \
"deployment:v1 replication:v1 storage:v1alpha backup:v1 deployment:v2alpha1 replication:v2alpha1 apps:v1" \
"deployment:v1 replication:v1 storage:v1alpha backup:v1 deployment:v2alpha1 replication:v2alpha1 apps:v1 ml:v1alpha1" \
--go-header-file "./tools/codegen/boilerplate.go.txt" \
$(VERIFYARGS)
GOPATH=$(GOBUILDDIR) $(VENDORDIR)/k8s.io/code-generator/generate-groups.sh \
Expand Down Expand Up @@ -791,7 +791,8 @@ fix: license-range fmt license yamlfmt
CRDS:=apps-job \
backups-backup backups-backuppolicy \
database-clustersynchronization database-deployment database-member database-task \
replication-deploymentreplication
replication-deploymentreplication \
ml-storage ml-extension ml-job-batch ml-job-cron

.PHONY: sync-crds
sync-crds:
Expand Down
22 changes: 22 additions & 0 deletions chart/kube-arangodb/crds/ml-extension.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: arangomlextensions.ml.arangodb.com
spec:
group: ml.arangodb.com
names:
kind: ArangoMLExtension
listKind: ArangoMLExtensionList
plural: arangomlextensions
singular: arangomlextension
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
served: true
storage: true
subresources:
status: {}
22 changes: 22 additions & 0 deletions chart/kube-arangodb/crds/ml-job-batch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: arangomlbatchjobs.ml.arangodb.com
spec:
group: ml.arangodb.com
names:
kind: ArangoMLBatchJob
listKind: ArangoMLBatchJobList
plural: arangomlbatchjobs
singular: arangomlbatchjob
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
served: true
storage: true
subresources:
status: {}
22 changes: 22 additions & 0 deletions chart/kube-arangodb/crds/ml-job-cron.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: arangomlcronjobs.ml.arangodb.com
spec:
group: ml.arangodb.com
names:
kind: ArangoMLCronJob
listKind: ArangoMLCronJobList
plural: arangomlcronjobs
singular: arangomlcronjob
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
served: true
storage: true
subresources:
status: {}
22 changes: 22 additions & 0 deletions chart/kube-arangodb/crds/ml-storage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: arangomlstorages.ml.arangodb.com
spec:
group: ml.arangodb.com
names:
kind: ArangoMLStorage
listKind: ArangoMLStorageList
plural: arangomlstorages
singular: arangomlstorage
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
served: true
storage: true
subresources:
status: {}
6 changes: 6 additions & 0 deletions docs/api/ArangoMLBatchJob.V1Alpha1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# API Reference for ArangoMLBatchJob V1Alpha1

## Spec

## Status

6 changes: 6 additions & 0 deletions docs/api/ArangoMLCronJob.V1Alpha1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# API Reference for ArangoMLCronJob V1Alpha1

## Spec

## Status

6 changes: 6 additions & 0 deletions docs/api/ArangoMLExtension.V1Alpha1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# API Reference for ArangoMLExtension V1Alpha1

## Spec

## Status

6 changes: 6 additions & 0 deletions docs/api/ArangoMLStorage.V1Alpha1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# API Reference for ArangoMLStorage V1Alpha1

## Spec

## Status

4 changes: 4 additions & 0 deletions docs/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@
- [ArangoDeployment.V1](./ArangoDeployment.V1.md)
- [ArangoDeploymentReplication.V1](./ArangoDeploymentReplication.V1.md)
- [ArangoLocalStorage.V1Alpha](./ArangoLocalStorage.V1Alpha.md)
nikita-vanyasin marked this conversation as resolved.
Show resolved Hide resolved
- [ArangoMLBatchJob.V1Alpha1](./ArangoMLBatchJob.V1Alpha1.md)
- [ArangoMLCronJob.V1Alpha1](./ArangoMLCronJob.V1Alpha1.md)
- [ArangoMLExtension.V1Alpha1](./ArangoMLExtension.V1Alpha1.md)
- [ArangoMLStorage.V1Alpha1](./ArangoMLStorage.V1Alpha1.md)
- [ArangoMember.V1](./ArangoMember.V1.md)

19 changes: 19 additions & 0 deletions internal/docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (

backupApi "github.com/arangodb/kube-arangodb/pkg/apis/backup/v1"
deploymentApi "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
mlApi "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1alpha1"
replicationApi "github.com/arangodb/kube-arangodb/pkg/apis/replication/v1"
storageApi "github.com/arangodb/kube-arangodb/pkg/apis/storage/v1alpha"
"github.com/arangodb/kube-arangodb/pkg/util"
Expand Down Expand Up @@ -145,6 +146,24 @@ func Test_GenerateAPIDocs(t *testing.T) {
"Status": backupApi.ArangoBackupPolicy{}.Status,
},
},
fmt.Sprintf("%s/pkg/apis/ml/v1alpha1", root): {
"ArangoMLExtension.V1Alpha1": {
"Spec": mlApi.ArangoMLExtension{}.Spec,
"Status": mlApi.ArangoMLExtension{}.Status,
},
"ArangoMLStorage.V1Alpha1": {
"Spec": mlApi.ArangoMLStorage{}.Spec,
"Status": mlApi.ArangoMLStorage{}.Status,
},
"ArangoMLCronJob.V1Alpha1": {
"Spec": mlApi.ArangoMLCronJob{}.Spec,
"Status": mlApi.ArangoMLCronJob{}.Status,
},
"ArangoMLBatchJob.V1Alpha1": {
"Spec": mlApi.ArangoMLBatchJob{}.Spec,
"Status": mlApi.ArangoMLBatchJob{}.Status,
},
},
fmt.Sprintf("%s/pkg/apis/replication/v1", root): {
"ArangoDeploymentReplication.V1": {
"Spec": replicationApi.ArangoDeploymentReplication{}.Spec,
Expand Down
41 changes: 41 additions & 0 deletions pkg/apis/ml/definitions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// 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 ml

const (
ArangoMLStorageCRDName = ArangoMLStorageResourcePlural + "." + ArangoMLGroupName
ArangoMLStorageResourceKind = "ArangoMLStorage"
ArangoMLStorageResourcePlural = "arangomlstorages"

ArangoMLExtensionCRDName = ArangoMLExtensionResourcePlural + "." + ArangoMLGroupName
ArangoMLExtensionResourceKind = "ArangoMLExtension"
ArangoMLExtensionResourcePlural = "arangomlextensions"

ArangoMLBatchJobCRDName = ArangoMLBatchJobResourcePlural + "." + ArangoMLGroupName
ArangoMLBatchJobResourceKind = "ArangoMLBatchJob"
ArangoMLBatchJobResourcePlural = "arangomlbatchjobs"

ArangoMLCronJobCRDName = ArangoMLCronJobResourcePlural + "." + ArangoMLGroupName
ArangoMLCronJobResourceKind = "ArangoMLCronJob"
ArangoMLCronJobResourcePlural = "arangomlcronjobs"

ArangoMLGroupName = "ml.arangodb.com"
)
47 changes: 47 additions & 0 deletions pkg/apis/ml/v1alpha1/batchjob.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// 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 (
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ArangoMLBatchJobList is a list of ArangoML BatchJobs.
type ArangoMLBatchJobList struct {
meta.TypeMeta `json:",inline"`
meta.ListMeta `json:"metadata,omitempty"`

Items []ArangoMLBatchJob `json:"items"`
}

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ArangoMLBatchJob contains definition and status of the ArangoML BatchJob.
type ArangoMLBatchJob struct {
meta.TypeMeta `json:",inline"`
meta.ObjectMeta `json:"metadata,omitempty"`

Spec ArangoMLBatchJobSpec `json:"spec"`
Status ArangoMLBatchJobStatus `json:"status"`
}
24 changes: 24 additions & 0 deletions pkg/apis/ml/v1alpha1/batchjob_spec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// 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

type ArangoMLBatchJobSpec struct {
}
24 changes: 24 additions & 0 deletions pkg/apis/ml/v1alpha1/batchjob_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// 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

type ArangoMLBatchJobStatus struct {
}
47 changes: 47 additions & 0 deletions pkg/apis/ml/v1alpha1/cronjob.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// 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 (
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ArangoMLCronJobList is a list of ArangoML CronJobs.
type ArangoMLCronJobList struct {
meta.TypeMeta `json:",inline"`
meta.ListMeta `json:"metadata,omitempty"`

Items []ArangoMLCronJob `json:"items"`
}

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ArangoMLCronJob contains definition and status of the ArangoML CronJob.
type ArangoMLCronJob struct {
meta.TypeMeta `json:",inline"`
meta.ObjectMeta `json:"metadata,omitempty"`

Spec ArangoMLCronJobSpec `json:"spec"`
Status ArangoMLCronJobStatus `json:"status"`
}
Loading