Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
deschmih authored Jul 8, 2024
2 parents 2260d72 + 9f5211b commit cbf501f
Show file tree
Hide file tree
Showing 19 changed files with 459 additions and 90 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ env:

jobs:
qa:
uses: stakater/.github/.github/workflows/pull_request_doc_qa.yaml@v0.0.79
uses: stakater/.github/.github/workflows/pull_request_doc_qa.yaml@v0.0.82
with:
MD_CONFIG: .github/md_config.json
DOC_SRC: README.md
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull_request_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ on:

jobs:
qa:
uses: stakater/.github/.github/workflows/pull_request_doc_qa.yaml@v0.0.79
uses: stakater/.github/.github/workflows/pull_request_doc_qa.yaml@v0.0.82
with:
MD_CONFIG: .github/md_config.json
DOC_SRC: docs
MD_LINT_CONFIG: .markdownlint.yaml
build:
uses: stakater/.github/.github/workflows/pull_request_container_build.yaml@v0.0.79
uses: stakater/.github/.github/workflows/pull_request_container_build.yaml@v0.0.82
with:
DOCKER_FILE_PATH: Dockerfile-docs
secrets:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,12 @@ jobs:

- name: Helm Template
run: |
helm template reloader deployments/kubernetes/chart/reloader/ > deployments/kubernetes/reloader.yaml
helm template reloader deployments/kubernetes/chart/reloader/ \
--set reloader.deployment.resources.limits.cpu=150m \
--set reloader.deployment.resources.limits.memory=512Mi \
--set reloader.deployment.resources.requests.cpu=10m \
--set reloader.deployment.resources.requests.memory=128Mi > deployments/kubernetes/reloader.yaml
helm template reloader deployments/kubernetes/chart/reloader/ --output-dir deployments/kubernetes/manifests && mv deployments/kubernetes/manifests/reloader/templates/* deployments/kubernetes/manifests/ && rm -r deployments/kubernetes/manifests/reloader
- name: Remove labels and annotations from manifests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:

jobs:
push:
uses: stakater/.github/.github/workflows/push_container.yaml@v0.0.79
uses: stakater/.github/.github/workflows/push_container.yaml@v0.0.82
with:
DOCKER_FILE_PATH: Dockerfile-docs
RELEASE_BRANCH: master
Expand Down
2 changes: 1 addition & 1 deletion .vale.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
StylesPath = styles
MinAlertLevel = warning

Packages = https://github.com/stakater/vale-package/releases/download/v0.0.25/Stakater.zip
Packages = https://github.com/stakater/vale-package/releases/download/v0.0.27/Stakater.zip
Vocab = Stakater

# Only check MarkDown files
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,17 @@ You can apply vanilla manifests by changing `RELEASE-NAME` placeholder provided
kubectl apply -f https://raw.githubusercontent.com/stakater/Reloader/master/deployments/kubernetes/reloader.yaml
```

By default, Reloader gets deployed in `default` namespace and watches changes `secrets` and `configmaps` in all namespaces.
By default, Reloader gets deployed in `default` namespace and watches changes `secrets` and `configmaps` in all namespaces.Additionally, in the default Reloader deployment, the following resource limits and requests are set:

```yaml
resources:
limits:
cpu: 150m
memory: 512Mi
requests:
cpu: 10m
memory: 128Mi
```

Reloader can be configured to ignore the resources `secrets` and `configmaps` by passing the following arguments (`spec.template.spec.containers.args`) to its container :

Expand Down Expand Up @@ -329,6 +339,7 @@ helm uninstall {{RELEASE_NAME}} -n {{NAMESPACE}}
| `reloader.readOnlyRootFileSystem` | Enforce readOnlyRootFilesystem | boolean | `false` |
| `reloader.legacy.rbac` | | boolean | `false` |
| `reloader.matchLabels` | Pod labels to match | map | `{}` |
| `reloader.enableMetricsByNamespace` | Expose an additional Prometheus counter of reloads by namespace (this metric may have high cardinality in clusters with many namespaces) | boolean | `false` |

#### Deployment Reloader Parameters

Expand Down
4 changes: 2 additions & 2 deletions deployments/kubernetes/chart/reloader/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
apiVersion: v1
name: reloader
description: Reloader chart that runs on kubernetes
version: 1.0.107
appVersion: v1.0.107
version: 1.0.115
appVersion: v1.0.115
keywords:
- Reloader
- kubernetes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this

{{- define "reloader-labels.chart" -}}
app: {{ template "reloader-fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ spec:
- image: "{{ .Values.reloader.deployment.image.name }}:{{ .Values.reloader.deployment.image.tag }}"
imagePullPolicy: {{ .Values.reloader.deployment.image.pullPolicy }}
name: {{ template "reloader-fullname" . }}
{{- if or (.Values.reloader.deployment.env.open) (.Values.reloader.deployment.env.secret) (.Values.reloader.deployment.env.field) (.Values.reloader.deployment.env.existing) (eq .Values.reloader.watchGlobally false) (.Values.reloader.enableHA)}}
{{- if or (.Values.reloader.deployment.env.open) (.Values.reloader.deployment.env.secret) (.Values.reloader.deployment.env.field) (.Values.reloader.deployment.env.existing) (eq .Values.reloader.watchGlobally false) (.Values.reloader.enableHA) (.Values.reloader.enableMetricsByNamespace)}}
env:
{{- range $name, $value := .Values.reloader.deployment.env.open }}
{{- if not (empty $value) }}
Expand Down Expand Up @@ -129,6 +129,10 @@ spec:
fieldRef:
fieldPath: metadata.namespace
{{- end }}
{{- if .Values.reloader.enableMetricsByNamespace }}
- name: METRICS_COUNT_BY_NAMESPACE
value: enabled
{{- end }}
{{- end }}

ports:
Expand Down
6 changes: 4 additions & 2 deletions deployments/kubernetes/chart/reloader/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ reloader:
legacy:
rbac: false
matchLabels: {}
# Set to true to expose a prometheus counter of reloads by namespace (this metric may have high cardinality in clusters with many namespaces)
enableMetricsByNamespace: false
deployment:
# If you wish to run multiple replicas set reloader.enableHA = true
replicas: 1
Expand Down Expand Up @@ -90,10 +92,10 @@ reloader:
labels:
provider: stakater
group: com.stakater.platform
version: v1.0.107
version: v1.0.115
image:
name: ghcr.io/stakater/reloader
tag: v1.0.107
tag: v1.0.115
pullPolicy: IfNotPresent
# Support for extra environment variables.
env:
Expand Down
2 changes: 1 addition & 1 deletion deployments/kubernetes/manifests/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
app: reloader-reloader
spec:
containers:
- image: "ghcr.io/stakater/reloader:v1.0.107"
- image: "ghcr.io/stakater/reloader:v1.0.115"
imagePullPolicy: IfNotPresent
name: reloader-reloader
ports:
Expand Down
23 changes: 15 additions & 8 deletions deployments/kubernetes/reloader.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
meta.helm.sh/release-name: "reloader"
labels:
app: reloader-reloader
chart: "reloader-1.0.107"
chart: "reloader-1.0.115"
release: "reloader"
heritage: "Helm"
app.kubernetes.io/managed-by: "Helm"
Expand All @@ -25,7 +25,7 @@ metadata:
meta.helm.sh/release-name: "reloader"
labels:
app: reloader-reloader
chart: "reloader-1.0.107"
chart: "reloader-1.0.115"
release: "reloader"
heritage: "Helm"
app.kubernetes.io/managed-by: "Helm"
Expand Down Expand Up @@ -92,7 +92,7 @@ metadata:
meta.helm.sh/release-name: "reloader"
labels:
app: reloader-reloader
chart: "reloader-1.0.107"
chart: "reloader-1.0.115"
release: "reloader"
heritage: "Helm"
app.kubernetes.io/managed-by: "Helm"
Expand All @@ -115,13 +115,13 @@ metadata:
meta.helm.sh/release-name: "reloader"
labels:
app: reloader-reloader
chart: "reloader-1.0.107"
chart: "reloader-1.0.115"
release: "reloader"
heritage: "Helm"
app.kubernetes.io/managed-by: "Helm"
group: com.stakater.platform
provider: stakater
version: v1.0.107
version: v1.0.115
name: reloader-reloader
namespace: default
spec:
Expand All @@ -135,16 +135,16 @@ spec:
metadata:
labels:
app: reloader-reloader
chart: "reloader-1.0.107"
chart: "reloader-1.0.115"
release: "reloader"
heritage: "Helm"
app.kubernetes.io/managed-by: "Helm"
group: com.stakater.platform
provider: stakater
version: v1.0.107
version: v1.0.115
spec:
containers:
- image: "ghcr.io/stakater/reloader:v1.0.107"
- image: "ghcr.io/stakater/reloader:v1.0.115"
imagePullPolicy: IfNotPresent
name: reloader-reloader

Expand Down Expand Up @@ -172,6 +172,13 @@ spec:

securityContext:
{}
resources:
limits:
cpu: 150m
memory: 512Mi
requests:
cpu: 10m
memory: 128Mi
securityContext:
runAsNonRoot: true
runAsUser: 65534
Expand Down
2 changes: 2 additions & 0 deletions deployments/kubernetes/templates/chart/values.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ reloader:
legacy:
rbac: false
matchLabels: {}
# Set to true to expose a prometheus counter of reloads by namespace (this metric may have high cardinality in clusters with many namespaces)
enableMetricsByNamespace: false
deployment:
replicas: 1
nodeSelector:
Expand Down
13 changes: 13 additions & 0 deletions docs/Verify-Reloader-Working.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,16 @@ When Reloader is unable to reload, `reloader_reload_executed_total{success="fals
reloader_reload_executed_total{success="false"} 15
reloader_reload_executed_total{success="true"} 12
```

### Reloads by Namespace

Reloader can also export a metric to show the number of reloads by namespace. This feature is disabled by default, as it can lead to high cardinality in clusters with many namespaces.

The metric will have both `success` and `namespace` as attributes:

```text
reloader_reload_executed_total{success="false", namespace="some-namespace"} 2
reloader_reload_executed_total{success="true", namespace="some-namespace"} 1
```

To opt in, set the environment variable `METRICS_COUNT_BY_NAMESPACE` to `enabled` or set the Helm value `reloader.enableMetricsByNamespace` to `true`.
34 changes: 17 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ module github.com/stakater/Reloader
go 1.21

require (
github.com/argoproj/argo-rollouts v1.6.6
github.com/argoproj/argo-rollouts v1.7.1
github.com/openshift/api v3.9.0+incompatible
github.com/openshift/client-go v0.0.0-20231110140829-a6ca51f6d5ba
github.com/parnurzeal/gorequest v0.2.16
github.com/prometheus/client_golang v1.19.1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.8.0
k8s.io/api v0.28.4
k8s.io/apimachinery v0.28.4
k8s.io/client-go v0.28.4
k8s.io/kubectl v0.28.4
github.com/spf13/cobra v1.8.1
k8s.io/api v0.29.3
k8s.io/apimachinery v0.29.3
k8s.io/client-go v0.29.3
k8s.io/kubectl v0.29.3
k8s.io/utils v0.0.0-20240423183400-0849a56e8f22
)

Expand All @@ -22,19 +22,19 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/elazarl/goproxy v0.0.0-20221015165544-a0805db90819 // indirect
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand All @@ -44,28 +44,28 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/smartystreets/goconvey v1.7.2 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.16.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
moul.io/http2curl v1.0.0 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

// Replacements for argo-rollouts
Expand Down
Loading

0 comments on commit cbf501f

Please sign in to comment.