Skip to content

Commit c9cc369

Browse files
committed
*: Support installing user crd when installing operator.
1 parent 5a28a54 commit c9cc369

File tree

2 files changed

+182
-0
lines changed

2 files changed

+182
-0
lines changed
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
2+
---
3+
apiVersion: apiextensions.k8s.io/v1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
annotations:
7+
controller-gen.kubebuilder.io/version: v0.4.1
8+
creationTimestamp: null
9+
name: mysqlusers.mysql.radondb.com
10+
spec:
11+
group: mysql.radondb.com
12+
names:
13+
kind: MysqlUser
14+
listKind: MysqlUserList
15+
plural: mysqlusers
16+
singular: mysqluser
17+
scope: Namespaced
18+
versions:
19+
- name: v1alpha1
20+
schema:
21+
openAPIV3Schema:
22+
description: MysqlUser is the Schema for the users API.
23+
properties:
24+
apiVersion:
25+
description: 'APIVersion defines the versioned schema of this representation
26+
of an object. Servers should convert recognized schemas to the latest
27+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
28+
type: string
29+
kind:
30+
description: 'Kind is a string value representing the REST resource this
31+
object represents. Servers may infer this from the endpoint the client
32+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
33+
type: string
34+
metadata:
35+
type: object
36+
spec:
37+
description: UserSpec defines the desired state of User.
38+
properties:
39+
hosts:
40+
description: Hosts is the grants hosts.
41+
items:
42+
type: string
43+
minItems: 1
44+
type: array
45+
permissions:
46+
description: Permissions is the list of roles that user has in the
47+
specified database.
48+
items:
49+
description: UserPermission defines a UserPermission permission.
50+
properties:
51+
database:
52+
description: Database is the grants database.
53+
pattern: ^([*]|[A-Za-z0-9_]{2,26})$
54+
type: string
55+
privileges:
56+
description: 'Privileges is the normal privileges(comma delimited,
57+
such as "SELECT,CREATE"). Optional parameters can refer to:
58+
https://dev.mysql.com/doc/refman/5.7/en/privileges-provided.html.'
59+
items:
60+
type: string
61+
minItems: 1
62+
type: array
63+
tables:
64+
description: Tables is the grants tables inside the database.
65+
items:
66+
type: string
67+
minItems: 1
68+
type: array
69+
type: object
70+
type: array
71+
secretSelector:
72+
description: SecretSelector Contains parameters about the secret object
73+
bound by user.
74+
properties:
75+
secretKey:
76+
description: SecretKey is the key of secret object.
77+
type: string
78+
secretName:
79+
description: SecretName is the name of secret object.
80+
type: string
81+
type: object
82+
user:
83+
description: Username is the name of user to be operated. This field
84+
should be immutable.
85+
pattern: ^[A-Za-z0-9_]{2,26}$
86+
type: string
87+
userOwner:
88+
description: UserOwner Contains parameters about the cluster bound
89+
by user.
90+
properties:
91+
clusterName:
92+
description: ClusterName is the name of cluster.
93+
type: string
94+
nameSpace:
95+
description: NameSpace is the nameSpace of cluster.
96+
type: string
97+
type: object
98+
type: object
99+
status:
100+
description: UserStatus defines the observed state of MysqlUser.
101+
properties:
102+
allowedHosts:
103+
description: AllowedHosts contains the list of hosts that the user
104+
is allowed to connect from.
105+
items:
106+
type: string
107+
type: array
108+
conditions:
109+
description: Conditions represents the MysqlUser resource conditions
110+
list.
111+
items:
112+
description: MySQLUserCondition defines the condition struct for
113+
a MysqlUser resource.
114+
properties:
115+
lastTransitionTime:
116+
description: Last time the condition transitioned from one status
117+
to another.
118+
format: date-time
119+
type: string
120+
lastUpdateTime:
121+
description: The last time this condition was updated.
122+
format: date-time
123+
type: string
124+
message:
125+
description: A human readable message indicating details about
126+
the transition.
127+
type: string
128+
reason:
129+
description: The reason for the condition's last transition.
130+
type: string
131+
status:
132+
description: Status of the condition, one of True, False, Unknown.
133+
type: string
134+
type:
135+
description: Type of MysqlUser condition.
136+
type: string
137+
required:
138+
- lastTransitionTime
139+
- message
140+
- reason
141+
- status
142+
- type
143+
type: object
144+
type: array
145+
type: object
146+
type: object
147+
served: true
148+
storage: true
149+
subresources:
150+
status: {}
151+
status:
152+
acceptedNames:
153+
kind: ""
154+
plural: ""
155+
conditions: []
156+
storedVersions: []

charts/mysql-operator/templates/cluster_rbac.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,32 @@ rules:
9999
- get
100100
- patch
101101
- update
102+
- apiGroups:
103+
- mysql.radondb.com
104+
resources:
105+
- mysqlusers
106+
verbs:
107+
- create
108+
- delete
109+
- get
110+
- list
111+
- patch
112+
- update
113+
- watch
114+
- apiGroups:
115+
- mysql.radondb.com
116+
resources:
117+
- mysqlusers/finalizers
118+
verbs:
119+
- update
120+
- apiGroups:
121+
- mysql.radondb.com
122+
resources:
123+
- mysqlusers/status
124+
verbs:
125+
- get
126+
- patch
127+
- update
102128
- apiGroups:
103129
- policy
104130
resources:

0 commit comments

Comments
 (0)