Skip to content

Commit a63e989

Browse files
committed
feat(s3user): allow define key fields to store credentials in secret
1 parent 314d637 commit a63e989

File tree

12 files changed

+211
-161
lines changed

12 files changed

+211
-161
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
184184

185185
## Tool Versions
186186
KUSTOMIZE_VERSION ?= v3.8.7
187-
CONTROLLER_TOOLS_VERSION ?= v0.11.1
187+
CONTROLLER_TOOLS_VERSION ?= v0.14.0
188188

189189
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
190190
.PHONY: kustomize

api/v1alpha1/bucket_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type BucketSpec struct {
4343

4444
// BucketStatus defines the observed state of Bucket
4545
type BucketStatus struct {
46-
// Status management using Conditions.
46+
// Status management using Conditions.
4747
// See also : https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
4848
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
4949
}

api/v1alpha1/policy_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type PolicySpec struct {
3939

4040
// PolicyStatus defines the observed state of Policy
4141
type PolicyStatus struct {
42-
// Status management using Conditions.
42+
// Status management using Conditions.
4343
// See also : https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
4444
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
4545
}

api/v1alpha1/s3user_types.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,20 @@ type S3UserSpec struct {
3737
// SecretName associated to the S3User
3838
// +kubebuilder:validation:Optional
3939
SecretName string `json:"secretName"`
40+
41+
// SecretFieldNameAccessKey associated to the S3User
42+
// Allow overridden the default key to store the accessKey value in the secret
43+
// +kubebuilder:validation:Optional
44+
// +kubebuilder:validation:Type="string"
45+
// +kubebuilder:default="accessKey"
46+
SecretFieldNameAccessKey string `json:"secretFieldNameAccessKey,omitempty"`
47+
48+
// SecretFieldNameSecretKey associated to the S3User
49+
// Allow overridden the default key to store the secretKey value in the secret
50+
// +kubebuilder:validation:Optional
51+
// +kubebuilder:validation:Type="string"
52+
// +kubebuilder:default="secretKey"
53+
SecretFieldNameSecretKey string `json:"secretFieldNameSecretKey,omitempty"`
4054
}
4155

4256
// S3UserStatus defines the observed state of S3User

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/s3.onyxia.sh_buckets.yaml

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.11.1
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.14.0
87
name: buckets.s3.onyxia.sh
98
spec:
109
group: s3.onyxia.sh
@@ -21,14 +20,19 @@ spec:
2120
description: Bucket is the Schema for the buckets API
2221
properties:
2322
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'
23+
description: |-
24+
APIVersion defines the versioned schema of this representation of an object.
25+
Servers should convert recognized schemas to the latest internal value, and
26+
may reject unrecognized values.
27+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
2728
type: string
2829
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'
30+
description: |-
31+
Kind is a string value representing the REST resource this object represents.
32+
Servers may infer this from the endpoint the client submits requests to.
33+
Cannot be updated.
34+
In CamelCase.
35+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3236
type: string
3337
metadata:
3438
type: object
@@ -65,45 +69,47 @@ spec:
6569
description: BucketStatus defines the observed state of Bucket
6670
properties:
6771
conditions:
68-
description: 'Status management using Conditions. See also : https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties'
72+
description: |-
73+
Status management using Conditions.
74+
See also : https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
6975
items:
7076
description: "Condition contains details for one aspect of the current
71-
state of this API Resource. --- This struct is intended for direct
72-
use as an array at the field path .status.conditions. For example,
73-
\n type FooStatus struct{ // Represents the observations of a
74-
foo's current state. // Known .status.conditions.type are: \"Available\",
75-
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
76-
// +listType=map // +listMapKey=type Conditions []metav1.Condition
77-
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
78-
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
77+
state of this API Resource.\n---\nThis struct is intended for
78+
direct use as an array at the field path .status.conditions. For
79+
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
80+
observations of a foo's current state.\n\t // Known .status.conditions.type
81+
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
82+
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
83+
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
84+
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
85+
\ // other fields\n\t}"
7986
properties:
8087
lastTransitionTime:
81-
description: lastTransitionTime is the last time the condition
82-
transitioned from one status to another. This should be when
83-
the underlying condition changed. If that is not known, then
84-
using the time when the API field changed is acceptable.
88+
description: |-
89+
lastTransitionTime is the last time the condition transitioned from one status to another.
90+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
8591
format: date-time
8692
type: string
8793
message:
88-
description: message is a human readable message indicating
89-
details about the transition. This may be an empty string.
94+
description: |-
95+
message is a human readable message indicating details about the transition.
96+
This may be an empty string.
9097
maxLength: 32768
9198
type: string
9299
observedGeneration:
93-
description: observedGeneration represents the .metadata.generation
94-
that the condition was set based upon. For instance, if .metadata.generation
95-
is currently 12, but the .status.conditions[x].observedGeneration
96-
is 9, the condition is out of date with respect to the current
97-
state of the instance.
100+
description: |-
101+
observedGeneration represents the .metadata.generation that the condition was set based upon.
102+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
103+
with respect to the current state of the instance.
98104
format: int64
99105
minimum: 0
100106
type: integer
101107
reason:
102-
description: reason contains a programmatic identifier indicating
103-
the reason for the condition's last transition. Producers
104-
of specific condition types may define expected values and
105-
meanings for this field, and whether the values are considered
106-
a guaranteed API. The value should be a CamelCase string.
108+
description: |-
109+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
110+
Producers of specific condition types may define expected values and meanings for this field,
111+
and whether the values are considered a guaranteed API.
112+
The value should be a CamelCase string.
107113
This field may not be empty.
108114
maxLength: 1024
109115
minLength: 1
@@ -117,11 +123,12 @@ spec:
117123
- Unknown
118124
type: string
119125
type:
120-
description: type of condition in CamelCase or in foo.example.com/CamelCase.
121-
--- Many .condition.type values are consistent across resources
122-
like Available, but because arbitrary conditions can be useful
123-
(see .node.status.conditions), the ability to deconflict is
124-
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
126+
description: |-
127+
type of condition in CamelCase or in foo.example.com/CamelCase.
128+
---
129+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
130+
useful (see .node.status.conditions), the ability to deconflict is important.
131+
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
125132
maxLength: 316
126133
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
127134
type: string

config/crd/bases/s3.onyxia.sh_paths.yaml

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.11.1
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.14.0
87
name: paths.s3.onyxia.sh
98
spec:
109
group: s3.onyxia.sh
@@ -21,14 +20,19 @@ spec:
2120
description: Path is the Schema for the paths API
2221
properties:
2322
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'
23+
description: |-
24+
APIVersion defines the versioned schema of this representation of an object.
25+
Servers should convert recognized schemas to the latest internal value, and
26+
may reject unrecognized values.
27+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
2728
type: string
2829
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'
30+
description: |-
31+
Kind is a string value representing the REST resource this object represents.
32+
Servers may infer this from the endpoint the client submits requests to.
33+
Cannot be updated.
34+
In CamelCase.
35+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3236
type: string
3337
metadata:
3438
type: object
@@ -50,45 +54,47 @@ spec:
5054
description: PathStatus defines the observed state of Path
5155
properties:
5256
conditions:
53-
description: 'Status management using Conditions. See also : https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties'
57+
description: |-
58+
Status management using Conditions.
59+
See also : https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
5460
items:
5561
description: "Condition contains details for one aspect of the current
56-
state of this API Resource. --- This struct is intended for direct
57-
use as an array at the field path .status.conditions. For example,
58-
\n type FooStatus struct{ // Represents the observations of a
59-
foo's current state. // Known .status.conditions.type are: \"Available\",
60-
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
61-
// +listType=map // +listMapKey=type Conditions []metav1.Condition
62-
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
63-
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
62+
state of this API Resource.\n---\nThis struct is intended for
63+
direct use as an array at the field path .status.conditions. For
64+
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
65+
observations of a foo's current state.\n\t // Known .status.conditions.type
66+
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
67+
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
68+
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
69+
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
70+
\ // other fields\n\t}"
6471
properties:
6572
lastTransitionTime:
66-
description: lastTransitionTime is the last time the condition
67-
transitioned from one status to another. This should be when
68-
the underlying condition changed. If that is not known, then
69-
using the time when the API field changed is acceptable.
73+
description: |-
74+
lastTransitionTime is the last time the condition transitioned from one status to another.
75+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
7076
format: date-time
7177
type: string
7278
message:
73-
description: message is a human readable message indicating
74-
details about the transition. This may be an empty string.
79+
description: |-
80+
message is a human readable message indicating details about the transition.
81+
This may be an empty string.
7582
maxLength: 32768
7683
type: string
7784
observedGeneration:
78-
description: observedGeneration represents the .metadata.generation
79-
that the condition was set based upon. For instance, if .metadata.generation
80-
is currently 12, but the .status.conditions[x].observedGeneration
81-
is 9, the condition is out of date with respect to the current
82-
state of the instance.
85+
description: |-
86+
observedGeneration represents the .metadata.generation that the condition was set based upon.
87+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
88+
with respect to the current state of the instance.
8389
format: int64
8490
minimum: 0
8591
type: integer
8692
reason:
87-
description: reason contains a programmatic identifier indicating
88-
the reason for the condition's last transition. Producers
89-
of specific condition types may define expected values and
90-
meanings for this field, and whether the values are considered
91-
a guaranteed API. The value should be a CamelCase string.
93+
description: |-
94+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
95+
Producers of specific condition types may define expected values and meanings for this field,
96+
and whether the values are considered a guaranteed API.
97+
The value should be a CamelCase string.
9298
This field may not be empty.
9399
maxLength: 1024
94100
minLength: 1
@@ -102,11 +108,12 @@ spec:
102108
- Unknown
103109
type: string
104110
type:
105-
description: type of condition in CamelCase or in foo.example.com/CamelCase.
106-
--- Many .condition.type values are consistent across resources
107-
like Available, but because arbitrary conditions can be useful
108-
(see .node.status.conditions), the ability to deconflict is
109-
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
111+
description: |-
112+
type of condition in CamelCase or in foo.example.com/CamelCase.
113+
---
114+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
115+
useful (see .node.status.conditions), the ability to deconflict is important.
116+
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
110117
maxLength: 316
111118
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
112119
type: string

0 commit comments

Comments
 (0)