mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
policy report yaml added
This commit is contained in:
parent
68855c2ca9
commit
573496f318
6 changed files with 1911 additions and 444 deletions
|
@ -32,6 +32,7 @@ const (
|
|||
validatingWebhookConfigKind string = "ValidatingWebhookConfiguration"
|
||||
)
|
||||
|
||||
|
||||
func main() {
|
||||
klog.InitFlags(nil)
|
||||
log.SetLogger(klogr.New())
|
||||
|
|
1748
definitions/install_policyreport.yaml
Executable file
1748
definitions/install_policyreport.yaml
Executable file
File diff suppressed because it is too large
Load diff
|
@ -207,7 +207,7 @@ func (j *Job) syncHandler(info JobInfo) error {
|
|||
if info.JobType == "POLICYSYNC" {
|
||||
wg.Add(1)
|
||||
go j.syncKyverno(&wg, "All", "SYNC", info.JobData)
|
||||
} else if info.JobType == "CONFIGMAP" {
|
||||
}else if info.JobType == "CONFIGMAP" {
|
||||
if info.JobData != "" {
|
||||
str := strings.Split(info.JobData, ",")
|
||||
wg.Add(len(str))
|
||||
|
|
|
@ -15,7 +15,7 @@ import (
|
|||
|
||||
func AllReportsCommand() *cobra.Command {
|
||||
kubernetesConfig := genericclioptions.NewConfigFlags(true)
|
||||
var namespace, policy string
|
||||
var mode,namespace, policy string
|
||||
cmd := &cobra.Command{
|
||||
Use: "all",
|
||||
Short: "generate report",
|
||||
|
@ -34,12 +34,11 @@ func AllReportsCommand() *cobra.Command {
|
|||
log.Log.Error(err, "Failed to create kubernetes client")
|
||||
os.Exit(1)
|
||||
}
|
||||
var stopCh <-chan struct{}
|
||||
if mode == "cli" {
|
||||
var wg sync.WaitGroup
|
||||
if namespace != "" {
|
||||
wg.Add(1)
|
||||
go backgroundScan(namespace, All, policy, &wg, restConfig, logger)
|
||||
wg.Wait()
|
||||
} else {
|
||||
ns, err := kubeClient.CoreV1().Namespaces().List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
|
@ -49,14 +48,18 @@ func AllReportsCommand() *cobra.Command {
|
|||
for _, n := range ns.Items {
|
||||
go backgroundScan(n.GetName(), All, policy, &wg, restConfig, logger)
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
wg.Wait()
|
||||
os.Exit(0)
|
||||
<-stopCh
|
||||
}else{
|
||||
log.Log.Error(nil, "mode is not supported","mode",mode)
|
||||
os.Exit(1)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
cmd.Flags().StringVarP(&namespace, "namespace", "n", "", "define specific namespace")
|
||||
cmd.Flags().StringVarP(&policy, "policy", "p", "", "define specific policy")
|
||||
cmd.Flags().StringVarP(&mode, "mode", "m", "cli", "mode")
|
||||
return cmd
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
Helm string = "Helm"
|
||||
Helm string = "App"
|
||||
Namespace string = "Namespace"
|
||||
Cluster string = "Cluster"
|
||||
All string = "All"
|
||||
|
|
Loading…
Reference in a new issue