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

Admission webhook should not reject workloads with only resource limits set #4802

Closed
Tracked by #5275
nettoclaudio opened this issue Jul 16, 2023 · 3 comments · Fixed by #4803
Closed
Tracked by #5275

Admission webhook should not reject workloads with only resource limits set #4802

nettoclaudio opened this issue Jul 16, 2023 · 3 comments · Fixed by #4803
Assignees
Labels
bug Something isn't working help wanted Looking for support from community

Comments

@nettoclaudio
Copy link
Contributor

Report

I'm unable to create/update ScaleObjects with either CPU; memory; or both scalers, if the underlying workload assigns only resource limits and does not set any requests.

Expected Behavior

Based on Kubernetes documentation (I brought the quote below from here), users can assign only resource limits to their containers, so the ScaledObject admission webhook should also consider the resource limits during workload resources validation.

Note: If you specify a limit for a resource, but do not specify any request, and no admission-time mechanism has applied a default request for that resource, then Kubernetes copies the limit you specified and uses it as the requested value for the resource.

Actual Behavior

Workloads that only set resource limits are rejected by the admission webhook.

Steps to Reproduce the Problem

  1. Create a Deployment that assigns only resource limits (e.g CPU limits):
# Filename: deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
spec:
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
      - name: echo-server
        image: jmalloc/echo-server:latest
        resources:
          limits:
            cpu: 500m
kubectl apply -f ./deploy.yaml
  1. Create a ScaledObject with CPU scaler defined and points to the above Deployment:
# Filename: scaledobject.yaml
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: my-app-so
spec:
  maxReplicaCount: 5
  minReplicaCount: 1
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: my-app
  triggers:
  - metadata:
      value: "80"
    metricType: Utilization
    type: cpu
kubectl apply -f ./scaledobject.yaml
  1. Got the message from Kubernetes API Server:
admission webhook \"vscaledobject.kb.io\" denied the request: the scaledobject has a cpu trigger but the container echo-server doesn't have the cpu request defined

Logs from KEDA operator

No response

KEDA Version

2.11.1

Kubernetes Version

None

Platform

Any

Scaler Details

CPU, memory

Anything else?

No response

@stale
Copy link

stale bot commented Sep 16, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale All issues that are marked as stale due to inactivity label Sep 16, 2023
@zroubalik zroubalik removed the stale All issues that are marked as stale due to inactivity label Sep 18, 2023
Copy link

stale bot commented Nov 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale All issues that are marked as stale due to inactivity label Nov 17, 2023
@tomkerkhove tomkerkhove added help wanted Looking for support from community stale All issues that are marked as stale due to inactivity and removed stale All issues that are marked as stale due to inactivity labels Nov 21, 2023
@stale stale bot removed the stale All issues that are marked as stale due to inactivity label Nov 21, 2023
@tomkerkhove
Copy link
Member

@nettoclaudio There are some comments on your PR; are you able to resolve them please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Looking for support from community
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants