feat: configauditreport (#609)

* feat: adding config audit report

Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>

* feat: adding config audit report

Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>

* feat: adding config audit report analyzer mechnics

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>

* feat: adding config audit report analyzer mechnics

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>

* chore: updated naming

Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>

* chore: updated naming

Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>

* chore: updated var names

Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>

---------

Signed-off-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>
Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
Co-authored-by: Alex Jones <alex@alexs-mbp.tailddc26.ts.net>
This commit is contained in:
Alex Jones
2023-08-25 17:37:53 +01:00
committed by GitHub
parent 0e5be89e5c
commit 44d3613c1f
5 changed files with 116 additions and 13 deletions

View File

@@ -35,7 +35,7 @@ type IIntegration interface {
// RemoveAnalyzer removes an analyzer from the cluster
RemoveAnalyzer() error
GetAnalyzerName() string
GetAnalyzerName() []string
IsActivate() bool
}
@@ -71,7 +71,11 @@ func (*Integration) Activate(name string, namespace string, activeFilters []stri
return errors.New("integration not found")
}
mergedFilters := append(activeFilters, integrations[name].GetAnalyzerName())
mergedFilters := activeFilters
for _, integrationAnalyzer := range integrations[name].GetAnalyzerName() {
mergedFilters = append(mergedFilters, integrationAnalyzer)
}
uniqueFilters, dupplicatedFilters := util.RemoveDuplicates(mergedFilters)
@@ -108,11 +112,15 @@ func (*Integration) Deactivate(name string, namespace string) error {
// This might be a bad idea, but we cannot reference analyzer here
foundFilter := false
for i, v := range activeFilters {
if v == integrations[name].GetAnalyzerName() {
foundFilter = true
activeFilters = append(activeFilters[:i], activeFilters[i+1:]...)
break
for _, intanal := range integrations[name].GetAnalyzerName() {
if v == intanal {
foundFilter = true
activeFilters = append(activeFilters[:i], activeFilters[i+1:]...)
break
}
}
}
if !foundFilter {
color.Red("Ingregation %s does not exist in configuration file. Please use k8sgpt integration add.", name)