INNER CODE UNIT · Go
Example_auditCluster
Shopify/kubeaudit · example_test.go:91
func Example_auditCluster() {
// Initialize all the security auditors using default configuration
allAuditors, err := all.Auditors(config.KubeauditConfig{})
if err != nil {
log.Fatal(err)
}
// Initialize kubeaudit
auditor, err := kubeaudit.New(allAuditors)
if err != nil {
log.Fatal(err)
}
// Run the audit in cluster mode. Note this will fail if kubeaudit is not running within a cluster.
report, err := auditor.AuditCluster(kubeaudit.AuditOptions{})
if err != nil {
log.Fatal(err)
}