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

Add replication controller status subresource #14672

Merged
merged 1 commit into from Oct 8, 2015

Conversation

derekwaynecarr
Copy link
Member

PR does the following:

  • Add a /status endpoint for replication controller.
  • Disable editing rc.Status when doing update
  • Disable editing rc.Spec when doing updateStatus

Fixes #4909

@derekwaynecarr
Copy link
Member Author

@kubernetes/rh-platform-management in case of any downstream issue.

@derekwaynecarr derekwaynecarr changed the title WIP: Add replication controller status subresource Add replication controller status subresource Sep 28, 2015
@k8s-bot
Copy link

k8s-bot commented Sep 28, 2015

Unit, integration and GCE e2e test build/test passed for commit afe8a2159458d61f9b7ff18f7161ad05728104cc.

@k8s-bot
Copy link

k8s-bot commented Sep 28, 2015

Unit, integration and GCE e2e build/test failed for commit ab5a3b83426609d58de5063c9393891d951ed0bd.

@derekwaynecarr
Copy link
Member Author

@k8s-bot test this

@k8s-github-robot k8s-github-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 28, 2015
@k8s-github-robot
Copy link

Labelling this PR as size/L

@k8s-bot
Copy link

k8s-bot commented Sep 28, 2015

Unit, integration and GCE e2e test build/test passed for commit ab5a3b83426609d58de5063c9393891d951ed0bd.

@derekwaynecarr
Copy link
Member Author

@thockin - can i get a quick review on this?

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 6, 2015
@derekwaynecarr derekwaynecarr removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 6, 2015
@derekwaynecarr
Copy link
Member Author

Rebased again. @thockin - any eyeballs available or reassign? @smarterclayton - got cycles?

@k8s-bot
Copy link

k8s-bot commented Oct 6, 2015

GCE e2e test build/test passed for commit ba4d8335699f73e8eec65109fa07e40ceeb02cb6.

newController := obj.(*api.ReplicationController)
oldController := old.(*api.ReplicationController)
// update is not allowed to set status
newController.Status = oldController.Status
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a backwards-incompatible API change. I don't think that we can do this in v1 unless we believe there is a security risk to the cluster to not change it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I had raised that concern prior to submitting the PR.

See @bgrant0607 comment here:
#4909 (comment)

I agree with his analysis.

Copy link
Member

Choose a reason for hiding this comment

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

It's a potential DoS vulnerability.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I agree as well.

On Wed, Oct 7, 2015 at 10:03 AM, Derek Carr notifications@github.com
wrote:

In pkg/registry/controller/strategy.go
#14672 (comment)
:

newController := obj.(*api.ReplicationController)
oldController := old.(*api.ReplicationController)
  • // update is not allowed to set status
  • newController.Status = oldController.Status

I had raised that concern prior to submitting the PR.

See @bgrant0607 https://github.com/bgrant0607 comment here:
#4909 (comment)
#4909 (comment)

I agree with his analysis.


Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/14672/files#r41393580.

@bgrant0607 bgrant0607 assigned bgrant0607 and unassigned thockin Oct 7, 2015
@bgrant0607
Copy link
Member

I'll take a look.

@@ -1338,6 +1339,23 @@ func ValidateReplicationControllerUpdate(oldController, controller *api.Replicat
allErrs := errs.ValidationErrorList{}
allErrs = append(allErrs, ValidateObjectMetaUpdate(&controller.ObjectMeta, &oldController.ObjectMeta).Prefix("metadata")...)
allErrs = append(allErrs, ValidateReplicationControllerSpec(&controller.Spec).Prefix("spec")...)
allErrs = append(allErrs, ValidateReplicationControllerStatus(&controller.Status).Prefix("status")...)
Copy link
Member

Choose a reason for hiding this comment

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

Should be ValidateReplicationControllerStatusUpdate.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is an internal helper function that is used by both

ValidateReplicationController(...)
ValidateReplicationControllerStatusUpdate(...)

to verify just the rc.status section of the resource.

the ValidateReplicationControllerStatusUpdate function (which I added in this PR) is what you expect.

@bgrant0607
Copy link
Member

Mostly looks pretty reasonable, thanks.

You need to regenerate the swagger spec again.

@smarterclayton
Copy link
Contributor

No further comments from me.

@bgrant0607
Copy link
Member

@derekwaynecarr Please mention me explicitly when you push the fixes.

@derekwaynecarr
Copy link
Member Author

@bgrant0607 - made requested updates.

  1. I had confused myself with the Validate*** comments, things should be fixed now as you expect.
  2. regenerated swagger from HEAD

this should be good to go.

Thanks!

@k8s-bot
Copy link

k8s-bot commented Oct 7, 2015

GCE e2e test build/test passed for commit d05b382d0852add12c8c7a50f2010c39aaa5bf78.

@k8s-bot
Copy link

k8s-bot commented Oct 7, 2015

GCE e2e build/test failed for commit 544b453.

@derekwaynecarr
Copy link
Member Author

@k8s-bot - test this

@@ -356,7 +356,8 @@ func (JobStatus) SwaggerDoc() map[string]string {
}

var map_NodeUtilization = map[string]string{
"": "NodeUtilization describes what percentage of a particular resource is used on a node.",
"": "NodeUtilization describes what percentage of a particular resource is used on a node.",
Copy link
Member

Choose a reason for hiding this comment

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

This has been fixed in head.

@bgrant0607
Copy link
Member

LGTM

@bgrant0607
Copy link
Member

@k8s-bot test this

@bgrant0607 bgrant0607 added lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Oct 7, 2015
@k8s-bot
Copy link

k8s-bot commented Oct 7, 2015

GCE e2e test build/test passed for commit 544b453.

@bgrant0607
Copy link
Member

Please create a cherrypick PR for 1.1 after this merges.

"nodes/status": nodeStatusStorage,
"events": eventStorage,
"replicationControllers": controllerStorage,
"replicationControllers/status": controllerStatusStorage,
Copy link
Member

Choose a reason for hiding this comment

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

didn't we convert everything to all-lowercase?

Copy link
Member Author

Choose a reason for hiding this comment

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

Case conversion happens automatically. Internally we have camel case in
many parts of the code.

On Thursday, October 8, 2015, Tim Hockin notifications@github.com wrote:

In pkg/master/master.go
#14672 (comment)
:

@@ -567,12 +567,13 @@ func (m *Master) init(c *Config) {

    "podTemplates": podTemplateStorage,
  •   "replicationControllers": controllerStorage,
    
  •   "services":               service.NewStorage(m.serviceRegistry, m.endpointRegistry, serviceClusterIPAllocator, serviceNodePortAllocator),
    
  •   "endpoints":              endpointsStorage,
    
  •   "nodes":                  nodeStorage,
    
  •   "nodes/status":           nodeStatusStorage,
    
  •   "events":                 eventStorage,
    
  •   "replicationControllers":        controllerStorage,
    
  •   "replicationControllers/status": controllerStatusStorage,
    

didn't we convert everything to all-lowercase?


Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/14672/files#r41474385.

Copy link
Member

Choose a reason for hiding this comment

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

Ugly, but true.

Copy link
Contributor

Choose a reason for hiding this comment

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

Now that we have dropped the old name, we can normalize the internal
constants. It would probably reduce confusion for code reviewers.

On Fri, Oct 9, 2015 at 12:16 PM, Brian Grant notifications@github.com
wrote:

In pkg/master/master.go
#14672 (comment)
:

@@ -567,12 +567,13 @@ func (m *Master) init(c *Config) {

    "podTemplates": podTemplateStorage,
  •   "replicationControllers": controllerStorage,
    
  •   "services":               service.NewStorage(m.serviceRegistry, m.endpointRegistry, serviceClusterIPAllocator, serviceNodePortAllocator),
    
  •   "endpoints":              endpointsStorage,
    
  •   "nodes":                  nodeStorage,
    
  •   "nodes/status":           nodeStatusStorage,
    
  •   "events":                 eventStorage,
    
  •   "replicationControllers":        controllerStorage,
    
  •   "replicationControllers/status": controllerStatusStorage,
    

Ugly, but true.


Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/14672/files#r41648501.

piosz added a commit that referenced this pull request Oct 8, 2015
Add replication controller status subresource
@piosz piosz merged commit 6217869 into kubernetes:master Oct 8, 2015
k8s-github-robot referenced this pull request Oct 10, 2015
…f-#14672-upstream-release-1.1

Auto commit by PR queue bot
shyamjvs referenced this pull request in shyamjvs/kubernetes Dec 1, 2016
…rry-pick-of-#14672-upstream-release-1.1

Auto commit by PR queue bot
shouhong referenced this pull request in shouhong/kubernetes Feb 14, 2017
…rry-pick-of-#14672-upstream-release-1.1

Auto commit by PR queue bot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants