@@ -12,6 +12,7 @@ import (
1212
1313 capsulev1beta1 "github.com/projectcapsule/capsule/api/v1beta1"
1414 "github.com/projectcapsule/capsule/pkg/api"
15+ "github.com/projectcapsule/capsule/pkg/api/meta"
1516)
1617
1718func (in * Tenant ) ConvertFrom (raw conversion.Hub ) error {
@@ -26,27 +27,29 @@ func (in *Tenant) ConvertFrom(raw conversion.Hub) error {
2627 }
2728
2829 in .ObjectMeta = src .ObjectMeta
29- in .Spec .Owners = make (OwnerListSpec , 0 , len (src .Spec .Owners ))
30+ in .Spec .Owners = make (api. OwnerListSpec , 0 , len (src .Spec .Owners ))
3031
3132 for index , owner := range src .Spec .Owners {
32- proxySettings := make ([]ProxySettings , 0 , len (owner .ProxyOperations ))
33+ proxySettings := make ([]api. ProxySettings , 0 , len (owner .ProxyOperations ))
3334
3435 for _ , proxyOp := range owner .ProxyOperations {
35- ops := make ([]ProxyOperation , 0 , len (proxyOp .Operations ))
36+ ops := make ([]api. ProxyOperation , 0 , len (proxyOp .Operations ))
3637
3738 for _ , op := range proxyOp .Operations {
38- ops = append (ops , ProxyOperation (op ))
39+ ops = append (ops , api . ProxyOperation (op ))
3940 }
4041
41- proxySettings = append (proxySettings , ProxySettings {
42- Kind : ProxyServiceKind (proxyOp .Kind ),
42+ proxySettings = append (proxySettings , api. ProxySettings {
43+ Kind : api . ProxyServiceKind (proxyOp .Kind ),
4344 Operations : ops ,
4445 })
4546 }
4647
47- in .Spec .Owners = append (in .Spec .Owners , OwnerSpec {
48- Kind : OwnerKind (owner .Kind ),
49- Name : owner .Name ,
48+ in .Spec .Owners = append (in .Spec .Owners , api.OwnerSpec {
49+ UserSpec : api.UserSpec {
50+ Kind : api .OwnerKind (owner .Kind ),
51+ Name : owner .Name ,
52+ },
5053 ClusterRoles : owner .GetRoles (* src , index ),
5154 ProxyOperations : proxySettings ,
5255 })
@@ -59,28 +62,28 @@ func (in *Tenant) ConvertFrom(raw conversion.Hub) error {
5962
6063 in .Spec .NamespaceOptions .AdditionalMetadata = nsOpts .AdditionalMetadata
6164
62- if value , found := annotations [api .ForbiddenNamespaceLabelsAnnotation ]; found {
65+ if value , found := annotations [meta .ForbiddenNamespaceLabelsAnnotation ]; found {
6366 in .Spec .NamespaceOptions .ForbiddenLabels .Exact = strings .Split (value , "," )
6467
65- delete (annotations , api .ForbiddenNamespaceLabelsAnnotation )
68+ delete (annotations , meta .ForbiddenNamespaceLabelsAnnotation )
6669 }
6770
68- if value , found := annotations [api .ForbiddenNamespaceLabelsRegexpAnnotation ]; found {
71+ if value , found := annotations [meta .ForbiddenNamespaceLabelsRegexpAnnotation ]; found {
6972 in .Spec .NamespaceOptions .ForbiddenLabels .Regex = value
7073
71- delete (annotations , api .ForbiddenNamespaceLabelsRegexpAnnotation )
74+ delete (annotations , meta .ForbiddenNamespaceLabelsRegexpAnnotation )
7275 }
7376
74- if value , found := annotations [api .ForbiddenNamespaceAnnotationsAnnotation ]; found {
77+ if value , found := annotations [meta .ForbiddenNamespaceAnnotationsAnnotation ]; found {
7578 in .Spec .NamespaceOptions .ForbiddenAnnotations .Exact = strings .Split (value , "," )
7679
77- delete (annotations , api .ForbiddenNamespaceAnnotationsAnnotation )
80+ delete (annotations , meta .ForbiddenNamespaceAnnotationsAnnotation )
7881 }
7982
80- if value , found := annotations [api .ForbiddenNamespaceAnnotationsRegexpAnnotation ]; found {
83+ if value , found := annotations [meta .ForbiddenNamespaceAnnotationsRegexpAnnotation ]; found {
8184 in .Spec .NamespaceOptions .ForbiddenAnnotations .Regex = value
8285
83- delete (annotations , api .ForbiddenNamespaceAnnotationsRegexpAnnotation )
86+ delete (annotations , meta .ForbiddenNamespaceAnnotationsRegexpAnnotation )
8487 }
8588 }
8689
@@ -144,10 +147,10 @@ func (in *Tenant) ConvertFrom(raw conversion.Hub) error {
144147 in .Spec .Cordoned = value
145148 }
146149
147- if _ , found := annotations [api .ProtectedTenantAnnotation ]; found {
150+ if _ , found := annotations [meta .ProtectedTenantAnnotation ]; found {
148151 in .Spec .PreventDeletion = true
149152
150- delete (annotations , api .ProtectedTenantAnnotation )
153+ delete (annotations , meta .ProtectedTenantAnnotation )
151154 }
152155
153156 in .SetAnnotations (annotations )
@@ -215,19 +218,19 @@ func (in *Tenant) ConvertTo(raw conversion.Hub) error {
215218 dst .Spec .NamespaceOptions .AdditionalMetadata = nsOpts .AdditionalMetadata
216219
217220 if exact := nsOpts .ForbiddenAnnotations .Exact ; len (exact ) > 0 {
218- annotations [api .ForbiddenNamespaceAnnotationsAnnotation ] = strings .Join (exact , "," )
221+ annotations [meta .ForbiddenNamespaceAnnotationsAnnotation ] = strings .Join (exact , "," )
219222 }
220223
221224 if regex := nsOpts .ForbiddenAnnotations .Regex ; len (regex ) > 0 {
222- annotations [api .ForbiddenNamespaceAnnotationsRegexpAnnotation ] = regex
225+ annotations [meta .ForbiddenNamespaceAnnotationsRegexpAnnotation ] = regex
223226 }
224227
225228 if exact := nsOpts .ForbiddenLabels .Exact ; len (exact ) > 0 {
226- annotations [api .ForbiddenNamespaceLabelsAnnotation ] = strings .Join (exact , "," )
229+ annotations [meta .ForbiddenNamespaceLabelsAnnotation ] = strings .Join (exact , "," )
227230 }
228231
229232 if regex := nsOpts .ForbiddenLabels .Regex ; len (regex ) > 0 {
230- annotations [api .ForbiddenNamespaceLabelsRegexpAnnotation ] = regex
233+ annotations [meta .ForbiddenNamespaceLabelsRegexpAnnotation ] = regex
231234 }
232235 }
233236
@@ -264,7 +267,7 @@ func (in *Tenant) ConvertTo(raw conversion.Hub) error {
264267 }
265268
266269 if in .Spec .PreventDeletion {
267- annotations [api .ProtectedTenantAnnotation ] = "true" //nolint:goconst
270+ annotations [meta .ProtectedTenantAnnotation ] = "true" //nolint:goconst
268271 }
269272
270273 if in .Spec .Cordoned {
0 commit comments