From 0a7cad4e509700983d1b959da64aafed139f1672 Mon Sep 17 00:00:00 2001 From: Nikita Vanyasin Date: Fri, 3 Jun 2022 17:22:19 +0300 Subject: [PATCH 1/2] Add CRD generator for `ArangoJob` --- CHANGELOG.md | 1 + .../templates/crd/cluster-role.yaml | 1 + pkg/crd/arangojobs.go | 70 +++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 pkg/crd/arangojobs.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 1cb35ff8b..daf6cc418 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - (Feature) Add agency leader service - (Feature) Add HostPath and PVC Volume types and allow templating - (Feature) Replace mod +- (Feature) Add `ArangoJob` CRD auto-installer ## [1.2.12](https://github.com/arangodb/kube-arangodb/tree/1.2.12) (2022-05-10) - (Feature) Add CoreV1 Endpoints Inspector diff --git a/chart/kube-arangodb/templates/crd/cluster-role.yaml b/chart/kube-arangodb/templates/crd/cluster-role.yaml index 7b8590259..a9abb0a8b 100644 --- a/chart/kube-arangodb/templates/crd/cluster-role.yaml +++ b/chart/kube-arangodb/templates/crd/cluster-role.yaml @@ -23,6 +23,7 @@ rules: - "arangotasks.database.arangodb.com" - "arangobackups.backup.arangodb.com" - "arangobackuppolicies.backup.arangodb.com" + - "arangojobs.apps.arangodb.com" {{- end }} {{- end }} diff --git a/pkg/crd/arangojobs.go b/pkg/crd/arangojobs.go new file mode 100644 index 000000000..b05434517 --- /dev/null +++ b/pkg/crd/arangojobs.go @@ -0,0 +1,70 @@ +// +// DISCLAIMER +// +// Copyright 2016-2022 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 crd + +import ( + apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" + + "github.com/arangodb/kube-arangodb/pkg/util" +) + +func init() { + registerCRDWithPanic("arangojobs.apps.arangodb.com", crd{ + version: "1.0.1", + spec: apiextensions.CustomResourceDefinitionSpec{ + Group: "apps.arangodb.com", + Names: apiextensions.CustomResourceDefinitionNames{ + Plural: "arangojobs", + Singular: "arangojob", + Kind: "ArangoJob", + ListKind: "ArangoJobList", + ShortNames: []string{ + "arangojob", + }, + }, + Scope: apiextensions.NamespaceScoped, + Versions: []apiextensions.CustomResourceDefinitionVersion{ + { + Name: "v1", + Schema: &apiextensions.CustomResourceValidation{ + OpenAPIV3Schema: &apiextensions.JSONSchemaProps{ + Type: "object", + XPreserveUnknownFields: util.NewBool(true), + }, + }, + Served: true, + Storage: true, + AdditionalPrinterColumns: []apiextensions.CustomResourceColumnDefinition{ + { + JSONPath: ".spec.arangoDeploymentName", + Description: "Deployment name", + Name: "ArangoDeploymentName", + Type: "string", + }, + }, + Subresources: &apiextensions.CustomResourceSubresources{ + Status: &apiextensions.CustomResourceSubresourceStatus{}, + }, + }, + }, + }, + }) +} From fd428a5f0953913cafeee9a899532808ada20563 Mon Sep 17 00:00:00 2001 From: ajanikow <12255597+ajanikow@users.noreply.github.com> Date: Thu, 9 Jun 2022 10:42:38 +0000 Subject: [PATCH 2/2] Update CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index daf6cc418..392e04564 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - (Feature) Add `ArangoMember` CRD auto-installer - (Feature) Add `ArangoBackup` CRD auto-installer - (Feature) Add `ArangoBackupPolicy` CRD auto-installer +- (Feature) Add `ArangoJob` CRD auto-installer ## [1.2.13](https://github.com/arangodb/kube-arangodb/tree/1.2.13) (2022-06-07) - (Bugfix) Fix arangosync members state inspection @@ -21,7 +22,6 @@ - (Feature) Add agency leader service - (Feature) Add HostPath and PVC Volume types and allow templating - (Feature) Replace mod -- (Feature) Add `ArangoJob` CRD auto-installer ## [1.2.12](https://github.com/arangodb/kube-arangodb/tree/1.2.12) (2022-05-10) - (Feature) Add CoreV1 Endpoints Inspector