Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from rebuy-de/update_readme_installation
Browse files Browse the repository at this point in the history
adds sample k8s manifests and updates readme
  • Loading branch information
octopusx authored Sep 18, 2018
2 parents 3485921 + 26a5127 commit 2c8f58d
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ node-drainer --access-key-id example_id --secret-access-key example_secret --reg

## Installation

Binaries and packages are not provided for *node-drainer*. To have it installed one must compile it from source.
* Binaries for *node-drainer* are provided for each release [here](https://github.com/rebuy-de/node-drainer/releases).
* Docker containers are are provided [here](https://quay.io/repository/rebuy/node-drainer). To obtain the latest docker image run `docker pull quay.io/rebuy/node-drainer:master`.
* For deploying *node-drainer* docker image to your Kubernetes cluster you can use the sample manifest files (found [here](https://github.com/rebuy-de/node-drainer/tree/master/samples)), just remember to fill in your own AWS credentials. I you use RBAC in Kubernetes you can also take advantage of the sample service account configuration.

To compile *node-drainer* from source you need a working
[Golang](https://golang.org/doc/install) development environment. The sources
Expand Down
2 changes: 0 additions & 2 deletions pkg/sqs/test_util/fixture_generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"github.com/rebuy-de/node-drainer/pkg/util"
)

//TODO: anonymise

func GenerateDescribeInstancesOutput(empty bool) *ec2.DescribeInstancesOutput {
output := &ec2.DescribeInstancesOutput{}
reservation := &ec2.Reservation{}
Expand Down
48 changes: 48 additions & 0 deletions samples/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Example K8S Deployment manifest file, read before applying
apiVersion: extensions/v1beta1
kind: Deployment

metadata:
name: node-drainer
labels:
app: node-drainer

spec:
replicas: 1
revisionHistoryLimit: 3

# You should always have one replica only,
# node-drainer was not designed to run concurrently
strategy:
rollingUpdate:
maxUnavailable: 1
maxSurge: 0

template:
metadata:
name: node-drainer
labels:
app: node-drainer

spec:
# The service account is necessary if your K8S cluster is running RBAC,
# otherwise the following line should be deleted
serviceAccountName: node-drainer

containers:
- name: node-drainer
image: "quay.io/rebuy/node-drainer:master"
imagePullPolicy: Always
# These are sample arguments, configure before applying the manifest
args:
- -q=asg-shutdown-queue
- -r=eu-west-1
- --access-key-id=FILL-ME-IN
- --secret-access-key=FILL-ME-IN
resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 100m
memory: 100Mi
38 changes: 38 additions & 0 deletions samples/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Example service account K8S manifest file, read before applying
apiVersion: v1
kind: ServiceAccount
metadata:
name: node-drainer
---
# ClusterRole is necessary for node-drainer to read node information
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: node-drainer
rules:
- apiGroups: [""]
resources:
- nodes
verbs: ["list", "watch", "get", "update"]
- apiGroups: [""]
resources:
- pods
verbs: ["list", "delete", "get"]
- apiGroups: [""]
resources:
- pods/eviction
verbs: ["list", "get", "create"]
---
# We must bind the ClusterRole to our new ServiceAccount
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: node-drainer
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: node-drainer
subjects:
- kind: ServiceAccount
name: node-drainer
namespace: default

0 comments on commit 2c8f58d

Please sign in to comment.