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

Commit 2a2c1b7

Browse files
committed
Adding a object reference that can be used as a reference to BR, BAR and SA
1 parent 4353934 commit 2a2c1b7

File tree

5 files changed

+118
-74
lines changed

5 files changed

+118
-74
lines changed

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

+5-38
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

+2-18
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,7 +194,7 @@ 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
200199
ServiceAccount string `json:"serviceAccount,omitempty"`
201200
// +optional
@@ -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

+6-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

+58-1
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:

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

+47
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,60 @@ spec:
5353
bucketClassName:
5454
type: string
5555
bucketRequest:
56+
description: 'ObjectReference contains enough information to let you
57+
inspect or modify the referred object. --- New uses of this type
58+
are discouraged because of difficulty describing its usage when
59+
embedded in APIs. 1. Ignored fields. It includes many fields which
60+
are not generally honored. For instance, ResourceVersion and FieldPath
61+
are both very rarely valid in actual usage. 2. Invalid usage help. It
62+
is impossible to add specific help for individual usage. In most
63+
embedded usages, there are particular restrictions like, "must
64+
refer only to types A and B" or "UID not honored" or "name must
65+
be restricted". Those cannot be well described when embedded. 3.
66+
Inconsistent validation. Because the usages are different, the
67+
validation rules are different by usage, which makes it hard for
68+
users to predict what will happen. 4. The fields are both imprecise
69+
and overly precise. Kind is not a precise mapping to a URL. This
70+
can produce ambiguity during interpretation and require a REST
71+
mapping. In most cases, the dependency is on the group,resource
72+
tuple and the version of the actual struct is irrelevant. 5.
73+
We cannot easily change it. Because this type is embedded in many
74+
locations, updates to this type will affect numerous schemas. Don''t
75+
make new APIs embed an underspecified API type they do not control.
76+
Instead of using this type, create a locally provided and used type
77+
that is well-focused on your reference. For example, ServiceReferences
78+
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
79+
.'
5680
properties:
81+
apiVersion:
82+
description: API version of the referent.
83+
type: string
84+
fieldPath:
85+
description: 'If referring to a piece of an object instead of
86+
an entire object, this string should contain a valid JSON/Go
87+
field access statement, such as desiredState.manifest.containers[2].
88+
For example, if the object reference is to a container within
89+
a pod, this would take on a value like: "spec.containers{name}"
90+
(where "name" refers to the name of the container that triggered
91+
the event) or if no container name is specified "spec.containers[2]"
92+
(container with index 2 in this pod). This syntax is chosen
93+
only to have some well-defined way of referencing a part of
94+
an object. TODO: this design is not final and this field is
95+
subject to change in the future.'
96+
type: string
97+
kind:
98+
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
99+
type: string
57100
name:
58101
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
59102
type: string
60103
namespace:
61104
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
62105
type: string
106+
resourceVersion:
107+
description: 'Specific resourceVersion to which this reference
108+
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
109+
type: string
63110
uid:
64111
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
65112
type: string

0 commit comments

Comments
 (0)