mirror of
https://github.com/FairwindsOps/polaris.git
synced 2026-08-29 22:17:16 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f2feb208a9 | ||
|
|
251f8f1c41 | ||
|
|
f723a76bb2 | ||
|
|
720729aa37 |
@@ -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
|
||||
|
||||
@@ -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,4 +1,4 @@
|
||||
apiVersion: v1
|
||||
description: Validation of best practices in your Kubernetes clusters
|
||||
name: polaris
|
||||
version: 0.1.2
|
||||
version: 0.1.3
|
||||
|
||||
@@ -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
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user