Skip to content

Commit

Permalink
New function to fetch OCP Virtualization version
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 committed Nov 26, 2024
1 parent be50475 commit 2685aa2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ocp-metadata/ocp-metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,15 @@ func toMap(str string) (map[string]interface{}, error) {
}
return config, nil
}

func (meta *Metadata) GetOCPVirtualizationVersion() (string, error) {
virtOp, err := meta.clientSet.AppsV1().Deployments("openshift-cnv").Get(context.TODO(), "virt-operator", metav1.GetOptions{})
if err != nil {
return "", err
}
if virtOpVers, ok := virtOp.Labels["app.kubernetes.io/verssion"]; ok {
return virtOpVers, nil
} else {
return "", fmt.Errorf("label app.kubernetes.io/version not found in virt-operator deployment")
}
}

0 comments on commit 2685aa2

Please sign in to comment.