datastax / kaap

KAAP, Kubernetes Autoscaling for Apache Pulsar
https://datastax.github.io/kaap/
Apache License 2.0
45 stars 15 forks source link

Add resources templating option to kaap operator deployment #159

Open MarkusNeuron opened 1 year ago

MarkusNeuron commented 1 year ago

For our cluster operation and complying to security standards its mandatory being able to configure pod resources.

Some standards for resources configuration we need to comply:

Because we should be flexible to applying different patterns for resource-requests and -limits I templated the full resources: block depending on values configuration and not the individual values. E.g. one example pattern for requests and limits

MarkusNeuron commented 11 months ago

Any update on this one?

nicoloboschi commented 11 months ago

Thanks @MarkusNeuron I'll cut a release once CI passes and this is merged

nicoloboschi commented 11 months ago

@MarkusNeuron can you please fix the CI?

I think you have to add the new values property here: https://github.com/datastax/kaap/blob/daaf6fc88d0599be04af063eb8cb1606c36558e8/tests/src/test/java/com/datastax/oss/kaap/tests/BaseK8sEnvTest.java#L215

MarkusNeuron commented 11 months ago

Added var to test. Hope this fixes CI.

MarkusNeuron commented 11 months ago

Test failed again. It seems that the test library can not work with templating functions. I will change test test to an empty resources key. I hope to fix the testcase issue this way.

MarkusNeuron commented 11 months ago

Sorry guys I do not know how to fix this in test. When I template with:

operator:
  enabled: true
  image: datastax/kaap:0.2.0
  imagePullPolicy: IfNotPresent
  replicas: 1
  resources: {}
  livenessProbe:
    failureThreshold: 3
...

of without resource key at all I get the correct output without resource config.

Templating with values:

operator:
  enabled: true
  image: datastax/kaap:0.2.0
  imagePullPolicy: IfNotPresent
  replicas: 1
  resources:
    requests:
      cpu: "0.2"
      memory: "512Mi"
    limits:
      memory: "512Mi"  
  livenessProbe:
    failureThreshold: 3

leads also to the correct template:

...
    spec:
      containers:
        - env:
            - name: KUBERNETES_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          envFrom:
            - configMapRef:
                name: kaap
          image: datastax/kaap:0.2.0
          imagePullPolicy: IfNotPresent
          resources:
            limits:
              memory: 512Mi
            requests:
              cpu: "0.2"
              memory: 512Mi
          livenessProbe:
            failureThreshold: 3
...

So how we can fix the java for ci testing? Thx, Markus