Skip to content

Commit

Permalink
Manifest readiness for Operator v2 (opendatahub-io#237)
Browse files Browse the repository at this point in the history
* Use config/ as the manifests source for ODH operator v2

Signed-off-by: Vedant Mahabaleshwarkar <[email protected]>

* move all changes into an overlay

Signed-off-by: Vedant Mahabaleshwarkar <[email protected]>

* restructure manifests so that kustomize does not need LoadRestrictorNone flag

Signed-off-by: Vedant Mahabaleshwarkar <[email protected]>

* correct label mismatch

Signed-off-by: Vedant Mahabaleshwarkar <[email protected]>

* final modifications

Signed-off-by: Vedant Mahabaleshwarkar <[email protected]>

* remove openvino variable as it is unused

Signed-off-by: Vedant Mahabaleshwarkar <[email protected]>

---------

Signed-off-by: Vedant Mahabaleshwarkar <[email protected]>
  • Loading branch information
VedantMahabaleshwarkar committed Oct 19, 2023
1 parent 6f02dc5 commit 749fbdb
Show file tree
Hide file tree
Showing 26 changed files with 659 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/default/config-defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ builtInServerTypes:
- triton
- mlserver
- ovms
- torchserve
- torchserve
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ spec:
- name: config-defaults
configMap:
defaultMode: 420
name: model-serving-config-defaults
name: model-serving-config-defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
$patch: delete
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clusterservingruntimes.serving.kserve.io
5 changes: 5 additions & 0 deletions config/overlays/odh/crd/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../crd/
53 changes: 53 additions & 0 deletions config/overlays/odh/default/config-defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2021 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# These are the system defaults which users can override with a user config

# OpenDataHub override : ODH config-defaults is different from upstream
podsPerRuntime: 2
headlessService: true
modelMeshImage:
name: $(odh-modelmesh)
modelMeshResources:
requests:
cpu: "300m"
memory: "448Mi"
limits:
cpu: "3"
memory: "448Mi"
restProxy:
enabled: true
port: 8008
image:
name: $(odh-mm-rest-proxy)
resources:
requests:
cpu: "50m"
memory: "96Mi"
limits:
cpu: "1"
memory: "512Mi"
storageHelperImage:
name: $(odh-modelmesh-runtime-adapter)
command: ["/opt/app/puller"]
storageHelperResources:
requests:
cpu: "50m"
memory: "96Mi"
limits:
cpu: "2"
memory: "512Mi"
serviceAccountName: "modelmesh-serving-sa"
metrics:
enabled: true
payloadProcessors: ""
21 changes: 21 additions & 0 deletions config/overlays/odh/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../crd/
- ../manager/
- ../webhook

configMapGenerator:
- files:
- ./config-defaults.yaml
name: model-serving-config-defaults

generatorOptions:
disableNameSuffixHash: true

transformers:
- metadataLabelTransformer.yaml

configurations:
- params.yaml
27 changes: 27 additions & 0 deletions config/overlays/odh/default/metadataLabelTransformer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright 2021 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
apiVersion: builtin
kind: LabelTransformer
metadata:
name: notImportantHere
labels:
app.kubernetes.io/instance: modelmesh-controller
app.kubernetes.io/managed-by: modelmesh-controller
app.kubernetes.io/name: modelmesh-controller
fieldSpecs:
- path: metadata/labels
create: true
- path: spec/template/metadata/labels
kind: Deployment
create: true
4 changes: 4 additions & 0 deletions config/overlays/odh/default/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
varReference:
- path: spec/template/spec/containers[]/image
kind: Deployment
apiVersion: apps/v1
65 changes: 65 additions & 0 deletions config/overlays/odh/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../prometheus
- ./default
- ./scripts
- ./quickstart.yaml
- ./rbac

namespace: opendatahub
configMapGenerator:
- envs:
- params.env
name: mesh-parameters
generatorOptions:
disableNameSuffixHash: true


vars:
- fieldref:
fieldPath: metadata.namespace
name: mesh-namespace
objref:
apiVersion: v1
kind: ConfigMap
name: mesh-parameters
- fieldref:
fieldPath: data.odh-modelmesh
name: odh-modelmesh
objref:
apiVersion: v1
kind: ConfigMap
name: mesh-parameters
- fieldref:
fieldPath: data.odh-mm-rest-proxy
name: odh-mm-rest-proxy
objref:
apiVersion: v1
kind: ConfigMap
name: mesh-parameters
- fieldref:
fieldPath: data.odh-modelmesh-runtime-adapter
name: odh-modelmesh-runtime-adapter
objref:
apiVersion: v1
kind: ConfigMap
name: mesh-parameters
- fieldref:
fieldPath: data.odh-modelmesh-controller
name: odh-modelmesh-controller
objref:
apiVersion: v1
kind: ConfigMap
name: mesh-parameters

commonLabels:
app: model-mesh
app.kubernetes.io/part-of: model-mesh

patchesStrategicMerge:
- ./crd/clusterservingruntime_patch_delete.yaml

configurations:
- params.yaml
27 changes: 27 additions & 0 deletions config/overlays/odh/manager/controller_manager_patch_replace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: modelmesh-controller
spec:
replicas: 3
template:
spec:
containers:
- name: manager
image: $(odh-modelmesh-controller)
resources:
limits:
memory: 2Gi
ports:
- containerPort: 9443
name: webhook
protocol: TCP
volumeMounts:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: modelmesh-webhook-server-cert
readOnly: true
volumes:
- name: modelmesh-webhook-server-cert
secret:
defaultMode: 420
secretName: modelmesh-webhook-server-cert
23 changes: 23 additions & 0 deletions config/overlays/odh/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../manager/
- ./service.yaml

patches:
- path: ./controller_manager_patch_replace.yaml
- target:
kind: Deployment
name: modelmesh-controller
patch: |
- op: add
path: /spec/template/spec/affinity/nodeAffinity
value:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
4 changes: 4 additions & 0 deletions config/overlays/odh/manager/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
varReference:
- path: spec/template/spec/containers[]/image
kind: Deployment
apiVersion: apps/v1
15 changes: 15 additions & 0 deletions config/overlays/odh/manager/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
labels:
control-plane: modelmesh-controller
app.kubernetes.io/managed-by: modelmesh-controller
name: modelmesh-controller
spec:
ports:
- protocol: TCP
port: 8080
targetPort: 8080
type: ClusterIP
selector:
control-plane: modelmesh-controller
4 changes: 4 additions & 0 deletions config/overlays/odh/params.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
odh-mm-rest-proxy=quay.io/opendatahub/rest-proxy:fast
odh-modelmesh-runtime-adapter=quay.io/opendatahub/modelmesh-runtime-adapter:fast
odh-modelmesh=quay.io/opendatahub/modelmesh:fast
odh-modelmesh-controller=quay.io/opendatahub/modelmesh-controller:fast
15 changes: 15 additions & 0 deletions config/overlays/odh/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
varReference:
- path: metadata/namespace
kind: ServiceAccount
apiVersion: v1
- path: metadata/name
kind: ClusterRoleBinding
apiGroup: rbac.authorization.k8s.io
- path: subjects/namespace
kind: RoleBinding
apiGroup: rbac.authorization.k8s.io
- path: spec/template/spec/containers[]/image
kind: Deployment
apiVersion: apps/v1
- path: data
kind: ConfigMap
Loading

0 comments on commit 749fbdb

Please sign in to comment.