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

Implement oc set route-backend and A/B to describers / printers #10551

Merged
merged 2 commits into from
Aug 21, 2016

Conversation

smarterclayton
Copy link
Contributor

@smarterclayton smarterclayton commented Aug 20, 2016

oc set route-backends foo a=10 b=20 c=0

Adds describer and printer support for router.

$ oc set route-backends --all
NAME         KIND     TO    WEIGHT
routes/bar   Service  bar   100 (100%)
routes/bar2  Service  bar2  100 (100%)
routes/foo   Service  a1    0
routes/foo   Service  b2    0
routes/foo   Service  c3    0

$ oc set route-backends foo a=10 b=30
route "foo" updated

$ oc set route-backends foo
NAME        KIND     TO  WEIGHT
routes/foo  Service  a   10 (25%)
routes/foo  Service  b   30 (75%)

$ oc describe route foo
Name:           foo
Namespace:      default
Created:        4 minutes ago
Labels:         <none>
Annotations:        openshift.io/host.generated=true
Requested Host:     foo-default.router.default.svc.cluster.local
Path:           <none>
TLS Termination:    edge
Insecure Policy:    <none>
Endpoint Port:      8080

Service:    a
Weight:     10 (25%)
Endpoints:  <error: endpoints "a" not found>

Service:    b
Weight:     30 (75%)
Endpoints:  <error: endpoints "b" not found>

$ oc get route
NAME      HOST/PORT                                       PATH      SERVICES        PORT      TERMINATION
bar       bar-default.router.default.svc.cluster.local              bar(100%)       9090      edge
bar2      bar2-default.router.default.svc.cluster.local             bar2(100%)      9090      edge
foo       foo-default.router.default.svc.cluster.local              a(25%),b(75%)   8080      edge

Primary use cases for set route-backend:

  1. Allow someone to easily set a number of backends at a time: oc set route-backends foo a=N b=N c=N
  2. Allow someone to script tweaking a particular backend up: oc set route-backends foo --adjust a=+10%
  3. Allow someone to reset to even: oc set route-backends foo --equal
  4. Allow someone to zero out the weights: oc set route-backends foo --zero

@smarterclayton
Copy link
Contributor Author

[test]

@smarterclayton smarterclayton added this to the 1.3.0 milestone Aug 20, 2016
    oc set route-backends foo a=10 b=20 c=0

Adds describer and printer support for router.
@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 1aac6c3

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/8286/)

@smarterclayton
Copy link
Contributor Author

[merge] @jwforres / @fabianofranz if you can do a retroactive - we'll consider this experimental / new

@openshift-bot
Copy link
Contributor

openshift-bot commented Aug 21, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/8288/) (Image: devenv-rhel7_4888)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 1aac6c3

@openshift-bot openshift-bot merged commit 7b3e38d into openshift:master Aug 21, 2016
return UpdateBackendsForObject(info.Object, o.Transform.Apply)
})
if singular && len(patches) == 0 {
return fmt.Errorf("%s/%s is not a deployment config or build config", infos[0].Mapping.Resource, infos[0].Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

cp error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smarterclayton
Copy link
Contributor Author

Follow up

  • warn if service doesn't exist
  • error if user provides percentages to "set" and they don't equal 100%
  • --allow-headers doesn't work

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.

3 participants