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

Fix the cpu limits and requests in generated deployment file #838

Merged
merged 3 commits into from
Oct 10, 2017

Conversation

denverdino
Copy link
Contributor

Signed-off-by: Li Yi denverdino@gmail.com

The source docker-compose.yml with CPU limits and reservations is as following.

version: '3'
services:
  mysql:
    image: mysql:5.7
    environment:
      - MYSQL_ROOT_PASSWORD=password
    deploy:
      resources:
        limits:
          cpus: "1"
        reservations:
          cpus: "0.5"

The generated deployment file with kompose 1.2 has incorrect format for CPU resource

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: kompose convert
    kompose.version: 1.2.0 (99f88ef)
  creationTimestamp: null
  labels:
    io.kompose.service: mysql
  name: mysql
spec:
  replicas: 1
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        io.kompose.service: mysql
    spec:
      containers:
      - env:
        - name: MYSQL_ROOT_PASSWORD
          value: password
        image: mysql:5.7
        name: mysql
        resources:
          limits:
            cpu: 1e3
          requests:
            cpu: "500"
      restartPolicy: Always
status: {}

The proper format should be

...
        resources:
          limits:
            cpu: "1"
          requests:
            cpu: 500m

Signed-off-by: Li Yi <denverdino@gmail.com>
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 9, 2017
Signed-off-by: Li Yi <denverdino@gmail.com>
@surajnarwade
Copy link
Contributor

@denverdino , thanks for the PR, can you modify functional test accordingly, PR looks good to me

Signed-off-by: Li Yi <denverdino@gmail.com>
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Oct 10, 2017
@denverdino
Copy link
Contributor Author

@surajnarwade Done, thx.

@surajnarwade
Copy link
Contributor

@denverdino LGTM, let's wait for @cdrage's review

@cdrage
Copy link
Member

cdrage commented Oct 10, 2017

You're right, the quantities are wrong. Thanks for this fix @denverdino !

@cdrage cdrage merged commit b262119 into kubernetes:master Oct 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants