Skip to content

Commit 60a69e3

Browse files
committed
refactor(kustomize): consolidate deployment manifests
This change introduces a single source of truth to make deployments simpler. Existing `maas-api/deploy` manifests are promoted to top-level `deployment` folder, reducing duplication and improving the structure. Installation script for OpenShift has been adjusted: - Fixed OCP version check - using cluster info instead as it's more reliable - Add helpers to wait for CRDs/pods and a version comparator; - Auto-detect and patch AuthPolicy audience; apply gateway policies in sequence after infra becomes ready. - Detect existing ODH/RHOAI KServe; deploy components only when missing, then proceed with retries. Signed-off-by: Bartosz Majsak <bartosz.majsak@gmail.com>
1 parent a609675 commit 60a69e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+235
-1068
lines changed

deployment/README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,13 @@ AUD="$(kubectl create token default --duration=10m \
191191

192192
echo "Patching AuthPolicy with audience: $AUD"
193193

194-
# Note: Auth policy path may vary depending on your deployment
195-
# For consolidated deployment structure:
196-
197-
# Patch MaaS API AuthPolicy
198-
kubectl patch --local -f ${PROJECT_DIR}/deployment/base/policies/maas-auth-policy.yaml \
194+
kubectl patch authpolicy maas-api-auth-policy -n maas-api \
199195
--type='json' \
200196
-p "$(jq -nc --arg aud "$AUD" '[{
201197
op:"replace",
202198
path:"/spec/rules/authentication/openshift-identities/kubernetesTokenReview/audiences/0",
203199
value:$aud
204-
}]')" \
205-
-o yaml | kubectl apply -f -
200+
}]')"
206201

207202
```
208203
## Testing the Deployment

deployment/base/maas-api/clusterrole.yaml

Lines changed: 0 additions & 35 deletions
This file was deleted.

deployment/base/maas-api/clusterrolebinding.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,36 @@
1-
---
21
apiVersion: apps/v1
32
kind: Deployment
43
metadata:
54
name: maas-api
6-
namespace: maas-api
7-
labels:
8-
app: maas-api
9-
version: v2
105
spec:
116
replicas: 1
12-
selector:
13-
matchLabels:
14-
app: maas-api
157
template:
16-
metadata:
17-
labels:
18-
app: maas-api
19-
version: v2
20-
annotations:
21-
sidecar.istio.io/inject: "false"
228
spec:
239
serviceAccountName: maas-api
2410
securityContext:
2511
runAsNonRoot: true
2612
containers:
2713
- name: maas-api
28-
image: quay.io/opendatahub/maas-api:latest
14+
image: maas-api
2915
imagePullPolicy: Always
3016
ports:
3117
- containerPort: 8080
3218
name: http
3319
protocol: TCP
3420
env:
35-
- name: PROVIDER
36-
value: "sa-tokens"
3721
- name: NAMESPACE
3822
valueFrom:
3923
fieldRef:
4024
fieldPath: metadata.namespace
41-
- name: KEY_NAMESPACE
42-
value: llm
43-
- name: SECRET_SELECTOR_LABEL
44-
value: kuadrant.io/apikeys-by
45-
- name: SECRET_SELECTOR_VALUE
46-
value: rhcl-keys
47-
- name: PORT
48-
value: "8080"
49-
- name: CREATE_DEFAULT_TEAM
50-
value: "true"
51-
- name: TOKEN_RATE_LIMIT_POLICY_NAME
52-
value: "gateway-token-rate-limits"
53-
- name: AUTH_POLICY_NAME
54-
value: "gateway-auth-policy"
55-
- name: GIN_MODE
56-
value: "debug"
25+
- name: PROVIDER
26+
value: sa-tokens
27+
resources:
28+
requests:
29+
memory: "64Mi"
30+
cpu: "50m"
31+
limits:
32+
memory: "128Mi"
33+
cpu: "200m"
5734
livenessProbe:
5835
httpGet:
5936
path: /health
@@ -70,17 +47,11 @@ spec:
7047
periodSeconds: 5
7148
timeoutSeconds: 3
7249
failureThreshold: 3
73-
resources:
74-
requests:
75-
memory: "64Mi"
76-
cpu: "250m"
77-
limits:
78-
memory: "128Mi"
79-
cpu: "500m"
8050
securityContext:
8151
allowPrivilegeEscalation: false
8252
capabilities:
8353
drop:
8454
- ALL
8555
readOnlyRootFilesystem: true
8656
runAsNonRoot: true
57+
terminationGracePeriodSeconds: 30

deployment/base/maas-api/kustomization.yaml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,19 @@ resources:
77
- namespace.yaml
88
- deployment.yaml
99
- service.yaml
10-
- httproute.yaml
11-
- maas-auth-policy.yaml
12-
- tier-mapping-configmap.yaml
13-
- clusterrolebinding.yaml
14-
- clusterrole.yaml
15-
- serviceaccount.yaml
10+
- rbac
11+
- networking
12+
- policies
13+
- resources
14+
15+
labels:
16+
- includeSelectors: true
17+
pairs:
18+
app.kubernetes.io/part-of: model-as-a-service
19+
app.kubernetes.io/component: api
20+
app.kubernetes.io/name: maas-api
21+
22+
images:
23+
- name: maas-api
24+
newName: quay.io/opendatahub/maas-api
25+
newTag: latest

deployment/base/maas-api/maas-auth-policy.yaml

Lines changed: 0 additions & 19 deletions
This file was deleted.
File renamed without changes.

maas-api/deploy/overlays/dev/infra/networking/kustomization.yaml renamed to deployment/base/maas-api/networking/kustomization.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ metadata:
55
name: maas-api-gw-api-routing-infra
66

77
resources:
8-
- gateway.yaml
98
- httproute.yaml
File renamed without changes.

maas-api/deploy/policies/maas-api/kustomization.yaml renamed to deployment/base/maas-api/policies/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ kind: Kustomization
44
metadata:
55
name: maas-api-policies
66

7+
# This requires Kuadrant/Red Hat Connectivity Link to be installed
78
resources:
89
- auth-policy.yaml

0 commit comments

Comments
 (0)