diff --git a/cluster/common.sh b/cluster/common.sh index f96c1c3f07..6d8770fcf4 100755 --- a/cluster/common.sh +++ b/cluster/common.sh @@ -672,6 +672,7 @@ ENABLE_APISERVER_BASIC_AUDIT: $(yaml-quote ${ENABLE_APISERVER_BASIC_AUDIT:-}) ENABLE_APISERVER_ADVANCED_AUDIT: $(yaml-quote ${ENABLE_APISERVER_ADVANCED_AUDIT:-}) ENABLE_CACHE_MUTATION_DETECTOR: $(yaml-quote ${ENABLE_CACHE_MUTATION_DETECTOR:-false}) ENABLE_PATCH_CONVERSION_DETECTOR: $(yaml-quote ${ENABLE_PATCH_CONVERSION_DETECTOR:-false}) +ADVANCED_AUDIT_POLICY: $(yaml-quote ${ADVANCED_AUDIT_POLICY:-}) ADVANCED_AUDIT_BACKEND: $(yaml-quote ${ADVANCED_AUDIT_BACKEND:-log}) GCE_API_ENDPOINT: $(yaml-quote ${GCE_API_ENDPOINT:-}) PROMETHEUS_TO_SD_ENDPOINT: $(yaml-quote ${PROMETHEUS_TO_SD_ENDPOINT:-}) diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index d1db2edfcd..9fa7ee8476 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -480,6 +480,12 @@ EOF # Write the config for the audit policy. function create-master-audit-policy { local -r path="${1}" + local -r policy="${2:-}" + + if [[ -n "${policy}" ]]; then + echo "${policy}" > "${path}" + return + fi # Known api groups local -r known_apis=' @@ -1317,7 +1323,7 @@ function start-kube-apiserver { local -r audit_policy_file="/etc/audit_policy.config" params+=" --audit-policy-file=${audit_policy_file}" # Create the audit policy file, and mount it into the apiserver pod. - create-master-audit-policy "${audit_policy_file}" + create-master-audit-policy "${audit_policy_file}" "${ADVANCED_AUDIT_POLICY:-}" audit_policy_config_mount="{\"name\": \"auditpolicyconfigmount\",\"mountPath\": \"${audit_policy_file}\", \"readOnly\": true}," audit_policy_config_volume="{\"name\": \"auditpolicyconfigmount\",\"hostPath\": {\"path\": \"${audit_policy_file}\", \"type\": \"FileOrCreate\"}},"