Skip to content

Commit

Permalink
Missed a few c -> config.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bader Boland committed Feb 10, 2020
1 parent 6009ee6 commit 4c345f3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cmd/polaris/audit.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var auditCmd = &cobra.Command{
config.DisplayName = displayName
}

auditData := runAndReportAudit(c, auditPath, auditOutputFile, auditOutputURL, auditOutputFormat)
auditData := runAndReportAudit(config, auditPath, auditOutputFile, auditOutputURL, auditOutputFormat)

summary := auditData.GetSummary()
score := summary.GetScore()
Expand Down
11 changes: 5 additions & 6 deletions cmd/polaris/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ import (
"fmt"
"net/http"

"github.com/spf13/cobra"
"github.com/sirupsen/logrus"
"github.com/fairwindsops/polaris/pkg/dashboard"
"github.com/fairwindsops/polaris/pkg/validator"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

var serverPort int
var basePath string
var loadAuditFile string


func init() {
rootCmd.AddCommand(dashboardCmd)
dashboardCmd.PersistentFlags().IntVarP(&serverPort, "port", "p", 8080, "Port for the dashboard webserver.")
Expand All @@ -47,18 +46,18 @@ var dashboardCmd = &cobra.Command{
if displayName != "" {
config.DisplayName = displayName
}

var auditDataPtr *validator.AuditData
if loadAuditFile != "" {
auditData := validator.ReadAuditFromFile(loadAuditFile)
auditDataPtr = &auditData
}
router := dashboard.GetRouter(c, auditPath, serverPort, basePath, auditDataPtr)
router := dashboard.GetRouter(config, auditPath, serverPort, basePath, auditDataPtr)
router.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("OK"))
})
http.Handle("/", router)

logrus.Infof("Starting Polaris dashboard server on port %d", serverPort)
logrus.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", serverPort), nil))
},
Expand Down
16 changes: 8 additions & 8 deletions cmd/polaris/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ package cmd

import (
"fmt"
"os"
"io/ioutil"
"os"
"strings"

"github.com/spf13/cobra"
fwebhook "github.com/fairwindsops/polaris/pkg/webhook"
"github.com/sirupsen/logrus"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"github.com/spf13/cobra"
apitypes "k8s.io/apimachinery/pkg/types"
k8sConfig "sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/manager"
fwebhook "github.com/fairwindsops/polaris/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/runtime/signals"
apitypes "k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/webhook"
)

var webhookPort int
Expand All @@ -45,7 +45,7 @@ var webhookCmd = &cobra.Command{
Long: `Runs the webhook webserver.`,
Run: func(cmd *cobra.Command, args []string) {
logrus.Debug("Setting up controller manager")
mgr, err := manager.New(config.GetConfigOrDie(), manager.Options{})
mgr, err := manager.New(k8sConfig.GetConfigOrDie(), manager.Options{})
if err != nil {
logrus.Errorf("Unable to set up overall controller manager: %v", err)
os.Exit(1)
Expand Down Expand Up @@ -105,7 +105,7 @@ var webhookCmd = &cobra.Command{
for index, controllerToScan := range config.ControllersToScan {
for innerIndex, supportedAPIType := range controllerToScan.ListSupportedAPIVersions() {
webhookName := strings.ToLower(fmt.Sprintf("%s-%d-%d", controllerToScan, index, innerIndex))
hook := fwebhook.NewWebhook(webhookName, mgr, fwebhook.Validator{Config: c}, supportedAPIType)
hook := fwebhook.NewWebhook(webhookName, mgr, fwebhook.Validator{Config: config}, supportedAPIType)
webhooks = append(webhooks, hook)
}
}
Expand Down

0 comments on commit 4c345f3

Please sign in to comment.