diff --git a/nodeup/pkg/model/kubeapiserver.go b/nodeup/pkg/model/kubeapiserver.go index 3b11c2ef8d..8f074a5112 100644 --- a/nodeup/pkg/model/kubeapiserver.go +++ b/nodeup/pkg/model/kubeapiserver.go @@ -73,6 +73,21 @@ func (b *KubeAPIServerBuilder) Build(c *fi.ModelBuilderContext) error { c.AddTask(t) } + auditLogPath := b.Cluster.Spec.KubeAPIServer.AuditLogPath + if auditLogPath != nil { + // Touch log file, so that docker doesn't create a directory instead + { + t := &nodetasks.File{ + Path: *auditLogPath, + Contents: fi.NewStringResource(""), + Type: nodetasks.FileType_File, + Mode: s("0400"), + IfNotExists: true, + } + c.AddTask(t) + } + } + return nil } @@ -183,6 +198,11 @@ func (b *KubeAPIServerBuilder) buildPod() (*v1.Pod, error) { addHostPathMapping(pod, container, "logfile", "/var/log/kube-apiserver.log").ReadOnly = false + auditLogPath := b.Cluster.Spec.KubeAPIServer.AuditLogPath + if auditLogPath != nil { + addHostPathMapping(pod, container, "auditlogfile", *auditLogPath).ReadOnly = false + } + pod.Spec.Containers = append(pod.Spec.Containers, *container) return pod, nil