docs/code-samples/eventing/helloworld/helloworld-python/sample-app.yaml

74 lines
1.7 KiB
YAML

# Namespace for sample application with eventing enabled
apiVersion: v1
kind: Namespace
metadata:
name: knative-samples
labels:
eventing.knative.dev/injection: enabled
---
# A default broker
apiVersion: eventing.knative.dev/v1
kind: Broker
metadata:
name: default
namespace: knative-samples
annotations:
# Note: you can set the eventing.knative.dev/broker.class annotation to change the class of the broker.
# The default broker class is MTChannelBasedBroker, but Knative also supports use of the other class.
eventing.knative.dev/broker.class: MTChannelBasedBroker
spec: {}
---
# helloworld-python app deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: helloworld-python
namespace: knative-samples
spec:
replicas: 1
selector:
matchLabels: &labels
app: helloworld-python
template:
metadata:
labels: *labels
spec:
containers:
- name: helloworld-python
image: docker.io/{username}/helloworld-python
imagePullPolicy: IfNotPresent
---
# Service that exposes helloworld-python app.
# This will be the subscriber for the Trigger
apiVersion: v1
kind: Service
metadata:
name: helloworld-python
namespace: knative-samples
spec:
selector:
app: helloworld-python
ports:
- protocol: TCP
port: 80
targetPort: 8080
---
# Knative Eventing Trigger to trigger the helloworld-python service
apiVersion: eventing.knative.dev/v1
kind: Trigger
metadata:
name: helloworld-python
namespace: knative-samples
spec:
broker: default
filter:
attributes:
type: dev.knative.samples.helloworld
source: dev.knative.samples/helloworldsource
subscriber:
ref:
apiVersion: v1
kind: Service
name: helloworld-python