The IBM Cloud Pak Operations CLI provides basic functionality to manage Red Hat OpenShift clusters and IBM Cloud Pak for Data on various cloud platforms.
Apache License 2.0
15
stars
2
forks
source link
CRD kind's "plural" should be customizable in cpd-custom-resources.json #99
I came across this when trying to add Watson Knowledge Catalog to the list of supported services, their CRD kind is WKC with wkc as plural which causes 404 errors with the currently implemented heuristic.
Here is my hack to work around this:
resources_file=$DGDIR/deps/config/cpd-custom-resources.json
# add WKC if necessary
if ! grep -q wkc $resources_file; then
resources=$(cat $resources_file)
resources=$(echo "$resources" | jq '."wkc"={"group":"wkc.cpd.ibm.com","description":"Watson Knowledge Catalog","kind":"WKC","licenses":["Enterprise","Standard"],"name":"wkc-cr","operator_name":"ibm-cpd-wkc","spec":{},"status_key_name":"wkcStatus","storage_option_required":false,"version":"v1beta1"}')
echo "$resources" > $resources_file
sed -i -e "/plural =/a\ plural = 'wkc' if custom_resource.kind.lower() == 'wkc' else plural" $DGDIR/lib/openshift/openshift_api_manager.py
sed -i -e "/plural =/a\ plural = 'wkc' if self.kind.lower() == 'wkc' else plural" $DGDIR/lib/cloud_pak_for_data/cpd_4_0_0/types/custom_resource_metadata.py
fi
The Cloud Pak Operations CLI does not support installing IBM Cloud Pak for Data anymore as this functionality was integrated into the Cloud Pak for Data CLI.
Instead of having special case logic relying on naming conventions in multiple places (https://github.com/IBM/cloud-pak-operations-cli/blob/25af9f3ed4798a8babb2020ad4830f25fd3ec70a/dg/lib/openshift/openshift_api_manager.py#L951 and https://github.com/IBM/cloud-pak-operations-cli/blob/25af9f3ed4798a8babb2020ad4830f25fd3ec70a/dg/lib/cloud_pak_for_data/cpd_4_0_0/types/custom_resource_metadata.py#L141), add a
plural
field to https://github.com/IBM/cloud-pak-operations-cli/blob/master/dg/deps/config/cpd-custom-resources.json.I came across this when trying to add Watson Knowledge Catalog to the list of supported services, their CRD kind is
WKC
withwkc
as plural which causes 404 errors with the currently implemented heuristic.Here is my hack to work around this: