Skip to content

Commit

Permalink
Revert REMOVE_BINDING change and use an alternate solution
Browse files Browse the repository at this point in the history
  • Loading branch information
valaparthvi committed Dec 5, 2022
1 parent f542b22 commit 3a88ffe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/odo/cli/remove/binding/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func NewCmdBinding(name, fullName string) *cobra.Command {
},
}
bindingCmd.Flags().String(backend.FLAG_NAME, "", "Name of the Binding to create")
clientset.Add(bindingCmd, clientset.REMOVE_BINDING, clientset.FILESYSTEM)
clientset.Add(bindingCmd, clientset.BINDING, clientset.FILESYSTEM)

return bindingCmd
}
9 changes: 3 additions & 6 deletions pkg/odo/genericclioptions/clientset/clientset.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ const (
ALIZER = "DEP_ALIZER"
// BINDING instantiates client for pkg/binding
BINDING = "DEP_BINDING"
// REMOVE_BINDING instantiates client for pkg/binding for removing a binding;
// this is required so that the command can be run even when the cluster is inaccessible
REMOVE_BINDING = "DEP_REMOVE_BINDING"
// DELETE_COMPONENT instantiates client for pkg/component/delete
DELETE_COMPONENT = "DEP_DELETE_COMPONENT"
// DEPLOY instantiates client for pkg/deploy
Expand Down Expand Up @@ -103,7 +100,6 @@ var subdeps map[string][]string = map[string][]string{
SYNC: {EXEC},
WATCH: {KUBERNETES_NULLABLE},
BINDING: {PROJECT, KUBERNETES_NULLABLE},
REMOVE_BINDING: {KUBERNETES_NULLABLE},
/* Add sub-dependencies here, if any */
}

Expand Down Expand Up @@ -159,7 +155,8 @@ func Fetch(command *cobra.Command, platform string) (*Clientset, error) {
if isDefined(command, KUBERNETES) || isDefined(command, KUBERNETES_NULLABLE) {
dep.KubernetesClient, err = kclient.New()
if err != nil {
if isDefined(command, KUBERNETES) {
// only return error is KUBERNETES_NULLABLE is not defined in combination with KUBERNETES
if isDefined(command, KUBERNETES) && !isDefined(command, KUBERNETES_NULLABLE) {
return nil, err
}
dep.KubernetesClient = nil
Expand Down Expand Up @@ -231,7 +228,7 @@ func Fetch(command *cobra.Command, platform string) (*Clientset, error) {
if isDefined(command, WATCH) {
dep.WatchClient = watch.NewWatchClient(dep.KubernetesClient)
}
if isDefined(command, BINDING) || isDefined(command, REMOVE_BINDING) {
if isDefined(command, BINDING) {
dep.BindingClient = binding.NewBindingClient(dep.ProjectClient, dep.KubernetesClient)
}
if isDefined(command, PORT_FORWARD) {
Expand Down

0 comments on commit 3a88ffe

Please sign in to comment.