Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
add odh-model-controller as an independent component (#912)
Browse files Browse the repository at this point in the history
* add odh-model-controller as an independent component

* manifests update for operator 2.0

* Create v1.14.0 incubation release

* Add dashboard incubation tag

---------

Co-authored-by: Lucas Fernandez <lferrnan@redhat.com>
  • Loading branch information
VedantMahabaleshwarkar and lucferbux authored Aug 16, 2023
1 parent 59d87c2 commit 80132c2
Show file tree
Hide file tree
Showing 22 changed files with 534 additions and 0 deletions.
29 changes: 29 additions & 0 deletions odh-model-controller/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../prometheus
- ../overlays/odh

namespace: opendatahub
configMapGenerator:
- envs:
- params.env
name: odh-model-controller-parameters
generatorOptions:
disableNameSuffixHash: true

vars:
- fieldref:
fieldPath: metadata.namespace
name: mesh-namespace
objref:
apiVersion: v1
kind: ConfigMap
name: odh-model-controller-parameters
- fieldref:
fieldPath: data.odh-model-controller
name: odh-model-controller
objref:
apiVersion: v1
kind: ConfigMap
name: odh-model-controller-parameters
2 changes: 2 additions & 0 deletions odh-model-controller/base/params.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
odh-model-controller=quay.io/opendatahub/odh-model-controller:v0.11.0-alpha
kserve-enabled=true
3 changes: 3 additions & 0 deletions odh-model-controller/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bases:
- ../rbac
- ../manager
11 changes: 11 additions & 0 deletions odh-model-controller/manager/controller_manager_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: controller-runtime.sigs.k8s.io/v1alpha1
kind: ControllerManagerConfig
health:
healthProbeBindAddress: :8081
metrics:
bindAddress: 127.0.0.1:8080
webhook:
port: 9443
leaderElection:
leaderElect: true
resourceName: odh-model-controller
10 changes: 10 additions & 0 deletions odh-model-controller/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resources:
- manager.yaml

generatorOptions:
disableNameSuffixHash: true

configMapGenerator:
- files:
- controller_manager_config.yaml
name: manager-config
67 changes: 67 additions & 0 deletions odh-model-controller/manager/manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: odh-model-controller
labels:
control-plane: odh-model-controller
app: odh-model-controller
spec:
selector:
matchLabels:
control-plane: odh-model-controller
replicas: 3
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
labels:
control-plane: odh-model-controller
app: odh-model-controller
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: control-plane
operator: In
values:
- odh-model-controller
topologyKey: kubernetes.io/hostname
securityContext:
runAsNonRoot: true
containers:
- command:
- /manager
args:
- --leader-elect
image: controller:latest
name: manager
imagePullPolicy: Always
securityContext:
allowPrivilegeEscalation: false
livenessProbe:
httpGet:
path: /healthz
port: 8081
initialDelaySeconds: 15
periodSeconds: 20
readinessProbe:
httpGet:
path: /readyz
port: 8081
initialDelaySeconds: 5
periodSeconds: 10
# TODO(user): Configure the resources accordingly based on the project requirements.
# More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
resources:
limits:
cpu: 500m
memory: 2Gi
requests:
cpu: 10m
memory: 64Mi
serviceAccountName: odh-model-controller
terminationGracePeriodSeconds: 10
10 changes: 10 additions & 0 deletions odh-model-controller/overlays/odh/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../default

patchesStrategicMerge:
- odh_model_controller_manager_patch.yaml

configurations:
- params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: odh-model-controller
spec:
replicas: 3
template:
spec:
containers:
- args:
- --leader-elect
- "--monitoring-namespace"
- "$(MONITORING_NS)"
- --kserve-enabled
image: $(odh-model-controller)
env:
- name: MONITORING_NS
value: kserve
name: manager
7 changes: 7 additions & 0 deletions odh-model-controller/overlays/odh/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
varReference:
- path: metadata/name
kind: ClusterRoleBinding
apiGroup: authorization.openshift.io
- path: spec/template/spec/containers[]/image
kind: Deployment
apiVersion: apps/v1
2 changes: 2 additions & 0 deletions odh-model-controller/prometheus/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- monitor.yaml
18 changes: 18 additions & 0 deletions odh-model-controller/prometheus/monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Prometheus Monitor Service (Metrics)
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
control-plane: odh-model-controller
name: odh-model-controller-metrics-monitor
spec:
endpoints:
- path: /metrics
port: https
scheme: https
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
tlsConfig:
insecureSkipVerify: false
selector:
matchLabels:
control-plane: odh-model-controller
9 changes: 9 additions & 0 deletions odh-model-controller/rbac/auth_proxy_client_clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: metrics-reader
rules:
- nonResourceURLs:
- "/metrics"
verbs:
- get
17 changes: 17 additions & 0 deletions odh-model-controller/rbac/auth_proxy_role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: proxy-role
rules:
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
11 changes: 11 additions & 0 deletions odh-model-controller/rbac/auth_proxy_role_binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: proxy-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: proxy-role
subjects:
- kind: ServiceAccount
name: odh-model-controller
15 changes: 15 additions & 0 deletions odh-model-controller/rbac/auth_proxy_service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
labels:
control-plane: odh-model-controller
name: odh-model-controller-metrics-service
namespace: system
spec:
ports:
- name: metrics
port: 8080
protocol: TCP
targetPort: 8080
selector:
control-plane: odh-model-controller
15 changes: 15 additions & 0 deletions odh-model-controller/rbac/kserve_prometheus_clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kserve-prometheus-k8s
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- pods
verbs:
- get
- list
- watch
19 changes: 19 additions & 0 deletions odh-model-controller/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resources:
# All RBAC will be applied under this service account in
# the deployment namespace. You may comment out this resource
# if your manager will use a service account that exists at
# runtime. Be sure to update RoleBinding and ClusterRoleBinding
# subjects if changing service account names.
- service_account.yaml
- role.yaml
- role_binding.yaml
- leader_election_role.yaml
- leader_election_role_binding.yaml
# Comment the following 4 lines if you want to disable
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
# which protects your /metrics endpoint.
- auth_proxy_service.yaml
- auth_proxy_role.yaml
- auth_proxy_role_binding.yaml
- auth_proxy_client_clusterrole.yaml
- kserve_prometheus_clusterrole.yaml
37 changes: 37 additions & 0 deletions odh-model-controller/rbac/leader_election_role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# permissions to do leader election.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: leader-election-role
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
11 changes: 11 additions & 0 deletions odh-model-controller/rbac/leader_election_role_binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: leader-election-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: leader-election-role
subjects:
- kind: ServiceAccount
name: odh-model-controller
Loading

0 comments on commit 80132c2

Please sign in to comment.