Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[STK-322] Update readme to resolve any confusions #9

Merged
merged 8 commits into from
Aug 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## Problem

We would like to watch if some change happens in `ConfigMap` and `Secret` objects and then perform certain upgrade on relevant `Deployment`, `Deamonset` and `Statefulset`
We would like to watch if some change happens in `ConfigMap` and `Secret` objects and then perform rolling upgrade on relevant `Deployment`, `Deamonset` and `Statefulset`

## Solution

Reloader can watch any changes in `ConfigMap` and `Secret` objects and update or recreate Pods for their associated `Deployments`, `Deamonsets` and `Statefulsets`. In this way Pods can get the latest changes in `ConfigMap` or `Secret` objects.
Reloader can watch changes in `ConfigMap` and `Secret` and do rolling upgrades on Pods with their associated `Deployments`, `Deamonsets` and `Statefulsets`.

**NOTE:** This controller has been inspired from [configmapController](https://github.com/fabric8io/configmapcontroller)

Expand All @@ -30,39 +30,51 @@ metadata:
secret.reloader.stakater.com/reload: "foo"
```

## How Reloader works

Then, providing `Reloader` is running, whenever you edit the `ConfigMap` or `Secret` called `foo` the Reloader will update the `Deployment` by adding the environment variable:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this section in a new heading of How Reloader works

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated


```
STAKATER_FOO_REVISION=${reloaderRevision}
STAKATER_FOO_CONFIGMAP=${reloaderRevisionHash}
```
Or if the change is detected in secret
```
STAKATER_FOO_SECRET=${reloaderRevisionHash}
```

`reloaderRevisionHash` is the change in secret or configmap that is converted into SHA1. This value gets updated every time when reloader detects any change.

This then triggers a rolling upgrade of your deployment's pods to use the new configuration.

Same procedure can be followed to perform rolling upgrade on `Deamonsets` and `Statefulsets` as well.

## Deploying to Kubernetes

You can deploy Reloader by running the following kubectl commands:

```bash
kubectl apply -f rbac.yaml -n <namespace>
kubectl apply -f deployment.yaml -n <namespace>
```
You can deploy Reloader by following methods:

### Vanilla Manifests

You can apply vanilla manifests by running the following command

```bash
kubecl apply -f https://raw.githubusercontent.com/stakater/Reloader/master/deployments/kubernetes/reloader.yaml
kubectl apply -f https://raw.githubusercontent.com/stakater/Reloader/master/deployments/kubernetes/reloader.yaml
```

### Helm Charts

Or alternatively if you configured `helm` on your cluster, you can deploy Reloader via helm chart located under `deployments/kubernetes/chart/reloader` folder.
Alternatively if you have configured helm on your cluster, you can add reloader to helm from our public chart repository and deploy it via helm using below mentioned commands

```bash
helm repo add stakater https://stakater.github.io/stakater-charts

helm repo update

helm install stakater/reloader
```

## Monitor All namespaces

### Monitor All namespaces
You can monitor all namespaces in cluster by setting the `watchGlobally` flag to `true` in manifest file.
By default Reloader gets deployed in `default` namespace and watches changes `secrets` and `configmaps` in all namespaces.

## Help

Expand Down
2 changes: 1 addition & 1 deletion deployments/kubernetes/chart/reloader/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ reloader:
name: stakater/reloader
tag: "0.0.6"
pullPolicy: IfNotPresent
watchGlobally: false
watchGlobally: true
6 changes: 3 additions & 3 deletions deployments/kubernetes/manifests/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ metadata:
name: reloader
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
kind: ClusterRole
metadata:
labels:
app: reloader
Expand Down Expand Up @@ -51,7 +51,7 @@ rules:
- patch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
kind: ClusterRoleBinding
metadata:
labels:
app: reloader
Expand All @@ -65,7 +65,7 @@ metadata:
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
kind: ClusterRole
name: reloader-role
subjects:
- kind: ServiceAccount
Expand Down
10 changes: 3 additions & 7 deletions deployments/kubernetes/reloader.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ spec:
spec:
containers:
- env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: "stakater/reloader:0.0.6"
imagePullPolicy: IfNotPresent
name: reloader
Expand All @@ -54,7 +50,7 @@ metadata:
name: reloader
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
kind: ClusterRole
metadata:
labels:
app: reloader
Expand Down Expand Up @@ -91,7 +87,7 @@ rules:
- patch
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
kind: ClusterRoleBinding
metadata:
labels:
app: reloader
Expand All @@ -105,7 +101,7 @@ metadata:
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
kind: ClusterRole
name: reloader-role
subjects:
- kind: ServiceAccount
Expand Down
2 changes: 1 addition & 1 deletion deployments/kubernetes/templates/chart/values.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ reloader:
name: {{ getenv "DOCKER_IMAGE" }}
tag: "{{ getenv "VERSION" }}"
pullPolicy: IfNotPresent
watchGlobally: false
watchGlobally: true