Skip to content

Instantly share code, notes, and snippets.

@rbo
Last active February 7, 2022 19:14
Show Gist options
  • Save rbo/ccaa431905e4b14c925b36aff737852c to your computer and use it in GitHub Desktop.
Save rbo/ccaa431905e4b14c925b36aff737852c to your computer and use it in GitHub Desktop.
Get operator features

Start index image:

podman run -p50051:50051 \
  -it registry.redhat.io/redhat/redhat-operator-index:v4.9

Run ./do.sh

./do.sh | head
Operator;Channel;Feature
3scale-operator;threescale-2.11;Disconnected
advanced-cluster-management;release-2.3;disconnected
advanced-cluster-management;release-2.3;proxy-aware
advanced-cluster-management;release-2.4;disconnected
advanced-cluster-management;release-2.4;proxy-aware
advanced-cluster-management;release-2.4;fips
amq-streams;amq-streams-1.8.x;Disconnected
amq-streams;amq-streams-1.8.x;Proxy
amq-streams;amq-streams-1.x;Disconnected
#!/usr/bin/env bash
# set -x
GRPCURL_ENDPOINT="localhost:50051"
OPERATORS=$(grpcurl -plaintext $GRPCURL_ENDPOINT api.Registry/ListPackages | jq '.name' -r )
echo "Operator;Channel;Feature"
for OPERATOR in $OPERATORS ; do
# echo "# $OPERATOR"
REQ=$(printf '{"name":"%s"}' "$OPERATOR" )
CHANNELS=$( grpcurl -plaintext -d $REQ $GRPCURL_ENDPOINT api.Registry/GetPackage | jq '.channels[]| .name ' -r )
for CHANNEL in $CHANNELS ; do
#echo -e " # Channel $CHANNEL"
REQ2=$(printf '{"pkgName":"%s","channelName":"%s"}' "$OPERATOR" "$CHANNEL" )
#echo $REQ2
FEATURES=$(
grpcurl -plaintext -d $REQ2 $GRPCURL_ENDPOINT api.Registry/GetBundleForChannel \
| jq '.csvJson' -r \
| jq '.metadata.annotations["operators.openshift.io/infrastructure-features"]' -r \
| jq '.[]' -r 2>/dev/null
)
for FEATURE in $FEATURES ; do
echo "$OPERATOR;$CHANNEL;$FEATURE"
done
done
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment