odo
odo copied to clipboard
ServiceBinding resources are not deployed with `odo deploy`
/kind bug
What versions of software are you using?
$ odo version
odo v3.0.0-alpha3 (8c99ce920)
How did you run odo exactly?
Apply this cluster resource:
apiVersion: postgresql.k8s.enterprisedb.io/v1
kind: Cluster
metadata:
name: cluster-sample
spec:
instances: 1
logLevel: info
primaryUpdateStrategy: unsupervised
storage:
size: 1Gi
variables:
CONTAINER_IMAGE: quay.io/tkral/devfile-nodejs-deploy:latest
commands:
- exec:
commandLine: GOCACHE=${PROJECT_SOURCE}/.cache go build main.go
component: runtime
group:
isDefault: true
kind: build
hotReloadCapable: false
workingDir: ${PROJECT_SOURCE}
id: build
- exec:
commandLine: ./main
component: runtime
group:
isDefault: true
kind: run
hotReloadCapable: false
workingDir: ${PROJECT_SOURCE}
id: run
- id: deploy
composite:
commands:
- build-image
- deploy-deployment
- deploy-service
- deploy-binding
group:
kind: deploy
isDefault: true
- id: build-image
apply:
component: prod-image
- id: deploy-deployment
apply:
component: outerloop-deploy
- id: deploy-service
apply:
component: outerloop-service
- id: deploy-binding
apply:
component: my-go-app-cluster-sample
components:
- container:
dedicatedPod: false
endpoints:
- name: http
secure: false
targetPort: 8080
image: quay.io/devfile/golang:latest
memoryLimit: 1024Mi
mountSources: true
name: runtime
- name: prod-image
image:
imageName: "{{CONTAINER_IMAGE}}"
dockerfile:
uri: ./Dockerfile
buildContext: ${PROJECT_SOURCE}
- name: outerloop-deploy
kubernetes:
inlined: |
kind: Deployment
apiVersion: apps/v1
metadata:
name: devfile-deploy
spec:
replicas: 1
selector:
matchLabels:
app: devfile-deploy
template:
metadata:
labels:
app: devfile-deploy
spec:
containers:
- name: main
image: "{{CONTAINER_IMAGE}}"
resources: {}
- name: outerloop-service
kubernetes:
inlined: |
apiVersion: v1
kind: Service
metadata:
labels:
app: devfile-deploy
name: devfile-deploy
spec:
ports:
- name: http-3000
port: 3000
protocol: TCP
targetPort: 3000
selector:
app: devfile-deploy
type: LoadBalancer
- kubernetes:
inlined: |
apiVersion: binding.operators.coreos.com/v1alpha1
kind: ServiceBinding
metadata:
name: my-go-app-cluster-sample
spec:
application:
group: apps
kind: Deployment
name: devfile-deploy
version: v1
bindAsFiles: true
detectBindingResources: true
services:
- group: postgresql.k8s.enterprisedb.io
id: my-go-app-cluster-sample
kind: Cluster
name: cluster-sample
resource: clusters
version: v1
status:
secret: ""
name: my-go-app-cluster-sample
metadata:
description: Stack with the latest Go version
displayName: Go Runtime
icon: https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/golang.svg
language: go
name: my-go-app
projectType: go
tags:
- Go
version: 1.0.0
schemaVersion: 2.2.0
starterProjects:
- git:
checkoutFrom:
revision: main
remotes:
origin: https://github.com/devfile-samples/devfile-stack-go.git
name: go-starter
$ PODMAN_CMD=echo odo deploy
__
/ \__ Deploying the application using my-go-app Devfile
\__/ \ Namespace: prj2
/ \__/ odo version: v3.0.0-beta2
\__/
↪ Building & Pushing Container: quay.io/tkral/devfile-nodejs-deploy:latest
• Building image locally ...
build -t quay.io/tkral/devfile-nodejs-deploy:latest -f /home/phmartin/Documents/tests/5883/Dockerfile /home/phmartin/Documents/tests/5883
✓ Building image locally
• Pushing image to container registry ...
push quay.io/tkral/devfile-nodejs-deploy:latest
✓ Pushing image to container registry
↪ Deploying Kubernetes Component: devfile-deploy
✓ Creating kind Deployment [15ms]
↪ Deploying Kubernetes Component: devfile-deploy
✓ Creating kind Service [13ms]
↪ Deploying Kubernetes Component: my-go-app-cluster-sample
Your Devfile has been successfully deployed
Actual behavior
$ kubectl get servicebindings.binding.operators.coreos.com
No resources found in demo namespace.
Expected behavior
The service binding must be created in the cluster
Any logs, error output, etc?
The problem occurs because the odo dev
command has a special treatment for ServiceBinding resources, and odo deploy
is reusing the same function (see service.PushKubernetesResource
)
If an apply command references the K8s(kind:ServiceBinding) component, then odo deploy
should deploy it.
Needs more information from @feloy / reproduceable
@feloy Do you also expect odo dev
to deploy this ServiceBinding?
No, as the SB is part of a Deploy command, the Devfile spec says it won't be deloyed using odo dev