Skip to content

Commit

Permalink
Merge pull request #120 from cncf/develop
Browse files Browse the repository at this point in the history
 Test Platform Conformance using sonobuoy #104
  • Loading branch information
denverwilliams authored Apr 2, 2020
2 parents 837ae41 + 7c4c1f4 commit 401e7dd
Show file tree
Hide file tree
Showing 84 changed files with 2,767 additions and 445 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:

# Set KUBECONFIG environment variable
- export KUBECONFIG="$(kind get kubeconfig-path)"
script: crystal spec
script: crystal spec -v
10 changes: 10 additions & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,15 @@ crystal src/cnf-conformance.cr direct_hugepages
```
crystal src/cnf-conformance.cr performance
```

## Platform Tests
#### (PoC) Run all platform tests
```
crystal src/cnf-conformance.cr platform
```
#### (PoC) Run the K8s conformance tests
```
crystal src/cnf-conformance.cr k8s_conformance
```

Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "coredns.fullname" . }}
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
{{- if .Values.isClusterService }}
k8s-app: {{ .Chart.Name | quote }}
kubernetes.io/cluster-service: "true"
kubernetes.io/name: "CoreDNS"
{{- end }}
app.kubernetes.io/name: {{ template "coredns.name" . }}
{{- if .Values.customLabels }}
{{ sdfskfsdf .Values.customLabels | indent 4 }}
{{- end }}
spec:
{{- if not .Values.autoscaler.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 10%
selector:
matchLabels:
app.kubernetes.io/instance: {{ .Release.Name | quote }}
{{- if .Values.isClusterService }}
k8s-app: {{ .Chart.Name | quote }}
{{- end }}
app.kubernetes.io/name: {{ template "coredns.name" . }}
template:
metadata:
labels:
{{- if .Values.isClusterService }}
k8s-app: {{ .Chart.Name | quote }}
{{- end }}
app.kubernetes.io/name: {{ template "coredns.name" . }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
{{- if .Values.customLabels }}
{{ sdfskfsdf .Values.customLabels | indent 8 }}
{{- end }}
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- if .Values.isClusterService }}
scheduler.alpha.kubernetes.io/critical-pod: ''
scheduler.alpha.kubernetes.io/tolerations: '[{"key":"CriticalAddonsOnly", "operator":"Exists"}]'
{{- end }}
spec:
serviceAccountName: {{ template "coredns.serviceAccountName" . }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName | quote }}
{{- end }}
{{- if .Values.isClusterService }}
dnsPolicy: Default
{{- end }}
{{- if .Values.affinity }}
affinity:
{{ sdfskfsdf .Values.affinity | indent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ sdfskfsdf .Values.tolerations | indent 8 }}
{{- end }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ sdfskfsdf .Values.nodeSelector | indent 8 }}
{{- end }}
containers:
- name: "coredns"
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
securityContext:
privileged: true
imagePullPolicy: {{ .Values.image.pullPolicy }}
args: [ "-conf", "/etc/coredns/Corefile" ]
volumeMounts:
- name: config-volume
mountPath: /etc/coredns
{{- range .Values.extraSecrets }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
readOnly: true
{{- end }}
resources:
{{ sdfskfsdf .Values.resources | indent 10 }}
ports:
{{ include "coredns.containerPorts" . | indent 8 }}
livenessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 60
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 5
readinessProbe:
httpGet:
path: /ready
port: 8181
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 5
volumes:
- name: config-volume
configMap:
name: {{ template "coredns.fullname" . }}
items:
- key: Corefile
path: Corefile
{{ range .Values.zoneFiles }}
- key: {{ .filename }}
path: {{ .filename }}
{{ end }}
{{- range .Values.extraSecrets }}
- name: {{ .name }}
secret:
secretName: {{ .name }}
defaultMode: 400
{{- end }}
6 changes: 4 additions & 2 deletions sample-cnfs/sample-bad_helm_coredns-cnf/cnf-conformance.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
helm_directory: cnfs/bad_helm_coredns/helm_chart/coredns
install_script: cnfs/bad_helm_coredns/Makefile
helm_directory: chart
git_clone_url:
install_script:
release_name: bad-helm-coredns-coredns
deployment_name: bad-helm-coredns-coredns
application_deployment_names: [bad-helm-coredns]
helm_chart: stable/coredns
Expand Down
11 changes: 11 additions & 0 deletions sample-cnfs/sample-coredns-cnf-source/cnf-conformance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
helm_directory: cnfs/coredns/helm_chart/coredns
# helm_directory: helm_chart
git_clone_url: https://github.com/coredns/coredns.git
install_script: coredns/Makefile
release_name: coredns
deployment_name: coredns-coredns
application_deployment_names: [coredns-coredns]
helm_chart: stable/coredns
helm_chart_container_name: coredns
white_list_helm_chart_container_names: [falco, nginx, coredns, calico-node, kube-proxy, nginx-proxy]
5 changes: 3 additions & 2 deletions sample-cnfs/sample-coredns-cnf/cnf-conformance.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
helm_directory: cnfs/coredns/helm_chart/coredns
# helm_directory: helm_chart
git_clone_url: https://github.com/coredns/coredns.git
install_script: cnfs/coredns/Makefile
git_clone_url:
install_script: coredns/Makefile
release_name: coredns
deployment_name: coredns-coredns
application_deployment_names: [coredns-coredns]
helm_chart: stable/coredns
helm_chart_container_name: coredns
cnf_image_version: latest
white_list_helm_chart_container_names: [falco, nginx, coredns, calico-node, kube-proxy, nginx-proxy]
7 changes: 5 additions & 2 deletions sample-cnfs/sample_coredns/cnf-conformance.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
helm_directory: cnfs/sample_coredns/chart
install_script: cnfs/sample_coredns/chart
helm_directory: chart
git_clone_url:
install_script: chart
release_name: coredns
deployment_name: coredns-coredns
application_deployment_names: [coredns-coredns]
helm_chart: stable/coredns
helm_chart_container_name: coredns-coredns
cnf_image_version: latest
white_list_helm_chart_container_names: []
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,6 @@ spec:
{{ toYaml .Values.resources | indent 10 }}
ports:
{{ include "coredns.containerPorts" . | indent 8 }}
readinessProbe:
httpGet:
path: /ready
port: 8181
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 5
volumes:
- name: config-volume
configMap:
Expand Down
6 changes: 4 additions & 2 deletions sample-cnfs/sample_coredns_bad_liveness/cnf-conformance.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
helm_directory: cnfs/sample_coredns_bad_liveness/chart
install_script: cnfs/sample_coredns_bad_liveness/chart
helm_directory: chart
git_clone_url:
install_script: chart
release_name: bad-liveness
deployment_name: bad-liveness-coredns
application_deployment_names: [bad-liveness-coredns]
helm_chart: stable/coredns
Expand Down
39 changes: 39 additions & 0 deletions sample-cnfs/sample_privileged_cnf/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]
```
23 changes: 23 additions & 0 deletions sample-cnfs/sample_privileged_cnf/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v1
appVersion: 1.6.7
description: CoreDNS is a DNS server that chains plugins and provides Kubernetes DNS
Services
home: https://coredns.io
icon: https://coredns.io/images/CoreDNS_Colour_Horizontal.png
keywords:
- coredns
- dns
- kubedns
maintainers:
- email: [email protected]
name: Acaleph
- email: [email protected]
name: shashidharatd
- email: [email protected]
name: andor44
- email: [email protected]
name: mrueg
name: coredns
sources:
- https://github.com/coredns/coredns
version: 1.9.3
Loading

0 comments on commit 401e7dd

Please sign in to comment.