Client-go: Option to rollback using client-go

Created on 18 Apr 2018  路  7Comments  路  Source: kubernetes/client-go

I would like to rollback the deployment to a particular revision( rollout history) using client-go(6.0.0) library of k8s. I created a deployment using workload API object apps/v1beta2 . Seems in apps/v1beta2 there is no ".spec.rollbackTo options". Where can i find the options to rollback to particular revision using client-go(6.0.0) library.

lifecyclrotten

Most helpful comment

Ref my previous response in https://github.com/kubernetes/kubernetes/pull/59970#discussion_r169758147:

Because apps/v1 endpoint doesn't support .spec.rollbackTo, you'll need to implement the logic yourself:

  1. List all ReplicaSets the Deployment owns
  2. Find the ReplicaSet of a specific revision
  3. Copy that ReplicaSet's template back to the Deployment's template

The rollback logic currently lives in Deployment controller code, which still uses extensions/v1beta1 Deployment client:
https://github.com/kubernetes/kubernetes/blob/17fec00b8915dbffac40b9eb481516a66092ef3e/pkg/controller/deployment/rollback.go#L30-L69

Note that we _didn't_ remove rollback support because it should be done client-side. We removed rollback because we wanted to change how it's implemented server-side (i.e. with extensions/v1beta1 API, the Deployment controller mutates DeploymentSpec during rollback) and wanted to revisit it in the future. If we didn't remove rollback in apps/v1, it'd be very difficult to make that change in the future.

All 7 comments

/cc @janetkuo

Ref my previous response in https://github.com/kubernetes/kubernetes/pull/59970#discussion_r169758147:

Because apps/v1 endpoint doesn't support .spec.rollbackTo, you'll need to implement the logic yourself:

  1. List all ReplicaSets the Deployment owns
  2. Find the ReplicaSet of a specific revision
  3. Copy that ReplicaSet's template back to the Deployment's template

The rollback logic currently lives in Deployment controller code, which still uses extensions/v1beta1 Deployment client:
https://github.com/kubernetes/kubernetes/blob/17fec00b8915dbffac40b9eb481516a66092ef3e/pkg/controller/deployment/rollback.go#L30-L69

Note that we _didn't_ remove rollback support because it should be done client-side. We removed rollback because we wanted to change how it's implemented server-side (i.e. with extensions/v1beta1 API, the Deployment controller mutates DeploymentSpec during rollback) and wanted to revisit it in the future. If we didn't remove rollback in apps/v1, it'd be very difficult to make that change in the future.

Does it means the struct DeploymentRollback and RollbackConfig is no more needed or existing? @janetkuo

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jharshman picture jharshman  路  4Comments

peterwillcn picture peterwillcn  路  5Comments

ghost picture ghost  路  3Comments

strugglingyouth picture strugglingyouth  路  5Comments

AdheipSingh picture AdheipSingh  路  5Comments