Skip to content

Commit

Permalink
Add an (Internal) prefix to internal-objects
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Wall <[email protected]>
  • Loading branch information
wallrj committed Feb 16, 2022
1 parent f09e04e commit 8e75b71
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 14 deletions.
10 changes: 5 additions & 5 deletions bundle/manifests/cert-manager.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ metadata:
capabilities: Full Lifecycle
categories: Security
containerImage: quay.io/jetstack/cert-manager-controller:v1.6.1
createdAt: '2022-02-16T07:26:24'
createdAt: '2022-02-16T09:25:32'
operators.operatorframework.io/builder: operator-sdk-v1.13.0+git
operators.operatorframework.io/internal-objects: |-
[
"challenge.acme.cert-manager.io",
"order.acme.cert-manager.io"
"challenges.acme.cert-manager.io",
"orders.acme.cert-manager.io"
]
operators.operatorframework.io/project_layout: unknown
repository: https://github.com/jetstack/cert-manager
Expand Down Expand Up @@ -109,7 +109,7 @@ spec:
version: v1
- description: Challenge is a type to represent a Challenge request with an ACME
server
displayName: Challenge
displayName: (Internal) Challenge
kind: Challenge
name: challenges.acme.cert-manager.io
version: v1
Expand All @@ -129,7 +129,7 @@ spec:
name: issuers.cert-manager.io
version: v1
- description: Order is a type to represent an Order with an ACME server
displayName: Order
displayName: (Internal) Order
kind: Order
name: orders.acme.cert-manager.io
version: v1
Expand Down
6 changes: 6 additions & 0 deletions global-csv-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,9 @@ architectures:
- arm64
- ppc64le
- s390x

# A list of Kind.Group which are considered "internal-objects".
# See https://docs.okd.io/4.9/operators/operator_sdk/osdk-generating-csvs.html#osdk-hiding-internal-objects_osdk-generating-csvs
internal_objects:
- "challenges.acme.cert-manager.io"
- "orders.acme.cert-manager.io"
26 changes: 17 additions & 9 deletions hack/fixup-csv
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,22 @@ def main():
conf = yaml.safe_load(config_file)
doc = yaml.safe_load(sys.stdin)

internal_objects = conf["internal_objects"]

# Add displayName for the CRD preview in operatorhub.io.
# Add an (Internal) prefix to the kinds that are internal-objects.
# Ideally operatorhub.io would just use the existing CRD name and
# description.
# See https://github.com/k8s-operatorhub/operatorhub.io/issues/2
for crd in doc["spec"]["customresourcedefinitions"]["owned"]:
crd["displayName"] = crd["kind"]
kind, group = crd["name"].split(".", 1)
crdContent = yaml.safe_load(open(f"bundle/manifests/{group}_{kind}.yaml"))
kindAndGroup = crd["name"]
displayName = crd["kind"]
if kindAndGroup in internal_objects:
displayName = f"(Internal) {displayName}"
crd["displayName"] = displayName
kind, group = kindAndGroup.split(".", 1)
with open(f"bundle/manifests/{group}_{kind}.yaml") as f:
crdContent = yaml.safe_load(f)
crd["description"] = crdContent["spec"]["versions"][-1]["schema"]["openAPIV3Schema"]["description"]

# Add multiarch labels.
Expand All @@ -78,13 +86,13 @@ def main():
for arch in conf["architectures"]
})

# Hide some internal APIs from the OperatorHub UI
# https://docs.okd.io/4.9/operators/operator_sdk/osdk-generating-csvs.html#osdk-hiding-internal-objects_osdk-generating-csvs
# Hide some internal APIs from the OperatorHub UI.
# See https://docs.okd.io/4.9/operators/operator_sdk/osdk-generating-csvs.html#osdk-hiding-internal-objects_osdk-generating-csvs
# Ideally these would be hidden from the WebUI in operatorhub.io, but they
# are not.
# See https://github.com/k8s-operatorhub/operatorhub.io/issues/14
doc["metadata"]["annotations"]["operators.operatorframework.io/internal-objects"] = literal(
json.dumps([
"challenge.acme.cert-manager.io",
"order.acme.cert-manager.io",
], indent=4)
json.dumps(internal_objects, indent=2)
)
doc["metadata"]["annotations"]["capabilities"] = conf["capabilities"]
doc["metadata"]["annotations"]["categories"] = ",".join(conf["categories"])
Expand Down

0 comments on commit 8e75b71

Please sign in to comment.