1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

[Feature] Add CRD generator for ArangoBackup (#999)

This commit is contained in:
Nikita Vanyasin 2022-06-09 13:41:25 +03:00 committed by GitHub
parent 889038b958
commit 316d9e26be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 182 additions and 0 deletions

View file

@ -5,6 +5,7 @@
- (Bugfix) Fix labels propagation
- (Feature) Add `ArangoDeployment` CRD auto-installer
- (Feature) Add `ArangoMember` CRD auto-installer
- (Feature) Add `ArangoBackup` 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

View file

@ -21,6 +21,7 @@ rules:
- "arangoclustersynchronizations.database.arangodb.com"
- "arangomembers.database.arangodb.com"
- "arangotasks.database.arangodb.com"
- "arangobackups.backup.arangodb.com"
{{- end }}
{{- end }}

180
pkg/crd/arangobackup.go Normal file
View file

@ -0,0 +1,180 @@
//
// 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("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{},
},
},
},
},
})
}