Skip to content

ClusterResourceOverride: overcommit admission controller - #6901

Merged
openshift-bot merged 1 commit into
openshift:masterfrom
sosiouxme:20160125-overcommit-admission
Feb 16, 2016
Merged

openshift-bot merged 1 commit into
openshift:masterfrom
sosiouxme:20160125-overcommit-admission

Conversation

@sosiouxme

Copy link
Copy Markdown
Member

Allows master config to override request and limit on submitted pods in order to control "request" overcommit and peg cpu limit to memory limit.

https://trello.com/c/rRN7m0zv/546-5-override-container-resource-request-based-on-limit

@sosiouxme

Copy link
Copy Markdown
Member Author

@csrwng I wasn't sure where to put this so I made a new directory. Can you think of a better location?

@csrwng

csrwng commented Jan 29, 2016

Copy link
Copy Markdown
Contributor

@sosiouxme yeah, this isn't for any of our resources. My preference would be under pkg/cmd/server/admission
@deads2k do you have a preference?

@sosiouxme sosiouxme changed the title [WIP] 20160125 overcommit admission [WIP] overcommit admission Jan 29, 2016
Comment thread pkg/pod/admission/limit_request.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Give this an explicit name. It will make a future transition to config cleaner.

@deads2k

deads2k commented Jan 29, 2016

Copy link
Copy Markdown
Contributor

@deads2k do you have a preference?

I would probably make a quota package: pkg/quota/admission. At some point, we'll have additional quota admission plugins for handling quota of our resources. It's a pretty minor change to move later though.

Comment thread pkg/pod/admission/limit_request.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this statement counting on this admission plugin coming after the LimitRanger one, so that whatever limit we set will not cause problems? if so, that might be worth calling out

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, it is supposed to come after, and yes that is worth a comment. Actually my reasoning was that in most cases the user isn't going to set any limit/request and I'm relying on the LimitRanger plugin to set values according to project limits object(s). I don't know if we're actually concerned about the adjustments landing outside what the limits say; I would think not.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

well, if this comes before the limitranger admission, and it makes an adjustment that makes it fall outside the allowed range, then the pod would be rejected. it's just a bit odd to stack admission plugins, one of which could do something another one would find invalid

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I agree it's a bit odd, however the alternatives seem about as odd (unless I'm missing some):

  • hack this into the LimitRanger plugin, which would mean carrying a patch in Godeps
  • run the LimitRanger before and after this plugin

Both are completely admin-configured, and seem like low risk for foot-shooting, although it certainly could confuse some.

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 1, 2016
@sosiouxme
sosiouxme force-pushed the 20160125-overcommit-admission branch 3 times, most recently from cd04752 to 84c2ddd Compare February 1, 2016 22:40
@sosiouxme

Copy link
Copy Markdown
Member Author

addressed comments, rebased, etc.

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 1, 2016
@sosiouxme
sosiouxme force-pushed the 20160125-overcommit-admission branch from 88e0ce8 to b02c8ba Compare February 2, 2016 16:20
@sosiouxme sosiouxme changed the title [WIP] overcommit admission PodRequestLimit: overcommit admission controller Feb 2, 2016
@sosiouxme
sosiouxme force-pushed the 20160125-overcommit-admission branch from b02c8ba to ac796ef Compare February 2, 2016 18:01
@sosiouxme

Copy link
Copy Markdown
Member Author

@csrwng @deads2k @liggitt other than adding some integration testing I think this is done. Care to take another look?

@spadgett

spadgett commented Feb 2, 2016

Copy link
Copy Markdown
Member

@sosiouxme Looks like this is generating an invalid config.js.

openshift_web_console

@sosiouxme

Copy link
Copy Markdown
Member Author

@derekwaynecarr this is the override PR.

@liggitt derek notes that pod specs are mutable now and will be able to update at least pod limits and maybe requests too later - should I pre-emptively handle updates here too or wait until that functionality actually exists?

Also derek thinks this should run before the limitranger so that we don't create containers/pods that are adjusted after validation and would fail validation on the next update. I guess I agree, except that means this needs to fill in the limit defaults (if missing) before doing the overrides.

@sosiouxme

Copy link
Copy Markdown
Member Author

@spadgett sorry i'll fix that as soon as I can

@spadgett

spadgett commented Feb 2, 2016

Copy link
Copy Markdown
Member

@sosiouxme No worries, I have other limit validation stuff to fix :-/

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 2, 2016
Comment thread hack/test-cmd.sh Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wouldn't a better way to break it be to append a duplicate key that points to a struct of the wrong type?
like

echo "
kubernetesMasterConfig: invalidData
" >> ${BASETMPDIR}/master-config-broken.yaml

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

i think it's trying to test the validation with fields missing. yaml deserialization errors don't make the test pass. but it's not a bad idea to add a duplicate with fields missing rather than trying to hack up the existing file. i'll play with it.

@sosiouxme

Copy link
Copy Markdown
Member Author

[test]

Comment thread assets/app/scripts/app.js Outdated
.constant("LOGGING_URL", (window.OPENSHIFT_CONFIG || {}).loggingURL)
.constant("METRICS_URL", (window.OPENSHIFT_CONFIG || {}).metricsURL)
.constant("LIMIT_REQUEST_OVERRIDES", _.get(window.OPENSHIFT_CONFIG, "limitRequestOverrides", {}))
.constant("LIMIT_REQUEST_OVERRIDES", _.get(window.OPENSHIFT_CONFIG, "limitRequestOverrides", null))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@spadgett I think I did this right but I can't figure out where to view the changes on my console.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

nm, found it and all seems to be working. so just an FYI for you.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just get rid of the 3rd arg to _.get, and it will be undefined. Or you could leave it {} and remove the null checks in limits.js.

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 15, 2016
@sosiouxme

Copy link
Copy Markdown
Member Author

Anyone have feelings about a merge? Devcut being tomorrow and all...

_ "github.com/openshift/origin/pkg/build/admission/defaults/api/install"
_ "github.com/openshift/origin/pkg/build/admission/overrides/api/install"
_ "github.com/openshift/origin/pkg/project/admission/requestlimit/api/install"
_ "github.com/openshift/origin/pkg/quota/admission/clusterresourceoverride/api/install"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

these were moved to pkg/cmd/server/api/install/install.go

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

On Tue, Feb 16, 2016 at 9:15 AM, David Eads [email protected]
wrote:

In pkg/cmd/server/api/install/install.go
#6901 (comment):

  • _ "github.com/openshift/origin/pkg/quota/admission/clusterresourceoverride/api/install"

these were moved to pkg/cmd/server/api/install/install.go

I followed suit and put mine in the same place as the other admission
plugins... did I miss something?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I followed suit and put mine in the same place as the other admission
plugins... did I miss something?

Nope, seems I lost my mind.

@deads2k

deads2k commented Feb 16, 2016

Copy link
Copy Markdown
Contributor

Relatively minor comments. Someone else will need to review the asset stuff, probably @liggitt

@liggitt

liggitt commented Feb 16, 2016

Copy link
Copy Markdown
Contributor

@spadgett for asset review

@sosiouxme
sosiouxme force-pushed the 20160125-overcommit-admission branch from 8803be9 to 1224403 Compare February 16, 2016 14:55
Comment thread assets/app/scripts/services/limits.js Outdated
return LIMIT_REQUEST_OVERRIDES.enabled &&
LIMIT_REQUEST_OVERRIDES.limitCPUToMemoryRatio &&
LIMIT_REQUEST_OVERRIDES.cpuRequestToLimitRatio;
return LIMIT_REQUEST_OVERRIDES !== null &&

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

      return LIMIT_REQUEST_OVERRIDES &&
             LIMIT_REQUEST_OVERRIDES.limitCPUToMemoryPercent &&
             LIMIT_REQUEST_OVERRIDES.cpuRequestToLimitPercent;

@sosiouxme

Copy link
Copy Markdown
Member Author

@deads2k can I get a LGTM? Tests actually passed finally. Will of course squash/rebase.

@deads2k

deads2k commented Feb 16, 2016

Copy link
Copy Markdown
Contributor

lgtm as long as @spadgett is happy with the asset stuff.

@spadgett

Copy link
Copy Markdown
Member

Asset changes LGTM

@sosiouxme
sosiouxme force-pushed the 20160125-overcommit-admission branch from 968ab58 to 858a2c0 Compare February 16, 2016 21:07
@sosiouxme

Copy link
Copy Markdown
Member Author

[merge]

@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/4979/) (Image: devenv-rhel7_3441)

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to 858a2c0

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to 858a2c0

@openshift-bot

Copy link
Copy Markdown
Contributor

openshift-bot pushed a commit that referenced this pull request Feb 16, 2016
@openshift-bot
openshift-bot merged commit 61efddd into openshift:master Feb 16, 2016
@sosiouxme
sosiouxme deleted the 20160125-overcommit-admission branch February 17, 2016 02:46
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.

8 participants