Skip to content

Commit

Permalink
package & version updates
Browse files Browse the repository at this point in the history
  • Loading branch information
benc-uk committed Aug 13, 2020
1 parent 9c32cb6 commit f370445
Show file tree
Hide file tree
Showing 7 changed files with 1,714 additions and 1,622 deletions.
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug Kubeview API server",
"type": "go",
"request": "launch",
"mode": "auto",
// "cwd": "./cmd/server",
"program": "${workspaceFolder}/cmd/server",
"env": {},
"args": []
}
]
}
4 changes: 2 additions & 2 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ RUN npm run build
# ================================================================================================
# === Stage 2: Build Golang API server and host for Vue app ======================================
# ================================================================================================
FROM golang:1.14-alpine as go-build
FROM golang:1.15-alpine as go-build
WORKDIR /build
ARG goPackage="github.com/benc-uk/kubeview/cmd/server"
ARG version="0.1.15"
ARG version="0.1.16"
ARG buildInfo="Local manual build"

ENV PORT 8000
Expand Down
31 changes: 17 additions & 14 deletions cmd/server/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package main
//

import (
"context"
"encoding/json"
"log"
"net/http"
Expand Down Expand Up @@ -102,7 +103,8 @@ func routeStatus(resp http.ResponseWriter, req *http.Request) {
// Return list of all namespaces in cluster
//
func routeGetNamespaces(resp http.ResponseWriter, req *http.Request) {
namespaces, err := clientset.CoreV1().Namespaces().List(metav1.ListOptions{})
ctx := context.Background()
namespaces, err := clientset.CoreV1().Namespaces().List(ctx, metav1.ListOptions{})
if err != nil {
log.Println("### Kubernetes API error", err.Error())
http.Error(resp, err.Error(), http.StatusInternalServerError)
Expand All @@ -120,19 +122,20 @@ func routeScrapeData(resp http.ResponseWriter, req *http.Request) {
params := mux.Vars(req)
namespace := params["ns"]

pods, err := clientset.CoreV1().Pods(namespace).List(metav1.ListOptions{})
services, err := clientset.CoreV1().Services(namespace).List(metav1.ListOptions{})
endpoints, err := clientset.CoreV1().Endpoints(namespace).List(metav1.ListOptions{})
pvs, err := clientset.CoreV1().PersistentVolumes().List(metav1.ListOptions{})
pvcs, err := clientset.CoreV1().PersistentVolumeClaims(namespace).List(metav1.ListOptions{})
configmaps, err := clientset.CoreV1().ConfigMaps(namespace).List(metav1.ListOptions{})
secrets, err := clientset.CoreV1().Secrets(namespace).List(metav1.ListOptions{})
deployments, err := clientset.AppsV1().Deployments(namespace).List(metav1.ListOptions{})
daemonsets, err := clientset.AppsV1().DaemonSets(namespace).List(metav1.ListOptions{})
replicasets, err := clientset.AppsV1().ReplicaSets(namespace).List(metav1.ListOptions{})
statefulsets, err := clientset.AppsV1().StatefulSets(namespace).List(metav1.ListOptions{})

ingresses, err := clientset.ExtensionsV1beta1().Ingresses(namespace).List(metav1.ListOptions{})
ctx := context.Background()
pods, err := clientset.CoreV1().Pods(namespace).List(ctx, metav1.ListOptions{})
services, err := clientset.CoreV1().Services(namespace).List(ctx, metav1.ListOptions{})
endpoints, err := clientset.CoreV1().Endpoints(namespace).List(ctx, metav1.ListOptions{})
pvs, err := clientset.CoreV1().PersistentVolumes().List(ctx, metav1.ListOptions{})
pvcs, err := clientset.CoreV1().PersistentVolumeClaims(namespace).List(ctx, metav1.ListOptions{})
configmaps, err := clientset.CoreV1().ConfigMaps(namespace).List(ctx, metav1.ListOptions{})
secrets, err := clientset.CoreV1().Secrets(namespace).List(ctx, metav1.ListOptions{})
deployments, err := clientset.AppsV1().Deployments(namespace).List(ctx, metav1.ListOptions{})
daemonsets, err := clientset.AppsV1().DaemonSets(namespace).List(ctx, metav1.ListOptions{})
replicasets, err := clientset.AppsV1().ReplicaSets(namespace).List(ctx, metav1.ListOptions{})
statefulsets, err := clientset.AppsV1().StatefulSets(namespace).List(ctx, metav1.ListOptions{})

ingresses, err := clientset.ExtensionsV1beta1().Ingresses(namespace).List(ctx, metav1.ListOptions{})

if err != nil {
log.Println("### Kubernetes API error", err.Error())
Expand Down
12 changes: 8 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
module github.com/benc-uk/kubeview

go 1.13
go 1.15

require (
github.com/benc-uk/go-starter v1.0.0
github.com/gorilla/mux v1.7.4
github.com/imdario/mergo v0.3.11 // indirect
github.com/joho/godotenv v1.3.0
k8s.io/api v0.15.7
k8s.io/apimachinery v0.15.7
k8s.io/client-go v0.15.7
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
k8s.io/api v0.18.6
k8s.io/apimachinery v0.18.6
k8s.io/client-go v0.18.6
k8s.io/utils v0.0.0-20200731180307-f00132d28269 // indirect
)
Loading

0 comments on commit f370445

Please sign in to comment.