mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
[Feature] Improve CRD Management and deprecate CRD Chart (#1247)
This commit is contained in:
parent
e709c074e8
commit
2bf6769b65
47 changed files with 1561 additions and 619 deletions
|
@ -13,6 +13,7 @@
|
|||
- (Feature) Optional Action
|
||||
- (Maintenance) Add & Enable YAML Linter
|
||||
- (Feature) Optional ResignLeadership Action
|
||||
- (Feature) Improve CRD Management and deprecate CRD Chart
|
||||
|
||||
## [1.2.24](https://github.com/arangodb/kube-arangodb/tree/1.2.24) (2023-01-25)
|
||||
- (Bugfix) Fix deployment creation on ARM64
|
||||
|
|
29
Makefile
29
Makefile
|
@ -397,7 +397,20 @@ endef
|
|||
.PHONY: manifests
|
||||
manifests:
|
||||
|
||||
$(eval $(call manifest-generator, crd, kube-arangodb-crd))
|
||||
.PHONY: manifests-crd-file
|
||||
manifests-crd-file:
|
||||
@echo Building manifests for CRD - $(MANIFESTPATHCRD)
|
||||
@echo -n > $(MANIFESTPATHCRD)
|
||||
@$(foreach FILE,$(CRDS),echo '---\n# File: chart/kube-arangodb/crds/$(FILE).yaml' >> $(MANIFESTPATHCRD) && \
|
||||
cat '$(ROOT)/chart/kube-arangodb/crds/$(FILE).yaml' >> $(MANIFESTPATHCRD) && \
|
||||
echo '\n' >> $(MANIFESTPATHCRD);)
|
||||
manifests: manifests-crd-file
|
||||
|
||||
.PHONY: manifests-crd-kustomize
|
||||
manifests-crd-kustomize: manifests-crd-file
|
||||
@echo Building manifests for CRD - $(KUSTOMIZEPATHCRD)
|
||||
@cp "$(MANIFESTPATHCRD)" "$(KUSTOMIZEPATHCRD)"
|
||||
manifests: manifests-crd-kustomize
|
||||
|
||||
$(eval $(call manifest-generator, deployment, kube-arangodb, \
|
||||
--set "operator.features.deployment=true" \
|
||||
|
@ -481,6 +494,7 @@ run-unit-tests: $(SOURCES)
|
|||
$(REPOPATH)/pkg/apis/storage/... \
|
||||
$(REPOPATH)/pkg/deployment/... \
|
||||
$(REPOPATH)/pkg/storage \
|
||||
$(REPOPATH)/pkg/crd/... \
|
||||
$(REPOPATH)/pkg/util/... \
|
||||
$(REPOPATH)/pkg/handlers/...
|
||||
|
||||
|
@ -526,6 +540,8 @@ tools-min: update-vendor
|
|||
tools: tools-min
|
||||
@echo ">> Fetching gci"
|
||||
@GOBIN=$(GOPATH)/bin go install github.com/daixiang0/gci@v0.3.0
|
||||
@echo ">> Fetching yamlfmt"
|
||||
@GOBIN=$(GOPATH)/bin go install github.com/UltiRequiem/yamlfmt@v1.3.0
|
||||
@echo ">> Downloading protobuf compiler..."
|
||||
@curl -L ${PROTOC_URL} -o $(GOPATH)/protoc.zip
|
||||
@echo ">> Unzipping protobuf compiler..."
|
||||
|
@ -612,7 +628,7 @@ check-enterprise:
|
|||
check-community:
|
||||
@$(MAKE) _check RELEASE_MODE=community
|
||||
|
||||
_check:
|
||||
_check: sync-crds
|
||||
@$(MAKE) fmt yamlfmt license-verify linter run-unit-tests bin
|
||||
|
||||
generate: generate-internal generate-proto fmt
|
||||
|
@ -628,3 +644,12 @@ generate-proto:
|
|||
|
||||
.PHONY: fix
|
||||
fix: license-range fmt license yamlfmt
|
||||
|
||||
CRDS:=apps-job \
|
||||
backups-backup backups-backuppolicy \
|
||||
database-clustersynchronization database-deployment database-member database-task \
|
||||
replication-deploymentreplication
|
||||
|
||||
.PHONY: sync-crds
|
||||
sync-crds:
|
||||
@cp $(foreach FILE,$(CRDS),"$(ROOT)/chart/kube-arangodb/crds/$(FILE).yaml" ) "$(ROOT)/pkg/crd/crds/"
|
||||
|
|
|
@ -111,8 +111,6 @@ Only use this procedure for a new install of the operator. See below for
|
|||
upgrades.
|
||||
|
||||
```bash
|
||||
# The following will install the custom resources required by the operators.
|
||||
helm install https://github.com/arangodb/kube-arangodb/releases/download/1.2.24/kube-arangodb-crd-1.2.24.tgz
|
||||
# The following will install the operator for `ArangoDeployment` &
|
||||
# `ArangoDeploymentReplication` resources.
|
||||
helm install https://github.com/arangodb/kube-arangodb/releases/download/1.2.24/kube-arangodb-1.2.24.tgz
|
||||
|
@ -136,7 +134,6 @@ list` output:
|
|||
```
|
||||
% helm list
|
||||
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
|
||||
steely-mule 1 Sun Mar 31 21:11:07 2019 DEPLOYED kube-arangodb-crd-0.3.9 default
|
||||
vetoed-ladybird 1 Mon Apr 8 11:36:58 2019 DEPLOYED kube-arangodb-0.3.10-preview default
|
||||
```
|
||||
|
||||
|
@ -200,8 +197,6 @@ Only use this procedure for a new install of the operator. See below for
|
|||
upgrades.
|
||||
|
||||
```bash
|
||||
# The following will install the custom resources required by the operators.
|
||||
helm install https://github.com/arangodb/kube-arangodb/releases/download/1.2.24/kube-arangodb-crd-1.2.24.tgz --set "operator.image=arangodb/kube-arangodb-enterprise:1.2.24"
|
||||
# The following will install the operator for `ArangoDeployment` &
|
||||
# `ArangoDeploymentReplication` resources.
|
||||
helm install https://github.com/arangodb/kube-arangodb/releases/download/1.2.24/kube-arangodb-1.2.24.tgz --set "operator.image=arangodb/kube-arangodb-enterprise:1.2.24"
|
||||
|
@ -225,7 +220,6 @@ list` output:
|
|||
```
|
||||
% helm list
|
||||
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
|
||||
steely-mule 1 Sun Mar 31 21:11:07 2019 DEPLOYED kube-arangodb-crd-0.3.9 default
|
||||
vetoed-ladybird 1 Mon Apr 8 11:36:58 2019 DEPLOYED kube-arangodb-0.3.10-preview default
|
||||
```
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: kube-arangodb-crd
|
||||
version: 1.2.24
|
||||
description: "ArangoDB Kubernetes Custom Resource Definitions"
|
||||
description: "ArangoDB Kubernetes Custom Resource Definitions (Deprecated)"
|
||||
tillerVersion: ">2.7"
|
||||
appVersion: 3.5.0
|
||||
|
|
29
chart/kube-arangodb/crds/apps-job.yaml
Normal file
29
chart/kube-arangodb/crds/apps-job.yaml
Normal file
|
@ -0,0 +1,29 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangojobs.apps.arangodb.com
|
||||
spec:
|
||||
group: apps.arangodb.com
|
||||
names:
|
||||
kind: ArangoJob
|
||||
listKind: ArangoJobList
|
||||
plural: arangojobs
|
||||
singular: arangojob
|
||||
shortNames:
|
||||
- arangojob
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
additionalPrinterColumns:
|
||||
- jsonPath: .spec.arangoDeploymentName
|
||||
description: Deployment name
|
||||
name: ArangoDeploymentName
|
||||
type: string
|
||||
subresources:
|
||||
status: {}
|
103
chart/kube-arangodb/crds/backups-backup.yaml
Normal file
103
chart/kube-arangodb/crds/backups-backup.yaml
Normal file
|
@ -0,0 +1,103 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangobackups.backup.arangodb.com
|
||||
spec:
|
||||
group: backup.arangodb.com
|
||||
names:
|
||||
kind: ArangoBackup
|
||||
listKind: ArangoBackupList
|
||||
plural: arangobackups
|
||||
shortNames:
|
||||
- arangobackup
|
||||
singular: arangobackup
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
additionalPrinterColumns:
|
||||
- jsonPath: .spec.policyName
|
||||
description: Policy name
|
||||
name: Policy
|
||||
type: string
|
||||
- jsonPath: .spec.deployment.name
|
||||
description: Deployment name
|
||||
name: Deployment
|
||||
type: string
|
||||
- jsonPath: .status.backup.version
|
||||
description: Backup Version
|
||||
name: Version
|
||||
type: string
|
||||
- jsonPath: .status.backup.createdAt
|
||||
description: Backup Creation Timestamp
|
||||
name: Created
|
||||
type: string
|
||||
- jsonPath: .status.backup.sizeInBytes
|
||||
description: Backup Size in Bytes
|
||||
name: Size
|
||||
type: integer
|
||||
format: byte
|
||||
- jsonPath: .status.backup.numberOfDBServers
|
||||
description: Backup Number of the DB Servers
|
||||
name: DBServers
|
||||
type: integer
|
||||
- jsonPath: .status.state
|
||||
description: The actual state of the ArangoBackup
|
||||
name: State
|
||||
type: string
|
||||
- jsonPath: .status.message
|
||||
priority: 1
|
||||
description: Message of the ArangoBackup object
|
||||
name: Message
|
||||
type: string
|
||||
subresources:
|
||||
status: {}
|
||||
- name: v1alpha
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
additionalPrinterColumns:
|
||||
- jsonPath: .spec.policyName
|
||||
description: Policy name
|
||||
name: Policy
|
||||
type: string
|
||||
- jsonPath: .spec.deployment.name
|
||||
description: Deployment name
|
||||
name: Deployment
|
||||
type: string
|
||||
- jsonPath: .status.backup.version
|
||||
description: Backup Version
|
||||
name: Version
|
||||
type: string
|
||||
- jsonPath: .status.backup.createdAt
|
||||
description: Backup Creation Timestamp
|
||||
name: Created
|
||||
type: string
|
||||
- jsonPath: .status.backup.sizeInBytes
|
||||
description: Backup Size in Bytes
|
||||
name: Size
|
||||
type: integer
|
||||
format: byte
|
||||
- jsonPath: .status.backup.numberOfDBServers
|
||||
description: Backup Number of the DB Servers
|
||||
name: DBServers
|
||||
type: integer
|
||||
- jsonPath: .status.state
|
||||
description: The actual state of the ArangoBackup
|
||||
name: State
|
||||
type: string
|
||||
- jsonPath: .status.message
|
||||
priority: 1
|
||||
description: Message of the ArangoBackup object
|
||||
name: Message
|
||||
type: string
|
||||
subresources:
|
||||
status: {}
|
62
chart/kube-arangodb/crds/backups-backuppolicy.yaml
Normal file
62
chart/kube-arangodb/crds/backups-backuppolicy.yaml
Normal file
|
@ -0,0 +1,62 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangobackuppolicies.backup.arangodb.com
|
||||
spec:
|
||||
group: backup.arangodb.com
|
||||
names:
|
||||
kind: ArangoBackupPolicy
|
||||
listKind: ArangoBackupPolicyList
|
||||
plural: arangobackuppolicies
|
||||
shortNames:
|
||||
- arangobackuppolicy
|
||||
- arangobp
|
||||
singular: arangobackuppolicy
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
additionalPrinterColumns:
|
||||
- jsonPath: .spec.schedule
|
||||
description: Schedule
|
||||
name: Schedule
|
||||
type: string
|
||||
- jsonPath: .status.scheduled
|
||||
description: Scheduled
|
||||
name: Scheduled
|
||||
type: string
|
||||
- jsonPath: .status.message
|
||||
priority: 1
|
||||
description: Message of the ArangoBackupPolicy object
|
||||
name: Message
|
||||
type: string
|
||||
subresources:
|
||||
status: {}
|
||||
- name: v1alpha
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
additionalPrinterColumns:
|
||||
- jsonPath: .spec.schedule
|
||||
description: Schedule
|
||||
name: Schedule
|
||||
type: string
|
||||
- jsonPath: .status.scheduled
|
||||
description: Scheduled
|
||||
name: Scheduled
|
||||
type: string
|
||||
- jsonPath: .status.message
|
||||
priority: 1
|
||||
description: Message of the ArangoBackupPolicy object
|
||||
name: Message
|
||||
type: string
|
||||
subresources:
|
||||
status: {}
|
|
@ -0,0 +1,33 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangoclustersynchronizations.database.arangodb.com
|
||||
spec:
|
||||
group: database.arangodb.com
|
||||
names:
|
||||
kind: ArangoClusterSynchronization
|
||||
listKind: ArangoClusterSynchronizationList
|
||||
plural: arangoclustersynchronizations
|
||||
singular: arangoclustersynchronization
|
||||
shortNames:
|
||||
- arangoclustersync
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
- name: v2alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
subresources:
|
||||
status: {}
|
39
chart/kube-arangodb/crds/database-deployment.yaml
Normal file
39
chart/kube-arangodb/crds/database-deployment.yaml
Normal file
|
@ -0,0 +1,39 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangodeployments.database.arangodb.com
|
||||
spec:
|
||||
group: database.arangodb.com
|
||||
names:
|
||||
kind: ArangoDeployment
|
||||
listKind: ArangoDeploymentList
|
||||
plural: arangodeployments
|
||||
shortNames:
|
||||
- arangodb
|
||||
- arango
|
||||
singular: arangodeployment
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
- name: v1alpha
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
- name: v2alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
subresources:
|
||||
status: {}
|
39
chart/kube-arangodb/crds/database-task.yaml
Normal file
39
chart/kube-arangodb/crds/database-task.yaml
Normal file
|
@ -0,0 +1,39 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangotasks.database.arangodb.com
|
||||
spec:
|
||||
group: database.arangodb.com
|
||||
names:
|
||||
kind: ArangoTask
|
||||
listKind: ArangoTaskList
|
||||
plural: arangotasks
|
||||
shortNames:
|
||||
- arangodb
|
||||
- arango
|
||||
singular: arangotask
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
- name: v1alpha
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
- name: v2alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
subresources:
|
||||
status: {}
|
|
@ -0,0 +1,38 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangodeploymentreplications.replication.database.arangodb.com
|
||||
spec:
|
||||
group: replication.database.arangodb.com
|
||||
names:
|
||||
kind: ArangoDeploymentReplication
|
||||
listKind: ArangoDeploymentReplicationList
|
||||
plural: arangodeploymentreplications
|
||||
shortNames:
|
||||
- arangorepl
|
||||
singular: arangodeploymentreplication
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
- name: v1alpha
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
- name: v2alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
subresources:
|
||||
status: {}
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-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.
|
||||
|
@ -21,12 +21,12 @@
|
|||
package replication
|
||||
|
||||
const (
|
||||
ArangoDeploymentReplicationCRDName = ArangoDeploymentReplicationResourcePlural + "." + ArangoDeploymentReplicationGroupName
|
||||
ArangoDeploymentReplicationResourceKind = "ArangoDeploymentReplication"
|
||||
ArangoDeploymentReplicationResourcePlural = "arangodeploymentreplications"
|
||||
ArangoDeploymentReplicationGroupName = "replication.database.arangodb.com"
|
||||
)
|
||||
|
||||
var (
|
||||
ArangoDeploymentReplicationCRDName = ArangoDeploymentReplicationResourcePlural + "." + ArangoDeploymentReplicationGroupName
|
||||
ArangoDeploymentReplicationShortNames = []string{"arangorepl"}
|
||||
)
|
||||
|
|
33
pkg/apis/storage/definitions.go
Normal file
33
pkg/apis/storage/definitions.go
Normal file
|
@ -0,0 +1,33 @@
|
|||
//
|
||||
// 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 storage
|
||||
|
||||
const (
|
||||
ArangoLocalStorageResourceKind = "ArangoLocalStorage"
|
||||
ArangoLocalStorageResourcePlural = "arangolocalstorages"
|
||||
|
||||
ArangoLocalStorageCRDName = ArangoLocalStorageResourcePlural + "." + ArangoLocalStorageGroupName
|
||||
ArangoLocalStorageGroupName = "storage.arangodb.com"
|
||||
)
|
||||
|
||||
var (
|
||||
ArangoLocalStorageShortNames = []string{"arangostorage"}
|
||||
)
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-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.
|
||||
|
@ -24,13 +24,16 @@ import (
|
|||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/storage"
|
||||
)
|
||||
|
||||
const (
|
||||
ArangoLocalStorageResourceKind = "ArangoLocalStorage"
|
||||
ArangoLocalStorageResourcePlural = "arangolocalstorages"
|
||||
ArangoLocalStorageResourceKind = storage.ArangoLocalStorageResourceKind
|
||||
ArangoLocalStorageResourcePlural = storage.ArangoLocalStorageResourcePlural
|
||||
|
||||
groupName = "storage.arangodb.com"
|
||||
groupName = storage.ArangoLocalStorageGroupName
|
||||
ArangoLocalStorageCRDName = ArangoLocalStorageResourcePlural + "." + groupName
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -38,7 +41,6 @@ var (
|
|||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: groupName, Version: "v1alpha"}
|
||||
ArangoLocalStorageCRDName = ArangoLocalStorageResourcePlural + "." + groupName
|
||||
ArangoLocalStorageShortNames = []string{"arangostorage"}
|
||||
)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-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.
|
||||
|
@ -41,7 +41,7 @@ func EnsureCRD(ctx context.Context, client kclient.Client, ignoreErrors bool) er
|
|||
crdsLock.Lock()
|
||||
defer crdsLock.Unlock()
|
||||
|
||||
for crd, spec := range crds {
|
||||
for crd, spec := range registeredCRDs {
|
||||
getAccess := verifyCRDAccess(ctx, client, crd, "get")
|
||||
if !getAccess.Allowed {
|
||||
logger.Str("crd", crd).Info("Get Operations is not allowed. Continue")
|
||||
|
@ -123,6 +123,10 @@ func tryApplyCRD(ctx context.Context, client kclient.Client, crd string, spec cr
|
|||
}
|
||||
|
||||
func verifyCRDAccess(ctx context.Context, client kclient.Client, crd string, verb string) authorization.SubjectAccessReviewStatus {
|
||||
if c := verifyCRDAccessForTests; c != nil {
|
||||
return *c
|
||||
}
|
||||
|
||||
r, err := verifyCRDAccessRequest(ctx, client, crd, verb)
|
||||
if err != nil {
|
||||
return authorization.SubjectAccessReviewStatus{
|
||||
|
@ -134,6 +138,8 @@ func verifyCRDAccess(ctx context.Context, client kclient.Client, crd string, ver
|
|||
return r.Status
|
||||
}
|
||||
|
||||
var verifyCRDAccessForTests *authorization.SubjectAccessReviewStatus
|
||||
|
||||
func verifyCRDAccessRequest(ctx context.Context, client kclient.Client, crd string, verb string) (*authorization.SelfSubjectAccessReview, error) {
|
||||
review := authorization.SelfSubjectAccessReview{
|
||||
Spec: authorization.SelfSubjectAccessReviewSpec{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-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.
|
||||
|
@ -23,17 +23,115 @@ package crd
|
|||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
authorization "k8s.io/api/authorization/v1"
|
||||
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/crd/crds"
|
||||
"github.com/arangodb/kube-arangodb/pkg/logging"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/tests"
|
||||
)
|
||||
|
||||
func Test_Apply(t *testing.T) {
|
||||
t.Run("Ensure CRD exists", func(t *testing.T) {
|
||||
c, ok := kclient.GetDefaultFactory().Client()
|
||||
func dropLogMessages(t *testing.T, s tests.LogScanner) map[string]string {
|
||||
lines := map[string]string{}
|
||||
|
||||
for i := 0; i < len(crds.AllDefinitions()); i++ {
|
||||
var data map[string]string
|
||||
require.True(t, s.GetData(t, 500*time.Millisecond, &data))
|
||||
|
||||
p, ok := data["crd"]
|
||||
require.True(t, ok)
|
||||
|
||||
_ = EnsureCRD(context.Background(), c, true)
|
||||
m, ok := data["message"]
|
||||
require.True(t, ok)
|
||||
|
||||
lines[p] = m
|
||||
}
|
||||
|
||||
return lines
|
||||
}
|
||||
|
||||
func Test_Apply(t *testing.T) {
|
||||
verifyCRDAccessForTests = &authorization.SubjectAccessReviewStatus{
|
||||
Allowed: true,
|
||||
}
|
||||
|
||||
tests.WithLogScanner(t, "Run", func(t *testing.T, s tests.LogScanner) {
|
||||
t.Run("Create CRDs", func(t *testing.T) {
|
||||
logger = s.Factory().RegisterAndGetLogger("crd", logging.Info)
|
||||
|
||||
c := kclient.NewFakeClient()
|
||||
|
||||
t.Run("Ensure", func(t *testing.T) {
|
||||
require.NoError(t, EnsureCRD(context.Background(), c, false))
|
||||
|
||||
for k, v := range dropLogMessages(t, s) {
|
||||
t.Run(k, func(t *testing.T) {
|
||||
require.Equal(t, "CRD Created", v)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Verify", func(t *testing.T) {
|
||||
for _, q := range crds.AllDefinitions() {
|
||||
_, err := c.KubernetesExtensions().ApiextensionsV1().CustomResourceDefinitions().Get(context.Background(), q.CRD.GetName(), meta.GetOptions{})
|
||||
require.NoError(t, err)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("Create partially CRDs without version", func(t *testing.T) {
|
||||
c := kclient.NewFakeClient()
|
||||
|
||||
t.Run("Create", func(t *testing.T) {
|
||||
_, err := c.KubernetesExtensions().ApiextensionsV1().CustomResourceDefinitions().Create(context.Background(), crds.AllDefinitions()[0].CRD, meta.CreateOptions{})
|
||||
require.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("Ensure", func(t *testing.T) {
|
||||
require.NoError(t, EnsureCRD(context.Background(), c, false))
|
||||
|
||||
for k, v := range dropLogMessages(t, s) {
|
||||
t.Run(k, func(t *testing.T) {
|
||||
if k == crds.AllDefinitions()[0].CRD.GetName() {
|
||||
require.Equal(t, "CRD Updated", v)
|
||||
} else {
|
||||
require.Equal(t, "CRD Created", v)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("Create partially CRDs with version", func(t *testing.T) {
|
||||
c := kclient.NewFakeClient()
|
||||
|
||||
t.Run("Create", func(t *testing.T) {
|
||||
d := crds.AllDefinitions()[0]
|
||||
q := d.CRD.DeepCopy()
|
||||
q.Labels = map[string]string{
|
||||
Version: string(d.Version),
|
||||
}
|
||||
_, err := c.KubernetesExtensions().ApiextensionsV1().CustomResourceDefinitions().Create(context.Background(), q, meta.CreateOptions{})
|
||||
require.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("Ensure", func(t *testing.T) {
|
||||
require.NoError(t, EnsureCRD(context.Background(), c, false))
|
||||
|
||||
for k, v := range dropLogMessages(t, s) {
|
||||
t.Run(k, func(t *testing.T) {
|
||||
if k == crds.AllDefinitions()[0].CRD.GetName() {
|
||||
require.Equal(t, "CRD Update not required", v)
|
||||
} else {
|
||||
require.Equal(t, "CRD Created", v)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-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.
|
||||
|
@ -21,160 +21,9 @@
|
|||
package crd
|
||||
|
||||
import (
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
"github.com/arangodb/kube-arangodb/pkg/crd/crds"
|
||||
)
|
||||
|
||||
func init() {
|
||||
registerCRDWithPanic("arangobackups.backup.arangodb.com", crd{
|
||||
version: "1.0.1",
|
||||
spec: apiextensions.CustomResourceDefinitionSpec{
|
||||
Group: "backup.arangodb.com",
|
||||
Names: apiextensions.CustomResourceDefinitionNames{
|
||||
Plural: "arangobackups",
|
||||
Singular: "arangobackup",
|
||||
Kind: "ArangoBackup",
|
||||
ListKind: "ArangoBackupList",
|
||||
ShortNames: []string{
|
||||
"arangobackup",
|
||||
},
|
||||
},
|
||||
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.policyName",
|
||||
Description: "Policy name",
|
||||
Name: "Policy",
|
||||
Type: "string",
|
||||
},
|
||||
{
|
||||
JSONPath: ".spec.deployment.name",
|
||||
Description: "Deployment name",
|
||||
Name: "Deployment",
|
||||
Type: "string",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.backup.version",
|
||||
Description: "Backup Version",
|
||||
Name: "Version",
|
||||
Type: "string",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.backup.createdAt",
|
||||
Description: "Backup Creation Timestamp",
|
||||
Name: "Created",
|
||||
Type: "string",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.backup.sizeInBytes",
|
||||
Description: "Backup Size in Bytes",
|
||||
Name: "Size",
|
||||
Type: "integer",
|
||||
Format: "byte",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.backup.numberOfDBServers",
|
||||
Description: "Backup Number of the DB Servers",
|
||||
Name: "DBServers",
|
||||
Type: "integer",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.state",
|
||||
Description: "The actual state of the ArangoBackup",
|
||||
Name: "State",
|
||||
Type: "string",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.message",
|
||||
Priority: 1,
|
||||
Description: "Message of the ArangoBackup object",
|
||||
Name: "Message",
|
||||
Type: "string",
|
||||
},
|
||||
},
|
||||
Subresources: &apiextensions.CustomResourceSubresources{
|
||||
Status: &apiextensions.CustomResourceSubresourceStatus{},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "v1alpha",
|
||||
Schema: &apiextensions.CustomResourceValidation{
|
||||
OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
|
||||
Type: "object",
|
||||
XPreserveUnknownFields: util.NewBool(true),
|
||||
},
|
||||
},
|
||||
Served: true,
|
||||
Storage: false,
|
||||
AdditionalPrinterColumns: []apiextensions.CustomResourceColumnDefinition{
|
||||
{
|
||||
JSONPath: ".spec.policyName",
|
||||
Description: "Policy name",
|
||||
Name: "Policy",
|
||||
Type: "string",
|
||||
},
|
||||
{
|
||||
JSONPath: ".spec.deployment.name",
|
||||
Description: "Deployment name",
|
||||
Name: "Deployment",
|
||||
Type: "string",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.backup.version",
|
||||
Description: "Backup Version",
|
||||
Name: "Version",
|
||||
Type: "string",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.backup.createdAt",
|
||||
Description: "Backup Creation Timestamp",
|
||||
Name: "Created",
|
||||
Type: "string",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.backup.sizeInBytes",
|
||||
Description: "Backup Size in Bytes",
|
||||
Name: "Size",
|
||||
Type: "integer",
|
||||
Format: "byte",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.backup.numberOfDBServers",
|
||||
Description: "Backup Number of the DB Servers",
|
||||
Name: "DBServers",
|
||||
Type: "integer",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.state",
|
||||
Description: "The actual state of the ArangoBackup",
|
||||
Name: "State",
|
||||
Type: "string",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.message",
|
||||
Priority: 1,
|
||||
Description: "Message of the ArangoBackup object",
|
||||
Name: "Message",
|
||||
Type: "string",
|
||||
},
|
||||
},
|
||||
Subresources: &apiextensions.CustomResourceSubresources{
|
||||
Status: &apiextensions.CustomResourceSubresourceStatus{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
registerCRDWithPanic(crds.BackupsBackupDefinition())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-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.
|
||||
|
@ -21,99 +21,9 @@
|
|||
package crd
|
||||
|
||||
import (
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
"github.com/arangodb/kube-arangodb/pkg/crd/crds"
|
||||
)
|
||||
|
||||
func init() {
|
||||
registerCRDWithPanic("arangobackuppolicies.backup.arangodb.com", crd{
|
||||
version: "1.0.1",
|
||||
spec: apiextensions.CustomResourceDefinitionSpec{
|
||||
Group: "backup.arangodb.com",
|
||||
Names: apiextensions.CustomResourceDefinitionNames{
|
||||
Plural: "arangobackuppolicies",
|
||||
Singular: "arangobackuppolicy",
|
||||
Kind: "ArangoBackupPolicy",
|
||||
ListKind: "ArangoBackupPolicyList",
|
||||
ShortNames: []string{
|
||||
"arangobackuppolicy",
|
||||
"arangobp",
|
||||
},
|
||||
},
|
||||
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.schedule",
|
||||
Description: "Schedule",
|
||||
Name: "Schedule",
|
||||
Type: "string",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.scheduled",
|
||||
Description: "Scheduled",
|
||||
Name: "Scheduled",
|
||||
Type: "string",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.message",
|
||||
Priority: 1,
|
||||
Description: "Message of the ArangoBackupPolicy object",
|
||||
Name: "Message",
|
||||
Type: "string",
|
||||
},
|
||||
},
|
||||
Subresources: &apiextensions.CustomResourceSubresources{
|
||||
Status: &apiextensions.CustomResourceSubresourceStatus{},
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "v1alpha",
|
||||
Schema: &apiextensions.CustomResourceValidation{
|
||||
OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
|
||||
Type: "object",
|
||||
XPreserveUnknownFields: util.NewBool(true),
|
||||
},
|
||||
},
|
||||
Served: true,
|
||||
Storage: false,
|
||||
AdditionalPrinterColumns: []apiextensions.CustomResourceColumnDefinition{
|
||||
{
|
||||
JSONPath: ".spec.schedule",
|
||||
Description: "Schedule",
|
||||
Name: "Schedule",
|
||||
Type: "string",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.scheduled",
|
||||
Description: "Scheduled",
|
||||
Name: "Scheduled",
|
||||
Type: "string",
|
||||
},
|
||||
{
|
||||
JSONPath: ".status.message",
|
||||
Priority: 1,
|
||||
Description: "Message of the ArangoBackupPolicy object",
|
||||
Name: "Message",
|
||||
Type: "string",
|
||||
},
|
||||
},
|
||||
Subresources: &apiextensions.CustomResourceSubresources{
|
||||
Status: &apiextensions.CustomResourceSubresourceStatus{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
registerCRDWithPanic(crds.BackupsBackupPolicyDefinition())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-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.
|
||||
|
@ -21,56 +21,9 @@
|
|||
package crd
|
||||
|
||||
import (
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
"github.com/arangodb/kube-arangodb/pkg/crd/crds"
|
||||
)
|
||||
|
||||
func init() {
|
||||
registerCRDWithPanic("arangoclustersynchronizations.database.arangodb.com", crd{
|
||||
version: "1.0.1",
|
||||
spec: apiextensions.CustomResourceDefinitionSpec{
|
||||
Group: "database.arangodb.com",
|
||||
Names: apiextensions.CustomResourceDefinitionNames{
|
||||
Plural: "arangoclustersynchronizations",
|
||||
Singular: "arangoclustersynchronization",
|
||||
ShortNames: []string{
|
||||
"arangoclustersync",
|
||||
},
|
||||
Kind: "ArangoClusterSynchronization",
|
||||
ListKind: "ArangoClusterSynchronizationList",
|
||||
},
|
||||
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: "v2alpha1",
|
||||
Schema: &apiextensions.CustomResourceValidation{
|
||||
OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
|
||||
Type: "object",
|
||||
XPreserveUnknownFields: util.NewBool(true),
|
||||
},
|
||||
},
|
||||
Served: true,
|
||||
Storage: false,
|
||||
Subresources: &apiextensions.CustomResourceSubresources{
|
||||
Status: &apiextensions.CustomResourceSubresourceStatus{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
registerCRDWithPanic(crds.DatabaseClusterSynchronizationDefinition())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-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.
|
||||
|
@ -21,64 +21,9 @@
|
|||
package crd
|
||||
|
||||
import (
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
"github.com/arangodb/kube-arangodb/pkg/crd/crds"
|
||||
)
|
||||
|
||||
func init() {
|
||||
registerCRDWithPanic("arangodeploymentreplications.replication.database.arangodb.com", crd{
|
||||
version: "1.0.1",
|
||||
spec: apiextensions.CustomResourceDefinitionSpec{
|
||||
Group: "replication.database.arangodb.com",
|
||||
Names: apiextensions.CustomResourceDefinitionNames{
|
||||
Plural: "arangodeploymentreplications",
|
||||
Singular: "arangodeploymentreplication",
|
||||
ShortNames: []string{
|
||||
"arangorepl",
|
||||
},
|
||||
Kind: "ArangoDeploymentReplication",
|
||||
ListKind: "ArangoDeploymentReplicationList",
|
||||
},
|
||||
Scope: apiextensions.NamespaceScoped,
|
||||
Versions: []apiextensions.CustomResourceDefinitionVersion{
|
||||
{
|
||||
Name: "v1",
|
||||
Schema: &apiextensions.CustomResourceValidation{
|
||||
OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
|
||||
Type: "object",
|
||||
XPreserveUnknownFields: util.NewBool(true),
|
||||
},
|
||||
},
|
||||
Served: true,
|
||||
Storage: true,
|
||||
},
|
||||
{
|
||||
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{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
registerCRDWithPanic(crds.ReplicationDeploymentReplicationDefinition())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-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.
|
||||
|
@ -21,65 +21,9 @@
|
|||
package crd
|
||||
|
||||
import (
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
"github.com/arangodb/kube-arangodb/pkg/crd/crds"
|
||||
)
|
||||
|
||||
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,
|
||||
},
|
||||
{
|
||||
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{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
registerCRDWithPanic(crds.DatabaseDeploymentDefinition())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-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.
|
||||
|
@ -21,50 +21,9 @@
|
|||
package crd
|
||||
|
||||
import (
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
"github.com/arangodb/kube-arangodb/pkg/crd/crds"
|
||||
)
|
||||
|
||||
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{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
registerCRDWithPanic(crds.AppsJobDefinition())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-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.
|
||||
|
@ -20,40 +20,8 @@
|
|||
|
||||
package crd
|
||||
|
||||
import (
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
)
|
||||
import "github.com/arangodb/kube-arangodb/pkg/crd/crds"
|
||||
|
||||
func init() {
|
||||
registerCRDWithPanic("arangolocalstorages.storage.arangodb.com", crd{
|
||||
version: "1.0.1",
|
||||
spec: apiextensions.CustomResourceDefinitionSpec{
|
||||
Group: "storage.arangodb.com",
|
||||
Names: apiextensions.CustomResourceDefinitionNames{
|
||||
Plural: "arangolocalstorages",
|
||||
Singular: "arangolocalstorage",
|
||||
Kind: "ArangoLocalStorage",
|
||||
ListKind: "ArangoLocalStorageList",
|
||||
ShortNames: []string{
|
||||
"arangostorage",
|
||||
},
|
||||
},
|
||||
Scope: apiextensions.ClusterScoped,
|
||||
Versions: []apiextensions.CustomResourceDefinitionVersion{
|
||||
{
|
||||
Name: "v1alpha",
|
||||
Schema: &apiextensions.CustomResourceValidation{
|
||||
OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
|
||||
Type: "object",
|
||||
XPreserveUnknownFields: util.NewBool(true),
|
||||
},
|
||||
},
|
||||
Served: true,
|
||||
Storage: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
registerCRDWithPanic(crds.StorageLocalStorageDefinition())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-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.
|
||||
|
@ -21,56 +21,9 @@
|
|||
package crd
|
||||
|
||||
import (
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
"github.com/arangodb/kube-arangodb/pkg/crd/crds"
|
||||
)
|
||||
|
||||
func init() {
|
||||
registerCRDWithPanic("arangomembers.database.arangodb.com", crd{
|
||||
version: "1.0.1",
|
||||
spec: apiextensions.CustomResourceDefinitionSpec{
|
||||
Group: "database.arangodb.com",
|
||||
Names: apiextensions.CustomResourceDefinitionNames{
|
||||
Plural: "arangomembers",
|
||||
Singular: "arangomember",
|
||||
Kind: "ArangoMember",
|
||||
ListKind: "ArangoMemberList",
|
||||
ShortNames: []string{
|
||||
"arangomembers",
|
||||
},
|
||||
},
|
||||
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: "v2alpha1",
|
||||
Schema: &apiextensions.CustomResourceValidation{
|
||||
OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
|
||||
Type: "object",
|
||||
XPreserveUnknownFields: util.NewBool(true),
|
||||
},
|
||||
},
|
||||
Served: true,
|
||||
Storage: false,
|
||||
Subresources: &apiextensions.CustomResourceSubresources{
|
||||
Status: &apiextensions.CustomResourceSubresourceStatus{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
registerCRDWithPanic(crds.DatabaseMemberDefinition())
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-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.
|
||||
|
@ -21,53 +21,9 @@
|
|||
package crd
|
||||
|
||||
import (
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/util"
|
||||
"github.com/arangodb/kube-arangodb/pkg/crd/crds"
|
||||
)
|
||||
|
||||
func init() {
|
||||
registerCRDWithPanic("arangotasks.database.arangodb.com", crd{
|
||||
version: "1.0.1",
|
||||
spec: apiextensions.CustomResourceDefinitionSpec{
|
||||
Group: "database.arangodb.com",
|
||||
Names: apiextensions.CustomResourceDefinitionNames{
|
||||
Plural: "arangotasks",
|
||||
Singular: "arangotask",
|
||||
Kind: "ArangoTask",
|
||||
ListKind: "ArangoTaskList",
|
||||
},
|
||||
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: "v2alpha1",
|
||||
Schema: &apiextensions.CustomResourceValidation{
|
||||
OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
|
||||
Type: "object",
|
||||
XPreserveUnknownFields: util.NewBool(true),
|
||||
},
|
||||
},
|
||||
Served: true,
|
||||
Storage: false,
|
||||
Subresources: &apiextensions.CustomResourceSubresources{
|
||||
Status: &apiextensions.CustomResourceSubresourceStatus{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
registerCRDWithPanic(crds.DatabaseTaskDefinition())
|
||||
}
|
||||
|
|
56
pkg/crd/crds/apps-job.go
Normal file
56
pkg/crd/crds/apps-job.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
//
|
||||
// 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 crds
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
|
||||
"github.com/arangodb/go-driver"
|
||||
)
|
||||
|
||||
const (
|
||||
AppsJobVersion = driver.Version("1.0.1")
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := yaml.Unmarshal(appsJobs, &appsJobsCRD); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func AppsJob() *apiextensions.CustomResourceDefinition {
|
||||
return appsJobsCRD.DeepCopy()
|
||||
}
|
||||
|
||||
func AppsJobDefinition() Definition {
|
||||
return Definition{
|
||||
Version: AppsJobVersion,
|
||||
CRD: appsJobsCRD.DeepCopy(),
|
||||
}
|
||||
}
|
||||
|
||||
var appsJobsCRD apiextensions.CustomResourceDefinition
|
||||
|
||||
//go:embed apps-job.yaml
|
||||
var appsJobs []byte
|
29
pkg/crd/crds/apps-job.yaml
Normal file
29
pkg/crd/crds/apps-job.yaml
Normal file
|
@ -0,0 +1,29 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangojobs.apps.arangodb.com
|
||||
spec:
|
||||
group: apps.arangodb.com
|
||||
names:
|
||||
kind: ArangoJob
|
||||
listKind: ArangoJobList
|
||||
plural: arangojobs
|
||||
singular: arangojob
|
||||
shortNames:
|
||||
- arangojob
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
additionalPrinterColumns:
|
||||
- jsonPath: .spec.arangoDeploymentName
|
||||
description: Deployment name
|
||||
name: ArangoDeploymentName
|
||||
type: string
|
||||
subresources:
|
||||
status: {}
|
56
pkg/crd/crds/backups-backup.go
Normal file
56
pkg/crd/crds/backups-backup.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
//
|
||||
// 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 crds
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
|
||||
"github.com/arangodb/go-driver"
|
||||
)
|
||||
|
||||
const (
|
||||
BackupsBackupVersion = driver.Version("1.0.1")
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := yaml.Unmarshal(backupsBackup, &backupsBackupCRD); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func BackupsBackup() *apiextensions.CustomResourceDefinition {
|
||||
return backupsBackupCRD.DeepCopy()
|
||||
}
|
||||
|
||||
func BackupsBackupDefinition() Definition {
|
||||
return Definition{
|
||||
Version: BackupsBackupVersion,
|
||||
CRD: backupsBackupCRD.DeepCopy(),
|
||||
}
|
||||
}
|
||||
|
||||
var backupsBackupCRD apiextensions.CustomResourceDefinition
|
||||
|
||||
//go:embed backups-backup.yaml
|
||||
var backupsBackup []byte
|
103
pkg/crd/crds/backups-backup.yaml
Normal file
103
pkg/crd/crds/backups-backup.yaml
Normal file
|
@ -0,0 +1,103 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangobackups.backup.arangodb.com
|
||||
spec:
|
||||
group: backup.arangodb.com
|
||||
names:
|
||||
kind: ArangoBackup
|
||||
listKind: ArangoBackupList
|
||||
plural: arangobackups
|
||||
shortNames:
|
||||
- arangobackup
|
||||
singular: arangobackup
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
additionalPrinterColumns:
|
||||
- jsonPath: .spec.policyName
|
||||
description: Policy name
|
||||
name: Policy
|
||||
type: string
|
||||
- jsonPath: .spec.deployment.name
|
||||
description: Deployment name
|
||||
name: Deployment
|
||||
type: string
|
||||
- jsonPath: .status.backup.version
|
||||
description: Backup Version
|
||||
name: Version
|
||||
type: string
|
||||
- jsonPath: .status.backup.createdAt
|
||||
description: Backup Creation Timestamp
|
||||
name: Created
|
||||
type: string
|
||||
- jsonPath: .status.backup.sizeInBytes
|
||||
description: Backup Size in Bytes
|
||||
name: Size
|
||||
type: integer
|
||||
format: byte
|
||||
- jsonPath: .status.backup.numberOfDBServers
|
||||
description: Backup Number of the DB Servers
|
||||
name: DBServers
|
||||
type: integer
|
||||
- jsonPath: .status.state
|
||||
description: The actual state of the ArangoBackup
|
||||
name: State
|
||||
type: string
|
||||
- jsonPath: .status.message
|
||||
priority: 1
|
||||
description: Message of the ArangoBackup object
|
||||
name: Message
|
||||
type: string
|
||||
subresources:
|
||||
status: {}
|
||||
- name: v1alpha
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
additionalPrinterColumns:
|
||||
- jsonPath: .spec.policyName
|
||||
description: Policy name
|
||||
name: Policy
|
||||
type: string
|
||||
- jsonPath: .spec.deployment.name
|
||||
description: Deployment name
|
||||
name: Deployment
|
||||
type: string
|
||||
- jsonPath: .status.backup.version
|
||||
description: Backup Version
|
||||
name: Version
|
||||
type: string
|
||||
- jsonPath: .status.backup.createdAt
|
||||
description: Backup Creation Timestamp
|
||||
name: Created
|
||||
type: string
|
||||
- jsonPath: .status.backup.sizeInBytes
|
||||
description: Backup Size in Bytes
|
||||
name: Size
|
||||
type: integer
|
||||
format: byte
|
||||
- jsonPath: .status.backup.numberOfDBServers
|
||||
description: Backup Number of the DB Servers
|
||||
name: DBServers
|
||||
type: integer
|
||||
- jsonPath: .status.state
|
||||
description: The actual state of the ArangoBackup
|
||||
name: State
|
||||
type: string
|
||||
- jsonPath: .status.message
|
||||
priority: 1
|
||||
description: Message of the ArangoBackup object
|
||||
name: Message
|
||||
type: string
|
||||
subresources:
|
||||
status: {}
|
56
pkg/crd/crds/backups-backuppolicy.go
Normal file
56
pkg/crd/crds/backups-backuppolicy.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
//
|
||||
// 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 crds
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
|
||||
"github.com/arangodb/go-driver"
|
||||
)
|
||||
|
||||
const (
|
||||
BackupsBackupPolicyPolicyVersion = driver.Version("1.0.1")
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := yaml.Unmarshal(backupsBackupPolicy, &backupsBackupPolicyCRD); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func BackupsBackupPolicyPolicy() *apiextensions.CustomResourceDefinition {
|
||||
return backupsBackupPolicyCRD.DeepCopy()
|
||||
}
|
||||
|
||||
func BackupsBackupPolicyDefinition() Definition {
|
||||
return Definition{
|
||||
Version: BackupsBackupPolicyPolicyVersion,
|
||||
CRD: backupsBackupPolicyCRD.DeepCopy(),
|
||||
}
|
||||
}
|
||||
|
||||
var backupsBackupPolicyCRD apiextensions.CustomResourceDefinition
|
||||
|
||||
//go:embed backups-backuppolicy.yaml
|
||||
var backupsBackupPolicy []byte
|
62
pkg/crd/crds/backups-backuppolicy.yaml
Normal file
62
pkg/crd/crds/backups-backuppolicy.yaml
Normal file
|
@ -0,0 +1,62 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangobackuppolicies.backup.arangodb.com
|
||||
spec:
|
||||
group: backup.arangodb.com
|
||||
names:
|
||||
kind: ArangoBackupPolicy
|
||||
listKind: ArangoBackupPolicyList
|
||||
plural: arangobackuppolicies
|
||||
shortNames:
|
||||
- arangobackuppolicy
|
||||
- arangobp
|
||||
singular: arangobackuppolicy
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
additionalPrinterColumns:
|
||||
- jsonPath: .spec.schedule
|
||||
description: Schedule
|
||||
name: Schedule
|
||||
type: string
|
||||
- jsonPath: .status.scheduled
|
||||
description: Scheduled
|
||||
name: Scheduled
|
||||
type: string
|
||||
- jsonPath: .status.message
|
||||
priority: 1
|
||||
description: Message of the ArangoBackupPolicy object
|
||||
name: Message
|
||||
type: string
|
||||
subresources:
|
||||
status: {}
|
||||
- name: v1alpha
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
additionalPrinterColumns:
|
||||
- jsonPath: .spec.schedule
|
||||
description: Schedule
|
||||
name: Schedule
|
||||
type: string
|
||||
- jsonPath: .status.scheduled
|
||||
description: Scheduled
|
||||
name: Scheduled
|
||||
type: string
|
||||
- jsonPath: .status.message
|
||||
priority: 1
|
||||
description: Message of the ArangoBackupPolicy object
|
||||
name: Message
|
||||
type: string
|
||||
subresources:
|
||||
status: {}
|
46
pkg/crd/crds/crds.go
Normal file
46
pkg/crd/crds/crds.go
Normal file
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// 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 crds
|
||||
|
||||
import (
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
|
||||
"github.com/arangodb/go-driver"
|
||||
)
|
||||
|
||||
type Definition struct {
|
||||
Version driver.Version
|
||||
CRD *apiextensions.CustomResourceDefinition
|
||||
}
|
||||
|
||||
func AllDefinitions() []Definition {
|
||||
return []Definition{
|
||||
AppsJobDefinition(),
|
||||
BackupsBackupDefinition(),
|
||||
BackupsBackupPolicyDefinition(),
|
||||
DatabaseClusterSynchronizationDefinition(),
|
||||
DatabaseDeploymentDefinition(),
|
||||
DatabaseMemberDefinition(),
|
||||
DatabaseTaskDefinition(),
|
||||
ReplicationDeploymentReplicationDefinition(),
|
||||
StorageLocalStorageDefinition(),
|
||||
}
|
||||
}
|
51
pkg/crd/crds/crds_test.go
Normal file
51
pkg/crd/crds/crds_test.go
Normal file
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// 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 crds
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/apps"
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/backup"
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/replication"
|
||||
"github.com/arangodb/kube-arangodb/pkg/apis/storage"
|
||||
)
|
||||
|
||||
func ensureCRDCompliance(t *testing.T, name string, def Definition) {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
require.Equal(t, name, def.CRD.GetName())
|
||||
})
|
||||
}
|
||||
|
||||
func Test_CRD(t *testing.T) {
|
||||
ensureCRDCompliance(t, apps.ArangoJobCRDName, AppsJobDefinition())
|
||||
ensureCRDCompliance(t, backup.ArangoBackupCRDName, BackupsBackupDefinition())
|
||||
ensureCRDCompliance(t, backup.ArangoBackupPolicyCRDName, BackupsBackupPolicyDefinition())
|
||||
ensureCRDCompliance(t, deployment.ArangoClusterSynchronizationCRDName, DatabaseClusterSynchronizationDefinition())
|
||||
ensureCRDCompliance(t, deployment.ArangoDeploymentCRDName, DatabaseDeploymentDefinition())
|
||||
ensureCRDCompliance(t, deployment.ArangoMemberCRDName, DatabaseMemberDefinition())
|
||||
ensureCRDCompliance(t, deployment.ArangoTaskCRDName, DatabaseTaskDefinition())
|
||||
ensureCRDCompliance(t, replication.ArangoDeploymentReplicationCRDName, ReplicationDeploymentReplicationDefinition())
|
||||
ensureCRDCompliance(t, storage.ArangoLocalStorageCRDName, StorageLocalStorageDefinition())
|
||||
}
|
56
pkg/crd/crds/database-clustersynchronization.go
Normal file
56
pkg/crd/crds/database-clustersynchronization.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
//
|
||||
// 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 crds
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
|
||||
"github.com/arangodb/go-driver"
|
||||
)
|
||||
|
||||
const (
|
||||
DatabaseClusterSynchronizationVersion = driver.Version("1.0.1")
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := yaml.Unmarshal(databaseClusterSynchronization, &databaseClusterSynchronizationCRD); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func DatabaseClusterSynchronization() *apiextensions.CustomResourceDefinition {
|
||||
return databaseClusterSynchronizationCRD.DeepCopy()
|
||||
}
|
||||
|
||||
func DatabaseClusterSynchronizationDefinition() Definition {
|
||||
return Definition{
|
||||
Version: DatabaseClusterSynchronizationVersion,
|
||||
CRD: databaseClusterSynchronizationCRD.DeepCopy(),
|
||||
}
|
||||
}
|
||||
|
||||
var databaseClusterSynchronizationCRD apiextensions.CustomResourceDefinition
|
||||
|
||||
//go:embed database-clustersynchronization.yaml
|
||||
var databaseClusterSynchronization []byte
|
33
pkg/crd/crds/database-clustersynchronization.yaml
Normal file
33
pkg/crd/crds/database-clustersynchronization.yaml
Normal file
|
@ -0,0 +1,33 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangoclustersynchronizations.database.arangodb.com
|
||||
spec:
|
||||
group: database.arangodb.com
|
||||
names:
|
||||
kind: ArangoClusterSynchronization
|
||||
listKind: ArangoClusterSynchronizationList
|
||||
plural: arangoclustersynchronizations
|
||||
singular: arangoclustersynchronization
|
||||
shortNames:
|
||||
- arangoclustersync
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
- name: v2alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
subresources:
|
||||
status: {}
|
56
pkg/crd/crds/database-deployment.go
Normal file
56
pkg/crd/crds/database-deployment.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
//
|
||||
// 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 crds
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
|
||||
"github.com/arangodb/go-driver"
|
||||
)
|
||||
|
||||
const (
|
||||
DatabaseDeploymentVersion = driver.Version("1.0.1")
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := yaml.Unmarshal(batabaseDeployment, &batabaseDeploymentCRD); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func DatabaseDeployment() *apiextensions.CustomResourceDefinition {
|
||||
return batabaseDeploymentCRD.DeepCopy()
|
||||
}
|
||||
|
||||
func DatabaseDeploymentDefinition() Definition {
|
||||
return Definition{
|
||||
Version: DatabaseDeploymentVersion,
|
||||
CRD: batabaseDeploymentCRD.DeepCopy(),
|
||||
}
|
||||
}
|
||||
|
||||
var batabaseDeploymentCRD apiextensions.CustomResourceDefinition
|
||||
|
||||
//go:embed database-deployment.yaml
|
||||
var batabaseDeployment []byte
|
39
pkg/crd/crds/database-deployment.yaml
Normal file
39
pkg/crd/crds/database-deployment.yaml
Normal file
|
@ -0,0 +1,39 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangodeployments.database.arangodb.com
|
||||
spec:
|
||||
group: database.arangodb.com
|
||||
names:
|
||||
kind: ArangoDeployment
|
||||
listKind: ArangoDeploymentList
|
||||
plural: arangodeployments
|
||||
shortNames:
|
||||
- arangodb
|
||||
- arango
|
||||
singular: arangodeployment
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
- name: v1alpha
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
- name: v2alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
subresources:
|
||||
status: {}
|
56
pkg/crd/crds/database-member.go
Normal file
56
pkg/crd/crds/database-member.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
//
|
||||
// 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 crds
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
|
||||
"github.com/arangodb/go-driver"
|
||||
)
|
||||
|
||||
const (
|
||||
DatabaseMemberVersion = driver.Version("1.0.1")
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := yaml.Unmarshal(databaseMember, &databaseMemberCRD); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func DatabaseMember() *apiextensions.CustomResourceDefinition {
|
||||
return databaseMemberCRD.DeepCopy()
|
||||
}
|
||||
|
||||
func DatabaseMemberDefinition() Definition {
|
||||
return Definition{
|
||||
Version: DatabaseMemberVersion,
|
||||
CRD: databaseMemberCRD.DeepCopy(),
|
||||
}
|
||||
}
|
||||
|
||||
var databaseMemberCRD apiextensions.CustomResourceDefinition
|
||||
|
||||
//go:embed database-member.yaml
|
||||
var databaseMember []byte
|
33
pkg/crd/crds/database-member.yaml
Normal file
33
pkg/crd/crds/database-member.yaml
Normal file
|
@ -0,0 +1,33 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangomembers.database.arangodb.com
|
||||
spec:
|
||||
group: database.arangodb.com
|
||||
names:
|
||||
kind: ArangoMember
|
||||
listKind: ArangoMemberList
|
||||
plural: arangomembers
|
||||
shortNames:
|
||||
- arangomembers
|
||||
singular: arangomember
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
- name: v2alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
subresources:
|
||||
status: {}
|
56
pkg/crd/crds/database-task.go
Normal file
56
pkg/crd/crds/database-task.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
//
|
||||
// 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 crds
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
|
||||
"github.com/arangodb/go-driver"
|
||||
)
|
||||
|
||||
const (
|
||||
DatabaseTaskVersion = driver.Version("1.0.1")
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := yaml.Unmarshal(databaseTask, &databaseTaskCRD); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func DatabaseTask() *apiextensions.CustomResourceDefinition {
|
||||
return databaseTaskCRD.DeepCopy()
|
||||
}
|
||||
|
||||
func DatabaseTaskDefinition() Definition {
|
||||
return Definition{
|
||||
Version: DatabaseTaskVersion,
|
||||
CRD: databaseTaskCRD.DeepCopy(),
|
||||
}
|
||||
}
|
||||
|
||||
var databaseTaskCRD apiextensions.CustomResourceDefinition
|
||||
|
||||
//go:embed database-task.yaml
|
||||
var databaseTask []byte
|
39
pkg/crd/crds/database-task.yaml
Normal file
39
pkg/crd/crds/database-task.yaml
Normal file
|
@ -0,0 +1,39 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangotasks.database.arangodb.com
|
||||
spec:
|
||||
group: database.arangodb.com
|
||||
names:
|
||||
kind: ArangoTask
|
||||
listKind: ArangoTaskList
|
||||
plural: arangotasks
|
||||
shortNames:
|
||||
- arangodb
|
||||
- arango
|
||||
singular: arangotask
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
- name: v1alpha
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
- name: v2alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
subresources:
|
||||
status: {}
|
56
pkg/crd/crds/replication-deploymentreplication.go
Normal file
56
pkg/crd/crds/replication-deploymentreplication.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
//
|
||||
// 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 crds
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
|
||||
"github.com/arangodb/go-driver"
|
||||
)
|
||||
|
||||
const (
|
||||
ReplicationDeploymentReplicationVersion = driver.Version("1.0.1")
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := yaml.Unmarshal(replicationDeploymentReplication, &replicationDeploymentReplicationCRD); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func ReplicationDeploymentReplication() *apiextensions.CustomResourceDefinition {
|
||||
return replicationDeploymentReplicationCRD.DeepCopy()
|
||||
}
|
||||
|
||||
func ReplicationDeploymentReplicationDefinition() Definition {
|
||||
return Definition{
|
||||
Version: ReplicationDeploymentReplicationVersion,
|
||||
CRD: replicationDeploymentReplicationCRD.DeepCopy(),
|
||||
}
|
||||
}
|
||||
|
||||
var replicationDeploymentReplicationCRD apiextensions.CustomResourceDefinition
|
||||
|
||||
//go:embed replication-deploymentreplication.yaml
|
||||
var replicationDeploymentReplication []byte
|
38
pkg/crd/crds/replication-deploymentreplication.yaml
Normal file
38
pkg/crd/crds/replication-deploymentreplication.yaml
Normal file
|
@ -0,0 +1,38 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangodeploymentreplications.replication.database.arangodb.com
|
||||
spec:
|
||||
group: replication.database.arangodb.com
|
||||
names:
|
||||
kind: ArangoDeploymentReplication
|
||||
listKind: ArangoDeploymentReplicationList
|
||||
plural: arangodeploymentreplications
|
||||
shortNames:
|
||||
- arangorepl
|
||||
singular: arangodeploymentreplication
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: true
|
||||
- name: v1alpha
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
- name: v2alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
served: true
|
||||
storage: false
|
||||
subresources:
|
||||
status: {}
|
56
pkg/crd/crds/storage-localstorage.go
Normal file
56
pkg/crd/crds/storage-localstorage.go
Normal file
|
@ -0,0 +1,56 @@
|
|||
//
|
||||
// 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 crds
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
|
||||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
|
||||
"github.com/arangodb/go-driver"
|
||||
)
|
||||
|
||||
const (
|
||||
StorageLocalStorageVersion = driver.Version("1.0.1")
|
||||
)
|
||||
|
||||
func init() {
|
||||
if err := yaml.Unmarshal(storageLocalStorage, &storageLocalStorageCRD); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func StorageLocalStorage() *apiextensions.CustomResourceDefinition {
|
||||
return storageLocalStorageCRD.DeepCopy()
|
||||
}
|
||||
|
||||
func StorageLocalStorageDefinition() Definition {
|
||||
return Definition{
|
||||
Version: StorageLocalStorageVersion,
|
||||
CRD: storageLocalStorageCRD.DeepCopy(),
|
||||
}
|
||||
}
|
||||
|
||||
var storageLocalStorageCRD apiextensions.CustomResourceDefinition
|
||||
|
||||
//go:embed storage-localstorage.yaml
|
||||
var storageLocalStorage []byte
|
22
pkg/crd/crds/storage-localstorage.yaml
Normal file
22
pkg/crd/crds/storage-localstorage.yaml
Normal file
|
@ -0,0 +1,22 @@
|
|||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
name: arangolocalstorages.storage.arangodb.com
|
||||
spec:
|
||||
group: storage.arangodb.com
|
||||
names:
|
||||
kind: ArangoLocalStorage
|
||||
listKind: ArangoLocalStorageList
|
||||
plural: arangolocalstorages
|
||||
shortNames:
|
||||
- arangostorage
|
||||
singular: arangolocalstorage
|
||||
scope: Cluster
|
||||
versions:
|
||||
- name: v1alpha
|
||||
served: true
|
||||
storage: true
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
|
@ -1,7 +1,7 @@
|
|||
//
|
||||
// DISCLAIMER
|
||||
//
|
||||
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
|
||||
// Copyright 2016-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.
|
||||
|
@ -27,13 +27,14 @@ import (
|
|||
|
||||
"github.com/arangodb/go-driver"
|
||||
|
||||
"github.com/arangodb/kube-arangodb/pkg/crd/crds"
|
||||
"github.com/arangodb/kube-arangodb/pkg/util/errors"
|
||||
)
|
||||
|
||||
const Version = "arangodb.com/version"
|
||||
|
||||
var (
|
||||
crds = map[string]crd{}
|
||||
registeredCRDs = map[string]crd{}
|
||||
|
||||
crdsLock sync.Mutex
|
||||
)
|
||||
|
@ -43,8 +44,11 @@ type crd struct {
|
|||
spec apiextensions.CustomResourceDefinitionSpec
|
||||
}
|
||||
|
||||
func registerCRDWithPanic(name string, crd crd) {
|
||||
if err := registerCRD(name, crd); err != nil {
|
||||
func registerCRDWithPanic(c crds.Definition) {
|
||||
if err := registerCRD(c.CRD.GetName(), crd{
|
||||
version: c.Version,
|
||||
spec: c.CRD.Spec,
|
||||
}); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
@ -53,11 +57,11 @@ func registerCRD(name string, crd crd) error {
|
|||
crdsLock.Lock()
|
||||
defer crdsLock.Unlock()
|
||||
|
||||
if _, ok := crds[name]; ok {
|
||||
if _, ok := registeredCRDs[name]; ok {
|
||||
return errors.Newf("CRD %s already exists", name)
|
||||
}
|
||||
|
||||
crds[name] = crd
|
||||
registeredCRDs[name] = crd
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue