Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Scaffolder committed Jan 22, 2025
0 parents commit 71373c2
Show file tree
Hide file tree
Showing 33 changed files with 813 additions and 0 deletions.
25 changes: 25 additions & 0 deletions app-of-apps/application-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: test-jan22-app
namespace: ai-rhdh
finalizers: ["resources-finalizer.argocd.argoproj.io"]
spec:
project: default
source:
path: ./components/test-jan22/overlays/development
repoURL: https://github.com/jdubrick-ai/test-jan22-gitops.git
targetRevision: main
destination:
namespace: rhdh-app
server: https://kubernetes.default.svc
syncPolicy:
managedNamespaceMetadata:
labels:
argocd.argoproj.io/managed-by: ai-rhdh
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
- PruneLast=true
10 changes: 10 additions & 0 deletions app-of-apps/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
rhtap/gitops: test-jan22
janus-idp.io/tekton: test-jan22
backstage.io/kubernetes-id: test-jan22
backstage.io/kubernetes-namespace: rhdh-app
app.kubernetes.io/part-of: test-jan22
resources:
- application-dev.yaml
25 changes: 25 additions & 0 deletions application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: test-jan22
namespace: ai-rhdh
finalizers: ["resources-finalizer.argocd.argoproj.io"]
spec:
project: default
source:
path: ./app-of-apps
repoURL: https://github.com/jdubrick-ai/test-jan22-gitops.git
targetRevision: main
destination:
namespace: rhdh-app
server: https://kubernetes.default.svc
syncPolicy:
managedNamespaceMetadata:
labels:
argocd.argoproj.io/managed-by: ai-rhdh
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
- PruneLast=true
22 changes: 22 additions & 0 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: test-jan22-gitops
description: This is GitOps manifest for test-jan22
links:
- url: https://www.redhat.com/en/solutions/trusted-software-supply-chain
title: Trusted Secure Supply Chain
icon: dashboard
type: admin-dashboard
annotations:
# ArgoCD apps from this template used rhtap-gitops as the grouping
argocd/app-selector: rhtap/gitops=test-jan22
janus-idp.io/tekton: test-jan22
backstage.io/kubernetes-id: test-jan22
backstage.io/techdocs-ref: dir:.
spec:
type: gitops
owner: user:guest
lifecycle: experimental
dependsOn:
- component:test-jan22
7 changes: 7 additions & 0 deletions components/test-jan22/base/database-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: test-jan22-database-config
data:
VECTORDB_HOST: "test-jan22-database"
VECTORDB_PORT: ""
38 changes: 38 additions & 0 deletions components/test-jan22/base/deployment-database.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/instance: test-jan22-database
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: test-jan22-database
app.kubernetes.io/part-of: test-jan22
name: test-jan22-database
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: test-jan22-database
template:
metadata:
labels:
app.kubernetes.io/instance: test-jan22-database
spec:
containers:
- image:
name: database
args: [
"--workers",
"1",
"--host",
"0.0.0.0",
"--port",
"",
"--proxy-headers",
"--log-config",
"chromadb/log_config.yml",
"--timeout-keep-alive",
"30"]
ports:
- containerPort:
securityContext:
runAsNonRoot: true
48 changes: 48 additions & 0 deletions components/test-jan22/base/deployment-model-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/instance: test-jan22-model-server
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: test-jan22-model-server
app.kubernetes.io/part-of: test-jan22
name: test-jan22-model-server
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: test-jan22-model-server
template:
metadata:
labels:
app.kubernetes.io/instance: test-jan22-model-server
spec:
initContainers:
- name: model-file
image: quay.io/redhat-ai-dev/mistral-7b-code-16k-qlora:latest
command: ['/usr/bin/install', '/model/model.file', '/shared/']
volumeMounts:
- name: model-file
mountPath: /shared
containers:
- env:
- name: HOST
value: "0.0.0.0"
- name: PORT
value: "8001"
- name: MODEL_PATH
value: /model/model.file
- name: CHAT_FORMAT
value: openchat
image: quay.io/ai-lab/llamacpp_python:latest
volumeMounts:
- name: model-file
mountPath: /model
name: app-model-service
ports:
- containerPort: 8001
securityContext:
runAsNonRoot: true
volumes:
- name: model-file
emptyDir: {}
34 changes: 34 additions & 0 deletions components/test-jan22/base/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
tad.gitops.set/image: ".spec.template.spec.containers[0].image"
tad.gitops.get/image: ".spec.template.spec.containers[0].image"
tad.gitops.set/replicas: ".spec.replicas"
tad.gitops.get/replicas: ".spec.replicas"
labels:
app.kubernetes.io/instance: test-jan22
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: test-jan22
app.kubernetes.io/part-of: test-jan22
name: test-jan22
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: test-jan22
template:
metadata:
labels:
app.kubernetes.io/instance: test-jan22
spec:
containers:
- image: quay.io/redhat-ai-dev/ai-template-bootstrap-app:latest
name: app-inference
envFrom:
- configMapRef:
name: test-jan22-model-config
ports:
- containerPort: 8501
securityContext:
runAsNonRoot: true
42 changes: 42 additions & 0 deletions components/test-jan22/base/initialize-namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: batch/v1
kind: Job
metadata:
name: initialize-namespace-test-jan22-gitops
spec:
template:
metadata:
name: initialize-namespace-test-jan22-gitops
spec:
serviceAccountName: pipeline
containers:
- name: initialize-namespace
image: quay.io/redhat-ai-dev/utils:latest
command:
- /bin/bash
- -c
- |
NS=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
echo "Initialize RHDH Namespace: $NS"
cat <<CONFIGURE_PIPELINE | oc create -f -
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
generateName: dev-namespace-setup-
namespace: $NS
spec:
pipelineSpec:
tasks:
- name: configure-namespace
taskRef:
kind: Task
params:
- name: kind
value: task
- name: name
value: dev-namespace-setup
- name: namespace
value: ai-rhdh
resolver: cluster
CONFIGURE_PIPELINE
restartPolicy: Never
16 changes: 16 additions & 0 deletions components/test-jan22/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
argocd/app-name: test-jan22
janus-idp.io/tekton: test-jan22
backstage.io/kubernetes-id: test-jan22
backstage.io/kubernetes-namespace: rhdh-app
app.kubernetes.io/part-of: test-jan22
resources:
- initialize-namespace.yaml
- deployment-model-server.yaml
- service-model-server.yaml
- deployment.yaml
- route.yaml
- service.yaml
- model-config.yaml
6 changes: 6 additions & 0 deletions components/test-jan22/base/model-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: test-jan22-model-config
data:
MODEL_ENDPOINT: "http://test-jan22-model-server:8001"
16 changes: 16 additions & 0 deletions components/test-jan22/base/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/instance: test-jan22
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: test-jan22
name: test-jan22
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 100Gi
54 changes: 54 additions & 0 deletions components/test-jan22/base/rhoai/create-imagestream.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
apiVersion: batch/v1
kind: Job
metadata:
name: create-imagestream-test-jan22-gitops
spec:
template:
metadata:
name: create-imagestream-test-jan22-gitops
spec:
serviceAccountName: test-jan22-dsp-job
containers:
- name: create-imagestream
image: quay.io/redhat-ai-dev/utils:latest

command:
- /bin/bash
- -c
- |
# Check for image stream and create it not present
echo "Checking if the image stream exist"
if ! oc get is custom-sqlite3-odh-minimal-notebook-container -n redhat-ods-applications >/dev/null 2>&1 ; then
echo "The image stream does not exist, a new image stream will be created"
cat <<EOF | oc apply -f -
kind: ImageStream
apiVersion: image.openshift.io/v1
metadata:
annotations:
opendatahub.io/notebook-image-name: custom-sqlite3-odh-minimal-notebook-container
opendatahub.io/notebook-image-url: 'quay.io/redhat-ai-dev/odh-minimal-notebook-container:v2-2024a-20240523-sqlite3'
name: custom-sqlite3-odh-minimal-notebook-container
namespace: redhat-ods-applications
labels:
opendatahub.io/dashboard: 'true'
opendatahub.io/notebook-image: 'true'
spec:
lookupPolicy:
local: true
tags:
- name: v2-2024a-20240523-sqlite3
annotations:
openshift.io/imported-from: 'quay.io/redhat-ai-dev/odh-minimal-notebook-container:v2-2024a-20240523-sqlite3'
from:
kind: DockerImage
name: 'quay.io/redhat-ai-dev/odh-minimal-notebook-container:v2-2024a-20240523-sqlite3'
generation: 2
importPolicy:
importMode: Legacy
referencePolicy:
type: Source
EOF
else
echo "Image stream is already present, skipping create"
fi
restartPolicy: Never
21 changes: 21 additions & 0 deletions components/test-jan22/base/rhoai/dsp-clone-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: batch/v1
kind: Job
metadata:
name: dsp-clone-job-test-jan22-gitops
spec:
template:
metadata:
name: dsp-clone-job-test-jan22-gitops
spec:
serviceAccountName: test-jan22-dsp-job
containers:
- name: initialize-dsp
image: quay.io/redhat-ai-dev/utils:latest
command:
- /bin/bash
- -c
- |
NS=$(cat /var/run/secrets/kubernetes.io/serviceaccount/namespace)
oc wait -l statefulset=test-jan22-notebook --for=condition=ready pod --timeout=300s
oc exec StatefulSet/test-jan22-notebook -- git clone https://github.com/jdubrick-ai/test-jan22
restartPolicy: Never
12 changes: 12 additions & 0 deletions components/test-jan22/base/rhoai/dsp-job-rb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: test-jan22-dsp-job-rolebinding
subjects:
- kind: ServiceAccount
name: test-jan22-dsp-job
namespace: rhdh-app
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: test-jan22-dsp-job-role
Loading

0 comments on commit 71373c2

Please sign in to comment.