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

Commit b21b536

Browse files
authored
Clarify documentation used by 'kubectl explain' (#1008)
Summary of changes: - Expands acronyms for the sake of clarity - Uses descriptive mood when possible - Clarifies some difficult-to-understand statements Signed-off-by: Andy Sadler <[email protected]>
1 parent a1a8d12 commit b21b536

File tree

3 files changed

+114
-99
lines changed

3 files changed

+114
-99
lines changed

apis/binding/v1alpha1/servicebinding_types.go

+60-47
Original file line numberDiff line numberDiff line change
@@ -28,73 +28,85 @@ var templates = map[string]string{
2828
"lowercase": "{{ .name | lower }}",
2929
}
3030

31-
// ServiceBindingSpec defines the desired state of ServiceBinding
31+
// ServiceBindingSpec defines the desired state of ServiceBinding.
3232
type ServiceBindingSpec struct {
33-
// MountPath is the path inside app container where bindings will be mounted
34-
// If `SERVICE_BINDING_ROOT` env var is present, mountPath is ignored.
35-
// If `SERVICE_BINDING_ROOT` is absent and mountPath is present, set `SERVICE_BINDING_ROOT` as mountPath value
36-
// If `SERVICE_BINDING_ROOT` is absent but mounthPath is absent, set SERVICE_BINDING_ROOT as `/bindings`
37-
// When mountPath is used, the file will be mounted directly under that directory
38-
// Otherwise it will be under `SERVICE_BINDING_ROOT`/<SERVICE-BINDING-NAME>
33+
// MountPath specifies the path inside the app container where bindings
34+
// will be mounted. The environment variable `SERVICE_BINDING_ROOT`
35+
// has higher precedence than this option, and setting it within an
36+
// application to be bound will cause MountPath to be ignored and will
37+
// always mount resources as files. If it isn't set, then it is
38+
// automatically set to the value of MountPath. If neither MountPath
39+
// nor `SERVICE_BINDING_ROOT` are set, this field defaults to
40+
// `/bindings`, and `SERVICE_BINDING_ROOT` is also set. This results
41+
// in the file being mounted under the directory specified.
3942
// +optional
4043
MountPath string `json:"mountPath,omitempty"`
4144

42-
// NamingStrategy defines custom string template for preparing binding names.
43-
// It can be pre-defined strategies(i.e none,uppercase), in case strategy provided in this field isn't defined
44-
// we are going to treat the value as a custom template and prepare binding names accordingly.
45+
// NamingStrategy defines custom string template for preparing binding
46+
// names. It can be set to pre-defined strategies: `none`,
47+
// `lowercase`, or `uppercase`. Otherwise, it is treated as a custom
48+
// go template, and it is handled accordingly.
4549
// +optional
4650
NamingStrategy string `json:"namingStrategy,omitempty"`
4751

48-
// Custom mappings
52+
// Mappings specifies custom mappings.
4953
// +optional
5054
Mappings []Mapping `json:"mappings,omitempty"`
5155

52-
// Services is used to identify multiple backing services.
56+
// Services indicates the backing services to be connected to by an
57+
// application. At least one service must be specified.
5358
// +kubebuilder:validation:MinItems:=1
5459
Services []Service `json:"services"`
5560

56-
// Application is used to identify the application connecting to the
57-
// backing service operator.
61+
// Application identifies the application connecting to the backing
62+
// service.
5863
Application Application `json:"application"`
5964

60-
// DetectBindingResources is flag used to bind all non-bindable variables from
61-
// different subresources owned by backing operator CR.
65+
// DetectBindingResources is a flag that, when set to true, will cause
66+
// SBO to search for binding information in the owned resources of the
67+
// specified services. If this binding information exists, then the
68+
// application is bound to these subresources.
6269
// +optional
6370
DetectBindingResources bool `json:"detectBindingResources,omitempty"`
6471

65-
// BindAsFiles makes available the binding values as files in the application's container
66-
// See MountPath attribute description for more details.
72+
// BindAsFiles makes the binding values available as files in the
73+
// application's container. See the MountPath attribute description
74+
// for more details.
6775
// +optional
6876
// +kubebuilder:default:=true
6977
BindAsFiles bool `json:"bindAsFiles"`
7078
}
7179

72-
// ServiceBindingMapping defines a new binding from set of existing bindings
80+
// ServiceBindingMapping defines a new binding from a set of existing bindings.
7381
type Mapping struct {
74-
// Name is the name of new binding
82+
// Name is the name of new binding.
7583
Name string `json:"name"`
76-
// Value is a template which will be rendered and ibjected into the application
84+
85+
// Value specificies a go template that will be rendered and injected
86+
// into the application.
7787
Value string `json:"value"`
7888
}
7989

80-
// ServiceBindingStatus defines the observed state of ServiceBinding
90+
// ServiceBindingStatus defines the observed state of ServiceBinding.
8191
// +k8s:openapi-gen=true
8292
type ServiceBindingStatus struct {
83-
// Conditions describes the state of the operator's reconciliation functionality.
93+
// Conditions describes the state of the operator's reconciliation
94+
// functionality.
8495
// +patchMergeKey=type
8596
// +patchStrategy=merge
8697
// +listType=map
8798
// +listMapKey=type
8899
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
89-
// Secret is the name of the intermediate secret
100+
101+
// Secret indicates the name of the binding secret.
90102
Secret string `json:"secret"`
91103

92-
// Application defines the application workloads to which the binding secret has
93-
// injected
104+
// Applications defines the application workloads to which the binding
105+
// secret has been injected.
94106
Applications []Ref `json:"applications,omitempty"`
95107
}
96108

97-
// Object reference in the same namespace
109+
// Ref identifies an object reference in the same namespace.
98110
// +mapType=atomic
99111
type Ref struct {
100112

@@ -116,58 +128,59 @@ type Ref struct {
116128
Name string `json:"name,omitempty"`
117129
}
118130

119-
// Object reference in some namespace
131+
// NamespacedRef is an object reference in some namespace.
120132
type NamespacedRef struct {
121133
Ref `json:",inline"`
122134

123-
// Namespace of the referent.
124-
// if empty assumes the same namespace as ServiceBinding
135+
// Namespace of the referent. If unspecified, assumes the same namespace as
136+
// ServiceBinding.
125137
// +optional
126138
Namespace *string `json:"namespace,omitempty"`
127139
}
128140

129-
// Service defines the selector based on resource name, version, and resource kind
141+
// Service defines the selector based on resource name, version, and resource kind.
130142
type Service struct {
131143
NamespacedRef `json:",inline"`
132144

133145
Id *string `json:"id,omitempty"`
134146
}
135147

136-
// Application defines the selector based on labels and GVR
148+
// Application defines the selector based on labels and group version resource.
137149
type Application struct {
138150
Ref `json:",inline"`
151+
139152
// +optional
140153
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
141154

142155
// BindingPath refers to the paths in the application workload's schema
143-
// where the binding workload would be referenced.
144-
// If BindingPath is not specified the default path locations is going to
145-
// be used. The default location for ContainersPath is
146-
// going to be: "spec.template.spec.containers" and if SecretPath
147-
// is not specified, the name of the secret object is not going
148-
// to be specified.
156+
// where the binding workload would be referenced. If BindingPath is
157+
// not specified, then the default path locations are used. The
158+
// default location for ContainersPath is
159+
// "spec.template.spec.containers". If SecretPath is not specified,
160+
// then the name of the secret object does not need to be specified.
149161
// +optional
150162
BindingPath *BindingPath `json:"bindingPath,omitempty"`
151163
}
152164

153165
// BindingPath defines the path to the field where the binding would be
154-
// embedded in the workload
166+
// embedded in the workload.
155167
type BindingPath struct {
156-
// ContainersPath defines the path to the corev1.Containers reference
168+
// ContainersPath defines the path to the corev1.Containers reference.
157169
// If BindingPath is not specified, the default location is
158-
// going to be: "spec.template.spec.containers"
170+
// "spec.template.spec.containers".
159171
// +optional
160172
ContainersPath string `json:"containersPath"`
161173

162-
// SecretPath defines the path to a string field where
163-
// the name of the secret object is going to be assigned.
164-
// Note: The name of the secret object is same as that of the name of SBR CR (metadata.name)
174+
// SecretPath defines the path to a string field where the name of the
175+
// secret object is going to be assigned. Note: The name of the secret
176+
// object is same as that of the name of service binding custom resource
177+
// (metadata.name).
165178
// +optional
166179
SecretPath string `json:"secretPath"`
167180
}
168181

169-
// ServiceBinding expresses intent to bind an operator-backed service with
170-
// an application workload.
182+
// ServiceBinding expresses intent to bind a service with an application
183+
// workload.
171184
// +kubebuilder:subresource:status
172185
// +operator-sdk:gen-csv:customresourcedefinitions.displayName="Service Binding"
173186
// +kubebuilder:resource:path=servicebindings,shortName=sbr;sbrs
@@ -182,7 +195,7 @@ type ServiceBinding struct {
182195

183196
// +kubebuilder:object:root=true
184197

185-
// ServiceBindingList contains a list of ServiceBinding
198+
// ServiceBindingList contains a list of ServiceBinding.
186199
type ServiceBindingList struct {
187200
metav1.TypeMeta `json:",inline"`
188201
metav1.ListMeta `json:"metadata,omitempty"`

config/crd/bases/binding.operators.coreos.com_servicebindings.yaml

+52-50
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ spec:
2222
- name: v1alpha1
2323
schema:
2424
openAPIV3Schema:
25-
description: ServiceBinding expresses intent to bind an operator-backed service
26-
with an application workload.
25+
description: ServiceBinding expresses intent to bind a service with an application
26+
workload.
2727
properties:
2828
apiVersion:
2929
description: 'APIVersion defines the versioned schema of this representation
@@ -38,31 +38,30 @@ spec:
3838
metadata:
3939
type: object
4040
spec:
41-
description: ServiceBindingSpec defines the desired state of ServiceBinding
41+
description: ServiceBindingSpec defines the desired state of ServiceBinding.
4242
properties:
4343
application:
44-
description: Application is used to identify the application connecting
45-
to the backing service operator.
44+
description: Application identifies the application connecting to
45+
the backing service.
4646
properties:
4747
bindingPath:
48-
description: 'BindingPath refers to the paths in the application
49-
workload''s schema where the binding workload would be referenced.
50-
If BindingPath is not specified the default path locations is
51-
going to be used. The default location for ContainersPath is
52-
going to be: "spec.template.spec.containers" and if SecretPath
53-
is not specified, the name of the secret object is not going
54-
to be specified.'
48+
description: BindingPath refers to the paths in the application
49+
workload's schema where the binding workload would be referenced. If
50+
BindingPath is not specified, then the default path locations
51+
are used. The default location for ContainersPath is "spec.template.spec.containers". If
52+
SecretPath is not specified, then the name of the secret object
53+
does not need to be specified.
5554
properties:
5655
containersPath:
57-
description: 'ContainersPath defines the path to the corev1.Containers
58-
reference If BindingPath is not specified, the default location
59-
is going to be: "spec.template.spec.containers"'
56+
description: ContainersPath defines the path to the corev1.Containers
57+
reference. If BindingPath is not specified, the default
58+
location is "spec.template.spec.containers".
6059
type: string
6160
secretPath:
6261
description: 'SecretPath defines the path to a string field
63-
where the name of the secret object is going to be assigned.
64-
Note: The name of the secret object is same as that of the
65-
name of SBR CR (metadata.name)'
62+
where the name of the secret object is going to be assigned. Note:
63+
The name of the secret object is same as that of the name
64+
of service binding custom resource (metadata.name).'
6665
type: string
6766
type: object
6867
group:
@@ -133,54 +132,57 @@ spec:
133132
type: object
134133
bindAsFiles:
135134
default: true
136-
description: BindAsFiles makes available the binding values as files
137-
in the application's container See MountPath attribute description
135+
description: BindAsFiles makes the binding values available as files
136+
in the application's container. See the MountPath attribute description
138137
for more details.
139138
type: boolean
140139
detectBindingResources:
141-
description: DetectBindingResources is flag used to bind all non-bindable
142-
variables from different subresources owned by backing operator
143-
CR.
140+
description: DetectBindingResources is a flag that, when set to true,
141+
will cause SBO to search for binding information in the owned resources
142+
of the specified services. If this binding information exists,
143+
then the application is bound to these subresources.
144144
type: boolean
145145
mappings:
146-
description: Custom mappings
146+
description: Mappings specifies custom mappings.
147147
items:
148-
description: ServiceBindingMapping defines a new binding from set
149-
of existing bindings
148+
description: ServiceBindingMapping defines a new binding from a
149+
set of existing bindings.
150150
properties:
151151
name:
152-
description: Name is the name of new binding
152+
description: Name is the name of new binding.
153153
type: string
154154
value:
155-
description: Value is a template which will be rendered and
156-
ibjected into the application
155+
description: Value specificies a go template that will be rendered
156+
and injected into the application.
157157
type: string
158158
required:
159159
- name
160160
- value
161161
type: object
162162
type: array
163163
mountPath:
164-
description: MountPath is the path inside app container where bindings
165-
will be mounted If `SERVICE_BINDING_ROOT` env var is present, mountPath
166-
is ignored. If `SERVICE_BINDING_ROOT` is absent and mountPath is
167-
present, set `SERVICE_BINDING_ROOT` as mountPath value If `SERVICE_BINDING_ROOT`
168-
is absent but mounthPath is absent, set SERVICE_BINDING_ROOT as
169-
`/bindings` When mountPath is used, the file will be mounted directly
170-
under that directory Otherwise it will be under `SERVICE_BINDING_ROOT`/<SERVICE-BINDING-NAME>
164+
description: MountPath specifies the path inside the app container
165+
where bindings will be mounted. The environment variable `SERVICE_BINDING_ROOT`
166+
has higher precedence than this option, and setting it within an
167+
application to be bound will cause MountPath to be ignored and will
168+
always mount resources as files. If it isn't set, then it is automatically
169+
set to the value of MountPath. If neither MountPath nor `SERVICE_BINDING_ROOT`
170+
are set, this field defaults to `/bindings`, and `SERVICE_BINDING_ROOT`
171+
is also set. This results in the file being mounted under the directory
172+
specified.
171173
type: string
172174
namingStrategy:
173-
description: NamingStrategy defines custom string template for preparing
174-
binding names. It can be pre-defined strategies(i.e none,uppercase),
175-
in case strategy provided in this field isn't defined we are going
176-
to treat the value as a custom template and prepare binding names
177-
accordingly.
175+
description: 'NamingStrategy defines custom string template for preparing
176+
binding names. It can be set to pre-defined strategies: `none`,
177+
`lowercase`, or `uppercase`. Otherwise, it is treated as a custom
178+
go template, and it is handled accordingly.'
178179
type: string
179180
services:
180-
description: Services is used to identify multiple backing services.
181+
description: Services indicates the backing services to be connected
182+
to by an application. At least one service must be specified.
181183
items:
182184
description: Service defines the selector based on resource name,
183-
version, and resource kind
185+
version, and resource kind.
184186
properties:
185187
group:
186188
description: Group of the referent.
@@ -194,8 +196,8 @@ spec:
194196
description: Name of the referent.
195197
type: string
196198
namespace:
197-
description: Namespace of the referent. if empty assumes the
198-
same namespace as ServiceBinding
199+
description: Namespace of the referent. If unspecified, assumes
200+
the same namespace as ServiceBinding.
199201
type: string
200202
resource:
201203
description: Resource of the referent.
@@ -214,13 +216,13 @@ spec:
214216
- services
215217
type: object
216218
status:
217-
description: ServiceBindingStatus defines the observed state of ServiceBinding
219+
description: ServiceBindingStatus defines the observed state of ServiceBinding.
218220
properties:
219221
applications:
220-
description: Application defines the application workloads to which
221-
the binding secret has injected
222+
description: Applications defines the application workloads to which
223+
the binding secret has been injected.
222224
items:
223-
description: Object reference in the same namespace
225+
description: Ref identifies an object reference in the same namespace.
224226
properties:
225227
group:
226228
description: Group of the referent.
@@ -317,7 +319,7 @@ spec:
317319
- type
318320
x-kubernetes-list-type: map
319321
secret:
320-
description: Secret is the name of the intermediate secret
322+
description: Secret indicates the name of the binding secret.
321323
type: string
322324
required:
323325
- secret

config/manager/kustomization.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ configMapGenerator:
1111
apiVersion: kustomize.config.k8s.io/v1beta1
1212
kind: Kustomization
1313
images:
14-
- digest: latest
15-
name: controller
14+
- name: controller
1615
newName: quay.io/redhat-developer/servicebinding-operator
16+
newTag: e4860168

0 commit comments

Comments
 (0)