Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Commit 0c3244f

Browse files
authored
Merge pull request #8 from brahmaroutu/fix_objectreferences
Adding a object reference that can be used as a reference to BR, BAR …
2 parents 4353934 + 092e8ea commit 0c3244f

File tree

5 files changed

+183
-78
lines changed

5 files changed

+183
-78
lines changed

Diff for: apis/objectstorage.k8s.io/v1alpha1/openapi_generated.go

+6-40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: apis/objectstorage.k8s.io/v1alpha1/types.go

+3-19
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package v1alpha1
1919
import (
2020
corev1 "k8s.io/api/core/v1"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22-
"k8s.io/apimachinery/pkg/types"
2322
)
2423

2524
type BucketRequestSpec struct {
@@ -59,7 +58,7 @@ type BucketSpec struct {
5958
AnonymousAccessMode AnonymousAccessMode `json:"anonymousAccessMode,omitempty"`
6059
// +optional
6160
BucketClassName string `json:"bucketClassName,omitempty"`
62-
BucketRequest *BucketRequestReference `json:"bucketRequest,omitempty"`
61+
BucketRequest *corev1.ObjectReference `json:"bucketRequest,omitempty"`
6362
// +listType=atomic
6463
AllowedNamespaces []string `json:"allowedNamespaces,omitempty"`
6564
Protocol Protocol `json:"protocol"`
@@ -195,9 +194,9 @@ type BucketAccessSpec struct {
195194
// +optional
196195
BucketInstanceName string `json:"bucketInstanceName,omitempty"`
197196
// +optional
198-
BucketAccessRequest string `json:"bucketAccessRequest,omitempty"`
197+
BucketAccessRequest *corev1.ObjectReference `json:"bucketAccessRequest,omitempty"`
199198
// +optional
200-
ServiceAccount string `json:"serviceAccount,omitempty"`
199+
ServiceAccount *corev1.ObjectReference `json:"serviceAccount,omitempty"`
201200
// +optional
202201
MintedSecretName string `json:"mintedSecretName,omitempty"`
203202
PolicyActionsConfigMapData string `json:"policyActionsConfigMapData,omitempty"`
@@ -279,21 +278,6 @@ type BucketAccessRequestList struct {
279278
Items []BucketAccessRequest `json:"items"`
280279
}
281280

282-
type BucketRequestReference struct {
283-
// Namespace of the referent.
284-
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
285-
// +optional
286-
Namespace string `json:"namespace,omitempty"`
287-
// Name of the referent.
288-
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
289-
// +optional
290-
Name string `json:"name,omitempty"`
291-
// UID of the referent.
292-
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids
293-
// +optional
294-
UID types.UID `json:"uid,omitempty"`
295-
}
296-
297281
func init() {
298282
SchemeBuilder.Register(&Bucket{}, &BucketList{})
299283
SchemeBuilder.Register(&BucketRequest{}, &BucketRequestList{})

Diff for: apis/objectstorage.k8s.io/v1alpha1/zz_generated.deepcopy.go

+11-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: crds/objectstorage.k8s.io_bucketaccesses.yaml

+116-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,64 @@ spec:
3535
spec:
3636
properties:
3737
bucketAccessRequest:
38-
type: string
38+
description: 'ObjectReference contains enough information to let you
39+
inspect or modify the referred object. --- New uses of this type
40+
are discouraged because of difficulty describing its usage when
41+
embedded in APIs. 1. Ignored fields. It includes many fields which
42+
are not generally honored. For instance, ResourceVersion and FieldPath
43+
are both very rarely valid in actual usage. 2. Invalid usage help. It
44+
is impossible to add specific help for individual usage. In most
45+
embedded usages, there are particular restrictions like, "must
46+
refer only to types A and B" or "UID not honored" or "name must
47+
be restricted". Those cannot be well described when embedded. 3.
48+
Inconsistent validation. Because the usages are different, the
49+
validation rules are different by usage, which makes it hard for
50+
users to predict what will happen. 4. The fields are both imprecise
51+
and overly precise. Kind is not a precise mapping to a URL. This
52+
can produce ambiguity during interpretation and require a REST
53+
mapping. In most cases, the dependency is on the group,resource
54+
tuple and the version of the actual struct is irrelevant. 5.
55+
We cannot easily change it. Because this type is embedded in many
56+
locations, updates to this type will affect numerous schemas. Don''t
57+
make new APIs embed an underspecified API type they do not control.
58+
Instead of using this type, create a locally provided and used type
59+
that is well-focused on your reference. For example, ServiceReferences
60+
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
61+
.'
62+
properties:
63+
apiVersion:
64+
description: API version of the referent.
65+
type: string
66+
fieldPath:
67+
description: 'If referring to a piece of an object instead of
68+
an entire object, this string should contain a valid JSON/Go
69+
field access statement, such as desiredState.manifest.containers[2].
70+
For example, if the object reference is to a container within
71+
a pod, this would take on a value like: "spec.containers{name}"
72+
(where "name" refers to the name of the container that triggered
73+
the event) or if no container name is specified "spec.containers[2]"
74+
(container with index 2 in this pod). This syntax is chosen
75+
only to have some well-defined way of referencing a part of
76+
an object. TODO: this design is not final and this field is
77+
subject to change in the future.'
78+
type: string
79+
kind:
80+
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
81+
type: string
82+
name:
83+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
84+
type: string
85+
namespace:
86+
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
87+
type: string
88+
resourceVersion:
89+
description: 'Specific resourceVersion to which this reference
90+
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
91+
type: string
92+
uid:
93+
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
94+
type: string
95+
type: object
3996
bucketInstanceName:
4097
type: string
4198
mintedSecretName:
@@ -51,7 +108,64 @@ spec:
51108
provisioner:
52109
type: string
53110
serviceAccount:
54-
type: string
111+
description: 'ObjectReference contains enough information to let you
112+
inspect or modify the referred object. --- New uses of this type
113+
are discouraged because of difficulty describing its usage when
114+
embedded in APIs. 1. Ignored fields. It includes many fields which
115+
are not generally honored. For instance, ResourceVersion and FieldPath
116+
are both very rarely valid in actual usage. 2. Invalid usage help. It
117+
is impossible to add specific help for individual usage. In most
118+
embedded usages, there are particular restrictions like, "must
119+
refer only to types A and B" or "UID not honored" or "name must
120+
be restricted". Those cannot be well described when embedded. 3.
121+
Inconsistent validation. Because the usages are different, the
122+
validation rules are different by usage, which makes it hard for
123+
users to predict what will happen. 4. The fields are both imprecise
124+
and overly precise. Kind is not a precise mapping to a URL. This
125+
can produce ambiguity during interpretation and require a REST
126+
mapping. In most cases, the dependency is on the group,resource
127+
tuple and the version of the actual struct is irrelevant. 5.
128+
We cannot easily change it. Because this type is embedded in many
129+
locations, updates to this type will affect numerous schemas. Don''t
130+
make new APIs embed an underspecified API type they do not control.
131+
Instead of using this type, create a locally provided and used type
132+
that is well-focused on your reference. For example, ServiceReferences
133+
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
134+
.'
135+
properties:
136+
apiVersion:
137+
description: API version of the referent.
138+
type: string
139+
fieldPath:
140+
description: 'If referring to a piece of an object instead of
141+
an entire object, this string should contain a valid JSON/Go
142+
field access statement, such as desiredState.manifest.containers[2].
143+
For example, if the object reference is to a container within
144+
a pod, this would take on a value like: "spec.containers{name}"
145+
(where "name" refers to the name of the container that triggered
146+
the event) or if no container name is specified "spec.containers[2]"
147+
(container with index 2 in this pod). This syntax is chosen
148+
only to have some well-defined way of referencing a part of
149+
an object. TODO: this design is not final and this field is
150+
subject to change in the future.'
151+
type: string
152+
kind:
153+
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
154+
type: string
155+
name:
156+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
157+
type: string
158+
namespace:
159+
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
160+
type: string
161+
resourceVersion:
162+
description: 'Specific resourceVersion to which this reference
163+
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
164+
type: string
165+
uid:
166+
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
167+
type: string
168+
type: object
55169
type: object
56170
status:
57171
properties:

0 commit comments

Comments
 (0)