Compare commits

..
4 Commits
Author SHA1 Message Date
Bobby Brennan f2feb208a9 Merge pull request #111 from reactiveops/rb/bump
bump version
2019-05-17 16:46:50 -04:00
Bobby Brennan 251f8f1c41 bump version 2019-05-17 20:40:33 +00:00
Bobby Brennan f723a76bb2 Merge pull request #110 from reactiveops/rb/refresh
run audit on every page load
2019-05-17 16:37:23 -04:00
Bobby Brennan 720729aa37 run audit on every page load 2019-05-17 20:28:43 +00:00
6 changed files with 28 additions and 21 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
[![Version][version-image]][version-link] [![CircleCI][circleci-image]][circleci-link] [![Go Report Card][goreport-image]][goreport-link]
</div>
[version-image]: https://img.shields.io/static/v1.svg?label=Version&message=0.1.2&color=239922
[version-image]: https://img.shields.io/static/v1.svg?label=Version&message=0.1.3&color=239922
[version-link]: https://github.com/reactiveops/polaris
[goreport-image]: https://goreportcard.com/badge/github.com/reactiveops/polaris
+1 -1
View File
@@ -160,7 +160,7 @@ spec:
- --dashboard
- --config
- /opt/app/config.yaml
image: 'quay.io/reactiveops/polaris:0.1.2'
image: 'quay.io/reactiveops/polaris:0.1.3'
imagePullPolicy: 'Always'
name: dashboard
ports:
+1 -1
View File
@@ -1,4 +1,4 @@
apiVersion: v1
description: Validation of best practices in your Kubernetes clusters
name: polaris
version: 0.1.2
version: 0.1.3
+2 -2
View File
@@ -50,7 +50,7 @@ dashboard:
type: ClusterIP
image:
repository: quay.io/reactiveops/polaris
tag: 0.1.2
tag: 0.1.3
pullPolicy: Always
webhook:
@@ -58,7 +58,7 @@ webhook:
replicas: 1
image:
repository: quay.io/reactiveops/polaris
tag: 0.1.2
tag: 0.1.3
pullPolicy: Always
rbac:
+1 -1
View File
@@ -210,7 +210,7 @@ spec:
- --webhook
- --config
- /opt/app/config.yaml
image: 'quay.io/reactiveops/polaris:0.1.2'
image: 'quay.io/reactiveops/polaris:0.1.3'
imagePullPolicy: 'Always'
ports:
- containerPort: 9876
+22 -15
View File
@@ -44,7 +44,7 @@ import (
const (
// Version represents the current release version of Polaris
Version = "0.1.2"
Version = "0.1.3"
)
func main() {
@@ -89,28 +89,24 @@ func main() {
if *webhook {
startWebhookServer(c, *disableWebhookConfigInstaller, *webhookPort)
} else if *dashboard {
k, err := kube.CreateResourceProvider(*auditPath)
if err != nil {
logrus.Errorf("Error fetching Kubernetes resources %v", err)
os.Exit(1)
}
startDashboardServer(c, k, *dashboardPort)
startDashboardServer(c, *dashboardPort)
} else if *audit {
k, err := kube.CreateResourceProvider(*auditPath)
if err != nil {
logrus.Errorf("Error fetching Kubernetes resources %v", err)
os.Exit(1)
}
runAudit(c, k, *auditOutputFile, *auditOutputURL)
runAudit(c, *auditPath, *auditOutputFile, *auditOutputURL)
}
}
func startDashboardServer(c conf.Configuration, k *kube.ResourceProvider, port int) {
func startDashboardServer(c conf.Configuration, port int) {
router := mux.NewRouter()
router.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("OK"))
})
router.HandleFunc("/results.json", func(w http.ResponseWriter, r *http.Request) {
k, err := kube.CreateResourceProvider("")
if err != nil {
logrus.Errorf("Error fetching Kubernetes resources %v", err)
http.Error(w, "Error fetching Kubernetes resources", http.StatusInternalServerError)
return
}
dashboard.EndpointHandler(w, r, c, k)
})
router.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {
@@ -128,6 +124,12 @@ func startDashboardServer(c conf.Configuration, k *kube.ResourceProvider, port i
http.NotFound(w, r)
return
}
k, err := kube.CreateResourceProvider("")
if err != nil {
logrus.Errorf("Error fetching Kubernetes resources %v", err)
http.Error(w, "Error fetching Kubernetes resources", http.StatusInternalServerError)
return
}
auditData, err := validator.RunAudit(c, k)
if err != nil {
logrus.Errorf("Error getting audit data: %v", err)
@@ -213,7 +215,12 @@ func startWebhookServer(c conf.Configuration, disableWebhookConfigInstaller bool
}
}
func runAudit(c conf.Configuration, k *kube.ResourceProvider, outputFile string, outputURL string) {
func runAudit(c conf.Configuration, auditPath string, outputFile string, outputURL string) {
k, err := kube.CreateResourceProvider(auditPath)
if err != nil {
logrus.Errorf("Error fetching Kubernetes resources %v", err)
os.Exit(1)
}
auditData, err := validator.RunAudit(c, k)
if err != nil {