Skip to content

Commit

Permalink
allows for specifying a path for NewAuditPolicyPathGetter function
Browse files Browse the repository at this point in the history
  • Loading branch information
p0lyn0mial committed Jul 31, 2020
1 parent 918750c commit 0f5f426
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions pkg/operator/apiserver/audit/audit_policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ func getRawAuditPolicies(targetName, targetNamespace string) ([]byte, error) {
return auditPoliciesForTargetNs, nil
}

// NewAuditPolicyPathGetter returns a path getter for audit policy file mounted into
// the '/var/run/configmaps/audit' directory of a Pod.
// NewAuditPolicyPathGetter returns a path getter for audit policy file mounted into the given path of a Pod as a directory.
//
// openshift-apiserver and oauth-apiserver mounts the audit policy ConfigMap into
// the above path inside the Pod.
func NewAuditPolicyPathGetter() (libgoapiserver.AuditPolicyPathGetterFunc, error) {
return newAuditPolicyPathGetter("/var/run/configmaps/audit")
func NewAuditPolicyPathGetter(path string) (libgoapiserver.AuditPolicyPathGetterFunc, error) {
return newAuditPolicyPathGetter(path)
}

func newAuditPolicyPathGetter(path string) (libgoapiserver.AuditPolicyPathGetterFunc, error) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/apiserver/audit/audit_policies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func TestNewAuditPolicyPathGetter(t *testing.T) {
},
}

pathGetter, err := NewAuditPolicyPathGetter()
pathGetter, err := NewAuditPolicyPathGetter("/var/run/configmaps/audit")
if err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 0f5f426

Please sign in to comment.