Skip to content

Commit f90f278

Browse files
committed
Implement podman rootless and rootful for Linux and MacOS
1 parent cceda83 commit f90f278

File tree

4 files changed

+546
-111
lines changed

4 files changed

+546
-111
lines changed

.github/workflows/pr-kind.yml

Lines changed: 305 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,305 @@
1+
---
2+
name: PR Kind Test
3+
on:
4+
push:
5+
workflow_dispatch:
6+
pull_request:
7+
8+
env:
9+
MACOS_TOOLS: kind kubectl helm
10+
11+
jobs:
12+
# check-if-kind-changed:
13+
# name: Check if kind is changed.
14+
# runs-on: ubuntu-latest
15+
# outputs:
16+
# kind_grep_result: ${{ steps.pr_contains_kind.outputs.grep_result }}
17+
# output2: ${{ steps.step2.outputs.test }}
18+
# steps:
19+
# - name: Checkout code
20+
# uses: actions/checkout@v4
21+
# - name: Get changed files
22+
# id: changed-files
23+
# uses: tj-actions/changed-files@v44
24+
# - name: List all changed files
25+
# env:
26+
# ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
27+
# run: |
28+
# for file in ${ALL_CHANGED_FILES}; do
29+
# echo "$file was changed"
30+
# done
31+
# - name: Check if the changes contain and file from kind
32+
# id: pr_contains_kind
33+
# env:
34+
# ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
35+
# continue-on-error: true
36+
# run: |
37+
# set +e
38+
# echo ${ALL_CHANGED_FILES} | grep -c '/kind/'
39+
# echo "grep_result=$(echo ${ALL_CHANGED_FILES} | grep -c '/kind/')" >> $GITHUB_OUTPUT
40+
41+
42+
kind-test-docker-linux:
43+
name: Deploy Docker Linux
44+
runs-on: ${{ matrix.os }}
45+
# if: needs.scheck-if-kind-changed.outputs.kind_grep_result > 0
46+
# needs: check-if-kind-changed
47+
env:
48+
IngressHTTPPort: 80
49+
strategy:
50+
matrix:
51+
kind_version: [v0.22.0]
52+
os: [ubuntu-latest]
53+
steps:
54+
- name: Checkout project
55+
uses: actions/checkout@v3
56+
- name: Deploy kind
57+
run: |
58+
curl -Lo ./kind/kind https://kind.sigs.k8s.io/dl/${{ matrix.kind_version }}/kind-linux-amd64
59+
chmod 755 kind
60+
./kind/registry.sh install --registry-name kind-registry.local --verbosity 5
61+
./kind/kind.sh install --registry-name kind-registry.local --verbosity 5
62+
- name: Wait before checking if ingress available
63+
uses: GuillaumeFalourd/wait-sleep-action@v1
64+
with:
65+
time: '30'
66+
# - name: Wait for ingress to be available
67+
# uses: iFaxity/wait-on-action@v1
68+
# with:
69+
# resource: http://localhost:$IngressHTTPPort
70+
# timeout: 300000
71+
- name: Check that ingress is available
72+
run: |
73+
set +e
74+
CURL_EXIT_CODE=$(curl -o /dev/null -s -w "%{exitcode}\n" http://localhost:$IngressHTTPPort)
75+
if [ ! "${CURL_EXIT_CODE}" == '0' ]; then
76+
echo "Exit code should have been 0 but it was ${CURL_EXIT_CODE}."
77+
curl -o /dev/null -s -w "%{http_code}\n" http://localhost:$IngressHTTPPort
78+
curl -o /dev/null -s -w "%{exitcode}\n" http://localhost:$IngressHTTPPort
79+
exit 1
80+
fi
81+
82+
kind-test-docker-macos:
83+
name: Deploy Docker MacOS
84+
runs-on: ${{ matrix.os }}
85+
env:
86+
IngressHTTPPort: 80
87+
strategy:
88+
matrix:
89+
kind_version: [v0.22.0]
90+
os: [macos-13]
91+
steps:
92+
- name: Checkout project
93+
uses: actions/checkout@v3
94+
# - name: Setup Docker
95+
# run: |
96+
# brew install docker-machine
97+
# brew install --cask virtualbox
98+
# # brew install --cask docker
99+
# docker-machine create --driver virtualbox default
100+
- name: Set up Docker
101+
uses: crazy-max/ghaction-setup-docker@v3
102+
env:
103+
LIMA_START_ARGS: --cpus 4 --memory 8
104+
- name: Setup tools
105+
run: |
106+
brew install $MACOS_TOOLS
107+
# brew install kind
108+
# brew install kubectl
109+
# brew install helm
110+
- name: Deploy kind
111+
run: |
112+
curl -Lo ./kind/kind https://kind.sigs.k8s.io/dl/${{ matrix.kind_version }}/kind-linux-amd64
113+
chmod 755 kind
114+
./kind/registry.sh install --registry-name kind-registry.local --verbosity 5
115+
./kind/kind.sh install --registry-name kind-registry.local --verbosity 5
116+
- name: Wait before checking if ingress available
117+
uses: GuillaumeFalourd/wait-sleep-action@v1
118+
with:
119+
time: '60'
120+
# - name: Wait for ingress to be available
121+
# uses: iFaxity/wait-on-action@v1
122+
# with:
123+
# resource: http://localhost:$IngressHTTPPort
124+
# timeout: 60000
125+
- name: Check that ingress is available
126+
run: |
127+
set +e
128+
CURL_EXIT_CODE=$(curl -o /dev/null -s -w "%{exitcode}\n" http://localhost:$IngressHTTPPort)
129+
if [ ! "${CURL_EXIT_CODE}" == '0' ]; then
130+
echo "Exit code should have been 0 but it was ${CURL_EXIT_CODE}."
131+
curl -o /dev/null -s -w "%{http_code}\n" http://localhost:$IngressHTTPPort
132+
curl -o /dev/null -s -w "%{exitcode}\n" http://localhost:$IngressHTTPPort
133+
exit 1
134+
fi
135+
136+
# Rootless Podman doesn't work on Linux due to:
137+
# warning: "Error validating CNI config file /home/runner/.config/cni/net.d/kind.conflist:
138+
# [plugin bridge does not support config version \"1.0.0\" plugin portmap does not support config version \"1.0.0\" plugin firewall does not support config version \"1.0.0\" plugin tuning does not support config version \"1.0.0\"]"
139+
kind-test-podman-rootless-linux:
140+
name: Deploy Podman Rootless Linux
141+
if: false
142+
runs-on: ${{ matrix.os }}
143+
env:
144+
IngressHTTPPort: 30080
145+
IngressHTTPSPort: 30443
146+
strategy:
147+
matrix:
148+
kind_version: [v0.22.0]
149+
os: [ubuntu-latest]
150+
steps:
151+
- name: Setup Podman
152+
run: |
153+
sudo apt update
154+
sudo apt-get -y install podman
155+
- name: Checkout project
156+
uses: actions/checkout@v3
157+
- name: Deploy kind
158+
run: |
159+
curl -Lo ./kind/kind https://kind.sigs.k8s.io/dl/${{ matrix.kind_version }}/kind-linux-amd64
160+
chmod 755 kind
161+
./kind/registry.sh install --registry-name kind-registry.local --provider podman --rootless --verbosity 5
162+
./kind/kind.sh install --registry-name kind-registry.local --provider podman --rootless --kubeconfig-tgt ./kube_config --kubeconfig-gen --verbosity 5
163+
- name: Wait before checking if ingress available
164+
uses: GuillaumeFalourd/wait-sleep-action@v1
165+
with:
166+
time: '60'
167+
- name: Check that ingress is available
168+
run: |
169+
set +e
170+
CURL_EXIT_CODE=$(curl --insecure -o /dev/null -s -w "%{exitcode}\n" https://localhost:$IngressHTTPSPort)
171+
if [ ! "${CURL_EXIT_CODE}" == '0' ]; then
172+
echo "Exit code should have been 0 but it was ${CURL_EXIT_CODE}."
173+
curl -o /dev/null -s -w "%{http_code}\n" http://localhost:$IngressHTTPPort
174+
curl -o /dev/null -s -w "%{exitcode}\n" http://localhost:$IngressHTTPPort
175+
exit 1
176+
fi
177+
178+
# Disabling this workflow for now as GitHub action freezes in the middle of the process.
179+
kind-test-podman-rootless-macos:
180+
name: Deploy Podman Rootless MacOS
181+
if: false
182+
runs-on: ${{ matrix.os }}
183+
env:
184+
IngressHTTPPort: 30080
185+
IngressHTTPSPort: 30443
186+
strategy:
187+
matrix:
188+
kind_version: [v0.22.0]
189+
os: [macos-13]
190+
steps:
191+
- name: Checkout project
192+
uses: actions/checkout@v3
193+
- name: Setup podman
194+
run: |
195+
brew install podman
196+
podman machine init
197+
podman machine set --rootful=false
198+
podman machine start
199+
podman info
200+
- name: Setup tools
201+
run: |
202+
brew install $MACOS_TOOLS
203+
- name: Deploy kind
204+
run: |
205+
curl -Lo ./kind/kind https://kind.sigs.k8s.io/dl/${{ matrix.kind_version }}/kind-linux-amd64
206+
chmod 755 kind
207+
./kind/registry.sh install --registry-name kind-registry.local --provider podman --rootless
208+
./kind/kind.sh install --registry-name kind-registry.local --provider podman --rootless --kubeconfig-tgt ./kube_config --kubeconfig-gen
209+
- name: Wait before checking if ingress available
210+
uses: GuillaumeFalourd/wait-sleep-action@v1
211+
with:
212+
time: '30'
213+
- name: Check that ingress is available
214+
run: |
215+
set +e
216+
CURL_EXIT_CODE=$(curl -o /dev/null -s -w "%{exitcode}\n" http://localhost:$IngressHTTPPort)
217+
if [ ! "${CURL_EXIT_CODE}" == '0' ]; then
218+
echo "Exit code should have been 0 but it was ${CURL_EXIT_CODE}."
219+
curl -o /dev/null -s -w "%{http_code}\n" http://localhost:$IngressHTTPPort
220+
curl -o /dev/null -s -w "%{exitcode}\n" http://localhost:$IngressHTTPPort
221+
exit 1
222+
fi
223+
224+
kind-test-podman-rootful-linux:
225+
name: Deploy Podman Rootful Linux
226+
runs-on: ${{ matrix.os }}
227+
env:
228+
IngressHTTPPort: 80
229+
strategy:
230+
matrix:
231+
kind_version: [v0.22.0]
232+
os: [ubuntu-latest]
233+
steps:
234+
- name: Setup Podman
235+
run: |
236+
sudo apt update
237+
sudo apt-get -y install podman
238+
- name: Checkout project
239+
uses: actions/checkout@v3
240+
- name: Deploy kind
241+
run: |
242+
curl -Lo ./kind/kind https://kind.sigs.k8s.io/dl/${{ matrix.kind_version }}/kind-linux-amd64
243+
chmod 755 kind
244+
./kind/registry.sh install --registry-name kind-registry.local --provider podman --verbosity 5
245+
./kind/kind.sh install --registry-name kind-registry.local --provider podman --kubeconfig-tgt ./kube_config --kubeconfig-gen --verbosity 5
246+
- name: Wait before checking if ingress available
247+
uses: GuillaumeFalourd/wait-sleep-action@v1
248+
with:
249+
time: '30'
250+
- name: Check that ingress is available
251+
run: |
252+
set +e
253+
CURL_EXIT_CODE=$(curl -o /dev/null -s -w "%{exitcode}\n" http://localhost:$IngressHTTPPort)
254+
if [ ! "${CURL_EXIT_CODE}" == '0' ]; then
255+
echo "Exit code should have been 0 but it was ${CURL_EXIT_CODE}."
256+
curl -o /dev/null -s -w "%{http_code}\n" http://localhost:$IngressHTTPPort
257+
curl -o /dev/null -s -w "%{exitcode}\n" http://localhost:$IngressHTTPPort
258+
exit 1
259+
fi
260+
261+
# Disabling this workflow for now as GitHub action freezes in the middle of the process.
262+
kind-test-podman-rootful-macos:
263+
name: Deploy Podman Rootful MacOS
264+
if: false
265+
runs-on: ${{ matrix.os }}
266+
env:
267+
IngressHTTPPort: 80
268+
strategy:
269+
matrix:
270+
kind_version: [v0.22.0]
271+
os: [macos-13]
272+
steps:
273+
- name: Checkout project
274+
uses: actions/checkout@v3
275+
- name: Setup podman
276+
run: |
277+
brew install podman
278+
podman machine init
279+
podman machine set --rootful=true
280+
podman machine start
281+
podman info
282+
- name: Setup tools
283+
run: |
284+
brew install $MACOS_TOOLS
285+
- name: Deploy kind
286+
run: |
287+
curl -Lo ./kind/kind https://kind.sigs.k8s.io/dl/${{ matrix.kind_version }}/kind-linux-amd64
288+
chmod 755 kind
289+
./kind/registry.sh install --registry-name kind-registry.local --provider podman
290+
./kind/kind.sh install --registry-name kind-registry.local --provider podman --kubeconfig-tgt ./kube_config --kubeconfig-gen
291+
- name: Wait before checking if ingress available
292+
uses: GuillaumeFalourd/wait-sleep-action@v1
293+
with:
294+
time: '30'
295+
- name: Check that ingress is available
296+
run: |
297+
set +e
298+
CURL_EXIT_CODE=$(curl -o /dev/null -s -w "%{exitcode}\n" http://localhost:$IngressHTTPPort)
299+
if [ ! "${CURL_EXIT_CODE}" == '0' ]; then
300+
echo "Exit code should have been 0 but it was ${CURL_EXIT_CODE}."
301+
curl -o /dev/null -s -w "%{http_code}\n" http://localhost:$IngressHTTPPort
302+
curl -o /dev/null -s -w "%{exitcode}\n" http://localhost:$IngressHTTPPort
303+
exit 1
304+
fi
305+
...

.github/workflows/pr.yml

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: Pull Request Test
2+
name: PR generic test
33
on:
44
push:
55
workflow_dispatch:
@@ -37,20 +37,4 @@ jobs:
3737
# - name: Run role tests
3838
# run: |
3939
# molecule test --scenario-name github
40-
41-
kind-test:
42-
name: Test Kind Deployment
43-
runs-on: ubuntu-latest
44-
strategy:
45-
matrix:
46-
kind_version: [v0.20.0]
47-
steps:
48-
- name: Checkout project
49-
uses: actions/checkout@v3
50-
- name: Deploy kind
51-
run: |
52-
curl -Lo ./kind/kind https://kind.sigs.k8s.io/dl/${{ matrix.kind_version }}/kind-linux-amd64
53-
chmod 755 kind
54-
./kind/registry.sh install --registry-name kind-registry.local
55-
./kind/kind.sh install --registry-name kind-registry.local
5640
...

0 commit comments

Comments
 (0)