Repository navigation
Update oc idle to patch dc's and rc's instead of update - #11634
openshift-bot merged 1 commit into
Conversation
|
[test] |
| typedObj.Annotations = make(map[string]string) | ||
| } | ||
|
|
||
| originalObj, err := json.Marshal(typedObj) |
There was a problem hiding this comment.
why not use an encoder instead of raw json package?
|
@mfojtik i would like to have this for 1.4 |
| scale.Spec.Replicas = scalableRef.Replicas | ||
|
|
||
| if err = scaleAnnotater.UpdateObjectScale(info.Namespace, scalableRef.CrossGroupObjectReference, obj, scale); err != nil { | ||
| codec := kapi.Codecs.LegacyCodec(registered.EnabledVersions()...) |
There was a problem hiding this comment.
@liggitt Switched to use runtime.Encode(), however I am not sure if this is the right way of obtaining a codec here
|
@liggitt Am I using the wrong encoder? deploymentconfig object when using same object when using EDIT: I receicve an empty array of bytes when generating a {"Spec":{"Replicas":0},"annotations":{"idling.alpha.openshift.io/idled-at":"2016-10-31T19:11:43Z","idling.alpha.openshift.io/previous-scale":"1"}} |
|
Also fixes #10988 |
|
cc @DirectXMan12 @fabianofranz @smarterclayton Per Solly's suggestion, I have added a |
|
Win, now this is looking like properly architected. I imagine this is already covered by tests so we don't need to write new ones, correct? |
|
Can I get a quick summary of why we can't use patch in scale? Do we need On Nov 1, 2016, at 9:46 AM, Fabiano Franz [email protected] wrote: Win, now this is looking like properly architected. I imagine this is — |
|
Patch on scale with name/namespace/uid set should work correctly. |
|
I think this is patch under scale - an unrelated change should not block On Nov 1, 2016, at 9:56 AM, Jordan Liggitt [email protected] wrote: Patch on scale with name/namespace/uid/resourceVersion set should work — |
|
Yeah, edited that one second after making that comment |
|
@liggitt @smarterclayton Should I update unidling/controller/controller.go to use |
|
This is a problem with scale, not with the clients of Scale. If this is a On Tue, Nov 1, 2016 at 1:49 PM, Juan Vallejo [email protected]
|
|
@smarterclayton @DirectXMan12 updated The only times Patch() is not used is when the resource kind is unknown PTAL |
DirectXMan12
left a comment
There was a problem hiding this comment.
I don't necessarily want to block this PR, but I'd prefer that the ScaleUpdater not be touching the innards (fields) of the ScaleAnnotater. That seems ugly to me. Otherwise, this is probably fine.
b88b477 to
05aad3e
Compare
|
@DirectXMan12 Thanks for the feedback! Updated |
| @@ -12,6 +12,7 @@ import ( | |||
|
|
|||
| cmdutil "github.com/openshift/origin/pkg/cmd/util" | |||
| utilerrors "github.com/openshift/origin/pkg/util/errors" | |||
There was a problem hiding this comment.
Move these imports with the rest of the Openshift imports
f797138 to
f7aede6
Compare
Done! |
f7aede6 to
a3ab2c9
Compare
| return true, nil, errors.NewNotFound(action.GetResource().GroupResource(), obj.Name) | ||
| }) | ||
|
|
||
| fakeDeployClient.PrependReactor("patch", "deploymentconfigs", func(action ktestingcore.Action) (bool, runtime.Object, error) { |
| annotator.ChangeAnnotations(typedObj.Spec.Replicas, typedObj.Annotations) | ||
| typedObj.Spec.Replicas = scale.Spec.Replicas | ||
|
|
||
| newObj, err := json.Marshal(typedObj) |
There was a problem hiding this comment.
That wasn't still addressed, we should not be using raw json package for any kind of encoding. Sooner or later this will bite us hard. I'd rather fix it before that happens. Here and the next call in the following case, as well.
There was a problem hiding this comment.
That wasn't still addressed, we should not be using raw json package for any kind of encoding. Sooner or later this will bite us hard. I'd rather fix it before that happens. Here and the next call in the following case, as well.
Thanks for the feedback, done!
268eee8 to
f8ee34f
Compare
|
conformance flaked on #10988 re[test] |
f8ee34f to
df345fa
Compare
|
flaked on #9076 re[test] |
|
conformance flaked on #11775 re[test] |
9f9173f to
d0b68d6
Compare
|
@DirectXMan12 @smarterclayton any other comments here? |
DirectXMan12
left a comment
There was a problem hiding this comment.
I'd prefer for the scaleUpdater to be moved to utils if it's being used by both the controller and oc -- oc shouldn't have to pull in the entire controller code. Once that's done, this is probably fine.
Makes sense, done |
|
@DirectXMan12 @fabianofranz I will go ahead and squash if there are no more comments, thanks for the review |
aaa2ceb to
b701818
Compare
|
Evaluated for origin test up to b701818 |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/11552/) (Base Commit: 32c2948) |
|
LGTM [merge] |
|
Evaluated for origin merge up to b701818 |
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/11562/) (Base Commit: cdf9282) (Image: devenv-rhel7_5384) |
Fixes #11622 as well as a minor bug when running the command without
--dry-runcc @openshift/cli-review @Kargakis