diff --git a/pkg/apis/servicebindinginternal/v1alpha2/servicebindingprojection_lifecycle.go b/pkg/apis/servicebindinginternal/v1alpha2/servicebindingprojection_lifecycle.go index 828cb4fa..dae82a44 100644 --- a/pkg/apis/servicebindinginternal/v1alpha2/servicebindingprojection_lifecycle.go +++ b/pkg/apis/servicebindinginternal/v1alpha2/servicebindingprojection_lifecycle.go @@ -25,9 +25,6 @@ const ( ServiceBindingProjectionConditionApplicationAvailable = "ApplicationAvailable" ServiceBindingRootEnv = "SERVICE_BINDING_ROOT" - // Deprecated: favor ServiceBindingRootEnv, this value will be removed in a - // future release - DeprecatedServiceBindingsRootEnv = "SERVICE_BINDINGS_ROOT" ) var sbpCondSet = apis.NewLivingConditionSet( @@ -111,29 +108,21 @@ func (b *ServiceBindingProjection) Do(ctx context.Context, ps *duckv1.WithPod) { func (b *ServiceBindingProjection) doContainer(ctx context.Context, ps *duckv1.WithPod, c *corev1.Container, bindingVolume, secretName string) { mountPath := "" - env := []corev1.EnvVar{} // lookup predefined mount path for _, e := range c.Env { - if e.Name == ServiceBindingRootEnv || e.Name == DeprecatedServiceBindingsRootEnv { + if e.Name == ServiceBindingRootEnv { mountPath = e.Value - } else { - env = append(env, e) + break } } if mountPath == "" { // default mount path mountPath = "/bindings" - } - c.Env = append(env, - corev1.EnvVar{ + c.Env = append(c.Env, corev1.EnvVar{ Name: ServiceBindingRootEnv, Value: mountPath, - }, - corev1.EnvVar{ - Name: DeprecatedServiceBindingsRootEnv, - Value: mountPath, - }, - ) + }) + } containerVolumes := sets.NewString() for _, vm := range c.VolumeMounts { diff --git a/pkg/apis/servicebindinginternal/v1alpha2/servicebindingprojection_test.go b/pkg/apis/servicebindinginternal/v1alpha2/servicebindingprojection_test.go index f5ac2b5d..b2265e71 100644 --- a/pkg/apis/servicebindinginternal/v1alpha2/servicebindingprojection_test.go +++ b/pkg/apis/servicebindinginternal/v1alpha2/servicebindingprojection_test.go @@ -782,10 +782,6 @@ func TestServiceBindingProjection_Do(t *testing.T) { Name: "SERVICE_BINDING_ROOT", Value: "/bindings", }, - { - Name: "SERVICE_BINDINGS_ROOT", - Value: "/bindings", - }, }, VolumeMounts: []corev1.VolumeMount{ { @@ -803,10 +799,6 @@ func TestServiceBindingProjection_Do(t *testing.T) { Name: "SERVICE_BINDING_ROOT", Value: "/bindings", }, - { - Name: "SERVICE_BINDINGS_ROOT", - Value: "/bindings", - }, }, VolumeMounts: []corev1.VolumeMount{ { @@ -884,10 +876,6 @@ func TestServiceBindingProjection_Do(t *testing.T) { Name: "SERVICE_BINDING_ROOT", Value: "/bindings", }, - { - Name: "SERVICE_BINDINGS_ROOT", - Value: "/bindings", - }, }, VolumeMounts: []corev1.VolumeMount{ { @@ -907,10 +895,6 @@ func TestServiceBindingProjection_Do(t *testing.T) { Name: "SERVICE_BINDING_ROOT", Value: "/bindings", }, - { - Name: "SERVICE_BINDINGS_ROOT", - Value: "/bindings", - }, }, VolumeMounts: []corev1.VolumeMount{ { @@ -991,10 +975,6 @@ func TestServiceBindingProjection_Do(t *testing.T) { Name: "SERVICE_BINDING_ROOT", Value: "/bindings", }, - { - Name: "SERVICE_BINDINGS_ROOT", - Value: "/bindings", - }, }, VolumeMounts: []corev1.VolumeMount{ { @@ -1067,10 +1047,6 @@ func TestServiceBindingProjection_Do(t *testing.T) { Name: "SERVICE_BINDING_ROOT", Value: "/bindings", }, - { - Name: "SERVICE_BINDINGS_ROOT", - Value: "/bindings", - }, }, VolumeMounts: []corev1.VolumeMount{ {Name: "preserve"}, @@ -1145,86 +1121,6 @@ func TestServiceBindingProjection_Do(t *testing.T) { Name: "SERVICE_BINDING_ROOT", Value: "/custom/path", }, - { - Name: "SERVICE_BINDINGS_ROOT", - Value: "/custom/path", - }, - }, - VolumeMounts: []corev1.VolumeMount{ - { - Name: "binding-5c5a15a8b0b3e154d77746945e563ba40100681b", - MountPath: "/custom/path/my-binding-name", - ReadOnly: true, - }, - }, - }, - }, - Volumes: []corev1.Volume{ - { - Name: "binding-5c5a15a8b0b3e154d77746945e563ba40100681b", - VolumeSource: corev1.VolumeSource{ - Secret: &corev1.SecretVolumeSource{ - SecretName: "my-secret", - }, - }, - }, - }, - }, - }, - }, - }, - }, - { - name: "inject volume at custom path, deprecated var", - binding: &ServiceBindingProjection{ - ObjectMeta: metav1.ObjectMeta{ - Name: "my-binding", - }, - Spec: ServiceBindingProjectionSpec{ - Name: "my-binding-name", - Binding: corev1.LocalObjectReference{ - Name: "my-secret", - }, - }, - }, - seed: &duckv1.WithPod{ - Spec: duckv1.WithPodSpec{ - Template: duckv1.PodSpecable{ - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Env: []corev1.EnvVar{ - { - Name: "SERVICE_BINDINGS_ROOT", - Value: "/custom/path", - }, - }, - }, - }, - }, - }, - }, - }, - expected: &duckv1.WithPod{ - ObjectMeta: metav1.ObjectMeta{ - Annotations: map[string]string{ - "internal.service.binding/projection-16384e6a11df69776193b6a877b": "binding-5c5a15a8b0b3e154d77746945e563ba40100681b", - }, - }, - Spec: duckv1.WithPodSpec{ - Template: duckv1.PodSpecable{ - Spec: corev1.PodSpec{ - Containers: []corev1.Container{ - { - Env: []corev1.EnvVar{ - { - Name: "SERVICE_BINDING_ROOT", - Value: "/custom/path", - }, - { - Name: "SERVICE_BINDINGS_ROOT", - Value: "/custom/path", - }, }, VolumeMounts: []corev1.VolumeMount{ { @@ -1305,10 +1201,6 @@ func TestServiceBindingProjection_Do(t *testing.T) { Name: "SERVICE_BINDING_ROOT", Value: "/bindings", }, - { - Name: "SERVICE_BINDINGS_ROOT", - Value: "/bindings", - }, { Name: "MY_VAR", ValueFrom: &corev1.EnvVarSource{ @@ -1446,10 +1338,6 @@ func TestServiceBindingProjection_Do(t *testing.T) { Name: "SERVICE_BINDING_ROOT", Value: "/bindings", }, - { - Name: "SERVICE_BINDINGS_ROOT", - Value: "/bindings", - }, }, VolumeMounts: []corev1.VolumeMount{ { @@ -1490,10 +1378,6 @@ func TestServiceBindingProjection_Do(t *testing.T) { Name: "SERVICE_BINDING_ROOT", Value: "/bindings", }, - { - Name: "SERVICE_BINDINGS_ROOT", - Value: "/bindings", - }, }, VolumeMounts: []corev1.VolumeMount{ { @@ -1511,10 +1395,6 @@ func TestServiceBindingProjection_Do(t *testing.T) { Name: "SERVICE_BINDING_ROOT", Value: "/bindings", }, - { - Name: "SERVICE_BINDINGS_ROOT", - Value: "/bindings", - }, }, VolumeMounts: []corev1.VolumeMount{ { diff --git a/samples/spring-petclinic/application.yaml b/samples/spring-petclinic/application.yaml index b8b7cc9b..184300a0 100644 --- a/samples/spring-petclinic/application.yaml +++ b/samples/spring-petclinic/application.yaml @@ -33,7 +33,7 @@ spec: containers: - name: application # built with paketo builder from https://github.com/spring-projects/spring-petclinic - image: scothis/petclinic:service-bindings + image: scothis/petclinic:service-bindings-20200922 env: # tell the application to use mysql instead of the default embedded database - name: SPRING_PROFILES_ACTIVE