Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
test: Add azure.json path for custom cloud k8s config & Update stabil…
Browse files Browse the repository at this point in the history
…ity timeout for Azure CNI network policy (#3895)
  • Loading branch information
haofan-ms authored Oct 8, 2020
1 parent 45eefc8 commit c1d004e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
9 changes: 5 additions & 4 deletions parts/k8s/cloud-init/artifacts/cse_customcloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ ensureCustomCloudSourcesList() {

configureK8sCustomCloud() {
{{- if IsAzureStackCloud}}
local azure_json_path="/etc/kubernetes/azure.json"
export -f ensureAzureStackCertificates
retrycmd 60 10 30 bash -c ensureAzureStackCertificates
set +x
Expand All @@ -65,20 +66,20 @@ configureK8sCustomCloud() {
SERVICE_PRINCIPAL_CLIENT_SECRET_PASSWORD=${SERVICE_PRINCIPAL_CLIENT_SECRET_PASSWORD#'"'}
SERVICE_PRINCIPAL_CLIENT_SECRET_PASSWORD=${SERVICE_PRINCIPAL_CLIENT_SECRET_PASSWORD%'"'}

KUBERNETES_FILE_DIR=$(dirname "${AZURE_JSON_PATH}")
KUBERNETES_FILE_DIR=$(dirname "${azure_json_path}")
K8S_CLIENT_CERT_PATH="${KUBERNETES_FILE_DIR}/k8s_auth_certificate.pfx"
echo $SERVICE_PRINCIPAL_CLIENT_SECRET_CERT | base64 --decode >$K8S_CLIENT_CERT_PATH
# shellcheck disable=SC2002,SC2005
echo $(cat "${AZURE_JSON_PATH}" |
echo $(cat "${azure_json_path}" |
jq --arg K8S_CLIENT_CERT_PATH ${K8S_CLIENT_CERT_PATH} '. + {aadClientCertPath:($K8S_CLIENT_CERT_PATH)}' |
jq --arg SERVICE_PRINCIPAL_CLIENT_SECRET_PASSWORD ${SERVICE_PRINCIPAL_CLIENT_SECRET_PASSWORD} '. + {aadClientCertPassword:($SERVICE_PRINCIPAL_CLIENT_SECRET_PASSWORD)}' |
jq 'del(.aadClientSecret)') >${AZURE_JSON_PATH}
jq 'del(.aadClientSecret)') >${azure_json_path}
fi

if [[ ${IDENTITY_SYSTEM,,} == "adfs" ]]; then
# update the tenent id for ADFS environment.
# shellcheck disable=SC2002,SC2005
echo $(cat "${AZURE_JSON_PATH}" | jq '.tenantId = "adfs"') >${AZURE_JSON_PATH}
echo $(cat "${azure_json_path}" | jq '.tenantId = "adfs"') >${azure_json_path}
fi
set -x

Expand Down
9 changes: 5 additions & 4 deletions pkg/engine/templates_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions test/e2e/kubernetes/kubernetes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ var _ = BeforeSuite(func() {
stabilityCommandTimeout = 3 * time.Second
if eng.ExpandedDefinition.Properties.OrchestratorProfile.KubernetesConfig.NetworkPolicy == api.NetworkPolicyCalico {
stabilityCommandTimeout = 10 * time.Second
} else if eng.ExpandedDefinition.Properties.OrchestratorProfile.KubernetesConfig.NetworkPolicy == api.NetworkPolicyAzure {
stabilityCommandTimeout = 15 * time.Second
}
Expect(dnsAddonName).NotTo(Equal(""))

Expand Down

0 comments on commit c1d004e

Please sign in to comment.