mirror of https://github.com/k3s-io/k3s
Make advanced audit policy on GCP configurable
parent
01154dd3cf
commit
ccf40abd50
|
@ -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:-})
|
||||
|
|
|
@ -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\"}},"
|
||||
|
||||
|
|
Loading…
Reference in New Issue