Uploaded image for project: 'OpenShift Builds'
  1. OpenShift Builds
  2. BUILD-976

oc adm prune deployments` does not work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • None
    • None
    • None
    • False
    • None
    • False

      Description of problem:

      oc adm prune deployments` does not work and giving below error:

      [root@weyb1525 ~]# oc adm prune deployments --orphans --keep-complete=1 --keep-failed=0 --keep-younger-than=1440m --replica-sets --v=6
      I0603 09:55:39.588085 1540280 loader.go:373] Config loaded from file:  /root/openshift-install/paas-03.build.net.intra.laposte.fr/auth/kubeconfig
      I0603 09:55:39.890672 1540280 round_trippers.go:553] GET https://api-int.paas-03.build.net.intra.laposte.fr:6443/apis/apps.openshift.io/v1/deploymentconfigs 200 OK in 301 milliseconds
      Warning: apps.openshift.io/v1 DeploymentConfig is deprecated in v4.14+, unavailable in v4.10000+
      I0603 09:55:40.529367 1540280 round_trippers.go:553] GET https://api-int.paas-03.build.net.intra.laposte.fr:6443/apis/apps/v1/deployments 200 OK in 65 milliseconds
      I0603 09:55:41.369413 1540280 round_trippers.go:553] GET https://api-int.paas-03.build.net.intra.laposte.fr:6443/api/v1/replicationcontrollers 200 OK in 706 milliseconds
      I0603 09:55:43.083804 1540280 round_trippers.go:553] GET https://api-int.paas-03.build.net.intra.laposte.fr:6443/apis/apps/v1/replicasets 200 OK in 118 milliseconds
      I0603 09:55:43.320700 1540280 prune.go:58] Creating deployment pruner with keepYoungerThan=24h0m0s, orphans=true, replicaSets=true, keepComplete=1, keepFailed=0
      Dry run enabled - no modifications will be made. Add --confirm to remove deployments
      panic: interface conversion: interface {} is *v1.Deployment, not *v1.DeploymentConfig
      
      goroutine 1 [running]:
      github.com/openshift/oc/pkg/cli/admin/prune/deployments.(*dataSet).GetDeployment(0xc007fa9bc0, {0x5052780?, 0xc00a0b67b0?})
              /go/src/github.com/openshift/oc/pkg/cli/admin/prune/deployments/data.go:171 +0x3d6
      github.com/openshift/oc/pkg/cli/admin/prune/deployments.(*orphanReplicaResolver).Resolve(0xc006ec87f8)
              /go/src/github.com/openshift/oc/pkg/cli/admin/prune/deployments/resolvers.go:78 +0x1a6
      github.com/openshift/oc/pkg/cli/admin/prune/deployments.(*mergeResolver).Resolve(0x55?)
              /go/src/github.com/openshift/oc/pkg/cli/admin/prune/deployments/resolvers.go:28 +0xcf
      github.com/openshift/oc/pkg/cli/admin/prune/deployments.(*pruner).Prune(0x5007c40?, {0x50033e0, 0xc0083c19e0})
              /go/src/github.com/openshift/oc/pkg/cli/admin/prune/deployments/prune.go:96 +0x2f
      github.com/openshift/oc/pkg/cli/admin/prune/deployments.PruneDeploymentsOptions.Run({0x0, 0x1, 0x1, 0x4e94914f0000, 0x1, 0x0, {0x0, 0x0}, {0x5002d00, 0xc000ba78c0}, ...})
              /go/src/github.com/openshift/oc/pkg/cli/admin/prune/deployments/deployments.go:206 +0xa03
      github.com/openshift/oc/pkg/cli/admin/prune/deployments.NewCmdPruneDeployments.func1(0xc0005f4900?, {0xc0006db020?, 0x0?, 0x6?})
              /go/src/github.com/openshift/oc/pkg/cli/admin/prune/deployments/deployments.go:78 +0x118
      github.com/spf13/cobra.(*Command).execute(0xc0005f4900, {0xc0006dafc0, 0x6, 0x6})
              /go/src/github.com/openshift/oc/vendor/github.com/spf13/cobra/command.go:944 +0x847
      github.com/spf13/cobra.(*Command).ExecuteC(0xc000e5b800)
              /go/src/github.com/openshift/oc/vendor/github.com/spf13/cobra/command.go:1068 +0x3bd
      github.com/spf13/cobra.(*Command).Execute(...)
              /go/src/github.com/openshift/oc/vendor/github.com/spf13/cobra/command.go:992
      k8s.io/component-base/cli.run(0xc000e5b800)
              /go/src/github.com/openshift/oc/vendor/k8s.io/component-base/cli/run.go:146 +0x317
      k8s.io/component-base/cli.RunNoErrOutput(...)
              /go/src/github.com/openshift/oc/vendor/k8s.io/component-base/cli/run.go:84
      main.main()
              /go/src/github.com/openshift/oc/cmd/oc/oc.go:77 +0x365 

      Prerequisites (if any, like setup, operators/versions):

      Steps to Reproduce

      1. Run  oc adm prune deployments command with --replica-sets option

       #  oc adm prune deployments --keep-younger-than=168h --orphans --keep-complete=5 --keep-failed=1 --replica-sets=true

       

      Actual results:

      Its failing with below error:

      panic: interface conversion: interface {} is *v1.Deployment, not *v1.DeploymentConfig 

      Expected results:

      Its should not fail and work as expected.

      Reproducibility (Always/Intermittent/Only Once):

       

      • Always

        Acceptance criteria: 

       

      Definition of Done:

      Build Details:

      Additional info (Such as Logs, Screenshots, etc):

       

       *

              Unassigned Unassigned
              rhn-support-psingour Poornima Singour
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: