Add minimal audit policy to local-up-cluster

Change-Id: Ia2cdb5a6a891665ece5365698f2989ba3782a5ec
pull/564/head
Davanum Srinivas 2019-01-02 10:24:29 -05:00
parent f7eb5769c2
commit 6b6bfb37fb
No known key found for this signature in database
GPG Key ID: 80D83A796103BF59
1 changed files with 16 additions and 0 deletions

View File

@ -116,6 +116,9 @@ START_MODE=${START_MODE:-"all"}
# A list of controllers to enable
KUBE_CONTROLLERS="${KUBE_CONTROLLERS:-"*"}"
# Audit policy
AUDIT_POLICY_FILE=${AUDIT_POLICY_FILE:-""}
# sanity check for OpenStack provider
if [ "${CLOUD_PROVIDER}" == "openstack" ]; then
if [ "${CLOUD_CONFIG}" == "" ]; then
@ -552,6 +555,17 @@ function start_apiserver {
cloud_config_arg="--cloud-provider=external"
fi
if [[ -n "${AUDIT_POLICY_FILE}" ]]; then
cat <<EOF > /tmp/kube-audit-policy-file
# Log all requests at the Metadata level.
apiVersion: audit.k8s.io/v1
kind: Policy
rules:
- level: Metadata
EOF
AUDIT_POLICY_FILE="/tmp/kube-audit-policy-file"
fi
APISERVER_LOG=${LOG_DIR}/kube-apiserver.log
${CONTROLPLANE_SUDO} "${GO_OUT}/hyperkube" apiserver ${authorizer_arg} ${priv_arg} ${runtime_config} \
${cloud_config_arg} \
@ -559,6 +573,8 @@ function start_apiserver {
${node_port_range} \
--v=${LOG_LEVEL} \
--vmodule="${LOG_SPEC}" \
--audit-policy-file="${AUDIT_POLICY_FILE}" \
--audit-log-path=${LOG_DIR}/kube-apiserver-audit.log \
--cert-dir="${CERT_DIR}" \
--client-ca-file="${CERT_DIR}/client-ca.crt" \
--kubelet-client-certificate="${CERT_DIR}/client-kube-apiserver.crt" \