Skip to content

Commit e671bbe

Browse files
committed
fix(actions): ensure kserve namespace exists for manifest test
Signed-off-by: alokdangre <alokdangre@gmail.com>
1 parent 4e42bf1 commit e671bbe

12 files changed

Lines changed: 738 additions & 168 deletions

File tree

‎.github/workflows/linting_bash_python_yaml_files.yaml‎

Lines changed: 130 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -10,141 +10,141 @@ jobs:
1010
format_python_files:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v5
14-
15-
- name: Python Files Formatting Guidelines
16-
run: |
17-
echo "### Python Files Formatting Guidelines ###
18-
If there is a formatting error in your python files,
19-
1. First install black
20-
It requires Python 3.8+ to run.
21-
Install with 'pip install black' and if you use pipx, install Black with 'pipx install black'.
22-
If you want to format Jupyter Notebooks, install with 'pip install black[jupyter]'.
23-
24-
2. Run the command
25-
'python -m black {source_file_or_directory}' or
26-
'black {source_file_or_directory}'
27-
to format python files.
28-
"
29-
- uses: psf/black@stable
30-
with:
31-
src: |
32-
./backend
13+
- uses: actions/checkout@v5
14+
15+
- name: Python Files Formatting Guidelines
16+
run: |
17+
echo "### Python Files Formatting Guidelines ###
18+
If there is a formatting error in your python files,
19+
1. First install black
20+
It requires Python 3.8+ to run.
21+
Install with 'pip install black' and if you use pipx, install Black with 'pipx install black'.
22+
If you want to format Jupyter Notebooks, install with 'pip install black[jupyter]'.
23+
24+
2. Run the command
25+
'python -m black {source_file_or_directory}' or
26+
'black {source_file_or_directory}'
27+
to format python files.
28+
"
29+
- uses: psf/black@stable
30+
with:
31+
src: |
32+
./backend
3333
3434
format_YAML_files:
3535
runs-on: ubuntu-latest
3636
steps:
37-
- uses: actions/checkout@v4
38-
with:
39-
fetch-depth: 0
40-
41-
- name: Install yamllint
42-
run: pip install yamllint
43-
44-
- name: YAML Formatting Guidelines
45-
run: |
46-
echo "### YAML Formatting Guidelines ###
47-
If there is a formatting error in your YAML file, you will see errors like the one below:
48-
'Error: 6:4 [indentation] wrong indentation: expected 2 but found 3'
49-
50-
6:4 means line 6, column 4.
51-
52-
To fix these errors, refer to the YAML formatting rules at:
53-
https://yamllint.readthedocs.io/en/stable/rules.html#
54-
55-
Search for the keyword inside the brackets [] in the error message. In this example, it's 'indentation'.
56-
Note: Some rules have been customized in the '.yamllint.yaml' file. Below is the content of that file:
57-
58-
extends: default
59-
60-
rules:
61-
document-start:
62-
present: false
63-
document-end:
64-
present: false
65-
indentation:
66-
indent-sequences: false
67-
line-length:
68-
max: 400
69-
"
70-
71-
- name: Fetch master branch
72-
run: git fetch origin master
73-
74-
- name: Set up changed files
75-
id: changed_files
76-
run: |
77-
git diff --name-only --diff-filter=AM origin/master...HEAD \
78-
| grep -v 'upstream' \
79-
| grep -E '^common/.*\.ya?ml$|^example/.*\.ya?ml$|^hack/.*\.ya?ml$|^tests/.*\.ya?ml$|^\.github/.*\.ya?ml$|^manifests/.*\.ya?ml$' \
80-
> changed_files_in_PR.txt || true
81-
if [ ! -s changed_files_in_PR.txt ]; then
82-
echo "No YAML files have changed in this PR." > changed_files_in_PR.txt
83-
fi
84-
85-
- name: Display changed files
86-
run: cat changed_files_in_PR.txt
87-
88-
- name: Run yamllint on changed files
89-
id: lint
90-
run: |
91-
if grep -q 'No YAML files have changed in this PR.' changed_files_in_PR.txt; then
92-
echo "No YAML files have changed in this PR."
93-
else
94-
cat changed_files_in_PR.txt | xargs -I {} yamllint {} || exit 1
95-
fi
96-
shell: bash
97-
98-
- name: Check YAML lint results
99-
if: success() && steps.lint.outcome == 'success'
100-
run: echo "No styling issues with YAML files."
101-
shell: bash
37+
- uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Install yamllint
42+
run: pip install yamllint
43+
44+
- name: YAML Formatting Guidelines
45+
run: |
46+
echo "### YAML Formatting Guidelines ###
47+
If there is a formatting error in your YAML file, you will see errors like the one below:
48+
'Error: 6:4 [indentation] wrong indentation: expected 2 but found 3'
49+
50+
6:4 means line 6, column 4.
51+
52+
To fix these errors, refer to the YAML formatting rules at:
53+
https://yamllint.readthedocs.io/en/stable/rules.html#
54+
55+
Search for the keyword inside the brackets [] in the error message. In this example, it's 'indentation'.
56+
Note: Some rules have been customized in the '.yamllint.yaml' file. Below is the content of that file:
57+
58+
extends: default
59+
60+
rules:
61+
document-start:
62+
present: false
63+
document-end:
64+
present: false
65+
indentation:
66+
indent-sequences: false
67+
line-length:
68+
max: 400
69+
"
70+
71+
- name: Fetch master branch
72+
run: git fetch origin master
73+
74+
- name: Set up changed files
75+
id: changed_files
76+
run: |
77+
git diff --name-only --diff-filter=AM origin/master...HEAD \
78+
| grep -v 'upstream' \
79+
| grep -E '^common/.*\.ya?ml$|^example/.*\.ya?ml$|^hack/.*\.ya?ml$|^tests/.*\.ya?ml$|^\.github/.*\.ya?ml$|^manifests/.*\.ya?ml$' \
80+
> changed_files_in_PR.txt || true
81+
if [ ! -s changed_files_in_PR.txt ]; then
82+
echo "No YAML files have changed in this PR." > changed_files_in_PR.txt
83+
fi
84+
85+
- name: Display changed files
86+
run: cat changed_files_in_PR.txt
87+
88+
- name: Run yamllint on changed files
89+
id: lint
90+
run: |
91+
if grep -q 'No YAML files have changed in this PR.' changed_files_in_PR.txt; then
92+
echo "No YAML files have changed in this PR."
93+
else
94+
cat changed_files_in_PR.txt | xargs -I {} yamllint {} || exit 1
95+
fi
96+
shell: bash
97+
98+
- name: Check YAML lint results
99+
if: success() && steps.lint.outcome == 'success'
100+
run: echo "No styling issues with YAML files."
101+
shell: bash
102102

103103
format_bash_files:
104104
runs-on: ubuntu-latest
105105
steps:
106-
- uses: actions/checkout@v4
107-
with:
108-
fetch-depth: 0
109-
110-
- name: Install ShellCheck
111-
run: sudo apt install -y shellcheck
112-
113-
- name: Bash Formatting Guidelines
114-
run: |
115-
echo "### Bash Files Formatting Guidelines ###
116-
If there are errors and warnings regarding your bash files,
117-
You can check the error code definitions at https://www.shellcheck.net/wiki/.
118-
You can correct them using the https://www.shellcheck.net/ site.
119-
You have to ignore disable errors in the .shellcheckrc file.
120-
"
121-
122-
- name: Fetch master branch
123-
run: git fetch origin master
124-
125-
- name: Set up changed files
126-
id: changed_files
127-
run: |
128-
git diff --name-only --diff-filter=AM origin/master...HEAD -- '*.sh' | grep -v '^applications/' > changed_files_in_PR.txt || true
129-
if [ ! -s changed_files_in_PR.txt ]; then
130-
echo "No bash files have changed in this PR."
131-
fi
132-
133-
- name: Display changed files
134-
if: always() # Always run this step
135-
run: cat changed_files_in_PR.txt || echo "No bash files have changed in this PR."
136-
137-
- name: Run ShellCheck on changed files
138-
id: lint
139-
run: |
140-
if grep -q 'No bash files have changed in this PR.' changed_files_in_PR.txt; then
141-
echo "No bash files have changed in this PR."
142-
else
143-
cat changed_files_in_PR.txt | xargs -I {} shellcheck {} || exit 1
144-
fi
145-
shell: bash
146-
147-
- name: Check Bash lint results
148-
if: success() && steps.lint.outcome == 'success'
149-
run: echo "No styling issues with Bash files."
150-
shell: bash
106+
- uses: actions/checkout@v4
107+
with:
108+
fetch-depth: 0
109+
110+
- name: Install ShellCheck
111+
run: sudo apt install -y shellcheck
112+
113+
- name: Bash Formatting Guidelines
114+
run: |
115+
echo "### Bash Files Formatting Guidelines ###
116+
If there are errors and warnings regarding your bash files,
117+
You can check the error code definitions at https://www.shellcheck.net/wiki/.
118+
You can correct them using the https://www.shellcheck.net/ site.
119+
You have to ignore disable errors in the .shellcheckrc file.
120+
"
121+
122+
- name: Fetch master branch
123+
run: git fetch origin master
124+
125+
- name: Set up changed files
126+
id: changed_files
127+
run: |
128+
git diff --name-only --diff-filter=AM origin/master...HEAD -- '*.sh' | grep -v '^applications/' > changed_files_in_PR.txt || true
129+
if [ ! -s changed_files_in_PR.txt ]; then
130+
echo "No bash files have changed in this PR."
131+
fi
132+
133+
- name: Display changed files
134+
if: always() # Always run this step
135+
run: cat changed_files_in_PR.txt || echo "No bash files have changed in this PR."
136+
137+
- name: Run ShellCheck on changed files
138+
id: lint
139+
run: |
140+
if grep -q 'No bash files have changed in this PR.' changed_files_in_PR.txt; then
141+
echo "No bash files have changed in this PR."
142+
else
143+
cat changed_files_in_PR.txt | xargs -I {} shellcheck {} || exit 1
144+
fi
145+
shell: bash
146+
147+
- name: Check Bash lint results
148+
if: success() && steps.lint.outcome == 'success'
149+
run: echo "No styling issues with Bash files."
150+
shell: bash

‎.github/workflows/test-manifests.yaml‎

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
test-models-web-app:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- name: Checkout models-web-app
16+
- name: Checkout Models Web Application
1717
uses: actions/checkout@v4
1818
with:
1919
path: models-web-app
@@ -33,6 +33,23 @@ jobs:
3333
working-directory: manifests
3434
run: kustomize build common/kubeflow-namespace/base | kubectl apply -f -
3535

36+
- name: Create KServe namespace
37+
run: kubectl create namespace kserve --dry-run=client -o yaml | kubectl apply -f -
38+
39+
- name: Build and dry-run apply KServe Models Web Application base manifests
40+
working-directory: models-web-app
41+
run: |
42+
kustomize build manifests/kustomize/base | kubectl apply --dry-run=server -f -
43+
44+
- name: Sync KServe Models Web Application manifests into kubeflow/manifests checkout
45+
run: |
46+
rm -rf manifests/applications/kserve/models-web-app/base
47+
rm -rf manifests/applications/kserve/models-web-app/components
48+
rm -rf manifests/applications/kserve/models-web-app/overlays
49+
cp -R models-web-app/manifests/kustomize/base manifests/applications/kserve/models-web-app/
50+
cp -R models-web-app/manifests/kustomize/components manifests/applications/kserve/models-web-app/
51+
cp -R models-web-app/manifests/kustomize/overlays manifests/applications/kserve/models-web-app/
52+
3653
- name: Install Istio CNI
3754
working-directory: manifests
3855
run: ./tests/istio-cni_install.sh
@@ -70,12 +87,31 @@ jobs:
7087
kubectl wait --for=condition=Available --timeout=120s deployment/cluster-local-gateway -n istio-system
7188
sleep 60
7289
73-
- name: Build and dry-run apply KServe Models Web App base manifests
74-
working-directory: models-web-app
90+
- name: Wait for KServe Models Web Application deployment
7591
run: |
76-
kustomize build manifests/kustomize/base | kubectl apply --dry-run=server -f -
92+
kubectl wait --for=condition=Ready pods --all --all-namespaces --timeout=300s --field-selector=status.phase!=Succeeded
93+
kubectl wait --for=condition=Available deployment/kserve-models-web-app -n kubeflow --timeout=60s
94+
sleep 10
7795
78-
- name: Build and apply KServe Models Web App kubeflow overlay manifests
79-
working-directory: models-web-app
96+
- name: Setup python 3.12
97+
uses: actions/setup-python@v4
98+
with:
99+
python-version: 3.12
100+
101+
- name: Port forward
102+
working-directory: manifests
103+
run: ./tests/port_forward_gateway.sh
104+
105+
- name: Run KServe tests
106+
run: bash ./models-web-app/manifests/tests/kserve_test.sh kubeflow-user-example-com
107+
108+
- name: Debug KServe Models Web Application connectivity
109+
if: failure()
80110
run: |
81-
kustomize build manifests/kustomize/overlays/kubeflow | kubectl apply -f -
111+
kubectl get deployment,service,endpoints,pods -n kubeflow -l app.kubernetes.io/component=kserve-models-web-app || true
112+
kubectl describe deployment kserve-models-web-app -n kubeflow || true
113+
kubectl logs deployment/kserve-models-web-app -n kubeflow --all-containers=true --tail=200 || true
114+
115+
- name: Apply Pod Security Standards restricted levels
116+
working-directory: manifests
117+
run: ./tests/PSS_enable.sh

‎README.md‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ spec:
100100
template:
101101
spec:
102102
containers:
103-
- name: kserve-models-web-app
104-
env:
105-
- name: ALLOWED_NAMESPACES
106-
value: "kubeflow-user,kubeflow-admin"
103+
- name: kserve-models-web-app
104+
env:
105+
- name: ALLOWED_NAMESPACES
106+
value: "kubeflow-user,kubeflow-admin"
107107
```
108108
109109
## Grafana Configuration
@@ -131,7 +131,6 @@ curl http://your-app-url/api/config
131131
```
132132

133133
Expected response:
134-
135134
```json
136135
{
137136
"grafanaPrefix": "/custom-grafana",

‎manifests/kustomize/base/deployment.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ spec:
77
replicas: 1
88
selector:
99
matchLabels:
10-
app.kubernetes.io/component: models-web-app
10+
app.kubernetes.io/component: kserve-models-web-app
1111
template:
1212
metadata:
1313
labels:
14-
app.kubernetes.io/component: models-web-app
14+
app.kubernetes.io/component: kserve-models-web-app
1515
spec:
1616
securityContext:
1717
runAsNonRoot: true

0 commit comments

Comments
 (0)