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

Add helper function to check if OV exists in cluster #1571

Merged
merged 3 commits into from
Jun 29, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/kudoctl/util/kudo/kudo.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ func (c *Client) OperatorExistsInCluster(name, namespace string) bool {
return true
}

// OperatorVersionExistsInCluster checks if a given OperatorVersion object is installed on the current k8s cluster
func (c *Client) OperatorVersionExistsInCluster(name, namespace string) bool {
zen-dog marked this conversation as resolved.
Show resolved Hide resolved
operator, err := c.kudoClientset.KudoV1beta1().OperatorVersions(namespace).Get(name, v1.GetOptions{})
if err != nil {
clog.V(2).Printf("operatorversion.kudo.dev/%s does not exist\n", name)
Copy link
Contributor

Choose a reason for hiding this comment

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

please change the logging to namespace/name here and below (we try to consolidate all logging of objects to this format):

Suggested change
clog.V(2).Printf("operatorversion.kudo.dev/%s does not exist\n", name)
clog.V(2).Printf("operatorversion %s/%s does not exist\n", namespace, name)

return false
}
clog.V(2).Printf("operatorversion.kudo.dev/%s unchanged", operator.Name)
}

// InstanceExistsInCluster checks if any OperatorVersion object matches to the given Operator name
// in the cluster.
// An Instance has two identifiers:
Expand Down