Environment Install and Setup: DEV and PROD Cluster

Parasol-insurance-dev cluster

Follow the following steps to complete the install and setup:

  • After the cluster is running and ready, log in as the admin

  • Copy the login token as shown in the image. Paste it in the terminal and run it. This should log you into the cluster through the terminal.

Copy the login token

If you have certificate errors to login to the cluster, remember to use --insecure-skip-tls-verify=true in the login command.

Setting up ai-accelerator project for Dev cluster

Instructions to fork ai-accelerator
  • Log into your git account and fork the following repository:

https://github.com/redhat-ai-services/ai-accelerator.git
  • Once forked, clone the repository to your local machine.

git clone https://github.com/{Git_ID}/ai-accelerator.git
  • Navigate to the cloned folder with the command:

cd ai-accelerator/

The ai-accelerator project uses Kustomize and GitOps/ArgoCD to deploy our project. It uses the bootstrap.sh script to deploy GitOps on the cluster. After GitOps is installed onto the cluster, it will then apply an overlay.

The overlay determines which folder/versions to apply to the cluster. This allows you to reuse components and files across multiple instances with different setups.

In our case, we want to set up a parasol-insurance-dev overlay.

  1. Open the the redhat-ai-services/ai-accelerator fork that was cloned earlier in your code editor.

  2. Change the git repoUrl at components/argocd/apps/base/tenants-applicationset.yaml to your forked repository URL.

    Change repoUrl
  3. Next lets create a new overlay named parasol-insurance-dev. Copy componets/argocd/apps/overlays/rhoai-fast and paste it as components/argocd/apps/overlays/parasol-insurance-dev.

  4. Change the line 7 of the patch-cluster-config-app-of-apps.yaml file to path: parasol-insurance-dev.

    Patch cluster path
  5. Change the line 3 of the patch-tenants-applicationset.yaml file to value: tenants/*/*/overlays/parasol-insurance-dev.

    Patch application set
  6. Next, create a new folder under the bootstrap/overlays folder named parasol-insurance-dev.

    ParaSol Insurance Dev Overlay
  7. In the bootstrap/overlays/parasol-insurance-dev folder, create a new file named kustomization.yaml add the below to the file.

    kustomization.yaml
    apiVersion: kustomize.config.k8s.io/v1beta1
    kind: Kustomization
    
    resources:
    - ../../base
    - ../../../clusters/overlays/parasol-insurance-dev
    As you can see, the Kustomization resource from above is referencing the clusters/overlays/parasol-insurance-dev folder. Let’s create that folder
  8. Create a new folder named parasol-insurance-dev in the clusters/overlays folder.

  9. In the clusters/overlays/parasol-insurance-dev folder, create a new file named kustomization.yaml add the below content to the file:

    kustomization.yaml
    apiVersion: kustomize.config.k8s.io/v1beta1
    kind: Kustomization
    
    namespace: openshift-gitops
    
    resources:
      - ../../base
      - ../../../components/argocd/apps/overlays/parasol-insurance-dev
    
    patches:
      # set the repo and branch for applications
      - path: patch-application-repo-revision.yaml
        target:
          group: argoproj.io
          kind: Application
    
    replacements:
      - source:
          kind: Application
          fieldPath: spec.source.repoURL
        targets:
          - select:
              kind: ApplicationSet
            fieldPaths:
              - spec.template.spec.source.repoURL
          - select:
              kind: ApplicationSet
              name: tenants
            fieldPaths:
              - spec.generators.*.git.repoURL
      - source:
          kind: Application
          fieldPath: spec.source.targetRevision
        targets:
          - select:
              kind: ApplicationSet
            fieldPaths:
              - spec.template.spec.source.targetRevision
          - select:
              kind: ApplicationSet
              name: tenants
            fieldPaths:
              - spec.generators.*.git.revision
  10. In the clusters/overlays/parasol-insurance-dev folder, create a new file named patch-applicationset-manual-sync.yaml add the below content to the file:

    patch-applicationset-manual-sync.yaml
    - op: remove
      path: /spec/template/spec/syncPolicy
  11. In the clusters/overlays/parasol-insurance-dev, create a new file named patch-application-manual-sync.yaml add the below content to the file:

    patch-application-manual-sync.yaml
    - op: remove
      path: /spec/syncPolicy
  12. In the clusters/overlays/parasol-insurance-dev folder, create a new file named patch-application-repo-revision.yaml add the below content to the file. Replace the repoURL with your fork URL.

    patch-application-repo-revision.yaml
    - op: replace
      path: /spec/source/repoURL
      value: 'https://github.com/{GIT_ID}/ai-accelerator.git'
    - op: replace
      path: /spec/source/targetRevision
      value: main

    Replace {GIT_ID} with your GitHub ID.

  13. In the tenants folder, create a new folder named parasol-insurance. Here is where we’ll be adding our new resources.

  14. In the tenants/parasol-insurance folder, create a folder named namespaces

  15. In the tenants/parasol-insurance/namespaces folder, create the base and overlays folders.

    Remember to add the base and overlays files and folders. Make sure you have the parasol-insurance-dev overlay in the overlays folder for Argo to pick up what it needs for the parasol-insurance-dev environment.
  16. In the tentans/parasol-insurance/namespaces/base folder, create a new file named kustomization.yaml add the below content to the file:

    kustomization.yaml
    apiVersion: kustomize.config.k8s.io/v1beta1
    kind: Kustomization
    
    resources:
      - parasol-insurance.yaml
  17. In the tenants/parasol-insurance/namespaces/base folder, create a new file named parasol-insurance.yaml add the below content to the file:

    parasol-insurance.yaml
    apiVersion: v1
    kind: Namespace
    metadata:
      name: parasol-insurance
      labels:
        opendatahub.io/dashboard: "true"
        kubernetes.io/metadata.name: parasol-insurance
        modelmesh-enabled: "true"
  18. In the tenants/parasol-insurance/namespaces/overlays folder, create a new folder named parasol-insurance-dev.

  19. In the tenants/parasol-insurance/namespaces/overlays/parasol-insurance-dev folder, create a new file named kustomization.yaml add the below content to the file:

    kustomization.yaml
    apiVersion: kustomize.config.k8s.io/v1beta1
    kind: Kustomization
    
    resources:
      - ../../base

    The opendatahub.io/dashboard: "true" label is used to identify the namespace as a RHOAI data science project.

    Our first component for the parasol-insurance tenant is the namespace.

    This namespace is defined to be created in the parasol-insurance-dev environment as per the parasol-insurance-dev overlay.

  20. Push the changes to your forked repository.

    push_changes
    git add .
    git commit -m "Add parasol-insurance-dev overlay"
    git push origin main
  21. Make sure you are logged into the Dev cluster and run the bootstrap script by running the bootstrap.sh script.

    ./bootstrap.sh
    ...
    
    1. bootstrap/overlays/parasol-insurance-dev/
    2. bootstrap/overlays/rhoai-eus-2.8-aws-gpu/
    3. bootstrap/overlays/rhoai-eus-2.8/
    4. bootstrap/overlays/rhoai-fast-aws-gpu/
    5. bootstrap/overlays/rhoai-fast/

    For parasol-insurance-dev environments type the number 1 and press Enter.

  22. After the script is done, you can check the ArgoCD console to see the applications deployed. It will install RHOAI and relevent operators.

    ArgoCD Apps

    Notice that the parasol-insurance-namespaces application was also deployed.

  23. Navigate to RHOAI, and validate that there is a data science project created with the name parasol-insurance.

    RHOAI Data Science Project

To check your work please refer to This Dev Branch

Parasol-insurance-prod cluster

The steps to set up the parasol-insurance-prod cluster are the same as parasol-insurance-dev, except change dev to prod in the kustomization files and folders.

Make the changes for prod in your forked repository and use it to set up the prod cluster.

When running the bootstrap script, select bootstrap/overlays/parasol-insurance-prod

To check your work please refer to This Prod Branch

Questions for Further Consideration

Additional questions that could be discussed for this topic:

  1. How familiar are your development teams with CI/CD concepts?

  2. How do you currently deploy project to development, QA and Production environments?

  3. Is ArgoCD new to the team?