Skip to content

Commit

Permalink
doc: add example configs
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Sep 20, 2024
1 parent 1daec8a commit 987ce5e
Show file tree
Hide file tree
Showing 13 changed files with 274 additions and 1 deletion.
3 changes: 3 additions & 0 deletions examples/account-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
controller:
nats:
url: "nats://nats.knative-eventing.svc.cluster.local"
21 changes: 21 additions & 0 deletions examples/account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: natz.zeiss.com/v1alpha1
kind: NatsAccount
metadata:
namespace: knative-eventing
name: knative-eventing-account
spec:
operatorRef:
name: natsoperator-sample
allowedUserNamespaces:
- knative-eventing
imports: []
exports: []
limits:
disk_storage: -1
streams: -1
conn: -1
imports: -1
exports: -1
subs: -1
payload: -1
data: -1
20 changes: 20 additions & 0 deletions examples/config-br-default-channel-jsm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: config-br-default-channel
namespace: knative-eventing
labels:
eventing.knative.dev/release: devel
data:
channelTemplateSpec: |
apiVersion: messaging.knative.dev/v1alpha1
kind: NatsJetStreamChannel
spec:
stream:
config:
retention: Limits
maxBytes: 1000000000
replicas: 1
consumerConfigTemplate:
deliverPolicy: New
maxDeliver: 1
19 changes: 19 additions & 0 deletions examples/config-nats.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: config-nats
namespace: knative-eventing
data:
eventing-nats: |
url: nats://nats.knative-eventing.svc.cluster.local
auth:
credentialFile:
secret:
name: knative-eventing-user
key: user.creds
connOpts:
retryOnFailedConnect: true
maxReconnects: 5
reconnectWaitMilliseconds: 2000
reconnectJitterMilliseconds: 100
reconnectJitterTLSMilliseconds: 1000
18 changes: 18 additions & 0 deletions examples/default-channels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: default-ch-webhook
namespace: knative-eventing
labels:
eventing.knative.dev/release: devel
app.kubernetes.io/version: devel
app.kubernetes.io/part-of: knative-eventing
data:
default-ch-config: |
clusterDefault:
apiVersion: messaging.knative.dev/v1
kind: NatsJetStreamChannel
knative-eventing:
some-namespace:
apiVersion: messaging.knative.dev/v1
kind: NatsJetStreamChannel
6 changes: 6 additions & 0 deletions examples/operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: natz.zeiss.com/v1alpha1
kind: NatsOperator
metadata:
namespace: knative-eventing
name: natsoperator-sample
spec:
74 changes: 74 additions & 0 deletions examples/ping-demo-default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
apiVersion: messaging.knative.dev/v1alpha1
kind: NatsJetStreamChannel
metadata:
name: channel-defaults
namespace: knative-eventing
---
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: event-display
namespace: knative-eventing
spec:
template:
metadata:
annotations:
autoscaling.knative.dev/min-scale: "1"
spec:
containers:
- name: display
image: gcr.io/knative-releases/knative.dev/eventing/cmd/event_display
ports:
- containerPort: 8080
---
apiVersion: sources.knative.dev/v1
kind: PingSource
metadata:
name: ping
namespace: knative-eventing
spec:
schedule: "*/1 * * * *"
contentType: "application/json"
data: |
{ "message": "Hello, World!" }
sink:
ref:
apiVersion: messaging.knative.dev/v1alpha1
kind: NatsJetStreamChannel
name: channel-defaults
---
apiVersion: messaging.knative.dev/v1
kind: Subscription
metadata:
name: subscription
namespace: knative-eventing
spec:
channel:
apiVersion: messaging.knative.dev/v1alpha1
kind: NatsJetStreamChannel
name: channel-defaults
subscriber:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: event-display
delivery:
deadLetterSink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: dead-letter-display
---
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: dead-letter-display
namespace: knative-eventing
spec:
template:
spec:
containers:
- name: display
image: gcr.io/knative-releases/knative.dev/eventing/cmd/event_display
ports:
- containerPort: 8080
74 changes: 74 additions & 0 deletions examples/ping-demo-knative-eventing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
apiVersion: messaging.knative.dev/v1alpha1
kind: NatsJetStreamChannel
metadata:
name: channel-defaults
namespace: knative-eventing
---
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: event-display
namespace: knative-eventing
spec:
template:
metadata:
annotations:
autoscaling.knative.dev/min-scale: "1"
spec:
containers:
- name: display
image: gcr.io/knative-releases/knative.dev/eventing/cmd/event_display
ports:
- containerPort: 8080
---
apiVersion: sources.knative.dev/v1
kind: PingSource
metadata:
name: ping
namespace: knative-eventing
spec:
schedule: "* * * * *"
contentType: "application/json"
data: |
{ "message": "Hello, World!" }
sink:
ref:
apiVersion: messaging.knative.dev/v1alpha1
kind: NatsJetStreamChannel
name: channel-defaults
---
apiVersion: messaging.knative.dev/v1
kind: Subscription
metadata:
name: subscription
namespace: knative-eventing
spec:
channel:
apiVersion: messaging.knative.dev/v1alpha1
kind: NatsJetStreamChannel
name: channel-defaults
subscriber:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: event-display
delivery:
deadLetterSink:
ref:
apiVersion: serving.knative.dev/v1
kind: Service
name: dead-letter-display
---
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: dead-letter-display
namespace: knative-eventing
spec:
template:
spec:
containers:
- name: display
image: gcr.io/knative-releases/knative.dev/eventing/cmd/event_display
ports:
- containerPort: 8080
5 changes: 5 additions & 0 deletions examples/simple-channel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: messaging.knative.dev/v1alpha1
kind: NatsJetStreamChannel
metadata:
name: channel-defaults
namespace: knative-eventing
13 changes: 13 additions & 0 deletions examples/user.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: natz.zeiss.com/v1alpha1
kind: NatsUser
metadata:
namespace: knative-eventing
name: knative-eventing-user
spec:
accountRef:
namespace: knative-eventing
name: knative-eventing-account
limits:
payload: -1
subs: -1
data: -1
2 changes: 2 additions & 0 deletions examples/values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
namespaceOverride: "knative-eventing"

config:
resolver:
enabled: true
Expand Down
2 changes: 1 addition & 1 deletion manifests/samples/nats_v1alpha1_natsaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ metadata:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/created-by: natz-operator
name: natsaccount-sample
spec:
spec:
18 changes: 18 additions & 0 deletions scripts/minikubeSetup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# Install the Knative Serving and Eventing components
helm install knative zeiss-staging/knative --wait
# Install the Eventing components
helm install eventing zeiss-staging/eventing --wait --namespace knative-eventing --create-namespace
# Install the NATZ operator
helm install natz-operator natz-operator/natz-operator --wait --namespace knative-eventing
# Create operator resources
kubectl apply -f ../examples/operator.yaml
# Create account resources
kubectl apply -f ../examples/account.yaml
# Create user resources
kubectl apply -f ../examples/user.yaml
# Install NATS.io
helm install nats nats/nats --values examples/values.yaml
# Install the NATZ accounts-server
helm install account-server natz-operator/account-server --wait --namespace knative-eventing --values examples/account-server.yaml

0 comments on commit 987ce5e

Please sign in to comment.