Skip to content

Commit e04d916

Browse files
committed
Empty MariaDBAccount CRD
Includes: operator-sdk create api --group mariadb --version v1beta1 --kind MariaDBAccount pre-commit run of make manifests, make generate
1 parent c971bdd commit e04d916

16 files changed

+463
-0
lines changed

PROJECT

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Code generated by tool. DO NOT EDIT.
2+
# This file is used to track the info used to scaffold your project
3+
# and allow the plugins properly work.
4+
# More info: https://book.kubebuilder.io/reference/project-config.html
15
domain: openstack.org
26
layout:
37
- go.kubebuilder.io/v3
@@ -42,4 +46,13 @@ resources:
4246
defaulting: true
4347
validation: true
4448
webhookVersion: v1
49+
- api:
50+
crdVersion: v1
51+
namespaced: true
52+
controller: true
53+
domain: openstack.org
54+
group: mariadb
55+
kind: MariaDBAccount
56+
path: github.com/openstack-k8s-operators/mariadb-operator/api/v1beta1
57+
version: v1beta1
4558
version: "3"
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.11.1
7+
creationTimestamp: null
8+
name: mariadbaccounts.mariadb.openstack.org
9+
spec:
10+
group: mariadb.openstack.org
11+
names:
12+
kind: MariaDBAccount
13+
listKind: MariaDBAccountList
14+
plural: mariadbaccounts
15+
singular: mariadbaccount
16+
scope: Namespaced
17+
versions:
18+
- name: v1beta1
19+
schema:
20+
openAPIV3Schema:
21+
description: MariaDBAccount is the Schema for the mariadbaccounts API
22+
properties:
23+
apiVersion:
24+
description: 'APIVersion defines the versioned schema of this representation
25+
of an object. Servers should convert recognized schemas to the latest
26+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
27+
type: string
28+
kind:
29+
description: 'Kind is a string value representing the REST resource this
30+
object represents. Servers may infer this from the endpoint the client
31+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
32+
type: string
33+
metadata:
34+
type: object
35+
spec:
36+
description: MariaDBAccountSpec defines the desired state of MariaDBAccount
37+
properties:
38+
foo:
39+
description: Foo is an example field of MariaDBAccount. Edit mariadbaccount_types.go
40+
to remove/update
41+
type: string
42+
type: object
43+
status:
44+
description: MariaDBAccountStatus defines the observed state of MariaDBAccount
45+
type: object
46+
type: object
47+
served: true
48+
storage: true
49+
subresources:
50+
status: {}

api/v1beta1/mariadbaccount_types.go

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
Copyright 2022.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1beta1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
)
22+
23+
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
24+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
25+
26+
// MariaDBAccountSpec defines the desired state of MariaDBAccount
27+
type MariaDBAccountSpec struct {
28+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
29+
// Important: Run "make" to regenerate code after modifying this file
30+
31+
// Foo is an example field of MariaDBAccount. Edit mariadbaccount_types.go to remove/update
32+
Foo string `json:"foo,omitempty"`
33+
}
34+
35+
// MariaDBAccountStatus defines the observed state of MariaDBAccount
36+
type MariaDBAccountStatus struct {
37+
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
38+
// Important: Run "make" to regenerate code after modifying this file
39+
}
40+
41+
//+kubebuilder:object:root=true
42+
//+kubebuilder:subresource:status
43+
44+
// MariaDBAccount is the Schema for the mariadbaccounts API
45+
type MariaDBAccount struct {
46+
metav1.TypeMeta `json:",inline"`
47+
metav1.ObjectMeta `json:"metadata,omitempty"`
48+
49+
Spec MariaDBAccountSpec `json:"spec,omitempty"`
50+
Status MariaDBAccountStatus `json:"status,omitempty"`
51+
}
52+
53+
//+kubebuilder:object:root=true
54+
55+
// MariaDBAccountList contains a list of MariaDBAccount
56+
type MariaDBAccountList struct {
57+
metav1.TypeMeta `json:",inline"`
58+
metav1.ListMeta `json:"metadata,omitempty"`
59+
Items []MariaDBAccount `json:"items"`
60+
}
61+
62+
func init() {
63+
SchemeBuilder.Register(&MariaDBAccount{}, &MariaDBAccountList{})
64+
}

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 89 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.11.1
7+
creationTimestamp: null
8+
name: mariadbaccounts.mariadb.openstack.org
9+
spec:
10+
group: mariadb.openstack.org
11+
names:
12+
kind: MariaDBAccount
13+
listKind: MariaDBAccountList
14+
plural: mariadbaccounts
15+
singular: mariadbaccount
16+
scope: Namespaced
17+
versions:
18+
- name: v1beta1
19+
schema:
20+
openAPIV3Schema:
21+
description: MariaDBAccount is the Schema for the mariadbaccounts API
22+
properties:
23+
apiVersion:
24+
description: 'APIVersion defines the versioned schema of this representation
25+
of an object. Servers should convert recognized schemas to the latest
26+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
27+
type: string
28+
kind:
29+
description: 'Kind is a string value representing the REST resource this
30+
object represents. Servers may infer this from the endpoint the client
31+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
32+
type: string
33+
metadata:
34+
type: object
35+
spec:
36+
description: MariaDBAccountSpec defines the desired state of MariaDBAccount
37+
properties:
38+
foo:
39+
description: Foo is an example field of MariaDBAccount. Edit mariadbaccount_types.go
40+
to remove/update
41+
type: string
42+
type: object
43+
status:
44+
description: MariaDBAccountStatus defines the observed state of MariaDBAccount
45+
type: object
46+
type: object
47+
served: true
48+
storage: true
49+
subresources:
50+
status: {}

config/crd/kustomization.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ resources:
55
- bases/mariadb.openstack.org_galeras.yaml
66
- bases/mariadb.openstack.org_mariadbs.yaml
77
- bases/mariadb.openstack.org_mariadbdatabases.yaml
8+
- bases/mariadb.openstack.org_mariadbaccounts.yaml
89
#+kubebuilder:scaffold:crdkustomizeresource
910

1011
patchesStrategicMerge:
@@ -13,13 +14,15 @@ patchesStrategicMerge:
1314
#- patches/webhook_in_galeras.yaml
1415
#- patches/webhook_in_mariadbs.yaml
1516
#- patches/webhook_in_mariadbdatabases.yaml
17+
#- patches/webhook_in_mariadbaccounts.yaml
1618
#+kubebuilder:scaffold:crdkustomizewebhookpatch
1719

1820
# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
1921
# patches here are for enabling the CA injection for each CRD
2022
#- patches/cainjection_in_galeras.yaml
2123
#- patches/cainjection_in_mariadbs.yaml
2224
#- patches/cainjection_in_mariadbdatabases.yaml
25+
#- patches/cainjection_in_mariadbaccounts.yaml
2326
#+kubebuilder:scaffold:crdkustomizecainjectionpatch
2427

2528
# the following config is for teaching kustomize how to do kustomization for CRDs.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# The following patch adds a directive for certmanager to inject CA into the CRD
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
7+
name: mariadbaccounts.mariadb.openstack.org
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# The following patch enables a conversion webhook for the CRD
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
name: mariadbaccounts.mariadb.openstack.org
6+
spec:
7+
conversion:
8+
strategy: Webhook
9+
webhook:
10+
clientConfig:
11+
service:
12+
namespace: system
13+
name: webhook-service
14+
path: /convert
15+
conversionReviewVersions:
16+
- v1
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# permissions for end users to edit mariadbaccounts.
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
labels:
6+
app.kubernetes.io/name: clusterrole
7+
app.kubernetes.io/instance: mariadbaccount-editor-role
8+
app.kubernetes.io/component: rbac
9+
app.kubernetes.io/created-by: mariadb-operator
10+
app.kubernetes.io/part-of: mariadb-operator
11+
app.kubernetes.io/managed-by: kustomize
12+
name: mariadbaccount-editor-role
13+
rules:
14+
- apiGroups:
15+
- mariadb.openstack.org
16+
resources:
17+
- mariadbaccounts
18+
verbs:
19+
- create
20+
- delete
21+
- get
22+
- list
23+
- patch
24+
- update
25+
- watch
26+
- apiGroups:
27+
- mariadb.openstack.org
28+
resources:
29+
- mariadbaccounts/status
30+
verbs:
31+
- get
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# permissions for end users to view mariadbaccounts.
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRole
4+
metadata:
5+
labels:
6+
app.kubernetes.io/name: clusterrole
7+
app.kubernetes.io/instance: mariadbaccount-viewer-role
8+
app.kubernetes.io/component: rbac
9+
app.kubernetes.io/created-by: mariadb-operator
10+
app.kubernetes.io/part-of: mariadb-operator
11+
app.kubernetes.io/managed-by: kustomize
12+
name: mariadbaccount-viewer-role
13+
rules:
14+
- apiGroups:
15+
- mariadb.openstack.org
16+
resources:
17+
- mariadbaccounts
18+
verbs:
19+
- get
20+
- list
21+
- watch
22+
- apiGroups:
23+
- mariadb.openstack.org
24+
resources:
25+
- mariadbaccounts/status
26+
verbs:
27+
- get

0 commit comments

Comments
 (0)