Skip to content

Commit 69f92d8

Browse files
authored
Merge pull request #555 from liangyuanpeng/fix_ghaction_e2e
Fix github action e2e test.
2 parents 11811bb + 68449bc commit 69f92d8

File tree

2 files changed

+95
-77
lines changed

2 files changed

+95
-77
lines changed

.github/workflows/e2e.yaml

Lines changed: 88 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
# kubectl
8181
curl -L https://dl.k8s.io/${{ env.K8S_VERSION }}/bin/linux/amd64/kubectl -o ${TMP_DIR}/kubectl
8282
# kind
83-
curl -Lo ${TMP_DIR}/kind https://kind.sigs.k8s.io/dl/v0.17.0/kind-linux-amd64
83+
curl -Lo ${TMP_DIR}/kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64
8484
# Install
8585
sudo cp ${TMP_DIR}/ginkgo /usr/local/bin/ginkgo
8686
sudo cp ${TMP_DIR}/e2e.test /usr/local/bin/e2e.test
@@ -103,6 +103,12 @@ jobs:
103103
ipFamily: ${IP_FAMILY}
104104
nodes:
105105
- role: control-plane
106+
kubeadmConfigPatchesJSON6902:
107+
- kind: ClusterConfiguration
108+
patch: |
109+
- op: add
110+
path: /apiServer/certSANs/-
111+
value: konnectivity-server.kube-system.svc.cluster.local
106112
kubeadmConfigPatches:
107113
- |
108114
kind: ClusterConfiguration
@@ -121,7 +127,10 @@ jobs:
121127
extraMounts:
122128
- hostPath: ./examples/kind/egress_selector_configuration.yaml
123129
containerPath: /etc/kubernetes/konnectivity-server-config/egress_selector_configuration.yaml
130+
- role: worker
131+
- role: worker
124132
EOF
133+
125134
# dump the kubeconfig for later
126135
/usr/local/bin/kind get kubeconfig --name ${{ env.KIND_CLUSTER_NAME}} > _artifacts/kubeconfig.conf
127136
@@ -143,79 +152,81 @@ jobs:
143152
kubectl apply -f examples/kind/konnectivity-server.yaml
144153
kubectl apply -f examples/kind/konnectivity-agent-ds.yaml
145154
146-
# - name: Get Cluster status
147-
# run: |
148-
# # wait network is ready
149-
# sleep 5
150-
# /usr/local/bin/kubectl get nodes -o wide
151-
# /usr/local/bin/kubectl get pods -A
152-
# /usr/local/bin/kubectl wait --timeout=1m --for=condition=ready pods --namespace=kube-system -l k8s-app=konnectivity-agent
153-
# /usr/local/bin/kubectl wait --timeout=1m --for=condition=ready pods --namespace=kube-system -l k8s-app=konnectivity-server
154-
# # smoke test
155-
# /usr/local/bin/kubectl run test --image httpd:2
156-
# /usr/local/bin/kubectl wait --timeout=1m --for=condition=ready pods test
157-
# /usr/local/bin/kubectl logs test
158-
159-
# - name: Workaround CoreDNS for IPv6 airgapped
160-
# if: ${{ matrix.ipFamily == 'ipv6' }}
161-
# run: |
162-
# # Patch CoreDNS to work in Github CI
163-
# # 1. Github CI doesn´t offer IPv6 connectivity, so CoreDNS should be configured
164-
# # to work in an offline environment:
165-
# # https://github.com/coredns/coredns/issues/2494#issuecomment-457215452
166-
# # 2. Github CI adds following domains to resolv.conf search field:
167-
# # .net.
168-
# # CoreDNS should handle those domains and answer with NXDOMAIN instead of SERVFAIL
169-
# # otherwise pods stops trying to resolve the domain.
170-
# # Get the current config
171-
# original_coredns=$(/usr/local/bin/kubectl get -oyaml -n=kube-system configmap/coredns)
172-
# echo "Original CoreDNS config:"
173-
# echo "${original_coredns}"
174-
# # Patch it
175-
# fixed_coredns=$(
176-
# printf '%s' "${original_coredns}" | sed \
177-
# -e 's/^.*kubernetes cluster\.local/& net/' \
178-
# -e '/^.*upstream$/d' \
179-
# -e '/^.*fallthrough.*$/d' \
180-
# -e '/^.*forward . \/etc\/resolv.conf$/d' \
181-
# -e '/^.*loop$/d' \
182-
# )
183-
# echo "Patched CoreDNS config:"
184-
# echo "${fixed_coredns}"
185-
# printf '%s' "${fixed_coredns}" | /usr/local/bin/kubectl apply -f -
186-
187-
# - name: Run tests
188-
# run: |
189-
# export KUBERNETES_CONFORMANCE_TEST='y'
190-
# export E2E_REPORT_DIR=${PWD}/_artifacts
191-
192-
# # Run tests
193-
# /usr/local/bin/ginkgo --nodes=25 \
194-
# --focus="\[Conformance\]" \
195-
# --skip="Feature|Federation|machinery|PerformanceDNS|DualStack|Disruptive|Serial|Slow|KubeProxy|LoadBalancer|GCE|Netpol|NetworkPolicy|NodeConformance" \
196-
# /usr/local/bin/e2e.test \
197-
# -- \
198-
# --kubeconfig=${PWD}/_artifacts/kubeconfig.conf \
199-
# --provider=local \
200-
# --dump-logs-on-failure=false \
201-
# --report-dir=${E2E_REPORT_DIR} \
202-
# --disable-log-dump=true
203-
204-
# - name: Upload Junit Reports
205-
# if: always()
206-
# uses: actions/upload-artifact@v2
207-
# with:
208-
# name: kind-junit-${{ env.JOB_NAME }}-${{ github.run_id }}
209-
# path: './_artifacts/*.xml'
210-
211-
# - name: Export logs
212-
# if: always()
213-
# run: |
214-
# /usr/local/bin/kind export logs --name ${KIND_CLUSTER_NAME} --loglevel=debug ./_artifacts/logs
215-
216-
# - name: Upload logs
217-
# if: always()
218-
# uses: actions/upload-artifact@v2
219-
# with:
220-
# name: kind-logs-${{ env.JOB_NAME }}-${{ github.run_id }}
221-
# path: ./_artifacts/logs
155+
- name: Get Cluster status
156+
run: |
157+
# wait network is ready
158+
sleep 5
159+
/usr/local/bin/kubectl get nodes -o wide
160+
/usr/local/bin/kubectl get pods -A
161+
/usr/local/bin/kubectl wait --timeout=1m --for=condition=ready pods --namespace=kube-system -l k8s-app=kube-dns
162+
# smoke test
163+
/usr/local/bin/kubectl run test --image httpd:2
164+
/usr/local/bin/kubectl wait --timeout=1m --for=condition=ready pods test
165+
/usr/local/bin/kubectl get pods -A -owide
166+
/usr/local/bin/kubectl wait --timeout=1m --for=condition=ready pods --namespace=kube-system -l k8s-app=konnectivity-agent
167+
/usr/local/bin/kubectl logs test
168+
169+
170+
- name: Workaround CoreDNS for IPv6 airgapped
171+
if: ${{ matrix.ipFamily == 'ipv6' }}
172+
run: |
173+
# Patch CoreDNS to work in Github CI
174+
# 1. Github CI doesn´t offer IPv6 connectivity, so CoreDNS should be configured
175+
# to work in an offline environment:
176+
# https://github.com/coredns/coredns/issues/2494#issuecomment-457215452
177+
# 2. Github CI adds following domains to resolv.conf search field:
178+
# .net.
179+
# CoreDNS should handle those domains and answer with NXDOMAIN instead of SERVFAIL
180+
# otherwise pods stops trying to resolve the domain.
181+
# Get the current config
182+
original_coredns=$(/usr/local/bin/kubectl get -oyaml -n=kube-system configmap/coredns)
183+
echo "Original CoreDNS config:"
184+
echo "${original_coredns}"
185+
# Patch it
186+
fixed_coredns=$(
187+
printf '%s' "${original_coredns}" | sed \
188+
-e 's/^.*kubernetes cluster\.local/& net/' \
189+
-e '/^.*upstream$/d' \
190+
-e '/^.*fallthrough.*$/d' \
191+
-e '/^.*forward . \/etc\/resolv.conf$/d' \
192+
-e '/^.*loop$/d' \
193+
)
194+
echo "Patched CoreDNS config:"
195+
echo "${fixed_coredns}"
196+
printf '%s' "${fixed_coredns}" | /usr/local/bin/kubectl apply -f -
197+
198+
- name: Run tests
199+
run: |
200+
export KUBERNETES_CONFORMANCE_TEST='y'
201+
export E2E_REPORT_DIR=${PWD}/_artifacts
202+
203+
# Run tests
204+
/usr/local/bin/ginkgo --nodes=25 \
205+
--focus="\[Conformance\]" \
206+
--skip="Feature|Federation|machinery|PerformanceDNS|DualStack|Disruptive|Serial|Slow|KubeProxy|LoadBalancer|GCE|Netpol|NetworkPolicy|NodeConformance" \
207+
/usr/local/bin/e2e.test \
208+
-- \
209+
--kubeconfig=${PWD}/_artifacts/kubeconfig.conf \
210+
--provider=local \
211+
--dump-logs-on-failure=false \
212+
--report-dir=${E2E_REPORT_DIR} \
213+
--disable-log-dump=true
214+
215+
- name: Upload Junit Reports
216+
if: always()
217+
uses: actions/upload-artifact@v2
218+
with:
219+
name: kind-junit-${{ env.JOB_NAME }}-${{ github.run_id }}
220+
path: './_artifacts/*.xml'
221+
222+
- name: Export logs
223+
if: always()
224+
run: |
225+
/usr/local/bin/kind export logs --name ${KIND_CLUSTER_NAME} --loglevel=debug ./_artifacts/logs
226+
227+
- name: Upload logs
228+
if: always()
229+
uses: actions/upload-artifact@v2
230+
with:
231+
name: kind-logs-${{ env.JOB_NAME }}-${{ github.run_id }}
232+
path: ./_artifacts/logs

examples/kind/konnectivity-agent-ds.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ spec:
7474
path: /healthz
7575
initialDelaySeconds: 15
7676
timeoutSeconds: 15
77+
readinessProbe:
78+
httpGet:
79+
scheme: HTTP
80+
port: 8093
81+
path: /readyz
82+
initialDelaySeconds: 15
83+
timeoutSeconds: 15
7784
volumeMounts:
7885
- mountPath: /var/run/secrets/tokens
7986
name: konnectivity-agent-token

0 commit comments

Comments
 (0)