Skip to content

Commit f103872

Browse files
authored
[Feature] [ML] SA Management (#1525)
1 parent a7bd9cb commit f103872

17 files changed

+1240
-18
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

chart/kube-arangodb/templates/ml/role.yaml renamed to chart/kube-arangodb/templates/ml-operator/role.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,23 @@ rules:
3434
- "get"
3535
- "list"
3636
- "watch"
37+
- apiGroups:
38+
- "rbac.authorization.k8s.io"
39+
resources:
40+
- "roles"
41+
- "rolebindings"
42+
verbs: ["*"]
43+
- apiGroups:
44+
- "batch"
45+
resources:
46+
- "cronjobs"
47+
- "jobs"
48+
verbs: ["*"]
3749
- apiGroups: [""]
3850
resources:
39-
- "secrets"
4051
- "pods"
52+
- "secrets"
53+
- "serviceaccounts"
4154
verbs: ["*"]
4255
{{- end }}
4356
{{- end }}

docs/api/ArangoMLExtension.V1Alpha1.md

Lines changed: 127 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,31 +76,31 @@ PullSecrets define Secrets used to pull Image from registry
7676

7777
### .spec.storage.name
7878

79-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L32)</sup>
79+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L46)</sup>
8080

8181
Name of the object
8282

8383
***
8484

8585
### .spec.storage.namespace
8686

87-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L35)</sup>
87+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L49)</sup>
8888

8989
Namespace of the object. Should default to the namespace of the parent object
9090

9191
***
9292

9393
### .spec.storage.uid
9494

95-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L38)</sup>
95+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L52)</sup>
9696

9797
UID keeps the information about object UID
9898

9999
## Status
100100

101101
### .status.conditions
102102

103-
Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_status.go#L28)</sup>
103+
Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/ml/v1alpha1/extension_status.go#L31)</sup>
104104

105105
Conditions specific to the entire extension
106106

@@ -124,23 +124,143 @@ ArangoPipeDatabase define Database name to be used as MetadataService Backend
124124

125125
### .status.metadataService.secret.name
126126

127-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L32)</sup>
127+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L46)</sup>
128128

129129
Name of the object
130130

131131
***
132132

133133
### .status.metadataService.secret.namespace
134134

135-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L35)</sup>
135+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L49)</sup>
136136

137137
Namespace of the object. Should default to the namespace of the parent object
138138

139139
***
140140

141141
### .status.metadataService.secret.uid
142142

143-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L38)</sup>
143+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L52)</sup>
144+
145+
UID keeps the information about object UID
146+
147+
***
148+
149+
### .status.serviceAccount.cluster.binding.name
150+
151+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L46)</sup>
152+
153+
Name of the object
154+
155+
***
156+
157+
### .status.serviceAccount.cluster.binding.namespace
158+
159+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L49)</sup>
160+
161+
Namespace of the object. Should default to the namespace of the parent object
162+
163+
***
164+
165+
### .status.serviceAccount.cluster.binding.uid
166+
167+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L52)</sup>
168+
169+
UID keeps the information about object UID
170+
171+
***
172+
173+
### .status.serviceAccount.cluster.role.name
174+
175+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L46)</sup>
176+
177+
Name of the object
178+
179+
***
180+
181+
### .status.serviceAccount.cluster.role.namespace
182+
183+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L49)</sup>
184+
185+
Namespace of the object. Should default to the namespace of the parent object
186+
187+
***
188+
189+
### .status.serviceAccount.cluster.role.uid
190+
191+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L52)</sup>
192+
193+
UID keeps the information about object UID
194+
195+
***
196+
197+
### .status.serviceAccount.name
198+
199+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L46)</sup>
200+
201+
Name of the object
202+
203+
***
204+
205+
### .status.serviceAccount.namespace
206+
207+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L49)</sup>
208+
209+
Namespace of the object. Should default to the namespace of the parent object
210+
211+
***
212+
213+
### .status.serviceAccount.namespaced.binding.name
214+
215+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L46)</sup>
216+
217+
Name of the object
218+
219+
***
220+
221+
### .status.serviceAccount.namespaced.binding.namespace
222+
223+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L49)</sup>
224+
225+
Namespace of the object. Should default to the namespace of the parent object
226+
227+
***
228+
229+
### .status.serviceAccount.namespaced.binding.uid
230+
231+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L52)</sup>
232+
233+
UID keeps the information about object UID
234+
235+
***
236+
237+
### .status.serviceAccount.namespaced.role.name
238+
239+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L46)</sup>
240+
241+
Name of the object
242+
243+
***
244+
245+
### .status.serviceAccount.namespaced.role.namespace
246+
247+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L49)</sup>
248+
249+
Namespace of the object. Should default to the namespace of the parent object
250+
251+
***
252+
253+
### .status.serviceAccount.namespaced.role.uid
254+
255+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L52)</sup>
256+
257+
UID keeps the information about object UID
258+
259+
***
260+
261+
### .status.serviceAccount.uid
262+
263+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L52)</sup>
144264

145265
UID keeps the information about object UID
146266

docs/api/ArangoMLStorage.V1Alpha1.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,47 +14,47 @@ Default Value: `false`
1414

1515
### .spec.backend.s3.caSecret.name
1616

17-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L32)</sup>
17+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L46)</sup>
1818

1919
Name of the object
2020

2121
***
2222

2323
### .spec.backend.s3.caSecret.namespace
2424

25-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L35)</sup>
25+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L49)</sup>
2626

2727
Namespace of the object. Should default to the namespace of the parent object
2828

2929
***
3030

3131
### .spec.backend.s3.caSecret.uid
3232

33-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L38)</sup>
33+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L52)</sup>
3434

3535
UID keeps the information about object UID
3636

3737
***
3838

3939
### .spec.backend.s3.credentialsSecret.name
4040

41-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L32)</sup>
41+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L46)</sup>
4242

4343
Name of the object
4444

4545
***
4646

4747
### .spec.backend.s3.credentialsSecret.namespace
4848

49-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L35)</sup>
49+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L49)</sup>
5050

5151
Namespace of the object. Should default to the namespace of the parent object
5252

5353
***
5454

5555
### .spec.backend.s3.credentialsSecret.uid
5656

57-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L38)</sup>
57+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/shared/v1/object.go#L52)</sup>
5858

5959
UID keeps the information about object UID
6060

pkg/apis/ml/v1alpha1/extension_conditions.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ const (
2727
ExtensionDeploymentFoundCondition api.ConditionType = "DeploymentFound"
2828
ExtensionBootstrapCompletedCondition api.ConditionType = "BootstrapCompleted"
2929
ExtensionMetadataServiceValidCondition api.ConditionType = "MetadataServiceValid"
30+
ExtensionServiceAccountReadyCondition api.ConditionType = "ServiceAccountReady"
3031
LicenseValidCondition api.ConditionType = "LicenseValid"
3132
)

pkg/apis/ml/v1alpha1/extension_status.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020

2121
package v1alpha1
2222

23-
import api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
23+
import (
24+
api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
25+
shared "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
26+
)
2427

2528
type ArangoMLExtensionStatus struct {
2629
// Conditions specific to the entire extension
@@ -29,4 +32,7 @@ type ArangoMLExtensionStatus struct {
2932

3033
// MetadataService keeps the MetadataService configuration
3134
MetadataService *ArangoMLExtensionStatusMetadataService `json:"metadataService,omitempty"`
35+
36+
// ServiceAccount keeps the information about ServiceAccount
37+
ServiceAccount *shared.ServiceAccount `json:"serviceAccount,omitempty"`
3238
}

pkg/apis/ml/v1alpha1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/shared/v1/object.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,22 @@ import (
2525
"k8s.io/apimachinery/pkg/types"
2626

2727
"github.com/arangodb/kube-arangodb/pkg/apis/shared"
28+
"github.com/arangodb/kube-arangodb/pkg/util"
2829
)
2930

31+
func NewObject(object meta.Object) Object {
32+
var n Object
33+
34+
n.Name = object.GetName()
35+
n.UID = util.NewType(object.GetUID())
36+
37+
if ns := object.GetNamespace(); ns != "" {
38+
n.Namespace = util.NewType(ns)
39+
}
40+
41+
return n
42+
}
43+
3044
type Object struct {
3145
// Name of the object
3246
Name string `json:"name"`
@@ -71,6 +85,30 @@ func (o *Object) GetUID() types.UID {
7185
return ""
7286
}
7387

88+
func (o *Object) Equals(obj meta.Object) bool {
89+
if o == nil {
90+
return false
91+
}
92+
93+
if o.Name != obj.GetName() {
94+
return false
95+
}
96+
97+
if n := o.Namespace; n != nil {
98+
if *n != obj.GetNamespace() {
99+
return false
100+
}
101+
}
102+
103+
if n := o.UID; n != nil {
104+
if *n != obj.GetUID() {
105+
return false
106+
}
107+
}
108+
109+
return true
110+
}
111+
74112
func (o *Object) Validate() error {
75113
if o == nil {
76114
o = &Object{}

0 commit comments

Comments
 (0)