k8s/

directory
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: Apache-2.0

README

SRE Resources

SRE resources are custom resources that implement the indicator protocol for kubernetes.

Resources

IndicatorDocument

IndicatorDocument is a resource that allow for indicators, thresholds, and layouts to be configured for a given product.

Controllers

Grafana

The grafana-indicator-controller configures dashboards for grafana based on IndicatorDocuments.

Prometheus

The prometheus-indicator-controller configures alerting rules for prometheus based on IndicatorDocuments.

Deployment

You can deploy the SRE resources by:

kubectl apply -Rf config

Cluster setup

# Create new cluster
gcloud container clusters create $NAME --zone us-central1-a

# Provide admin privileges to self
#  - Please note that the role binding name must be unique for the cluster
kubectl create clusterrolebinding cluster-admin-binding --clusterrole cluster-admin --user $(gcloud config get-value account)

# Ensure kubeconfig is pointing at the right cluster
kubectl config get-contexts

# [Optional] Point at the right cluster
gcloud container clusters get-credentials $NAME -z us-central1-a

# Initialize Helm
helm init
helm repo update
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
helm init --service-account tiller --upgrade

# Create Grafana namespace
kubectl create ns grafana

# Install Grafana helmchart
helm install stable/grafana --values helm_config/grafana_values.yml --name grafana --namespace grafana

# Create Prometheus namespace
kubectl create ns prometheus

# Install Prometheus helmchart
helm install stable/prometheus --name prometheus --namespace prometheus

# MIP components
kubectl apply -k config

# Apply a simple indicatordocument
kubectl apply -f test/valid/simple.yml
For test

To set up a cluster for end to end tests, the grafana and prometheus servers must be available on the internet. To achieve this, modify the lines in the above script which install those services like so:

# Install Grafana helmchart
helm install stable/grafana --values helm_config/e2e_grafana_values.yml --name grafana --namespace grafana
# Install Prometheus helmchart
helm install stable/prometheus --values helm_config/e2e_prometheus_values.yml --name prometheus --namespace prometheus

Directories

Path Synopsis
cmd
pkg
apis/indicatordocument/v1alpha1
Package v1alpha1 is the v1alpha1 version of the API.
Package v1alpha1 is the v1alpha1 version of the API.
client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/clientset/versioned/typed/indicatordocument/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/clientset/versioned/typed/indicatordocument/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

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