Skip to content

Commit

Permalink
Remove support for old k8s versions
Browse files Browse the repository at this point in the history
Signed-off-by: Chris <[email protected]>
  • Loading branch information
ccremer committed Nov 1, 2021
1 parent bb866fa commit d2d0780
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 49 deletions.
11 changes: 8 additions & 3 deletions appuio/k8up/README.gotmpl.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
```bash
# Install CRDs for K8s >= 1.16:
kubectl apply -f https://github.com/k8up-io/k8up/releases/download/{{ template "chart.appVersion" . }}/k8up-crd.yaml
# Install CRDs for K8s <= 1.15 (e.g. OpenShift 3.11):
kubectl apply -f https://github.com/k8up-io/k8up/releases/download/{{ template "chart.appVersion" . }}/k8up-crd-legacy.yaml
```

<!---
Expand Down Expand Up @@ -34,3 +31,11 @@ Document your changes in values.yaml and let `make docs:helm` generate this sect
* `replicaCount` is now configurable, defaults to `1`.
* Note: Deployment strategy type has changed from `Recreate` to `RollingUpdate`.
* CRDs need to be installed separately, they are no longer included in this chart.

## Upgrading from Charts 1.x to 2.x

* Note: `image.repository` changed from `vshn/k8up` to `k8up-io/k8up`.
* Note: `image.registry` changed from `quay.io` to `ghcr.io`.
* Note: `image.tag` changed from `v1.x` to `v2.x`. Please see the [full changelog](https://github.com/k8up-io/k8up/releases/tag/v2.0.0).
* `metrics.prometheusRule.legacyRules` has been removed (no support for OpenShift 3.11 anymore).
* Note: `k8up.backupImage.repository` changed from `quay.io/vshn/wrestic` to `ghcr.io/k8up-io/k8up` (`wrestic` is not needed anymore in K8up v2).
20 changes: 14 additions & 6 deletions appuio/k8up/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# k8up

![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![AppVersion: v2.0.0](https://img.shields.io/badge/AppVersion-v2.0.0-informational?style=flat-square)
![Version: 2.0.0](https://img.shields.io/badge/Version-2.0.0-informational?style=flat-square) ![AppVersion: v2.0.0](https://img.shields.io/badge/AppVersion-v2.0.0-informational?style=flat-square)

Kubernetes and OpenShift Backup Operator based on restic

Expand All @@ -13,10 +13,7 @@ helm repo add appuio https://charts.appuio.ch
helm install k8up appuio/k8up
```
```bash
# Install CRDs for K8s >= 1.16:
kubectl apply -f https://github.com/k8up-io/k8up/releases/download/v2.0.0/k8up-crd.yaml
# Install CRDs for K8s <= 1.15 (e.g. OpenShift 3.11):
kubectl apply -f https://github.com/k8up-io/k8up/releases/download/v2.0.0/k8up-crd-legacy.yaml
```

<!---
Expand Down Expand Up @@ -51,7 +48,7 @@ Document your changes in values.yaml and let `make docs:helm` generate this sect
| imagePullSecrets | list | `[]` | |
| k8up.backupImage.repository | string | `"ghcr.io/k8up-io/k8up"` | The backup runner image repository |
| k8up.backupImage.tag | string | `"v2.0.0"` | The backup runner image tag |
| k8up.enableLeaderElection | bool | `true` | Specifies whether leader election should be enabled. Disable this for K8s versions < 1.16 |
| k8up.enableLeaderElection | bool | `true` | Specifies whether leader election should be enabled. |
| k8up.envVars | list | `[]` | envVars allows the specification of additional environment variables. See [values.yaml](values.yaml) how to specify See documentation which variables are supported. |
| k8up.globalResources | object | empty values | Specify the resource requests and limits that the Pods should have when they are scheduled by K8up. You are still able to override those via K8up resources, but this gives cluster administrators custom defaults. |
| k8up.globalResources.limits.cpu | string | `""` | Global CPU resource limit applied to jobs. See [supported units][resource-units]. |
Expand All @@ -65,7 +62,6 @@ Document your changes in values.yaml and let `make docs:helm` generate this sect
| metrics.prometheusRule.createDefaultRules | bool | `true` | Whether the default rules should be installed |
| metrics.prometheusRule.enabled | bool | `false` | Whether to enable PrometheusRule manifest for [Prometheus Operator][prometheus-operator] |
| metrics.prometheusRule.jobFailedRulesFor | list | `["archive","backup","check","prune","restore"]` | Create default rules for the given job types. Valid values are "archive", "backup", "check", "prune", and "restore". |
| metrics.prometheusRule.legacyRules | bool | `false` | Create default rules for kube-state-metrics < v1.5.0 Needed for OpenShift 3.x |
| metrics.prometheusRule.namespace | string | `""` | If the object should be installed in a different namespace than operator |
| metrics.service.nodePort | int | `0` | Service node port of the metrics endpoint, requires `metrics.service.type=NodePort` |
| metrics.service.port | int | `8080` | |
Expand Down Expand Up @@ -95,6 +91,18 @@ Document your changes in values.yaml and let `make docs:helm` generate this sect
* Note: Deployment strategy type has changed from `Recreate` to `RollingUpdate`.
* CRDs need to be installed separately, they are no longer included in this chart.

## Upgrading from Charts 1.x to 2.x

* Note: `image.repository` changed from `vshn/k8up` to `k8up-io/k8up`.
* Note: `image.registry` changed from `quay.io` to `ghcr.io`.
* Note: `image.tag` changed from `v1.x` to `v2.x`. Please see the [full changelog](https://github.com/k8up-io/k8up/releases/tag/v2.0.0).
* `metrics.prometheusRule.legacyRules` has been removed (no support for OpenShift 3.11 anymore).
* Note: `k8up.backupImage.repository` changed from `quay.io/vshn/wrestic` to `ghcr.io/k8up-io/k8up` (`wrestic` is not needed anymore in K8up v2).

## Source Code

* <https://github.com/k8up-io/k8up>

<!---
Common/Useful Link references from values.yaml
-->
Expand Down
3 changes: 1 addition & 2 deletions appuio/k8up/templates/prometheus/prometheusrule.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{{- if and .Values.metrics.prometheusRule.enabled (or .Values.metrics.prometheusRule.createDefaultRules .Values.metrics.prometheusRule.additionalRules) -}}
{{- $jobNameLabel := ternary "job" "job_name" .Values.metrics.prometheusRule.legacyRules -}}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
Expand Down Expand Up @@ -39,7 +38,7 @@ spec:
summary: "K8up jobs are stuck in {{ "{{ $labels.namespace }}" }} for the last 24 hours."
{{- range .Values.metrics.prometheusRule.jobFailedRulesFor }}
- alert: K8up{{- . | title -}}Failed
expr: (sum(kube_job_status_failed) by({{ $jobNameLabel }}, namespace) * on({{ $jobNameLabel }}, namespace) group_right() kube_job_labels{label_k8up_syn_tools_type="{{- . -}}"}) > 0
expr: (sum(kube_job_status_failed) by(job_name, namespace) * on(job_name, namespace) group_right() kube_job_labels{label_k8up_syn_tools_type="{{- . -}}"}) > 0
for: 1m
labels:
severity: critical
Expand Down
34 changes: 0 additions & 34 deletions appuio/k8up/test/prometheus/prometheusrule_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package test

import (
"strconv"
"strings"
"testing"

Expand Down Expand Up @@ -92,39 +91,6 @@ func Test_PrometheusRule_GivenEnabled_ConfigureEnabledRules(t *testing.T) {
assert.Len(t, findFailedRules(renderWithRulesFor(rules)), 3)
}

var legacyRuleSubjects = map[string]struct {
legacyRulesEnabled bool
expectRuleToContain string
}{
"WhenLegacyRulesDisabled_ThenRenderNormalRule": {
true, "by(job,",
},
"WhenLegacyRulesEnabled_ThenRenderLegacyRule": {
false, "by(job_name,",
},
}

func Test_PrometheusRule_GivenEnabled_LegacyRules(t *testing.T) {
for descr, tC := range legacyRuleSubjects {
t.Run(descr, func(t *testing.T) {
options := &helm.Options{
SetValues: map[string]string{
"metrics.prometheusRule.enabled": "true",
"metrics.prometheusRule.legacyRules": strconv.FormatBool(tC.legacyRulesEnabled),
},
}

output := helm.RenderTemplate(t, options, helmChartPath, releaseName, tplPrometheusRule)
rule := monitoringv1.PrometheusRule{}
helm.UnmarshalK8SYaml(t, output, &rule)

failedRules := findFailedRules(rule.Spec.Groups[0].Rules)
assert.NotEmpty(t, failedRules)
assert.Contains(t, failedRules[0].Expr.String(), tC.expectRuleToContain)
})
}
}

func Test_PrometheusRule_GivenEnabled_WhenCreateDefaultRulesDisabled_ThenRenderNoTemplate(t *testing.T) {
options := &helm.Options{
SetValues: map[string]string{
Expand Down
4 changes: 0 additions & 4 deletions appuio/k8up/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ k8up:
timezone: ""

# -- Specifies whether leader election should be enabled.
# Disable this for K8s versions < 1.16
enableLeaderElection: true

# -- Specifies the namespace in which K8up's `EffectiveSchedules` are stored.
Expand Down Expand Up @@ -101,9 +100,6 @@ metrics:
additionalLabels: {}
# -- Whether the default rules should be installed
createDefaultRules: true
# -- Create default rules for kube-state-metrics < v1.5.0
# Needed for OpenShift 3.x
legacyRules: false
# -- Create default rules for the given job types.
# Valid values are "archive", "backup", "check", "prune", and "restore".
jobFailedRulesFor: ["archive", "backup", "check", "prune", "restore"]
Expand Down

0 comments on commit d2d0780

Please sign in to comment.