The game is composed of two separate components; the image recognition service provided by OpenShift AI (OpenShift DataScience), and the game components. These are deployed into separate Projects on the OpenShift cluster.
NOTE: A user with the cluster-admin
role assigned to them is required to
deploy the game. You also need the oc
CLI installed on your machine.
Begin by installing the Red Hat OpenShift DataScience operator via OperatorHub in the OpenShift Web Console:
Wait 3 or 4 minutes until the operator is ready, to give time to register all controllers and CRDs.
Then you'll need to login into the OpenShift cluster from a terminal and run the following command to install the AI model:
# Login as a valid OpenShift user with cluster-admin permissions
oc login
cd ai
make
After this, the model is installed, the AI service is running in the rps-ai-service
namespace, and you can continue with the installation process of the game.
You can deploy the game using regular CLI commands, or using GitOps.
You'll need helm
3.12+, and oc
:
export NAMESPACE="rps-game"
# Create the namespace for the application
oc new-project $NAMESPACE
# Generate and apply YAML manifests or use helm install
helm template helm/ --namespace $NAMESPACE | oc apply -f -
This requires an OpenShift cluster that you have access to a user with cluster-admin
access.
- Login to the OpenShift cluster's web console as the user with
cluster-admin
permission. - Select the Administrator perspective.
- Expand the Operators section and select Operator Hub.
- Type
openshift gitops
in the search box and click the Red Hat OpenShift GitOps operator from the list. - Follow the prompts to install the
stable
version of the operator.
Once the Operator is ready you can find the link to Argo CD (provided and managed by OpenShift GitOps) in the Application Launcher. The password to login as the admin
user can be found in the openshift-gitops-cluster
Secret in the openshift-gitops
namespace as shown:
- Login to the Argo CD instance using the username
admin
and the password you obtained from theopenshift-gitops-cluster
Secret in theopenshift-gitops
. - Click the New App button. An overlay appears.
- Click the Edit as YAML button in the overlay.
- Paste in the following YAML to deploy the game using non-production values:
apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: rps-game spec: destination: name: '' namespace: rps-game server: 'https://kubernetes.default.svc' source: path: helm repoURL: 'https://github.com/redhat-developer-demos/rps-game-manifests' targetRevision: HEAD helm: valueFiles: - values.yaml project: default syncPolicy: automated: prune: true selfHeal: true syncOptions: - CreateNamespace=true
- Click Save, then click Create.
- Label the newly created namesapce to provide GitOps with admin rights to manage it and deploy resources within it:
oc label namespace rps-game argocd.argoproj.io/managed-by=openshift-gitops
NOTE: use the values.production.yaml file if you need to allocate more resources for a large audience!