Skip to content

Commit 316d9e2

Browse files
[Feature] Add CRD generator for ArangoBackup (#999)
1 parent 889038b commit 316d9e2

File tree

3 files changed

+182
-0
lines changed

3 files changed

+182
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- (Bugfix) Fix labels propagation
66
- (Feature) Add `ArangoDeployment` CRD auto-installer
77
- (Feature) Add `ArangoMember` CRD auto-installer
8+
- (Feature) Add `ArangoBackup` CRD auto-installer
89

910
## [1.2.13](https://github.com/arangodb/kube-arangodb/tree/1.2.13) (2022-06-07)
1011
- (Bugfix) Fix arangosync members state inspection

chart/kube-arangodb/templates/crd/cluster-role.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ rules:
2121
- "arangoclustersynchronizations.database.arangodb.com"
2222
- "arangomembers.database.arangodb.com"
2323
- "arangotasks.database.arangodb.com"
24+
- "arangobackups.backup.arangodb.com"
2425

2526
{{- end }}
2627
{{- end }}

pkg/crd/arangobackup.go

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
//
2+
// DISCLAIMER
3+
//
4+
// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing, software
13+
// distributed under the License is distributed on an "AS IS" BASIS,
14+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
// See the License for the specific language governing permissions and
16+
// limitations under the License.
17+
//
18+
// Copyright holder is ArangoDB GmbH, Cologne, Germany
19+
//
20+
21+
package crd
22+
23+
import (
24+
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
25+
26+
"github.com/arangodb/kube-arangodb/pkg/util"
27+
)
28+
29+
func init() {
30+
registerCRDWithPanic("arangobackups.backup.arangodb.com", crd{
31+
version: "1.0.1",
32+
spec: apiextensions.CustomResourceDefinitionSpec{
33+
Group: "backup.arangodb.com",
34+
Names: apiextensions.CustomResourceDefinitionNames{
35+
Plural: "arangobackups",
36+
Singular: "arangobackup",
37+
Kind: "ArangoBackup",
38+
ListKind: "ArangoBackupList",
39+
ShortNames: []string{
40+
"arangobackup",
41+
},
42+
},
43+
Scope: apiextensions.NamespaceScoped,
44+
Versions: []apiextensions.CustomResourceDefinitionVersion{
45+
{
46+
Name: "v1",
47+
Schema: &apiextensions.CustomResourceValidation{
48+
OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
49+
Type: "object",
50+
XPreserveUnknownFields: util.NewBool(true),
51+
},
52+
},
53+
Served: true,
54+
Storage: true,
55+
AdditionalPrinterColumns: []apiextensions.CustomResourceColumnDefinition{
56+
{
57+
JSONPath: ".spec.policyName",
58+
Description: "Policy name",
59+
Name: "Policy",
60+
Type: "string",
61+
},
62+
{
63+
JSONPath: ".spec.deployment.name",
64+
Description: "Deployment name",
65+
Name: "Deployment",
66+
Type: "string",
67+
},
68+
{
69+
JSONPath: ".status.backup.version",
70+
Description: "Backup Version",
71+
Name: "Version",
72+
Type: "string",
73+
},
74+
{
75+
JSONPath: ".status.backup.createdAt",
76+
Description: "Backup Creation Timestamp",
77+
Name: "Created",
78+
Type: "string",
79+
},
80+
{
81+
JSONPath: ".status.backup.sizeInBytes",
82+
Description: "Backup Size in Bytes",
83+
Name: "Size",
84+
Type: "integer",
85+
Format: "byte",
86+
},
87+
{
88+
JSONPath: ".status.backup.numberOfDBServers",
89+
Description: "Backup Number of the DB Servers",
90+
Name: "DBServers",
91+
Type: "integer",
92+
},
93+
{
94+
JSONPath: ".status.state",
95+
Description: "The actual state of the ArangoBackup",
96+
Name: "State",
97+
Type: "string",
98+
},
99+
{
100+
JSONPath: ".status.message",
101+
Priority: 1,
102+
Description: "Message of the ArangoBackup object",
103+
Name: "Message",
104+
Type: "string",
105+
},
106+
},
107+
Subresources: &apiextensions.CustomResourceSubresources{
108+
Status: &apiextensions.CustomResourceSubresourceStatus{},
109+
},
110+
},
111+
{
112+
Name: "v1alpha",
113+
Schema: &apiextensions.CustomResourceValidation{
114+
OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
115+
Type: "object",
116+
XPreserveUnknownFields: util.NewBool(true),
117+
},
118+
},
119+
Served: true,
120+
Storage: false,
121+
AdditionalPrinterColumns: []apiextensions.CustomResourceColumnDefinition{
122+
{
123+
JSONPath: ".spec.policyName",
124+
Description: "Policy name",
125+
Name: "Policy",
126+
Type: "string",
127+
},
128+
{
129+
JSONPath: ".spec.deployment.name",
130+
Description: "Deployment name",
131+
Name: "Deployment",
132+
Type: "string",
133+
},
134+
{
135+
JSONPath: ".status.backup.version",
136+
Description: "Backup Version",
137+
Name: "Version",
138+
Type: "string",
139+
},
140+
{
141+
JSONPath: ".status.backup.createdAt",
142+
Description: "Backup Creation Timestamp",
143+
Name: "Created",
144+
Type: "string",
145+
},
146+
{
147+
JSONPath: ".status.backup.sizeInBytes",
148+
Description: "Backup Size in Bytes",
149+
Name: "Size",
150+
Type: "integer",
151+
Format: "byte",
152+
},
153+
{
154+
JSONPath: ".status.backup.numberOfDBServers",
155+
Description: "Backup Number of the DB Servers",
156+
Name: "DBServers",
157+
Type: "integer",
158+
},
159+
{
160+
JSONPath: ".status.state",
161+
Description: "The actual state of the ArangoBackup",
162+
Name: "State",
163+
Type: "string",
164+
},
165+
{
166+
JSONPath: ".status.message",
167+
Priority: 1,
168+
Description: "Message of the ArangoBackup object",
169+
Name: "Message",
170+
Type: "string",
171+
},
172+
},
173+
Subresources: &apiextensions.CustomResourceSubresources{
174+
Status: &apiextensions.CustomResourceSubresourceStatus{},
175+
},
176+
},
177+
},
178+
},
179+
})
180+
}

0 commit comments

Comments
 (0)