Skip to content

Commit

Permalink
use service binding name instead of class name in the volume mounts
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhprasad-sap committed Oct 24, 2024
1 parent 388b7d5 commit 89525e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions internal/controller/reconcile-captenantoperation.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,12 @@ func (c *Controller) initiateJobForCAPTenantOperationStep(ctx context.Context, c
consumedServiceInfos := getConsumedServiceInfos(getConsumedServiceMap(workload.ConsumedBTPServices), relatedResources.CAPApplication.Spec.BTP.Services)

// check volume mount annotation
useVolumeMount := useVolumeMountsForServiceCredentials(relatedResources.CAPApplicationVersion)
useVolumeMountsForServiceCredentials := useVolumeMountsForServiceCredentials(relatedResources.CAPApplicationVersion)

// create VCAP secret from consumed BTP services
var vcapSecretName string
err = nil
if !useVolumeMount {
if !useVolumeMountsForServiceCredentials {
vcapSecretName, err = createVCAPSecret(ctop.Name+"-"+strings.ToLower(workload.Name), ctop.Namespace, *metav1.NewControllerRef(ctop, v1alpha1.SchemeGroupVersion.WithKind(v1alpha1.CAPTenantOperationKind)), consumedServiceInfos, c.kubeClient)
if err != nil {
return nil, err
Expand Down Expand Up @@ -440,7 +440,7 @@ func (c *Controller) initiateJobForCAPTenantOperationStep(ctx context.Context, c
params.Env = workload.DeploymentDefinition.Env
}

if useVolumeMount {
if useVolumeMountsForServiceCredentials {
params.Env = updateServiceBindingRootEnv(params.Env)
params.volumeMounts = getServiceCredentialVolumeMounts(consumedServiceInfos)
params.volumes = getServiceCredentialVolumes(consumedServiceInfos)
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ func getWorkloadName(cavName, workloadName string) string {
func getServiceCredentialVolumeMounts(serviceInfos []v1alpha1.ServiceInfo) []corev1.VolumeMount {
volumeMounts := []corev1.VolumeMount{}
for _, serviceInfo := range serviceInfos {
volumeMounts = append(volumeMounts, corev1.VolumeMount{Name: serviceInfo.Name, MountPath: path.Join(defaultServiceBindingRootEnv.Value, serviceInfo.Class), ReadOnly: true})
volumeMounts = append(volumeMounts, corev1.VolumeMount{Name: serviceInfo.Name, MountPath: path.Join(defaultServiceBindingRootEnv.Value, serviceInfo.Name), ReadOnly: true})
}
return volumeMounts
}
Expand Down

0 comments on commit 89525e4

Please sign in to comment.