From 1f6efb47303e2efee4125b6d1b89c98e3803b945 Mon Sep 17 00:00:00 2001 From: Bobbins228 Date: Mon, 13 May 2024 14:19:17 +0100 Subject: [PATCH] Converted oc to kubectl & updated resource structure --- Makefile | 85 ++++++++++--------- contrib/configuration/odh/default-dsc.yaml | 40 +++++++++ contrib/configuration/odh/default-dsci.yaml | 24 ++++++ .../opendatahub-operator-subscription.yaml | 0 .../{ => rhoai}/default-dsc.yaml | 0 contrib/configuration/rhoai/default-dsci.yaml | 24 ++++++ .../rhoai-operator-subscription.yaml | 0 7 files changed, 134 insertions(+), 39 deletions(-) create mode 100644 contrib/configuration/odh/default-dsc.yaml create mode 100644 contrib/configuration/odh/default-dsci.yaml rename contrib/configuration/{ => odh}/opendatahub-operator-subscription.yaml (100%) rename contrib/configuration/{ => rhoai}/default-dsc.yaml (100%) create mode 100644 contrib/configuration/rhoai/default-dsci.yaml rename contrib/configuration/{ => rhoai}/rhoai-operator-subscription.yaml (100%) diff --git a/Makefile b/Makefile index 477efe443..a49d19514 100644 --- a/Makefile +++ b/Makefile @@ -407,8 +407,8 @@ all-in-one: -make delete-nfd-operator -make delete-ai-platform-operator -make delete-nvidia-operator - -make install-ai-platform-operator -make install-nfd-operator + -make install-ai-platform-operator -make install-nvidia-operator .PHONY: delete-all-in-one @@ -439,79 +439,86 @@ endif .PHONY: delete-rhoai-operator delete-rhoai-operator: ## Delete RHOAI Operator @echo -e "\n==> Deleting OpenShift AI Operator \n" - -oc delete subscription rhods-operator -n redhat-ods-operator - -export CLUSTER_SERVICE_VERSION=`oc get clusterserviceversion -n redhat-ods-operator -l operators.coreos.com/rhods-operator.redhat-ods-operator -o custom-columns=:metadata.name`; \ - oc delete clusterserviceversion $$CLUSTER_SERVICE_VERSION -n redhat-ods-operator + -kubectl delete subscription rhods-operator -n redhat-ods-operator + -export CLUSTER_SERVICE_VERSION=`kubectl get clusterserviceversion -n redhat-ods-operator -l operators.coreos.com/rhods-operator.redhat-ods-operator -o custom-columns=:metadata.name`; \ + kubectl delete clusterserviceversion $$CLUSTER_SERVICE_VERSION -n redhat-ods-operator + kubectl delete namespace redhat-ods-operator .PHONY: install-rhoai-operator install-rhoai-operator: ## Install RHOAI Operator @echo -e "\n==> Installing OpenShift AI Operator \n" - -oc create ns redhat-ods-operator - oc create -f contrib/configuration/rhoai-operator-subscription.yaml + -kubectl create ns redhat-ods-operator + kubectl create -f contrib/configuration/rhoai/rhoai-operator-subscription.yaml @echo Waiting for rhoai-operator Subscription to be ready - oc wait -n redhat-ods-operator subscription/rhods-operator --for=jsonpath='{.status.state}'=AtLatestKnown --timeout=180s + kubectl wait -n redhat-ods-operator subscription/rhods-operator --for=jsonpath='{.status.state}'=AtLatestKnown --timeout=180s @echo -e "\n==> Creating default Data Science Cluster \n" - oc apply -f contrib/configuration/default-dsc.yaml + kubectl apply -f contrib/configuration/rhoai/default-dsci.yaml --server-side + kubectl apply -f contrib/configuration/rhoai/default-dsc.yaml --server-side .PHONY: delete-opendatahub-operator delete-opendatahub-operator: ## Delete OpenDataHub operator @echo -e "\n==> Deleting OpenDataHub Operator \n" - -oc delete subscription opendatahub-operator -n openshift-operators - -export CLUSTER_SERVICE_VERSION=`oc get clusterserviceversion -n openshift-operators -l operators.coreos.com/opendatahub-operator.openshift-operators -o custom-columns=:metadata.name`; \ - oc delete clusterserviceversion $$CLUSTER_SERVICE_VERSION -n openshift-operators + -kubectl delete subscription opendatahub-operator -n openshift-operators + -export CLUSTER_SERVICE_VERSION=`kubectl get clusterserviceversion -n openshift-operators -l operators.coreos.com/opendatahub-operator.openshift-operators -o custom-columns=:metadata.name`; \ + kubectl delete clusterserviceversion $$CLUSTER_SERVICE_VERSION -n openshift-operators + -kubectl delete namespace opendatahub .PHONY: install-opendatahub-operator install-opendatahub-operator: ## Install OpenDataHub operator @echo -e "\n==> Installing OpenDataHub Operator \n" - -oc create ns opendatahub - oc create -f contrib/configuration/opendatahub-operator-subscription.yaml + -kubectl create ns opendatahub + kubectl create -f contrib/configuration/odh/opendatahub-operator-subscription.yaml @echo Waiting for opendatahub-operator Subscription to be ready - oc wait -n openshift-operators subscription/opendatahub-operator --for=jsonpath='{.status.state}'=AtLatestKnown --timeout=180s + kubectl wait -n openshift-operators subscription/opendatahub-operator --for=jsonpath='{.status.state}'=AtLatestKnown --timeout=180s + sleep 2 + kubectl wait --for=condition=available deployment/opendatahub-operator-controller-manager -n openshift-operators --timeout=180s + kubectl apply -f contrib/configuration/odh/default-dsci.yaml --server-side + kubectl apply -f contrib/configuration/odh/default-dsc.yaml --server-side ##@ GPU Support .PHONY: install-nfd-operator install-nfd-operator: ## Install NFD operator ( Node Feature Discovery ) @echo -e "\n==> Installing NFD Operator \n" - -oc create ns openshift-nfd - oc create -f contrib/configuration/nfd-operator-subscription.yaml + -kubectl create ns openshift-nfd + kubectl create -f contrib/configuration/nfd-operator-subscription.yaml @echo -e "\n==> Creating default NodeFeatureDiscovery CR \n" - @while [[ -z $$(oc get customresourcedefinition nodefeaturediscoveries.nfd.openshift.io) ]]; do echo "."; sleep 10; done - @while [[ -z $$(oc get csv -n openshift-nfd --selector operators.coreos.com/nfd.openshift-nfd) ]]; do echo "."; sleep 10; done - oc get csv -n openshift-nfd --selector operators.coreos.com/nfd.openshift-nfd -ojsonpath={.items[0].metadata.annotations.alm-examples} | jq '.[] | select(.kind=="NodeFeatureDiscovery")' | oc apply -f - + @while [[ -z $$(kubectl get customresourcedefinition nodefeaturediscoveries.nfd.openshift.io) ]]; do echo "."; sleep 10; done + @while [[ -z $$(kubectl get csv -n openshift-nfd --selector operators.coreos.com/nfd.openshift-nfd) ]]; do echo "."; sleep 10; done + kubectl get csv -n openshift-nfd --selector operators.coreos.com/nfd.openshift-nfd -ojsonpath={.items[0].metadata.annotations.alm-examples} | jq '.[] | select(.kind=="NodeFeatureDiscovery")' | kubectl apply -f - .PHONY: delete-nfd-operator delete-nfd-operator: ## Delete NFD operator @echo -e "\n==> Deleting NodeFeatureDiscovery CR \n" - oc delete NodeFeatureDiscovery --all -n openshift-nfd - @while [[ -n $$(oc get NodeFeatureDiscovery -n openshift-nfd) ]]; do echo "."; sleep 10; done + kubectl delete NodeFeatureDiscovery --all -n openshift-nfd + @while [[ -n $$(kubectl get NodeFeatureDiscovery -n openshift-nfd) ]]; do echo "."; sleep 10; done @echo -e "\n==> Deleting NFD Operator \n" - -oc delete subscription nfd -n openshift-nfd - -export CLUSTER_SERVICE_VERSION=`oc get clusterserviceversion -n openshift-nfd -l operators.coreos.com/nfd.openshift-nfd -o custom-columns=:metadata.name`; \ - oc delete clusterserviceversion $$CLUSTER_SERVICE_VERSION -n openshift-nfd - -oc delete ns openshift-nfd + -kubectl delete subscription nfd -n openshift-nfd + -export CLUSTER_SERVICE_VERSION=`kubectl get clusterserviceversion -n openshift-nfd -l operators.coreos.com/nfd.openshift-nfd -o custom-columns=:metadata.name`; \ + kubectl delete clusterserviceversion $$CLUSTER_SERVICE_VERSION -n openshift-nfd + -kubectl delete ns openshift-nfd .PHONY: install-nvidia-operator install-nvidia-operator: ## Install nvidia operator @echo -e "\n==> Installing nvidia Operator \n" - -oc create ns nvidia-gpu-operator - oc create -f contrib/configuration/nvidia-operator-subscription.yaml + -kubectl create ns nvidia-gpu-operator + kubectl create -f contrib/configuration/nvidia-operator-subscription.yaml @echo -e "\n==> Creating default ClusterPolicy CR \n" - @while [[ -z $$(oc get customresourcedefinition clusterpolicies.nvidia.com) ]]; do echo "."; sleep 10; done - @while [[ -z $$(oc get csv -n nvidia-gpu-operator --selector operators.coreos.com/gpu-operator-certified.nvidia-gpu-operator) ]]; do echo "."; sleep 10; done - oc get csv -n nvidia-gpu-operator --selector operators.coreos.com/gpu-operator-certified.nvidia-gpu-operator -ojsonpath={.items[0].metadata.annotations.alm-examples} | jq .[] | oc apply -f - + @while [[ -z $$(kubectl get customresourcedefinition clusterpolicies.nvidia.com) ]]; do echo "."; sleep 10; done + @while [[ -z $$(kubectl get csv -n nvidia-gpu-operator --selector operators.coreos.com/gpu-operator-certified.nvidia-gpu-operator) ]]; do echo "."; sleep 10; done + kubectl get csv -n nvidia-gpu-operator --selector operators.coreos.com/gpu-operator-certified.nvidia-gpu-operator -ojsonpath={.items[0].metadata.annotations.alm-examples} | jq .[] | kubectl apply -f - ifeq ($(USE_RHOAI), true) ## Additional steps required for RHOAI - oc delete configmap migration-gpu-status -n redhat-ods-applications --ignore-not-found=true - -export REPLICASET_NAME=`oc get replicaset -n redhat-ods-applications -l app=rhods-dashboard -o custom-columns=:metadata.name`; \ - oc delete replicaset $$REPLICASET_NAME -n redhat-ods-applications + kubectl delete configmap migration-gpu-status -n redhat-ods-applications --ignore-not-found=true + -export REPLICASET_NAME=`kubectl get replicaset -n redhat-ods-applications -l app=rhods-dashboard -o custom-columns=:metadata.name`; \ + kubectl delete replicaset $$REPLICASET_NAME -n redhat-ods-applications endif .PHONY: delete-nvidia-operator delete-nvidia-operator: ## Delete nvidia operator @echo -e "\n==> Deleting ClusterPolicy CR \n" - oc delete ClusterPolicy --all -n nvidia-gpu-operator - @while [[ -n $$(oc get ClusterPolicy -n nvidia-gpu-operator) ]]; do echo "."; sleep 10; done + kubectl delete ClusterPolicy --all -n nvidia-gpu-operator + @while [[ -n $$(kubectl get ClusterPolicy -n nvidia-gpu-operator) ]]; do echo "."; sleep 10; done @echo -e "\n==> Deleting nvidia Operator \n" - -oc delete subscription gpu-operator-certified -n nvidia-gpu-operator - -export CLUSTER_SERVICE_VERSION=`oc get clusterserviceversion -n nvidia-gpu-operator -l operators.coreos.com/gpu-operator-certified.nvidia-gpu-operator -o custom-columns=:metadata.name`; \ - oc delete clusterserviceversion $$CLUSTER_SERVICE_VERSION -n nvidia-gpu-operator - -oc delete ns nvidia-gpu-operator + -kubectl delete subscription gpu-operator-certified -n nvidia-gpu-operator + -export CLUSTER_SERVICE_VERSION=`kubectl get clusterserviceversion -n nvidia-gpu-operator -l operators.coreos.com/gpu-operator-certified.nvidia-gpu-operator -o custom-columns=:metadata.name`; \ + kubectl delete clusterserviceversion $$CLUSTER_SERVICE_VERSION -n nvidia-gpu-operator + -kubectl delete ns nvidia-gpu-operator diff --git a/contrib/configuration/odh/default-dsc.yaml b/contrib/configuration/odh/default-dsc.yaml new file mode 100644 index 000000000..d5e4d902a --- /dev/null +++ b/contrib/configuration/odh/default-dsc.yaml @@ -0,0 +1,40 @@ +kind: DataScienceCluster +apiVersion: datasciencecluster.opendatahub.io/v1 +metadata: + labels: + app.kubernetes.io/created-by: opendatahub-operator + app.kubernetes.io/instance: default + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: datasciencecluster + app.kubernetes.io/part-of: opendatahub-operator + name: default-dsc +spec: + components: + codeflare: + managementState: Managed + dashboard: + managementState: Managed + datasciencepipelines: + managementState: Managed + kserve: + managementState: Managed + serving: + ingressGateway: + certificate: + type: SelfSigned + managementState: Managed + name: knative-serving + kueue: + managementState: Managed + modelmeshserving: + managementState: Managed + modelregistry: + managementState: Removed + ray: + managementState: Managed + trainingoperator: + managementState: Removed + trustyai: + managementState: Managed + workbenches: + managementState: Managed diff --git a/contrib/configuration/odh/default-dsci.yaml b/contrib/configuration/odh/default-dsci.yaml new file mode 100644 index 000000000..e9f1b2995 --- /dev/null +++ b/contrib/configuration/odh/default-dsci.yaml @@ -0,0 +1,24 @@ +kind: DSCInitialization +apiVersion: dscinitialization.opendatahub.io/v1 +metadata: + labels: + app.kubernetes.io/created-by: opendatahub-operator + app.kubernetes.io/instance: default + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: dscinitialization + app.kubernetes.io/part-of: opendatahub-operator + name: default-dsci +spec: + applicationsNamespace: opendatahub + monitoring: + managementState: Managed + namespace: opendatahub + serviceMesh: + controlPlane: + metricsCollection: Istio + name: data-science-smcp + namespace: istio-system + managementState: Managed + trustedCABundle: + customCABundle: '' + managementState: Managed diff --git a/contrib/configuration/opendatahub-operator-subscription.yaml b/contrib/configuration/odh/opendatahub-operator-subscription.yaml similarity index 100% rename from contrib/configuration/opendatahub-operator-subscription.yaml rename to contrib/configuration/odh/opendatahub-operator-subscription.yaml diff --git a/contrib/configuration/default-dsc.yaml b/contrib/configuration/rhoai/default-dsc.yaml similarity index 100% rename from contrib/configuration/default-dsc.yaml rename to contrib/configuration/rhoai/default-dsc.yaml diff --git a/contrib/configuration/rhoai/default-dsci.yaml b/contrib/configuration/rhoai/default-dsci.yaml new file mode 100644 index 000000000..91d3d1b00 --- /dev/null +++ b/contrib/configuration/rhoai/default-dsci.yaml @@ -0,0 +1,24 @@ +kind: DSCInitialization +apiVersion: dscinitialization.opendatahub.io/v1 +metadata: + labels: + app.kubernetes.io/created-by: rhods-operator + app.kubernetes.io/instance: default-dsci + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/name: dscinitialization + app.kubernetes.io/part-of: rhods-operator + name: default-dsci +spec: + applicationsNamespace: redhat-ods-applications + monitoring: + managementState: Managed + namespace: redhat-ods-monitoring + serviceMesh: + controlPlane: + metricsCollection: Istio + name: data-science-smcp + namespace: istio-system + managementState: Managed + trustedCABundle: + customCABundle: '' + managementState: Managed diff --git a/contrib/configuration/rhoai-operator-subscription.yaml b/contrib/configuration/rhoai/rhoai-operator-subscription.yaml similarity index 100% rename from contrib/configuration/rhoai-operator-subscription.yaml rename to contrib/configuration/rhoai/rhoai-operator-subscription.yaml