Skip to content

Commit

Permalink
Hide internal CRDs (#479)
Browse files Browse the repository at this point in the history
With github.com/operator-framework/operator-lifecycle-manager/pull/1097
OM supports a mechanism to hide internal CRDs on OLM console.
Start using it.
By default only
- hyperconvergeds.hco.kubevirt.io
- v2vvmwares.kubevirt.io
- hostpathprovisioners.hostpathprovisioner.kubevirt.io
are going to be visible.
The list of visible CRDs can be override as a CLI parameter
to the csv-merger tool.

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
  • Loading branch information
kubevirt-bot authored Mar 5, 2020
1 parent 4b201fa commit ca16495
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
categories: OpenShift Optional
certified: "false"
containerImage: quay.io/kubevirt/hyperconverged-cluster-operator:latest
createdAt: "2020-03-04 08:25:27"
createdAt: "2020-03-04 23:40:03"
description: |-
**HyperConverged Cluster Operator** is an Operator pattern for managing multi-operator products.
Specifcally, the HyperConverged Cluster Operator manages the deployment of KubeVirt,
Expand Down Expand Up @@ -76,6 +76,7 @@ metadata:
KubeVirt is distributed under the
[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt).
operatorframework.io/suggested-namespace: kubevirt-hyperconverged
operators.operatorframework.io/internal-objects: '["networkaddonsconfigs.networkaddonsoperator.network.kubevirt.io","kubevirts.kubevirt.io","kubevirtcommontemplatesbundles.ssp.kubevirt.io","kubevirtmetricsaggregations.ssp.kubevirt.io","kubevirtnodelabellerbundles.ssp.kubevirt.io","kubevirttemplatevalidators.ssp.kubevirt.io","cdis.cdi.kubevirt.io","nodemaintenances.kubevirt.io"]'
repository: https://github.com/kubevirt/hyperconverged-cluster-operator
support: "false"
name: kubevirt-hyperconverged-operator.v1.0.0
Expand Down
27 changes: 26 additions & 1 deletion tools/csv-merger/csv-merger.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ var (
namespace = flag.String("namespace", "kubevirt-hyperconverged", "Namespace")
crdDisplay = flag.String("crd-display", "KubeVirt HyperConverged Cluster", "Label show in OLM UI about the primary CRD")
csvOverrides = flag.String("csv-overrides", "", "CSV like string with punctual changes that will be recursively applied (if possible)")
relatedImagesList = flag.String("related-images-list", "",
visibleCRDList = flag.String("visible-crds-list", "hyperconvergeds.hco.kubevirt.io,v2vvmwares.kubevirt.io,hostpathprovisioners.hostpathprovisioner.kubevirt.io",
"Comma separated list of all the CRDs that should be visible in OLM console")
relatedImagesList = flag.String("related-images-list", "",
"Comma separated list of all the images referred in the CSV (just the image pull URLs or eventually a set of 'image|name' collations)")
)

Expand Down Expand Up @@ -221,6 +223,29 @@ func main() {
}
}

hidden_crds := []string{}
visible_crds := strings.Split(*visibleCRDList, ",")
for _, owned := range csvExtended.Spec.CustomResourceDefinitions.Owned {
found := false
for _, name := range visible_crds {
if owned.Name == name {
found = true
}
}
if !found {
hidden_crds = append(
hidden_crds,
owned.Name,
)
}
}

hidden_crds_j, err := json.Marshal(hidden_crds)
if err != nil {
panic(err)
}
csvExtended.Annotations["operators.operatorframework.io/internal-objects"] = string(hidden_crds_j)

dfound := false
efound := false
for _, deployment := range installStrategyBase.DeploymentSpecs {
Expand Down

0 comments on commit ca16495

Please sign in to comment.