1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
#!/bin/bash
yum install -y jq
kube_filepath_root="/kubernetes-api-resources"
api_path="/apis/operator.openshift.io/v1/networks/cluster"
dir="$kube_filepath_root/apis/operator.openshift.io/v1/networks"
filepath="$kube_filepath_root$api_path"
mkdir -p "$dir"
jq_filter="[.spec.defaultNetwork.type]"
cat <<EOF > "$filepath"
{
"apiVersion": "operator.openshift.io/v1",
"kind": "Network",
"metadata": {
"creationTimestamp": "2022-04-25T13:39:15Z",
"generation": 61,
"name": "cluster",
"resourceVersion": "24589",
"uid": "089e8ee9-15c4-4868-80af-773df44cafdd"
},
"spec": {
"clusterNetwork": [
{
"cidr": "10.128.0.0/14",
"hostPrefix": 23
}
],
"defaultNetwork": {
"type": "OpenShiftSDN"
},
"disableNetworkDiagnostics": false,
"logLevel": "Normal",
"managementState": "Managed",
"observedConfig": null,
"operatorLogLevel": "Normal",
"serviceNetwork": [
"172.30.0.0/16"
],
"unsupportedConfigOverrides": null
},
"status": {
"conditions": [
{
"lastTransitionTime": "2022-04-25T13:39:15Z",
"status": "False",
"type": "ManagementStateDegraded"
},
{
"lastTransitionTime": "2022-04-25T13:52:19Z",
"status": "False",
"type": "Degraded"
},
{
"lastTransitionTime": "2022-04-25T13:39:15Z",
"status": "True",
"type": "Upgradeable"
},
{
"lastTransitionTime": "2022-04-25T13:53:53Z",
"status": "False",
"type": "Progressing"
},
{
"lastTransitionTime": "2022-04-25T13:40:00Z",
"status": "True",
"type": "Available"
}
],
"readyReplicas": 0,
"version": "4.10.6"
}
}
EOF
# Get the filepath. This will actually be read by the scan.
filteredpath="$filepath#$(echo -n "$api_path$jq_filter" | sha256sum | awk '{print $1}')"
jq "$jq_filter" "$filepath" > "$filteredpath"
|