Skip to content

Commit e02b9e9

Browse files
authored
Rename "application" to "workload" (vmware-tanzu#169)
See servicebinding/spec#148 Signed-off-by: Scott Andrews <[email protected]>
1 parent cb8a04f commit e02b9e9

30 files changed

+306
-306
lines changed

.github/workflows/ci.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ jobs:
213213
214214
kapp deploy -a spring-petclinic-db -f samples/spring-petclinic/service.yaml -y
215215
kapp deploy -a spring-petclinic-binding -f samples/spring-petclinic/service-binding.yaml -y
216-
kapp deploy -a spring-petclinic -f samples/spring-petclinic/application.yaml -y
216+
kapp deploy -a spring-petclinic -f samples/spring-petclinic/workload.yaml -y
217217
- name: Collect diagnostics
218218
run: |
219219
echo "##[group]Describe nodes"
@@ -238,7 +238,7 @@ jobs:
238238
kubectl get deployment spring-petclinic -oyaml
239239
echo "##[endgroup]"
240240
echo "##[group]Petclinic logs"
241-
kubectl logs -l app=spring-petclinic -c application --tail 1000
241+
kubectl logs -l app=spring-petclinic -c workload --tail 1000
242242
echo "##[endgroup]"
243243
echo "##[group]MySQL deployment"
244244
kubectl get deployment spring-petclinic-db -oyaml

README.md

+12-12
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
[![codecov](https://codecov.io/gh/vmware-labs/service-bindings/branch/main/graph/badge.svg)](https://codecov.io/gh/vmware-labs/service-bindings)
88

99

10-
Service Bindings for Kubernetes implements the [Service Binding Specification for Kubernetes](https://github.com/k8s-service-bindings/spec). We are tracking changes to the spec as it approaches a stable release (currently targeting [RC2++](https://github.com/k8s-service-bindings/spec/tree/04b99a3b9215af59e060359848de9622e909ff9e)). Backwards and forwards compatibility should not be expected for alpha versioned resources.
10+
Service Bindings for Kubernetes implements the [Service Binding Specification for Kubernetes](https://github.com/k8s-service-bindings/spec). We are tracking changes to the spec as it approaches a stable release (currently targeting [RC2++](https://github.com/k8s-service-bindings/spec/tree/e874935880b120cfd809d691b0fee5baca023a2e)). Backwards and forwards compatibility should not be expected for alpha versioned resources.
1111

1212
This implementation provides support for:
13-
- [Provisioned Service](https://github.com/k8s-service-bindings/spec/tree/04b99a3b9215af59e060359848de9622e909ff9e#provisioned-service)
14-
- [Application Projection](https://github.com/k8s-service-bindings/spec/tree/04b99a3b9215af59e060359848de9622e909ff9e#application-projection)
15-
- [Service Binding](https://github.com/k8s-service-bindings/spec/tree/04b99a3b9215af59e060359848de9622e909ff9e#service-binding)
16-
- [Direct Secret Reference](https://github.com/k8s-service-bindings/spec/tree/04b99a3b9215af59e060359848de9622e909ff9e#direct-secret-reference)
17-
- [Role-Based Access Control (RBAC)](https://github.com/k8s-service-bindings/spec/tree/04b99a3b9215af59e060359848de9622e909ff9e#role-based-access-control-rbac)
13+
- [Provisioned Service](https://github.com/k8s-service-bindings/spec/tree/e874935880b120cfd809d691b0fee5baca023a2e#provisioned-service)
14+
- [Workload Projection](https://github.com/k8s-service-bindings/spec/tree/e874935880b120cfd809d691b0fee5baca023a2e#workload-projection)
15+
- [Service Binding](https://github.com/k8s-service-bindings/spec/tree/e874935880b120cfd809d691b0fee5baca023a2e#service-binding)
16+
- [Direct Secret Reference](https://github.com/k8s-service-bindings/spec/tree/e874935880b120cfd809d691b0fee5baca023a2e#direct-secret-reference)
17+
- [Role-Based Access Control (RBAC)](https://github.com/k8s-service-bindings/spec/tree/e874935880b120cfd809d691b0fee5baca023a2e#role-based-access-control-rbac)
1818

1919
The following are not supported:
20-
- [Application Resource Mapping](https://github.com/k8s-service-bindings/spec/tree/04b99a3b9215af59e060359848de9622e909ff9e#application-resource-mapping)
20+
- [Workload Resource Mapping](https://github.com/k8s-service-bindings/spec/tree/e874935880b120cfd809d691b0fee5baca023a2e#workload-resource-mapping)
2121
- Extensions including:
22-
- [Binding Secret Generation Strategies](https://github.com/k8s-service-bindings/spec/tree/04b99a3b9215af59e060359848de9622e909ff9e#binding-secret-generation-strategies)
22+
- [Binding Secret Generation Strategies](https://github.com/k8s-service-bindings/spec/tree/e874935880b120cfd809d691b0fee5baca023a2e#binding-secret-generation-strategies)
2323

2424
## Try it out
2525

@@ -66,14 +66,14 @@ kind: ServiceBinding
6666
metadata:
6767
name: account-db
6868
spec:
69-
application:
70-
apiVersion: apps/v1
71-
kind: Deployment
72-
name: account-service
7369
service:
7470
apiVersion: bindings.labs.vmware.com/v1alpha1
7571
kind: ProvisionedService
7672
name: account-db
73+
workload:
74+
apiVersion: apps/v1
75+
kind: Deployment
76+
name: account-service
7777
```
7878

7979
### ProvisionedService (bindings.labs.vmware.com/v1alpha1)

config/300-servicebinding.yaml

+46-46
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,50 @@ spec:
4949
spec:
5050
description: ServiceBindingSpec defines the desired state of ServiceBinding
5151
properties:
52-
application:
53-
description: Application is a reference to an object
52+
env:
53+
description: Env is the collection of mappings from Secret entries to environment variables
54+
items:
55+
description: EnvMapping defines a mapping from the value of a Secret entry to an environment variable
56+
properties:
57+
key:
58+
description: Key is the key in the Secret that will be exposed
59+
type: string
60+
name:
61+
description: Name is the name of the environment variable
62+
type: string
63+
required:
64+
- key
65+
- name
66+
type: object
67+
type: array
68+
name:
69+
description: Name is the name of the service as projected into the workload container. Defaults to .metadata.name.
70+
type: string
71+
provider:
72+
description: Provider is the provider of the service as projected into the workload container
73+
type: string
74+
service:
75+
description: Service is a reference to an object that fulfills the ProvisionedService duck type
76+
properties:
77+
apiVersion:
78+
description: API version of the referent.
79+
type: string
80+
kind:
81+
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
82+
type: string
83+
name:
84+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
85+
type: string
86+
required:
87+
- apiVersion
88+
- kind
89+
- name
90+
type: object
91+
type:
92+
description: Type is the type of the service as projected into the workload container
93+
type: string
94+
workload:
95+
description: Workload is a reference to an object
5496
properties:
5597
apiVersion:
5698
description: API version of the referent.
@@ -67,7 +109,7 @@ spec:
67109
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
68110
type: string
69111
selector:
70-
description: Selector is a query that selects the application or applications to bind the service to
112+
description: Selector is a query that selects the workload or workloads to bind the service to
71113
properties:
72114
matchExpressions:
73115
description: matchExpressions is a list of label selector requirements. The requirements are ANDed.
@@ -100,51 +142,9 @@ spec:
100142
- apiVersion
101143
- kind
102144
type: object
103-
env:
104-
description: Env is the collection of mappings from Secret entries to environment variables
105-
items:
106-
description: EnvMapping defines a mapping from the value of a Secret entry to an environment variable
107-
properties:
108-
key:
109-
description: Key is the key in the Secret that will be exposed
110-
type: string
111-
name:
112-
description: Name is the name of the environment variable
113-
type: string
114-
required:
115-
- key
116-
- name
117-
type: object
118-
type: array
119-
name:
120-
description: Name is the name of the service as projected into the application container. Defaults to .metadata.name.
121-
type: string
122-
provider:
123-
description: Provider is the provider of the service as projected into the application container
124-
type: string
125-
service:
126-
description: Service is a reference to an object that fulfills the ProvisionedService duck type
127-
properties:
128-
apiVersion:
129-
description: API version of the referent.
130-
type: string
131-
kind:
132-
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
133-
type: string
134-
name:
135-
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
136-
type: string
137-
required:
138-
- apiVersion
139-
- kind
140-
- name
141-
type: object
142-
type:
143-
description: Type is the type of the service as projected into the application container
144-
type: string
145145
required:
146-
- application
147146
- service
147+
- workload
148148
type: object
149149
status:
150150
description: ServiceBindingStatus defines the observed state of ServiceBinding

config/300-servicebindingprojection.yaml

+27-27
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,32 @@ spec:
4444
type: object
4545
spec:
4646
properties:
47-
application:
47+
binding:
48+
properties:
49+
name:
50+
type: string
51+
required:
52+
- name
53+
type: object
54+
env:
55+
items:
56+
properties:
57+
key:
58+
type: string
59+
name:
60+
type: string
61+
required:
62+
- key
63+
- name
64+
type: object
65+
type: array
66+
name:
67+
type: string
68+
provider:
69+
type: string
70+
type:
71+
type: string
72+
workload:
4873
properties:
4974
apiVersion:
5075
type: string
@@ -83,35 +108,10 @@ spec:
83108
- apiVersion
84109
- kind
85110
type: object
86-
binding:
87-
properties:
88-
name:
89-
type: string
90-
required:
91-
- name
92-
type: object
93-
env:
94-
items:
95-
properties:
96-
key:
97-
type: string
98-
name:
99-
type: string
100-
required:
101-
- key
102-
- name
103-
type: object
104-
type: array
105-
name:
106-
type: string
107-
provider:
108-
type: string
109-
type:
110-
type: string
111111
required:
112-
- application
113112
- binding
114113
- name
114+
- workload
115115
type: object
116116
status:
117117
properties:

pkg/apis/labsinternal/v1alpha1/servicebindingprojection_lifecycle.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ import (
2222
)
2323

2424
const (
25-
ServiceBindingProjectionConditionReady = apis.ConditionReady
26-
ServiceBindingProjectionConditionApplicationAvailable = "ApplicationAvailable"
25+
ServiceBindingProjectionConditionReady = apis.ConditionReady
26+
ServiceBindingProjectionConditionWorkloadAvailable = "WorkloadAvailable"
2727

2828
ServiceBindingRootEnv = "SERVICE_BINDING_ROOT"
2929
bindingVolumePrefix = "binding-"
3030
)
3131

3232
var sbpCondSet = apis.NewLivingConditionSet(
33-
ServiceBindingProjectionConditionApplicationAvailable,
33+
ServiceBindingProjectionConditionWorkloadAvailable,
3434
)
3535

3636
func (b *ServiceBindingProjection) GetStatus() *duckv1.Status {
@@ -43,7 +43,7 @@ func (b *ServiceBindingProjection) GetConditionSet() apis.ConditionSet {
4343

4444
func (b *ServiceBindingProjection) GetSubject() tracker.Reference {
4545
var ref tracker.Reference
46-
b.Spec.Application.Reference.DeepCopyInto(&ref)
46+
b.Spec.Workload.Reference.DeepCopyInto(&ref)
4747
ref.Namespace = b.Namespace
4848
return ref
4949
}
@@ -228,7 +228,7 @@ func (b *ServiceBindingProjection) doContainer(ctx context.Context, ps *duckv1.W
228228
}
229229

230230
func (b *ServiceBindingProjection) isTargetContainer(idx int, c *corev1.Container) bool {
231-
targets := b.Spec.Application.Containers
231+
targets := b.Spec.Workload.Containers
232232
if len(targets) == 0 {
233233
return true
234234
}
@@ -332,16 +332,16 @@ func (bs *ServiceBindingProjectionStatus) InitializeConditions() {
332332
}
333333

334334
func (bs *ServiceBindingProjectionStatus) MarkBindingAvailable() {
335-
sbpCondSet.Manage(bs).MarkTrue(ServiceBindingProjectionConditionApplicationAvailable)
335+
sbpCondSet.Manage(bs).MarkTrue(ServiceBindingProjectionConditionWorkloadAvailable)
336336
}
337337

338338
func (bs *ServiceBindingProjectionStatus) MarkBindingUnavailable(reason string, message string) {
339339
if strings.HasPrefix(reason, "Subject") {
340-
// knative/pkg uses "Subject*" reasons, we want to rename to "Application*"
341-
reason = strings.Replace(reason, "Subject", "Application", 1)
340+
// knative/pkg uses "Subject*" reasons, we want to rename to "Workload*"
341+
reason = strings.Replace(reason, "Subject", "Workload", 1)
342342
}
343343
sbpCondSet.Manage(bs).MarkFalse(
344-
ServiceBindingProjectionConditionApplicationAvailable, reason, message)
344+
ServiceBindingProjectionConditionWorkloadAvailable, reason, message)
345345
}
346346

347347
func (bs *ServiceBindingProjectionStatus) SetObservedGeneration(gen int64) {

0 commit comments

Comments
 (0)