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

Introduce new way to deploy and configure workers #183

Merged
merged 12 commits into from
Sep 2, 2024
Merged

Conversation

Zelldon
Copy link
Member

@Zelldon Zelldon commented Sep 2, 2024

PR contains

Introduce a new workers value into the values.yaml, next to the old worker value. This is to keep backward compatibility.

The worker.yaml has been copied and extended with templates, such that it can be better configured from the values file. New configuration options are: jobtype, completionDelay, payloadPath, loglevel, resources

Furthermore, the workers are now more extensible, such that we can define many more workers, by easily adding new maps (values) for specific workers.

This will be useful for the realistic benchmarks where we want to deploy many different workers, see also slack channel

Example

# Worker configuration for the to be deployed worker application
worker:
  # Worker.benchmark defines the configuration for the default benchmark worker
  # See below if you want additional workers
  benchmark:
    # Worker.benchmark.replicas defines how many replicas of the benchmark worker should be deployed, defaults to 3
    replicas: 3
    # Worker.benchmark.capacity defines how many jobs the worker should activate and work on, defaults to 30.
    capacity: 60
    # Worker.benchmark.jobType defines the job type which should be used by the worker, defaults to "benchmark-task"
    jobType: "benchmark-task"
    # Worker.benchmark.logLevel defines the logging level for the benchmark worker, defaults to "INFO"
    logLevel: "WARN"
    # Worker.benchmark.resources defines the resources for the benchmark worker
    resources:
      limits:
        cpu: 500m
        memory: 256Mi
      requests:
        cpu: 500m
        memory: 256Mi

  # Worker.benchmark defines the configuration for the default benchmark worker
  # Adding more and different worker can be done via adding a new map like:
  benchmark-2:
    # Worker.benchmark.replicas defines how many replicas of the benchmark worker should be deployed, defaults to 3
    replicas: 3
    # Worker.benchmark.capacity defines how many jobs the worker should activate and work on, defaults to 30.
    capacity: 60
    # Worker.benchmark.jobType defines the job type which should be used by the worker, defaults to "benchmark-task"
    jobType: "benchmark-2-task"
    # Worker.benchmark.logLevel defines the logging level for the benchmark worker, defaults to "INFO"
    logLevel: "WARN"
    # Worker.benchmark.resources defines the resources for the benchmark worker
    resources:
      limits:
        cpu: 500m
        memory: 256Mi
      requests:
        cpu: 500m
        memory: 256Mi

Having the worker values in our values.yaml can produce the following deployments:

$ helm template zeebe-benchmark-test charts/zeebe-benchmark --render-subchart-notes --debug --show-only templates/worker.yaml
install.go:214: [debug] Original chart version: ""
install.go:231: [debug] CHART PATH: /home/cqjawa/go/src/github.com/zeebe-io/benchmark-helm/charts/zeebe-benchmark

---
# Source: zeebe-benchmark/templates/worker.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: benchmark-worker
  labels:
    app: benchmark-worker
spec:
  selector:
    matchLabels:
      app: benchmark-worker
  replicas: 3
  template:
    metadata:
      labels:
        app: benchmark-worker
        app.kubernetes.io/component: zeebe-client
    spec:
      containers:
        - name: benchmark-worker
          image: "gcr.io/zeebe-io/worker:SNAPSHOT"
          imagePullPolicy: Always
          env:
            - name: JDK_JAVA_OPTIONS
              value: >-
                -Dconfig.override_with_env_vars=true
                -Dapp.brokerUrl=zeebe-benchmark-test-zeebe-gateway:26500
                -Dzeebe.client.requestTimeout=62000
                -Dapp.worker.capacity=60
                -Dapp.worker.pollingDelay=1ms
                -Dapp.worker.completionDelay=50ms
                -Dapp.worker.workerName="benchmark"
                -Dapp.worker.jobType="benchmark-task"
                -XX:+HeapDumpOnOutOfMemoryError
            - name: LOG_LEVEL
              value: "WARN"
          resources:
            limits:
              cpu: 500m
              memory: 256Mi
            requests:
              cpu: 500m
              memory: 256Mi
          ports:
            - containerPort: 9600
              name: "http"
---
# Source: zeebe-benchmark/templates/worker.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: benchmark-2-worker
  labels:
    app: benchmark-2-worker
spec:
  selector:
    matchLabels:
      app: benchmark-2-worker
  replicas: 3
  template:
    metadata:
      labels:
        app: benchmark-2-worker
        app.kubernetes.io/component: zeebe-client
    spec:
      containers:
        - name: benchmark-2-worker
          image: "gcr.io/zeebe-io/worker:SNAPSHOT"
          imagePullPolicy: Always
          env:
            - name: JDK_JAVA_OPTIONS
              value: >-
                -Dconfig.override_with_env_vars=true
                -Dapp.brokerUrl=zeebe-benchmark-test-zeebe-gateway:26500
                -Dzeebe.client.requestTimeout=62000
                -Dapp.worker.capacity=60
                -Dapp.worker.pollingDelay=1ms
                -Dapp.worker.completionDelay=50ms
                -Dapp.worker.workerName="benchmark-2"
                -Dapp.worker.jobType="benchmark-2-task"
                -XX:+HeapDumpOnOutOfMemoryError
            - name: LOG_LEVEL
              value: "WARN"
          resources:
            limits:
              cpu: 500m
              memory: 256Mi
            requests:
              cpu: 500m
              memory: 256Mi
          ports:
            - containerPort: 9600
              name: "http"

Add templates to worker.yaml, so it can be configured from values file
New configuration options: jobtype, loglevel, resources

Make worker extensible so we can define many more workers, via
easily adding new maps (values) for specific workers.
@Zelldon
Copy link
Member Author

Zelldon commented Sep 2, 2024

Missing capabilities seem to be related to the camunda-platform helm chart change, I reported it here

Replace defaults with conditional branches, to
avoid to maintain several defaults, in values, templates and benchmark apps.

Conditions allow toe also not set values, like resources
In order to be backward compatible with previous deployments
introduce a new workers values, instead of overwriting the worker
@Zelldon Zelldon changed the title Configure Worker and make them more extensible Introduce new way to deploy and configure workers Sep 2, 2024
Copy link
Member

@npepinpe npepinpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@Zelldon Zelldon merged commit a63de60 into main Sep 2, 2024
3 checks passed
@Zelldon Zelldon deleted the ck-configure-apps branch September 3, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants