Skip to content

Commit

Permalink
Add test for reasonable cnf startup time lfn-cnti/certification#154
Browse files Browse the repository at this point in the history
  • Loading branch information
denverwilliams committed May 5, 2020
1 parent fbaad9e commit 73692a6
Show file tree
Hide file tree
Showing 17 changed files with 757 additions and 5 deletions.
2 changes: 2 additions & 0 deletions points.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

- name: image_size_large
tags: microservice, dynamic
- name: reasonable_startup_time
tags: microservice, dynamic

- name: cni_spec
tags: compatibility, dynamic
Expand Down
1 change: 0 additions & 1 deletion sample-cnfs/sample-large-cnf/.#notes.org

This file was deleted.

39 changes: 39 additions & 0 deletions sample-cnfs/sample_envoy_slow_startup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Set up Sample CoreDNS CNF
./sample-cnfs/sample-coredns-cnf/readme.md
# Prerequistes
### Install helm
```
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
```
### Optional: Use a helm version manager
https://github.com/yuya-takeyama/helmenv
Check out helmenv into any path (here is ${HOME}/.helmenv)
```
${HOME}/.helmenv)
$ git clone https://github.com/yuya-takeyama/helmenv.git ~/.helmenv
```
Add ~/.helmenv/bin to your $PATH any way you like
```
$ echo 'export PATH="$HOME/.helmenv/bin:$PATH"' >> ~/.bash_profile
```
```
helmenv versions
helmenv install <version 3.1?>
```

### core-dns installation
```
helm install coredns stable/coredns
```
### Pull down the helm chart code, untar it, and put it in the cnfs/coredns directory
```
helm pull stable/coredns
```
### Example cnf-conformance config file for sample-core-dns-cnf
In ./cnfs/sample-core-dns-cnf/cnf-conformance.yml
```
---
container_names: [coredns-coredns]
```
18 changes: 18 additions & 0 deletions sample-cnfs/sample_envoy_slow_startup/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
appVersion: 1.11.2
description: Envoy is an open source edge and service proxy, designed for cloud-native
applications.
home: https://www.envoyproxy.io/
icon: https://avatars0.githubusercontent.com/u/30125649
keywords:
- envoy
- proxy
maintainers:
- email: [email protected]
name: josdotso
- email: [email protected]
name: mumoshu
name: envoy
sources:
- https://github.com/envoyproxy/envoy
version: 1.9.0
Empty file.
32 changes: 32 additions & 0 deletions sample-cnfs/sample_envoy_slow_startup/chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "envoy.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "envoy.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "envoy.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "envoy.fullname" . }}
labels:
app: {{ template "envoy.name" . }}
chart: {{ template "envoy.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
{{- range $key, $value := .Values.files }}
{{ $key }}: |-
{{ $value | default "" | indent 4 }}
{{- end -}}
{{- range $key, $value := .Values.templates }}
{{ $key }}: |-
{{ $valueWithDefault := default "" $value -}}
{{ tpl $valueWithDefault $ | indent 4 }}
{{- end -}}
117 changes: 117 additions & 0 deletions sample-cnfs/sample_envoy_slow_startup/chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "envoy.fullname" . }}
labels:
app: {{ template "envoy.name" . }}
chart: {{ template "envoy.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "envoy.name" . }}
release: {{ .Release.Name }}
strategy:
{{ .Values.strategy | nindent 4 }}
template:
metadata:
labels:
app: {{ template "envoy.name" . }}
release: {{ .Release.Name }}
component: controller
{{- if .Values.podLabels }}
## Custom pod labels
{{- range $key, $value := .Values.podLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
annotations:
checksum/config: {{ include (print .Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- if .Values.podAnnotations }}
## Custom pod annotations
{{- range $key, $value := .Values.podAnnotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
securityContext:
{{ toYaml .Values.securityContext | nindent 8 }}
{{- if .Values.priorityClassName }}
priorityClassName: "{{ .Values.priorityClassName }}"
{{- end }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- if .Values.initContainersTemplate }}
initContainers:
{{ tpl .Values.initContainersTemplate $ | nindent 8 }}
{{- end }}
containers:

- name: envoy
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["/bin/bash","-c"]
args:
- sleep 31 && /usr/local/bin/envoy -c /config/envoy.yaml
ports:
{{- with .Values.ports }}
{{- range $key, $port := . }}
- name: {{ $key }}
{{ toYaml $port | nindent 14 }}
{{- end }}
{{- end }}

livenessProbe:
{{ toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{ toYaml .Values.readinessProbe | nindent 12 }}
env:
{{- range $key, $value := .Values.env }}
- name: {{ $key | upper | replace "." "_" }}
value: {{ $value | quote }}
{{- end }}
resources:
{{ toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: config
mountPath: /config
{{- if .Values.volumeMounts }}
{{ toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- range $key, $value := .Values.secretMounts }}
- name: {{ $key }}
mountPath: {{ $value.mountPath }}
{{- end }}
lifecycle:
{{ toYaml .Values.lifecyle | nindent 12 }}

{{- if .Values.sidecarContainersTemplate }}
{{ tpl .Values.sidecarContainersTemplate $ | nindent 8 }}
{{- end }}

{{- with .Values.nodeSelector }}
nodeSelector:
{{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{ toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ template "envoy.fullname" . }}
{{- if .Values.volumes }}
{{ toYaml .Values.volumes | nindent 8 }}
{{- end }}
{{- range $key, $value := .Values.secretMounts }}
- name: {{ $key }}
secret:
secretName: {{ $value.secretName }}
defaultMode: {{ $value.defaultMode }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: {{ template "envoy.fullname" . }}
labels:
app: {{ template "envoy.name" . }}
chart: {{ template "envoy.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
selector:
matchLabels:
app: {{ template "envoy.name" . }}
release: {{ .Release.Name }}
{{ .Values.podDisruptionBudget | indent 2 }}
28 changes: 28 additions & 0 deletions sample-cnfs/sample_envoy_slow_startup/chart/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.service.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.service.name }}
labels:
app: {{ template "envoy.name" . }}
chart: {{ template "envoy.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
{{- with .Values.service.annotations }}
{{ toYaml . | indent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type }}
{{- if ne .Values.service.loadBalancerIP "" }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
ports:
{{- range $key, $value := .Values.service.ports }}
- name: {{ $key }}
{{ toYaml $value | indent 6 }}
{{- end }}
selector:
app: {{ template "envoy.name" . }}
release: {{ .Release.Name }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{- if and ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) ( .Values.serviceMonitor.enabled ) }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app: {{ template "envoy.name" . }}
chart: {{ template "envoy.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- if .Values.serviceMonitor.additionalLabels }}
{{ toYaml .Values.serviceMonitor.additionalLabels | indent 4}}
{{- end }}
name: {{ template "envoy.fullname" . }}
{{- if .Values.serviceMonitor.namespace }}
namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }}
spec:
endpoints:
- targetPort: {{ .Values.ports.admin.containerPort }}
interval: {{ .Values.serviceMonitor.interval }}
path: "/stats/prometheus"
jobLabel: {{ template "envoy.fullname" . }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
app: {{ template "envoy.name" . }}
release: {{ .Release.Name }}
{{- with .Values.serviceMonitor.targetLabels }}
targetLabels:
{{ toYaml . | trim | indent 4 -}}
{{- end }}
{{- with .Values.serviceMonitor.podTargetLabels }}
podTargetLabels:
{{ toYaml . | trim | indent 4 -}}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "envoy.fullname" . }}-xds
labels:
app: {{ template "envoy.name" . }}
chart: {{ template "envoy.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
{{- range $filename, $content := .Values.xds }}
{{ tpl $filename $ }}: |-
{{ $valueWithDefault := default "" $content -}}
{{ tpl $valueWithDefault $ | indent 4 }}
{{- end -}}
Loading

0 comments on commit 73692a6

Please sign in to comment.