From 1307139c13386e55d48ef0caee30fa12642101e1 Mon Sep 17 00:00:00 2001 From: Filinto Duran Date: Tue, 12 Nov 2024 13:43:01 -0600 Subject: [PATCH] add k8s components --- actors/resources-k8s/statestore.yaml | 14 ++++++++++ pub_sub/components-k8s/observability.yaml | 10 +++++++ pub_sub/components-k8s/pubsub.yaml | 14 ++++++++++ .../resources-k8s/resiliency.yaml | 27 +++++++++++++++++++ .../resources-k8s/statestore.yaml | 16 +++++++++++ workflows/components-k8s/state_redis.yaml | 17 ++++++++++++ 6 files changed, 98 insertions(+) create mode 100644 actors/resources-k8s/statestore.yaml create mode 100644 pub_sub/components-k8s/observability.yaml create mode 100644 pub_sub/components-k8s/pubsub.yaml create mode 100644 state_management/resources-k8s/resiliency.yaml create mode 100644 state_management/resources-k8s/statestore.yaml create mode 100644 workflows/components-k8s/state_redis.yaml diff --git a/actors/resources-k8s/statestore.yaml b/actors/resources-k8s/statestore.yaml new file mode 100644 index 000000000..2f676bff8 --- /dev/null +++ b/actors/resources-k8s/statestore.yaml @@ -0,0 +1,14 @@ +apiVersion: dapr.io/v1alpha1 +kind: Component +metadata: + name: statestore +spec: + type: state.redis + version: v1 + metadata: + - name: redisHost + value: localhost:6379 + - name: redisPassword + value: "" + - name: actorStateStore + value: "true" diff --git a/pub_sub/components-k8s/observability.yaml b/pub_sub/components-k8s/observability.yaml new file mode 100644 index 000000000..4c75af57a --- /dev/null +++ b/pub_sub/components-k8s/observability.yaml @@ -0,0 +1,10 @@ +apiVersion: dapr.io/v1alpha1 +kind: Configuration +metadata: + name: daprConfig + namespace: default +spec: + tracing: + samplingRate: "1" + zipkin: + endpointAddress: "http://localhost:9411/api/v2/spans" diff --git a/pub_sub/components-k8s/pubsub.yaml b/pub_sub/components-k8s/pubsub.yaml new file mode 100644 index 000000000..2713eeb2e --- /dev/null +++ b/pub_sub/components-k8s/pubsub.yaml @@ -0,0 +1,14 @@ +apiVersion: dapr.io/v1alpha1 +kind: Component +metadata: + name: orderpubsub +spec: + type: pubsub.redis + version: v1 + metadata: + - name: redisHost + value: dapr-dev-redis-master:6379 + - name: redisPassword + secretKeyRef: + name: dapr-dev-redis + key: redis-password diff --git a/state_management/resources-k8s/resiliency.yaml b/state_management/resources-k8s/resiliency.yaml new file mode 100644 index 000000000..d9b3483bd --- /dev/null +++ b/state_management/resources-k8s/resiliency.yaml @@ -0,0 +1,27 @@ +apiVersion: dapr.io/v1alpha1 +kind: Resiliency +metadata: + name: myresiliency +scopes: + - order-processor + +spec: + policies: + retries: + retryForever: + policy: constant + duration: 5s + maxRetries: -1 + + circuitBreakers: + simpleCB: + maxRequests: 1 + timeout: 5s + trip: consecutiveFailures >= 5 + + targets: + components: + statestore: + outbound: + retry: retryForever + circuitBreaker: simpleCB \ No newline at end of file diff --git a/state_management/resources-k8s/statestore.yaml b/state_management/resources-k8s/statestore.yaml new file mode 100644 index 000000000..8ec715308 --- /dev/null +++ b/state_management/resources-k8s/statestore.yaml @@ -0,0 +1,16 @@ +apiVersion: dapr.io/v1alpha1 +kind: Component +metadata: + name: statestore +spec: + type: state.redis + version: v1 + metadata: + - name: redisHost + value: dapr-dev-redis-master:6379 + - name: redisPassword + secretKeyRef: + name: dapr-dev-redis + key: redis-password + - name: actorStateStore + value: "true" \ No newline at end of file diff --git a/workflows/components-k8s/state_redis.yaml b/workflows/components-k8s/state_redis.yaml new file mode 100644 index 000000000..5d14fe234 --- /dev/null +++ b/workflows/components-k8s/state_redis.yaml @@ -0,0 +1,17 @@ +apiVersion: dapr.io/v1alpha1 +kind: Component +metadata: + name: statestore +spec: + type: state.redis + version: v1 + initTimeout: 1m + metadata: + - name: redisHost + value: dapr-dev-redis-master:6379 + - name: redisPassword + secretKeyRef: + name: dapr-dev-redis + key: redis-password + - name: actorStateStore + value: "true" \ No newline at end of file