diff --git a/app/cookbook.deploy/hosted-loadbalancer.yml b/app/cookbook.deploy/hosted-loadbalancer.yml deleted file mode 100644 index 33081e1..0000000 --- a/app/cookbook.deploy/hosted-loadbalancer.yml +++ /dev/null @@ -1,384 +0,0 @@ -- name: install self-hosted load balancer - hosts: localhost - become: no - gather_facts: no - - tasks: - - name: ensure namespace exists - k8s: - name: openshift-hosted-loadbalancer - api_version: v1 - kind: Namespace - state: present - - - name: ensure service account exists - k8s: - name: hosted-loadbalancer-operator - api_version: v1 - kind: ServiceAccount - namespace: openshift-hosted-loadbalancer - state: present - - - name: ensure role exists - k8s: - state: present - definition: - apiVersion: rbac.authorization.k8s.io/v1 - kind: Role - metadata: - name: hosted-loadbalancer-operator - namespace: openshift-hosted-loadbalancer - rules: - - apiGroups: - - "" - resources: - - pods - - services - - services/finalizers - - endpoints - - persistentvolumeclaims - - events - - configmaps - - secrets - - serviceaccounts - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - apiGroups: - - apps - resources: - - deployments - - daemonsets - - replicasets - - statefulsets - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - apiGroups: - - security.openshift.io - resources: - - securitycontextcontraints - verbs: - - get - - list - - update - - patch - - apiGroups: - - security.openshift.io - resourceNames: - - privileged - resources: - - securitycontextconstraints - verbs: - - use - - apiGroups: - - rbac.authorization.k8s.io - resources: - - roles - - clusterroles - - rolebindings - - clusterrolebindings - verbs: - - get - - list - - delete - - create - - update - - patch - - watch - - apiGroups: - - monitoring.coreos.com - resources: - - servicemonitors - verbs: - - get - - create - - apiGroups: - - apps - resourceNames: - - operator - resources: - - deployments/finalizers - verbs: - - update - - apiGroups: - - "" - resources: - - pods - verbs: - - get - - apiGroups: - - apps - resources: - - replicasets - - deployments - verbs: - - get - - apiGroups: - - lb.faros.dev - resources: - - '*' - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - - name: ensure clusterrole exists - k8s: - state: present - definition: - apiVersion: rbac.authorization.k8s.io/v1 - kind: ClusterRole - metadata: - name: hosted-loadbalancer-operator - rules: - - apiGroups: - - "" - resources: - - nodes - verbs: - - list - - apiGroups: - - "" - resources: - - pods - - services - - services/finalizers - - endpoints - - persistentvolumeclaims - - events - - configmaps - - secrets - - serviceaccounts - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - apiGroups: - - apps - resources: - - deployments - - daemonsets - - replicasets - - statefulsets - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - apiGroups: - - security.openshift.io - resources: - - securitycontextcontraints - verbs: - - get - - list - - update - - patch - - apiGroups: - - security.openshift.io - resourceNames: - - privileged - resources: - - securitycontextconstraints - verbs: - - use - - apiGroups: - - rbac.authorization.k8s.io - resources: - - roles - - clusterroles - - rolebindings - - clusterrolebindings - verbs: - - get - - list - - delete - - create - - update - - patch - - watch - - apiGroups: - - monitoring.coreos.com - resources: - - servicemonitors - verbs: - - get - - create - - apiGroups: - - apps - resourceNames: - - operator - resources: - - deployments/finalizers - verbs: - - update - - apiGroups: - - "" - resources: - - pods - verbs: - - get - - apiGroups: - - apps - resources: - - replicasets - - deployments - verbs: - - get - - apiGroups: - - lb.faros.dev - resources: - - '*' - verbs: - - create - - delete - - get - - list - - patch - - update - - watch - - - name: ensure rolebinding exists - k8s: - state: present - definition: - kind: RoleBinding - apiVersion: rbac.authorization.k8s.io/v1 - metadata: - name: hosted-loadbalancer-operator - namespace: openshift-hosted-loadbalancer - subjects: - - kind: ServiceAccount - name: hosted-loadbalancer-operator - roleRef: - kind: ClusterRole - name: hosted-loadbalancer-operator - apiGroup: rbac.authorization.k8s.io - - - name: ensure clusterrolebinding exists - k8s: - state: present - definition: - kind: ClusterRoleBinding - apiVersion: rbac.authorization.k8s.io/v1 - metadata: - name: hosted-loadbalancer-operator - subjects: - - kind: ServiceAccount - name: hosted-loadbalancer-operator - namespace: openshift-hosted-loadbalancer - roleRef: - kind: ClusterRole - name: hosted-loadbalancer-operator - apiGroup: rbac.authorization.k8s.io - - - name: ensure customresourcedefinition exists - k8s: - state: present - definition: - apiVersion: apiextensions.k8s.io/v1beta1 - kind: CustomResourceDefinition - metadata: - name: clusterloadbalancers.lb.faros.dev - namespace: openshift-hosted-loadbalancer - spec: - version: v1beta1 - group: lb.faros.dev - names: - kind: ClusterLoadBalancer - listKind: ClusterLoadBalancerList - plural: clusterloadbalancers - singular: clusterloadbalancer - scope: Namespaced - subresources: - status: {} - validation: - openAPIV3Schema: - type: object - x-kubernetes-preserve-unknown-fields: true - versions: - - name: v1beta1 - served: true - storage: true - - - name: ensure operator deployment exists - k8s: - state: present - definition: - apiVersion: apps/v1 - kind: Deployment - metadata: - name: hosted-loadbalancer-operator - namespace: openshift-hosted-loadbalancer - spec: - replicas: 1 - selector: - matchLabels: - name: hosted-loadbalancer-operator - template: - metadata: - labels: - name: hosted-loadbalancer-operator - spec: - serviceAccountName: hosted-loadbalancer-operator - containers: - - name: hosted-loadbalancer-operator - image: "quay.io/faros/hosted-loadbalancer-operator:latest" - imagePullPolicy: Always - volumeMounts: - - mountPath: /tmp/ansible-operator/runner - name: runner - env: - - name: WATCH_NAMESPACE - valueFrom: - fieldRef: - fieldPath: metadata.namespace - - name: POD_NAME - valueFrom: - fieldRef: - fieldPath: metadata.name - - name: OPERATOR_NAME - value: "hosted-loadbalancer-operator" - - name: ANSIBLE_GATHERING - value: explicit - volumes: - - name: runner - emptyDir: {} - - - name: ensure clusterloadbalancer exists - k8s: - state: present - definition: - apiVersion: lb.faros.dev/v1beta1 - kind: ClusterLoadBalancer - metadata: - name: example-clusterloadbalancer - namespace: openshift-hosted-loadbalancer - spec: - vip_addr: "{{ loadbalancer_vip }}" - router_id: '100' - vip_pass: "{{ lookup('password', '/data/keepalived.pass chars=ascii_letters length=8') }}" - node_selector: - node-role.kubernetes.io/master: "" diff --git a/app/deploy.d/container-storage/container-storage.yml b/app/deploy.d/container-storage/container-storage.yml index b6e95dc..acf2867 100644 --- a/app/deploy.d/container-storage/container-storage.yml +++ b/app/deploy.d/container-storage/container-storage.yml @@ -49,7 +49,7 @@ - name: wait for operators to begin install pause: seconds: 15 - when: oc_subscribe is cchanged + when: op_subscribe is changed - name: save clusterserviceversion object set_fact: @@ -65,7 +65,7 @@ register: op_lkp until: op_lkp is success retries: 60 - delay: 15 ## NOT WORKING + delay: 15 - name: ensure storagecluster exists k8s: diff --git a/app/deploy.d/odh-demo/main.sh b/app/deploy.d/odh-demo/main.sh new file mode 100755 index 0000000..67d2f98 --- /dev/null +++ b/app/deploy.d/odh-demo/main.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +ME=$(dirname $0) + +ansible-playbook $ME/odh-demo.yml $@ || exit 1 diff --git a/app/deploy.d/odh-demo/odh-demo.yml b/app/deploy.d/odh-demo/odh-demo.yml new file mode 100644 index 0000000..ea60ca3 --- /dev/null +++ b/app/deploy.d/odh-demo/odh-demo.yml @@ -0,0 +1,367 @@ +--- +- name: deploy odh demo + hosts: localhost + gather_facts: no + become: no + + tasks: + - name: ensure the odh operator subscription exists + k8s: + state: present + definition: + apiVersion: operators.coreos.com/v1alpha1 + kind: Subscription + metadata: + name: opendatahub-operator + namespace: openshift-operators + spec: + channel: "{{ lookup('ini', 'opendatahub section=operators file=/app/versions.ini') }}" + name: opendatahub-operator + source: community-operators + sourceNamespace: openshift-marketplace + installPlanApproval: "Automatic" + register: op_subscribe + + - name: wait for operators to begin install + pause: + seconds: 15 + when: op_subscribe is changed + + - name: save clusterserviceversion object + set_fact: + k8s_obj: + apiVersion: operators.coreos.com/v1alpha1 + kind: ClusterServiceVersion + name: opendatahub-operator* + namepace: openshift-operators + + - name: wait for operator to become ready + assert: + that: "lookup('k8s', resource_definition=k8s_obj)[0].status.phase | default('error') == 'Succeeded'" + register: op_lkp + until: op_lkp is success + retries: 60 + delay: 15 + + - name: create odh-demo namespace + k8s: + state: present + definition: + kind: Project + apiVersion: project.openshift.io/v1 + metadata: + name: odh-demo + labels: + control-plane: kubeflow + katib-metricscollector-injection: enabled + annotations: + openshift.io/description: '' + openshift.io/display-name: '' + spec: + finalizers: + - kubernetes + + - name: install odh tooling + k8s: + state: present + definition: + apiVersion: kfdef.apps.kubeflow.org/v1 + kind: KfDef + metadata: + name: opendatahub + namespace: odh-demo + spec: + applications: + - kustomizeConfig: + repoRef: + name: manifests + path: odh-common + name: odh-common + - kustomizeConfig: + repoRef: + name: manifests + path: radanalyticsio/spark/cluster + name: radanalyticsio-cluster + - kustomizeConfig: + repoRef: + name: manifests + path: radanalyticsio/spark/operator + name: radanalyticsio-spark-operator + - kustomizeConfig: + parameters: + - name: s3_endpoint_url + value: s3.odh.com + repoRef: + name: manifests + path: jupyterhub/jupyterhub + name: jupyterhub + - kustomizeConfig: + overlays: + - additional + repoRef: + name: manifests + path: jupyterhub/notebook-images + name: notebook-images + - kustomizeConfig: + repoRef: + name: manifests + path: prometheus/cluster + name: prometheus-cluster + - kustomizeConfig: + repoRef: + name: manifests + path: prometheus/operator + name: prometheus-operator + - kustomizeConfig: + repoRef: + name: manifests + path: grafana/cluster + name: grafana-cluster + - kustomizeConfig: + repoRef: + name: manifests + path: grafana/grafana + name: grafana-instance + repos: + - name: kf-manifests + uri: >- + https://github.com/opendatahub-io/manifests/tarball/v0.7-branch-openshift + - name: manifests + uri: 'https://github.com/opendatahub-io/odh-manifests/tarball/v0.6.1' + version: v0.6.1 + + - name: ensure notebook imagestream exists + k8s: + state: present + definition: + kind: ImageStream + apiVersion: image.openshift.io/v1 + metadata: + name: ml-workflows-notebook + namespace: odh-demo + labels: + component.opendatahub.io/name: jupyterhub + opendatahub.io/component: 'true' + opendatahub.io/notebook-image: 'true' + spec: + lookupPolicy: + local: false + tags: + - name: latest + annotations: null + from: + kind: DockerImage + name: 'quay.io/willbenton/jh-ml-workflows-notebook:rhte-demo-2019' + generation: 2 + importPolicy: {} + referencePolicy: + type: Source + + - name: ensure kubeadmin config map exists + k8s: + state: present + definition: + kind: ConfigMap + apiVersion: v1 + metadata: + name: jupyterhub-singleuser-profile-kube-3aadmin + namespace: odh-demo + labels: + app: jupyterhub + data: + profile: | + env: + JUPYTER_PRELOAD_REPOS: https://github.com/willb/openshift-ml-workflows-workshop + gpu: '0' + last_selected_image: ml-workflows-notebook:latest + last_selected_size: None + + - name: ensure s2i builder imagestream exists + k8s: + state: present + definition: + kind: ImageStream + apiVersion: image.openshift.io/v1 + metadata: + name: simple-model-s2i + namespace: odh-demo + spec: + lookupPolicy: + local: false + tags: + - name: cached-pipeline-s2i + annotations: null + from: + kind: DockerImage + name: 'quay.io/willbenton/simple-model-s2i:cached-pipeline-s2i' + generation: 2 + importPolicy: {} + referencePolicy: + type: Source + + - name: ensure pipeline buildconfig exists + k8s: + state: present + definition: + kind: BuildConfig + apiVersion: build.openshift.io/v1 + metadata: + name: pipeline + namespace: odh-demo + labels: + scrapeModelMetrics: 'yes' + annotations: + openshift.io/generated-by: OpenShiftNewBuild + spec: + nodeSelector: null + output: + to: + kind: ImageStreamTag + name: 'pipeline:latest' + resources: + limits: + cpu: 500m + memory: 3Gi + requests: + cpu: 50m + memory: 256Mi + successfulBuildsHistoryLimit: 5 + failedBuildsHistoryLimit: 5 + strategy: + type: Source + sourceStrategy: + from: + kind: ImageStreamTag + namespace: odh-demo + name: 'simple-model-s2i:cached-pipeline-s2i' + env: + - name: S2I_SOURCE_NOTEBOOK_LIST + value: >- + 03-feature-engineering-tfidf.ipynb,04-model-logistic-regression.ipynb + postCommit: {} + source: + type: Git + git: + uri: 'https://github.com/willb/openshift-ml-workflows-workshop' + ref: develop + contextDir: source + triggers: [] + runPolicy: Serial + + - name: ensure pipeline imgestream exists + k8s: + state: present + definition: + kind: ImageStream + apiVersion: image.openshift.io/v1 + metadata: + name: pipeline + namespace: odh-demo + labels: + scrapeModelMetrics: 'yes' + spec: + lookupPolicy: + local: false + + - name: ensure pipeline deploymentconfig exists + k8s: + state: present + definition: + kind: DeploymentConfig + apiVersion: apps.openshift.io/v1 + metadata: + name: pipeline + namespace: odh-demo + labels: + app: pipeline + spec: + strategy: + type: Rolling + rollingParams: + updatePeriodSeconds: 1 + intervalSeconds: 1 + timeoutSeconds: 600 + maxUnavailable: 25% + maxSurge: 25% + resources: {} + activeDeadlineSeconds: 21600 + triggers: + - type: ConfigChange + - type: ImageChange + imageChangeParams: + automatic: true + containerNames: + - pipeline + from: + kind: ImageStreamTag + namespace: odh-demo + name: 'pipeline:latest' + replicas: 1 + revisionHistoryLimit: 10 + test: false + selector: + app: pipeline + deploymentconfig: pipeline + template: + metadata: + creationTimestamp: null + labels: + app: pipeline + deploymentconfig: pipeline + spec: + containers: + - name: pipeline + image: >- + image-registry.openshift-image-registry.svc:5000/odh-demo/pipeline:latest + ports: + - containerPort: 8080 + protocol: TCP + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + imagePullPolicy: Always + restartPolicy: Always + terminationGracePeriodSeconds: 30 + dnsPolicy: ClusterFirst + securityContext: {} + schedulerName: default-scheduler + + - name: ensure pipeline service exists + k8s: + state: present + definition: + apiVersion: v1 + kind: Service + metadata: + name: pipeline + namespace: odh-demo + labels: + mlmodel: yes + spec: + selector: + app: pipeline + ports: + - protocol: TCP + port: 8080 + targetPort: 8080 + + - name: ensure odhmodelmonitor exists + k8s: + state: present + definition: + apiVersion: monitoring.coreos.com/v1 + kind: ServiceMonitor + metadata: + name: odhmodelmonitor + namespace: odh-demo + labels: + component.opendatahub.io/name: prometheus + opendatahub.io/component: 'true' + team: opendatahub + spec: + endpoints: + - targetPort: 8080 + selector: + matchLabels: + mlmodel: yes + diff --git a/app/versions.ini b/app/versions.ini index 4fcf1b4..a74257e 100644 --- a/app/versions.ini +++ b/app/versions.ini @@ -5,3 +5,4 @@ installer=stable-4.4 [operators] local_storage=4.4 container_storage=stable-4.3 +opendatahub=beta diff --git a/version.txt b/version.txt index fa3de58..1750564 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.0.5 \ No newline at end of file +0.0.6