kubernetes-sigs / descheduler

Descheduler for Kubernetes
https://sigs.k8s.io/descheduler
Apache License 2.0
4.23k stars 645 forks source link

Helm chart - allow 'falsey' value in cmdOption #1390

Closed omerap12 closed 1 month ago

omerap12 commented 2 months ago

Fixed: #1371

linux-foundation-easycla[bot] commented 2 months ago

CLA Signed

The committers listed above are authorized under a signed CLA.

k8s-ci-robot commented 2 months ago

Welcome @omerap12!

It looks like this is your first PR to kubernetes-sigs/descheduler 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/descheduler has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot commented 2 months ago

Hi @omerap12. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
omerap12 commented 1 month ago

how would this work for flags such as --v=4?

what do you mean?

a7i commented 1 month ago

My apologies, this is what I meant to say:

This implementation will work for: --v=4 but it will not work for --enable-http2 where it doesn't require a value

omerap12 commented 1 month ago

My apologies, this is what I meant to say:

This implementation will work for: --v=4 but it will not work for --enable-http2 where it doesn't require a value

yes, you are right. lemme fix it real quick

omerap12 commented 1 month ago

Output example:

# Source: descheduler/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: release-name-descheduler
  namespace: default
  labels:
    app.kubernetes.io/name: descheduler
    helm.sh/chart: descheduler-0.29.0
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "0.29.0"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: descheduler
      app.kubernetes.io/instance: release-name
  template:
    metadata:
      labels:
        app.kubernetes.io/name: descheduler
        app.kubernetes.io/instance: release-name
      annotations:
        checksum/config: f35eff353cbeb8f608c03a0e9a21a65c6a12bbc3c7bccd407e5fc64709f3a935
    spec:
      priorityClassName: system-cluster-critical
      serviceAccountName: release-name-descheduler
      containers:
        - name: descheduler
          image: "registry.k8s.io/descheduler/descheduler:v0.29.0"
          imagePullPolicy: IfNotPresent
          command:
            - /bin/descheduler
          args:
            - --policy-config-file=/policy-dir/policy.yaml
            - --descheduling-interval=5m
            - --enable-https
            - --s=1
            - --v=0

          ports:
            - containerPort: 10258
              protocol: TCP
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 10258
              scheme: HTTPS
            initialDelaySeconds: 3
            periodSeconds: 10
          resources:
            requests:
              cpu: 500m
              memory: 256Mi
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
              - ALL
            privileged: false
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            runAsUser: 1000
          volumeMounts:
            - mountPath: /policy-dir
              name: policy-volume
      volumes:
        - name: policy-volume
          configMap:
            name: release-name-descheduler

For cronjob:

# Source: descheduler/templates/cronjob.yaml
apiVersion: batch/v1
kind: CronJob
metadata:
  name: release-name-descheduler
  namespace: default
  labels:
    app.kubernetes.io/name: descheduler
    helm.sh/chart: descheduler-0.29.0
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/version: "0.29.0"
    app.kubernetes.io/managed-by: Helm
spec:
  schedule: "*/2 * * * *"
  concurrencyPolicy: "Forbid"
  jobTemplate:
    spec:
      template:
        metadata:
          name: release-name-descheduler
          annotations:
            checksum/config: f35eff353cbeb8f608c03a0e9a21a65c6a12bbc3c7bccd407e5fc64709f3a935
          labels:
            app.kubernetes.io/name: descheduler
            app.kubernetes.io/instance: release-name
        spec:
          priorityClassName: system-cluster-critical
          serviceAccountName: release-name-descheduler
          restartPolicy: "Never"
          containers:
            - name: descheduler
              image: "registry.k8s.io/descheduler/descheduler:v0.29.0"
              imagePullPolicy: IfNotPresent
              command:
                - /bin/descheduler
              args:
                - --policy-config-file=/policy-dir/policy.yaml
                - --enable-https
                - --s=1
                - --v=0
              livenessProbe:
                failureThreshold: 3
                httpGet:
                  path: /healthz
                  port: 10258
                  scheme: HTTPS
                initialDelaySeconds: 3
                periodSeconds: 10
              resources:
                requests:
                  cpu: 500m
                  memory: 256Mi
              securityContext:
                allowPrivilegeEscalation: false
                capabilities:
                  drop:
                  - ALL
                privileged: false
                readOnlyRootFilesystem: true
                runAsNonRoot: true
                runAsUser: 1000
              volumeMounts:
                - mountPath: /policy-dir
                  name: policy-volume
          volumes:
          - name: policy-volume
            configMap:
              name: release-name-descheduler

with the values:

cmdOptions:
  v: 0
  enable-https:
  s: 1
JaneLiuL commented 1 month ago

/ok-to-test

a7i commented 1 month ago

/approve

k8s-ci-robot commented 1 month ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: a7i

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-sigs/descheduler/blob/master/OWNERS)~~ [a7i] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment