This instruction provides the steps required to deploy a production cluster for Prow.
NOTE: This Prow installation is compatible with the
fbc86f22b087a29d1dcf1f695bf367bbbe73e262
revision in thekubernetes/test-infra
repository, except for the branchprotector image which comes from thee4763975e0ab2d6a78bca446e9dfde1800d47af8
revision inkubernetes/test-infra
.
Use the following tools and configuration:
- Kubernetes 1.10+ on Google Kubernetes Engine (GKE)
- kubectl to communicate with Kubernetes
- gcloud to communicate with Google Cloud Platform (GCP)
- The
kyma-bot
GitHub account - Kubernetes cluster
- Secrets in the Kubernetes cluster:
hmac-token
which is a Prow HMAC token used to validate GitHub webhooksoauth-token
which is a GitHub token with read and write access to thekyma-bot
accountsap-slack-bot-token
which is a token for publishing messages in the SAP CX workspace. Find more information here.
- Two buckets on Google Cloud Storage (GCS), one for storing Secrets and the second for storing logs
- GCP configuration that includes:
- A global static IP address with the
kyma-prow-status
name - A DNS registry for the
status.build.kyma-project.io
domain that points to thekyma-prow-status
address
- A global static IP address with the
- Prepare the workload cluster:
export WORKLOAD_CLUSTER_NAME=kyma-prow-workload
export ZONE=europe-west3-a
export PROJECT=sap-kyma-prow
### In GKE get KUBECONFIG for cluster kyma-prow-workload
gcloud container clusters get-credentials $WORKLOAD_CLUSTER_NAME --zone=$ZONE --project=$PROJECT
./set-up-workload-cluster.sh
This script performs the following steps:
- Creates a ClusterRoleBinding to provide access to the Prow cluster. This way it enables running and monitoring jobs on the workload cluster.
- Creates Kubernetes Secrets resources from secrets fetched from the GCP bucket.
-
Set the context to your Google Cloud project.
Export the PROJECT variable and run this command:
gcloud config set project $PROJECT
- Make sure that kubectl points to the Prow main cluster.
Export these variables:
export CLUSTER_NAME=kyma-prow
export ZONE=europe-west3-a
export PROJECT=sap-kyma-prow
For GKE, run the following command:
gcloud container clusters get-credentials $CLUSTER_NAME --zone=$ZONE --project=$PROJECT
- Export these environment variables:
export BUCKET_NAME=kyma-prow-secrets
export KEYRING_NAME=kyma-prow
export ENCRYPTION_KEY_NAME=kyma-prow-encryption
export GOPATH=$GOPATH ### Ensure GOPATH is set
where:
- BUCKET_NAME is a GCS bucket in the Google Cloud project that stores Prow Secrets.
- KEYRING_NAME is the KMS key ring.
- ENCRYPTION_KEY_NAME is the key name in the key ring that is used for data encryption.
- Run the following script to create a Kubernetes Secret resource in the main Prow cluster. This way the main Prow cluster can access the workload cluster:
./create-secrets-for-workload-cluster.sh
NOTE: Create the workload cluster first and make sure the local kubeconfig for the Prow admin contains the context for this cluster. Point the current kubeconfig to the main Prow cluster.
- Run the following script to start the installation process:
./scripts/install-prow.sh
The installation script performs the following steps to install Prow:
- Deploys the NGINX Ingress Controller
- Creates a ClusterRoleBinding
- Deploys Prow components with the
a202e595a33ac92ab503f913f2d710efabd3de21
revision - Deploys the Cert Manager
- Deploys secure Ingress
- Removes insecure Ingress
-
Verify the installation.
To check if the installation is successful, perform the following steps:
- Check if all Pods are up and running:
kubeclt get pods
- Check if the Deck is accessible from outside of the cluster:
kubectl get ingress tls-ing
- Copy the address of the
tls-ing
Ingress and open it in a browser to display the Prow status on the dashboard.
- Check if all Pods are up and running:
When you use the install-prow.sh
script to install Prow on your cluster, the list of plugins and configuration is empty. You can configure Prow by specifying the config.yaml
and plugins.yaml
files, and adding job definitions to the jobs
directory.
The config.yaml
file contains the basic Prow configuration. When you create a particular Prow job, it uses the Preset definitions from this file. See the example of such a file here.
For more details, see the Kubernetes documentation.
The plugins.yaml
file contains the list of plugins you enable on a given repository. See the example of such a file here.
For more details, see the Kubernetes documentation.
The jobs
directory contains the Prow jobs configuration. See the example of such a file here.
For more details, see the Kubernetes documentation.
To check if the plugins.yaml
, config.yaml
, and jobs
configuration files are correct, run the validate-config.sh {plugins_file_path} {config_file_path} {jobs_dir_path}
script. For example, run:
./validate-config.sh ../prow/plugins.yaml ../prow/config.yaml ../prow/jobs
If the files are configured correctly, upload the files on a cluster.
-
Use the
update-plugins.sh {file_path}
script to apply plugin changes on a cluster../update-plugins.sh ../prow/plugins.yaml
-
Use the
update-config.sh {file_path}
script to apply Prow configuration on a cluster../update-config.sh ../prow/config.yaml
-
Use the
update-jobs.sh {jobs_dir_path}
script to apply jobs configuration on a cluster../update-jobs.sh ../prow/jobs
After you complete the required configuration, you can test the uploaded plugins and configurations. You can also create your own job pipeline and test it against the forked repository.
To clean up everything created by the installation script, run the removal script:
./remove-prow.sh