Skip to content

Commit af2d8ae

Browse files
sdowellgoogle-oss-prow[bot]
authored andcommitted
test: persist helm charts locally (#1658)
This changes the helm charts used by the cli tests to be persisted locally instead of fetched from a remote third party helm repository. This is intended to fix some flaky DNS lookup errors that have been observed from the presubmit environment. This also generally makes the tests more hermetic and minimizes reliance on third party infra.
1 parent fe92822 commit af2d8ae

File tree

150 files changed

+14833
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+14833
-17
lines changed

e2e/testcases/cli_test.go

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -742,13 +742,15 @@ func TestNomosHydrateAndVetDryRepos(t *testing.T) {
742742
sourceFormat: string(configsync.SourceFormatUnstructured),
743743
expectedOutPath: "../testdata/hydration/compiled/helm-overlay",
744744
},
745-
{
746-
name: "hydrate a DRY repo with remote base",
747-
path: "../testdata/hydration/remote-base",
748-
outPath: "remote-base/compiled",
749-
sourceFormat: string(configsync.SourceFormatUnstructured),
750-
expectedOutPath: "../testdata/hydration/compiled/remote-base",
751-
},
745+
// remote-base relies on external public helm chart, which occasionally
746+
// results in flaky DNS lookups in the presubmit job
747+
//{
748+
// name: "hydrate a DRY repo with remote base",
749+
// path: "../testdata/hydration/remote-base",
750+
// outPath: "remote-base/compiled",
751+
// sourceFormat: string(configsync.SourceFormatUnstructured),
752+
// expectedOutPath: "../testdata/hydration/compiled/remote-base",
753+
//},
752754
{
753755
name: "hydrate a DRY repo with relative path",
754756
path: "../testdata/hydration/relative-path/overlays/dev",
@@ -793,14 +795,6 @@ func TestNomosHydrateAndVetDryRepos(t *testing.T) {
793795
hydrateArgs = append(hydrateArgs, args...)
794796
out, err := exec.Command("nomos", hydrateArgs...).CombinedOutput()
795797

796-
// 'nomos hydrate' and 'nomos vet' might pull remote Helm charts locally.
797-
// Below deletes the generated charts after the test.
798-
chartsDir := filepath.Join(tc.path, "charts")
799-
if _, err := os.Stat(chartsDir); os.IsNotExist(err) {
800-
defer func() {
801-
_ = os.RemoveAll(chartsDir)
802-
}()
803-
}
804798
if len(tc.expectedErrMsg) != 0 && err == nil {
805799
tw.Errorf("%s: expected error '%s', but got no error", tc.name, tc.expectedErrMsg)
806800
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
description: Provides easy monitoring definitions for Kubernetes services, and deployment
3+
and management of Prometheus instances.
4+
maintainers:
5+
- email: mgoodness@gmail.com
6+
name: Michael Goodness
7+
name: prometheus-operator
8+
sources:
9+
- https://github.com/coreos/prometheus-operator
10+
version: 0.2.0
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# prometheus-operator
2+
3+
Installs [prometheus-operator](https://github.com/coreos/prometheus-operator) to create/configure/manage Prometheus clusters atop Kubernetes.
4+
5+
## TL;DR;
6+
7+
```console
8+
$ helm install opsgoodness/prometheus-operator
9+
```
10+
11+
## Introduction
12+
13+
This chart bootstraps a [prometheus-operator](https://github.com/coreos/prometheus-operator) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
14+
15+
## Prerequisites
16+
- Kubernetes 1.4+ with Beta APIs & ThirdPartyResources enabled
17+
18+
## Installing the Chart
19+
20+
To install the chart with the release name `my-release`:
21+
22+
```console
23+
$ helm install opsgoodness/prometheus-operator --name my-release
24+
```
25+
26+
The command deploys prometheus-operator on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
27+
28+
## Uninstalling the Chart
29+
30+
To uninstall/delete the `my-release` deployment:
31+
32+
```console
33+
$ helm delete my-release
34+
```
35+
36+
The command removes all the Kubernetes components associated with the chart and deletes the release.
37+
38+
## Configuration
39+
40+
The following tables lists the configurable parameters of the prometheus-operator chart and their default values.
41+
42+
Parameter | Description | Default
43+
--- | --- | ---
44+
`global.hyperkube.repository` | Hyperkube image | `quay.io/coreos/hyperkube`
45+
`global.hyperkube.tag` | Hyperkube image tag | `v1.5.3_coreos.0`
46+
`global.hyperkube.pullPolicy` | Hyperkube image pull policy | `IfNotPresent`
47+
`image.repository` | Image | `quay.io/coreos/prometheus-operator`
48+
`image.tag` | Image tag | `v0.6.0`
49+
`image.pullPolicy` | Image pull policy | `IfNotPresent`
50+
`nodeSelector` | Node labels for pod assignment | `{}`
51+
`resources` | Pod resource requests & limits | `{}`
52+
`sendAnalytics` | Collect & send anonymous usage statistics | `true`
53+
54+
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
55+
56+
```console
57+
$ helm install opsgoodness/prometheus-operator --name my-release --set sendAnalytics=true
58+
```
59+
60+
Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,
61+
62+
```console
63+
$ helm install opsgoodness/prometheus-operator --name my-release -f values.yaml
64+
```
65+
66+
> **Tip**: You can use the default [values.yaml](values.yaml)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
*/}}
13+
{{- define "fullname" -}}
14+
{{- $name := default .Chart.Name .Values.nameOverride -}}
15+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
16+
{{- end -}}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
annotations:
5+
helm.sh/hook: post-delete
6+
labels:
7+
app: {{ template "name" . }}
8+
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
9+
heritage: {{ .Release.Service }}
10+
release: {{ .Release.Name }}
11+
name: {{ template "fullname" . }}-cleanup
12+
spec:
13+
template:
14+
metadata:
15+
labels:
16+
app: {{ template "name" . }}
17+
release: {{ .Release.Name }}
18+
name: {{ template "fullname" . }}-cleanup
19+
spec:
20+
containers:
21+
- name: delete-services
22+
image: "{{ .Values.global.hyperkube.repository }}:{{ .Values.global.hyperkube.tag }}"
23+
imagePullPolicy: "{{ .Values.global.hyperkube.pullPolicy }}"
24+
command:
25+
- /bin/bash
26+
- -c
27+
- for n in $(/kubectl get namespaces -o jsonpath={..metadata.name}); do /kubectl delete --ignore-not-found --namespace $n services prometheus-operated alertmanager-operated; done
28+
- name: delete-tprs
29+
image: "{{ .Values.global.hyperkube.repository }}:{{ .Values.global.hyperkube.tag }}"
30+
imagePullPolicy: "{{ .Values.global.hyperkube.pullPolicy }}"
31+
command:
32+
- /kubectl
33+
- delete
34+
- --ignore-not-found
35+
- thirdpartyresource
36+
- alertmanager.monitoring.coreos.com
37+
- prometheus.monitoring.coreos.com
38+
- service-monitor.monitoring.coreos.com
39+
restartPolicy: OnFailure
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Deployment
3+
metadata:
4+
labels:
5+
app: {{ template "name" . }}
6+
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
7+
heritage: {{ .Release.Service }}
8+
operator: prometheus
9+
release: {{ .Release.Name }}
10+
name: {{ template "fullname" . }}
11+
spec:
12+
replicas: 1
13+
template:
14+
metadata:
15+
labels:
16+
app: {{ template "name" . }}
17+
operator: prometheus
18+
release: {{ .Release.Name }}
19+
spec:
20+
containers:
21+
- name: {{ template "name" . }}
22+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
23+
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
24+
args:
25+
- --analytics={{ .Values.sendAnalytics }}
26+
resources:
27+
{{ toYaml .Values.resources | indent 12 }}
28+
{{- if .Values.nodeSelector }}
29+
nodeSelector:
30+
{{ toYaml .Values.nodeSelector | indent 8 }}
31+
{{- end }}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
annotations:
5+
helm.sh/hook: post-install
6+
labels:
7+
app: {{ template "name" . }}
8+
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
9+
heritage: {{ .Release.Service }}
10+
release: {{ .Release.Name }}
11+
name: {{ template "fullname" . }}-get-tpr-{{ randAlphaNum 10 | lower }}
12+
spec:
13+
template:
14+
metadata:
15+
labels:
16+
app: {{ template "name" . }}
17+
release: {{ .Release.Name }}
18+
name: {{ template "fullname" . }}-get-tprs
19+
spec:
20+
containers:
21+
- name: hyperkube
22+
image: "{{ .Values.global.hyperkube.repository }}:{{ .Values.global.hyperkube.tag }}"
23+
imagePullPolicy: "{{ .Values.global.hyperkube.pullPolicy }}"
24+
command:
25+
- ./kubectl
26+
- get
27+
- thirdpartyresource
28+
- alertmanager.monitoring.coreos.com
29+
- prometheus.monitoring.coreos.com
30+
- service-monitor.monitoring.coreos.com
31+
restartPolicy: OnFailure
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
global:
2+
## Hyperkube image to use when getting ThirdPartyResources & cleaning up
3+
##
4+
hyperkube:
5+
repository: quay.io/coreos/hyperkube
6+
tag: v1.5.3_coreos.0
7+
pullPolicy: IfNotPresent
8+
9+
## Prometheus-operator image
10+
##
11+
image:
12+
repository: quay.io/coreos/prometheus-operator
13+
tag: v0.7.0
14+
pullPolicy: IfNotPresent
15+
16+
## Node labels for prometheus-operator pod assignment
17+
##
18+
nodeSelector: {}
19+
20+
## If true, collect & send anonymous usage statistics
21+
## Ref: https://github.com/coreos/prometheus-operator#installation
22+
##
23+
sendAnalytics: true
24+
25+
## Prometheus-operator resource limits & requests
26+
## Ref: https://kubernetes.io/docs/user-guide/compute-resources/
27+
##
28+
resources: {}
29+
# limits:
30+
# cpu: 200m
31+
# memory: 300Mi
32+
# requests:
33+
# cpu: 100m
34+
# memory: 50Mi
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
dependencies:
2+
- name: memcached
3+
repository: https://charts.bitnami.com/bitnami
4+
version: 6.3.5
5+
- name: mariadb
6+
repository: https://charts.bitnami.com/bitnami
7+
version: 11.4.4
8+
- name: common
9+
repository: https://charts.bitnami.com/bitnami
10+
version: 2.2.2
11+
digest: sha256:a917b459cd4db5baea69506921dd13e699f8a1a330fbe76bb80d24f668874d9d
12+
generated: "2023-01-19T00:46:08.195009985Z"

0 commit comments

Comments
 (0)