Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8s deployment updates #4

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
target/
.idea/
server/*.iml
k8s.secret.yml
/consumer.properties
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
library('jenkins-pipeline')

demoServerUiPipeline("sim-stocks", "maven")
demoServerUiPipeline("stocks-simulated", "maven")
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,13 @@ npm run dev
```

Then head to `localhost:5173` to see it in action.

# Deploying to kubernetes

Edit the consumer.properties file to match the settings needed to connect to confluent cloud.

```bash
# If the secret already exists
kubectl delete secret -n demo-stocks-simulated consumer-properties
kubectl update secret generic -n demo-stocks-simulated consumer-properties --from-file=consumer.properties
```
23 changes: 15 additions & 8 deletions k8s.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,39 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: demo-sim-stocks
namespace: demo-sim-stocks
name: demo-stocks-simulated
namespace: demo-stocks-simulated
spec:
replicas: 1
selector:
matchLabels:
demo: sim-stocks
demo: stocks-simulated
serviceName: demo
template:
metadata:
labels:
demo: sim-stocks
demo: stocks-simulated
spec:
volumes:
- name: consumer-properties
secret:
secretName: consumer-properties
containers:
- image: DOCKER_IMAGE
imagePullPolicy: Always
name: demo
args:
- "-Dswim.config=/config/server.k8s.recon"
volumeMounts:
- mountPath: /secret/confluent
name: consumer-properties
ports:
- containerPort: 9001
protocol: TCP
resources:
limits:
cpu: 500m
memory: 1Gi
memory: 512Mi
requests:
cpu: 250m
memory: 512Mi


memory: 256Mi
40 changes: 40 additions & 0 deletions server/src/main/resources/server.k8s.recon
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@kernel(class: "swim.meta.MetaKernel")
@kernel(class: "swim.service.web.UiRouter")

provisions: {
@provision("consumer") {
class: "nstream.adapter.common.provision.PropertiesProvision",
config: "/secret/confluent/consumer.properties"
}
}

stock: @fabric {
@plane(class: "io.nstream.demos.stocks.StockPlane")

uri: "/consumer"
@agent(class: "nstream.adapter.confluent.ConfluentIngestingPatch") {
confluentIngressConf: @kafkaIngressSettings {
consumerPropertiesProvisionName: "consumer"
laneUri: "status"
}
}

@node {
pattern: "/stock/:symbol"
@agent(class: "io.nstream.demos.stocks.agents.StockAgent")
}

@node {
pattern: "/symbols"
@agent(class: "io.nstream.demos.stocks.agents.SymbolsAgent")
}

}

@web(port: 9001) {
space: "stock"
@websocket {
serverCompressionLevel: 0# -1 = default; 0 = off; 1-9 = deflate level
clientCompressionLevel: 0# -1 = default; 0 = off; 1-9 = deflate level
}
}