Expand istio_version variable in snips (#8965)

* Expand istio_version variable in snips

* regen
This commit is contained in:
Frank Budinsky 2021-02-12 13:36:44 -05:00 committed by GitHub
parent 061a219fc9
commit a8148ae39b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 12 deletions

View File

@ -47,7 +47,7 @@ istioctl analyze samples/bookinfo/networking/bookinfo-gateway.yaml samples/booki
! read -r -d '' snip_analyze_sample_destrule_out <<\ENDSNIP
Error [IST0101] (VirtualService bookinfo.default samples/bookinfo/networking/bookinfo-gateway.yaml:39) Referenced host not found: "productpage"
Error: Analyzers found issues when analyzing namespace: default.
See https://istio.io/v{{< istio_version >}}/docs/reference/config/analysis for more information about causes and resolutions.
See https://istio.io/v1.10/docs/reference/config/analysis for more information about causes and resolutions.
ENDSNIP
snip_analyze_networking_directory() {
@ -74,7 +74,7 @@ spec:
...
status:
validationMessages:
- documentation_url: https://istio.io/v{{< istio_version >}}/docs/reference/config/analysis/ist0101/?ref=status-controller
- documentation_url: https://istio.io/v1.10/docs/reference/config/analysis/ist0101/?ref=status-controller
level: 3
type:
code: IST0101

View File

@ -35,11 +35,7 @@ snip_fix_default_namespace
_verify_contains snip_try_with_fixed_namespace "$snip_try_with_fixed_namespace_out"
echo '*** istioctl-analyze step 3 ***'
# Pull the Istio version from the docs configuration file.
ISTIO_VERSION=$(yq r "${REPO_ROOT}"/data/args.yml 'version')
# shellcheck disable=SC2001
verify_string=$(echo "$snip_analyze_sample_destrule_out" | sed "s/{{< istio_version >}}/${ISTIO_VERSION}/")
_verify_contains snip_analyze_sample_destrule "$verify_string"
_verify_contains snip_analyze_sample_destrule "$snip_analyze_sample_destrule_out"
# There are multiple DestinationRules, some are valid for the VirtualService, some lack subsets
echo '*** istioctl-analyze step 4 ***'
@ -82,10 +78,7 @@ echo '*** istioctl-analyze step 10 ***'
get_ratings_virtual_service() {
kubectl get vs ratings -o yaml
}
# shellcheck disable=SC2001
verify_string=$(echo "$snip_vs_yaml_with_status" | sed "s/{{< istio_version >}}/${ISTIO_VERSION}/")
_verify_elided get_ratings_virtual_service "$verify_string"
_verify_elided get_ratings_virtual_service "$snip_vs_yaml_with_status"
echo '*** istioctl-analyze step 11 ***'
kubectl create ns frod

View File

@ -87,8 +87,10 @@ with open("data/args.yml", 'r') as stream:
try:
source_branch_name = docs_config['source_branch_name']
istio_version = docs_config['version']
istio_full_version = docs_config['full_version']
except:
sys.stderr.write('"source_branch_name" not defined in "data/args.yml"\n')
sys.stderr.write('failed to retrieve data from "data/args.yml"\n')
sys.exit(1)
with open(markdown, 'rt', encoding='utf-8') as mdfile:
@ -172,6 +174,8 @@ with open(markdown, 'rt', encoding='utf-8') as mdfile:
print(" " + msg)
if heredoc.search(line):
multiline_cmd = True
line = line.replace("{{< istio_version >}}", istio_version)
line = line.replace("{{< istio_full_version >}}", istio_full_version)
current_snip["script"].append(line)
if len(boilerplates) > 0: