podstalk

package module
v0.0.0-...-ab4e960 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2019 License: MIT Imports: 15 Imported by: 0

README

Podstalk

Container that displays informations about the Pod it's running on.

Usage

kubectl create namespace podstalk && \
kubectl -n podstalk apply -f https://github.com/mhutter/podstalk/raw/master/kube/daemonset.yml

Will create a daemonset running mhutter/podstalk and a service named podstalk, along with a Role and a Rolebinding required to list pods in the namespace.

Customization

The following env vars can be set to customize Podstalk:

  • TITLE (default: Podstalk) - <title> of the HTML page
  • BASE_PATH (default: "") - Base path of the app, used for asset serving

Development

To regenerate bindata.go, do:

go-bindata -pkg podstalk -prefix data/ data/*

For local development I recommend using gin:

gin --build cmd/podstalk

This will run podstalk on http://localhost:3000/ and reload each time a go file is changed.

To use with minikube you can do the following:

# delploy podstalk into minikube
kubectl create namespace podstalk
kubectl -n podstalk apply -f kube/deployment.yml
kubectl -n podstalk expose svc/podstalk --type NodePort --name podstalk-ext

# set `imagePullPolicy` to `IfNotPresent`
kubectl -n podstalk edit deployment podstalk

# Connect to the minikube docker daemon
eval $(minikube docker-env)

# build the image (each time you changed the code)
docker build -t mhutter/podstalk .

# restart all pods (each time you built a new image)
kubectl -n podstalk delete pod -l app=podstalk

# access podstalk in the browser
minikube -n podstalk service podstalk-ext

Documentation

Index

Constants

View Source
const Topic = "visit"

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets. nolint: deadcode

func Check

func Check(err error)

Check ensures `err` is `nil`, and outputs an error message and exits if it is not

func GetEnvOr

func GetEnvOr(name, fallback string) string

GetEnvOr returns the value uf the env var named `name`, or `fallback` if said env var is empty

func LogoHandler

func LogoHandler(w http.ResponseWriter, r *http.Request)

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables. nolint: deadcode

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type InfoHandler

type InfoHandler struct {
	// contains filtered or unexported fields
}

func NewInfoHandler

func NewInfoHandler(basePath string) InfoHandler

func (InfoHandler) ServeHTTP

func (h InfoHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type PodInfo

type PodInfo struct {
	Name           string
	Namespace      string
	IP             string
	ServiceAccount string
	NodeName       string
	NodeIP         string
	Info           map[string]string
	Now            string
	Title          string
	Siblings       []string
	Refresh        int
	BasePath       string
}

PodInfo contains all interesting information about a pod

type Visit

type Visit struct {
	Host       string `json:"host"`
	Method     string `json:"method"`
	Proto      string `json:"proto"`
	RemoteAddr string `json:"remote_addr"`
	Path       string `json:"path"`
	UserAgent  string `json:"user_agent"`
}

Directories

Path Synopsis
cmd
podstalk command
stream command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL