From f6e8205c2c23bba5753ba6ae15c24a5cc3b02b18 Mon Sep 17 00:00:00 2001 From: Nikita Vanyasin Date: Fri, 3 Jun 2022 13:07:05 +0300 Subject: [PATCH 1/2] Add CRD generator for `ArangoDeployment` --- CHANGELOG.md | 1 + .../templates/crd/cluster-role.yaml | 1 + pkg/crd/arangodeployments.go | 88 +++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 pkg/crd/arangodeployments.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ec71ee5b..8a1cb4dff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - (Feature) Add agency leader service - (Feature) Add HostPath and PVC Volume types and allow templating - (Feature) Replace mod +- (Feature) Add `ArangoDeployment` 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 a3d56078e..4bc46b7a2 100644 --- a/chart/kube-arangodb/templates/crd/cluster-role.yaml +++ b/chart/kube-arangodb/templates/crd/cluster-role.yaml @@ -17,6 +17,7 @@ rules: resources: ["customresourcedefinitions"] verbs: ["get", "list", "watch", "update", "delete"] resourceNames: + - "arangodeployments.database.arangodb.com" - "arangoclustersynchronizations.database.arangodb.com" - "arangotasks.database.arangodb.com" diff --git a/pkg/crd/arangodeployments.go b/pkg/crd/arangodeployments.go new file mode 100644 index 000000000..ac542cc54 --- /dev/null +++ b/pkg/crd/arangodeployments.go @@ -0,0 +1,88 @@ +// +// 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("arangodeployments.database.arangodb.com", crd{ + version: "1.0.1", + spec: apiextensions.CustomResourceDefinitionSpec{ + Group: "database.arangodb.com", + Names: apiextensions.CustomResourceDefinitionNames{ + Plural: "arangodeployments", + Singular: "arangodeployment", + ShortNames: []string{ + "arangodb", + "arango", + }, + Kind: "ArangoDeployment", + ListKind: "ArangoDeploymentList", + }, + Scope: apiextensions.NamespaceScoped, + Versions: []apiextensions.CustomResourceDefinitionVersion{ + { + Name: "v1", + Schema: &apiextensions.CustomResourceValidation{ + OpenAPIV3Schema: &apiextensions.JSONSchemaProps{ + Type: "object", + XPreserveUnknownFields: util.NewBool(true), + }, + }, + Served: true, + Storage: true, + Subresources: &apiextensions.CustomResourceSubresources{ + Status: &apiextensions.CustomResourceSubresourceStatus{}, + }, + }, + { + Name: "v1alpha", + Schema: &apiextensions.CustomResourceValidation{ + OpenAPIV3Schema: &apiextensions.JSONSchemaProps{ + Type: "object", + XPreserveUnknownFields: util.NewBool(true), + }, + }, + Served: true, + Storage: false, + }, + { + Name: "v2alpha1", + Schema: &apiextensions.CustomResourceValidation{ + OpenAPIV3Schema: &apiextensions.JSONSchemaProps{ + Type: "object", + XPreserveUnknownFields: util.NewBool(true), + }, + }, + Served: true, + Storage: false, + Subresources: &apiextensions.CustomResourceSubresources{ + Status: &apiextensions.CustomResourceSubresourceStatus{}, + }, + }, + }, + }, + }) +} From 65731b5a172c8fcc467ddedf2d85b25a9a92ab11 Mon Sep 17 00:00:00 2001 From: ajanikow <12255597+ajanikow@users.noreply.github.com> Date: Thu, 9 Jun 2022 10:02:41 +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 8a1cb4dff..d6c540368 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A) - (Feature) Add ArangoSync TLS based rotation - (Bugfix) Fix labels propagation +- (Feature) Add `ArangoDeployment` 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 @@ -17,7 +18,6 @@ - (Feature) Add agency leader service - (Feature) Add HostPath and PVC Volume types and allow templating - (Feature) Replace mod -- (Feature) Add `ArangoDeployment` CRD auto-installer ## [1.2.12](https://github.com/arangodb/kube-arangodb/tree/1.2.12) (2022-05-10) - (Feature) Add CoreV1 Endpoints Inspector