Ejemplo n.º 1
0
    def rollback_release(self,
                         release_name,
                         version,
                         wait=False,
                         timeout=None,
                         force=False,
                         recreate_pods=False):
        '''
        Rollback a helm release.
        '''

        timeout = self._check_timeout(wait, timeout)

        LOG.debug(
            'Helm rollback%s of release=%s, version=%s, '
            'wait=%s, timeout=%s', (' (dry run)' if self.dry_run else ''),
            release_name, version, wait, timeout)
        try:
            stub = ReleaseServiceStub(self.channel)
            rollback_request = RollbackReleaseRequest(name=release_name,
                                                      version=version,
                                                      dry_run=self.dry_run,
                                                      wait=wait,
                                                      timeout=timeout,
                                                      force=force,
                                                      recreate=recreate_pods)

            rollback_msg = stub.RollbackRelease(rollback_request,
                                                timeout + GRPC_EPSILON,
                                                metadata=self.metadata)
            LOG.debug('RollbackRelease= %s', rollback_msg)
            return

        except Exception:
            raise ex.RollbackReleaseException(release_name, version)
Ejemplo n.º 2
0
 def rollback_release(self,
                      name,
                      version,
                      timeout=REQUEST_TIMEOUT,
                      dry_run=False,
                      disable_hooks=False,
                      recreate=False,
                      wait=False,
                      force=False):
     """回滚release
     Args:
         :params - name - release nam
         :params - version - release version
         :params - dry_run - simulate a rollback
         :params - disable_hooks - prevent hooks from running during rollback
         :params - recreate - performs pods restart for the resource if applicable
     Returns:
         返回回滚release的grpc响应对象
     """
     # build rollback release request
     stub = ReleaseServiceStub(self.channel)
     rollback_release_request = RollbackReleaseRequest(
         name=name,
         timeout=timeout,
         version=version,
         dry_run=dry_run,
         disable_hooks=disable_hooks,
         recreate=recreate,
         wait=wait,
         force=force)
     return stub.RollbackRelease(rollback_release_request,
                                 self.timeout,
                                 metadata=self.metadata)