Skip to content

Commit 56e6a88

Browse files
[Feature] Add CRD generator for ArangoBackupPolicy (#1000)
1 parent 316d9e2 commit 56e6a88

File tree

3 files changed

+121
-0
lines changed

3 files changed

+121
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- (Feature) Add `ArangoDeployment` CRD auto-installer
77
- (Feature) Add `ArangoMember` CRD auto-installer
88
- (Feature) Add `ArangoBackup` CRD auto-installer
9+
- (Feature) Add `ArangoBackupPolicy` CRD auto-installer
910

1011
## [1.2.13](https://github.com/arangodb/kube-arangodb/tree/1.2.13) (2022-06-07)
1112
- (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
@@ -22,6 +22,7 @@ rules:
2222
- "arangomembers.database.arangodb.com"
2323
- "arangotasks.database.arangodb.com"
2424
- "arangobackups.backup.arangodb.com"
25+
- "arangobackuppolicies.backup.arangodb.com"
2526

2627
{{- end }}
2728
{{- end }}

pkg/crd/arangobackuppolicies.go

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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("arangobackuppolicies.backup.arangodb.com", crd{
31+
version: "1.0.1",
32+
spec: apiextensions.CustomResourceDefinitionSpec{
33+
Group: "backup.arangodb.com",
34+
Names: apiextensions.CustomResourceDefinitionNames{
35+
Plural: "arangobackuppolicies",
36+
Singular: "arangobackuppolicy",
37+
Kind: "ArangoBackupPolicy",
38+
ListKind: "ArangoBackupPolicyList",
39+
ShortNames: []string{
40+
"arangobackuppolicy",
41+
"arangobp",
42+
},
43+
},
44+
Scope: apiextensions.NamespaceScoped,
45+
Versions: []apiextensions.CustomResourceDefinitionVersion{
46+
{
47+
Name: "v1",
48+
Schema: &apiextensions.CustomResourceValidation{
49+
OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
50+
Type: "object",
51+
XPreserveUnknownFields: util.NewBool(true),
52+
},
53+
},
54+
Served: true,
55+
Storage: true,
56+
AdditionalPrinterColumns: []apiextensions.CustomResourceColumnDefinition{
57+
{
58+
JSONPath: ".spec.schedule",
59+
Description: "Schedule",
60+
Name: "Schedule",
61+
Type: "string",
62+
},
63+
{
64+
JSONPath: ".status.scheduled",
65+
Description: "Scheduled",
66+
Name: "Scheduled",
67+
Type: "string",
68+
},
69+
{
70+
JSONPath: ".status.message",
71+
Priority: 1,
72+
Description: "Message of the ArangoBackupPolicy object",
73+
Name: "Message",
74+
Type: "string",
75+
},
76+
},
77+
Subresources: &apiextensions.CustomResourceSubresources{
78+
Status: &apiextensions.CustomResourceSubresourceStatus{},
79+
},
80+
},
81+
{
82+
Name: "v1alpha",
83+
Schema: &apiextensions.CustomResourceValidation{
84+
OpenAPIV3Schema: &apiextensions.JSONSchemaProps{
85+
Type: "object",
86+
XPreserveUnknownFields: util.NewBool(true),
87+
},
88+
},
89+
Served: true,
90+
Storage: false,
91+
AdditionalPrinterColumns: []apiextensions.CustomResourceColumnDefinition{
92+
{
93+
JSONPath: ".spec.schedule",
94+
Description: "Schedule",
95+
Name: "Schedule",
96+
Type: "string",
97+
},
98+
{
99+
JSONPath: ".status.scheduled",
100+
Description: "Scheduled",
101+
Name: "Scheduled",
102+
Type: "string",
103+
},
104+
{
105+
JSONPath: ".status.message",
106+
Priority: 1,
107+
Description: "Message of the ArangoBackupPolicy object",
108+
Name: "Message",
109+
Type: "string",
110+
},
111+
},
112+
Subresources: &apiextensions.CustomResourceSubresources{
113+
Status: &apiextensions.CustomResourceSubresourceStatus{},
114+
},
115+
},
116+
},
117+
},
118+
})
119+
}

0 commit comments

Comments
 (0)