Skip to content

Commit

Permalink
Moved ContainerLogsV2 logic into postdeploy.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
samaea committed Nov 14, 2022
1 parent d83b81c commit beff74b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
11 changes: 0 additions & 11 deletions postdeploy/scripts/certmanager-install.sh

This file was deleted.

16 changes: 15 additions & 1 deletion postdeploy/scripts/postdeploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dnsZoneId=""
denydefaultNetworkPolicy=""
certEmail=""
certClusterIssuer="letsencrypt-prod"
containerLogsV2=""

acrName=""
KubeletId=""
Expand All @@ -24,7 +25,7 @@ while getopts "p:g:n:r:" opt; do
p )
IFS=',' read -ra params <<< "$OPTARG"
for i in "${params[@]}"; do
if [[ $i =~ (ingress|monitor|enableMonitorIngress|grafanaHostname|ingressEveryNode|dnsZoneId|denydefaultNetworkPolicy|certEmail|certClusterIssuer|acrName|KubeletId|TenantId)=([^ ]*) ]]; then
if [[ $i =~ (ingress|monitor|enableMonitorIngress|grafanaHostname|ingressEveryNode|dnsZoneId|denydefaultNetworkPolicy|certEmail|certClusterIssuer|acrName|KubeletId|TenantId|containerLogsV2)=([^ ]*) ]]; then
echo "set ${BASH_REMATCH[1]}=${BASH_REMATCH[2]}"
declare ${BASH_REMATCH[1]}=${BASH_REMATCH[2]}
else
Expand Down Expand Up @@ -111,6 +112,7 @@ if [ "$show_usage" ]; then
echo " KubeletId=<managed identity of Kubelet> *Require for cert-manager"
echo " TenantId=<AzureAD TenentId> *Require for cert-manager"
echo " acrName=<name of ACR> * If provided, used imported images for 3rd party charts"
echo " containerLogsV2=<true> - Enables ContainerLogsV2"
exit 1
fi

Expand Down Expand Up @@ -401,3 +403,15 @@ if [ "$denydefaultNetworkPolicy" ]; then
echo "# ----------- Default Deny All Network Policy, east-west traffic in cluster"
kubectl apply -f ${release_version:-./postdeploy/k8smanifests}/networkpolicy-deny-all.yml
fi

if [ "$containerLogsV2" ]; then
replace="\# containerlog_schema_version = \"v2\""
replaceWith='containerlog_schema_version = "v2"'
echo "Downloading default ConfigMap"
$configMapYamlFile="$(curl https://raw.githubusercontent.com/microsoft/Docker-Provider/ci_prod/kubernetes/container-azm-ms-agentconfig.yaml)"
echo "Setting containerlog_schema_version to v2"
echo "${configMapYamlFile/$replace/$replaceWith}" > container-azm-ms-agentconfig.yaml
echo "Applying ConfigMap using kubectl apply"
kubectl apply -f container-azm-ms-agentconfig.yaml
sleep 1m
fi

0 comments on commit beff74b

Please sign in to comment.