Skip to content

Commit

Permalink
chore: use j2 to render different kind.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Jul 18, 2020
1 parent 16e468f commit 5c4d5a3
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 259 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-x86-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ jobs:
- name: Init Kind
run: |
sudo make kind-init
pip install j2cli --user
pip install "j2cli[yaml]" --user
sudo PATH=~/.local/bin:$PATH make kind-init
- name: Run E2E
run: |
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,16 @@ build-bin:

kind-init:
kind delete cluster --name=kube-ovn
kind create cluster --config yamls/kind-single.yaml --name kube-ovn
ip_family=ipv4 ha=false j2 yamls/kind.yaml.j2 -o yamls/kind.yaml
kind create cluster --config yamls/kind.yaml --name kube-ovn
kind load docker-image --name kube-ovn ${REGISTRY}/kube-ovn:${RELEASE_TAG}
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-
bash dist/images/install.sh

kind-init-ha:
kind delete cluster --name=kube-ovn
kind create cluster --config yamls/kind-ha.yaml --name kube-ovn
ip_family=ipv4 ha=true j2 yamls/kind.yaml.j2 -o yamls/kind.yaml
kind create cluster --config yamls/kind.yaml --name kube-ovn
kind load docker-image --name kube-ovn ${REGISTRY}/kube-ovn:${RELEASE_TAG}
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-
bash dist/images/install.sh
Expand Down
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ make release

## How to run e2e tests

Kube-OVN uses [KIND](https://kind.sigs.k8s.io/) to setup a local Kubernetes cluster
Kube-OVN uses [KIND](https://kind.sigs.k8s.io/) to setup a local Kubernetes cluster and [j2cli](https://github.com/kolypto/j2cli) to render template
and [Ginkgo](https://onsi.github.io/ginkgo/) as the test framework to run the e2e tests.

```
Expand Down
235 changes: 0 additions & 235 deletions get_helm.sh

This file was deleted.

20 changes: 0 additions & 20 deletions yamls/kind-single.yaml

This file was deleted.

7 changes: 7 additions & 0 deletions yamls/kind-ha.yaml → yamls/kind.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
networking:
disableDefaultCNI: true
ipFamily: {{ ip_family }}

kubeadmConfigPatches:
- |
kind: ClusterConfiguration
Expand All @@ -16,7 +18,12 @@ kubeadmConfigPatches:
nodes:
- role: control-plane
image: kindest/node:v1.18.2
{%- if ha is equalto "true" %}
- role: control-plane
image: kindest/node:v1.18.2
- role: control-plane
image: kindest/node:v1.18.2
{%- else %}
- role: worker
image: kindest/node:v1.18.2
{%- endif %}

0 comments on commit 5c4d5a3

Please sign in to comment.