Skip to content

Daniel-OG/ping

Repository files navigation

Ping Helm Chart Deployment

This repository contains a Helm chart for the application "ping", a Terraform module, and a GitHub workflow to deploy it.

Getting Started

  1. Clone the Repository:

    • Clone this repository to your local machine.
  2. Configure the Workflow:

    • Modify the config.json file to set the appropriate environment variables for your GCP project and GKE cluster.
  3. Push to GitHub:

    • Push the changes to your GitHub repository.
  4. Add Secrets:

    • Add the necessary secret GCP_SA_KEY to your GitHub repository.
  5. Trigger the Workflow:

    • Push to the main branch to trigger the GitHub Actions workflow and deploy the Helm chart to your GKE cluster.

NOTE: As part of Challenge 1, a preinstall hook that checks for random-service was added in templates/pre-install-check.yaml. You might want to delete that before testing.

Challenge Solutions

Challenge 1: Helm Chart Configuration

The Helm chart for the "ping" application is configured to meet the following requirements:

  • Node Affinity: Pods are scheduled to avoid specific node groups.
  • Pod Anti-Affinity: Ensures that a pod will not be scheduled on a node that already has a pod of the same type.
  • Topology Spread Constraints: Pods are deployed across different availability zones.
  • Pre-Install Hook: Ensures that another random service is up before applying the manifests.

You can see the configuration for the first three in values.yaml(it was added to deployment.yaml in lines 30-35) For the 4th point i added a job in templates/pre-install-check.yaml, with the helm-hook pre-install that checks whether random-service exists

Challenge 2: Terraform Module

A Terraform module is provided to automate the process of creating a cluster, copying Helm charts from the reference Artifact Registry (reference.gcr.io) to an instance Artifact Registry (instance.gcr.io). The module:

  • Creates an Artifact Registry repository if it does not already exist, and a GKE cluster.
  • Uses a null_resource with a local-exec provisioner to copy the specified Helm charts from the reference registry to the instance registry.

Challenge 3: GitHub Workflow

A GitHub Actions workflow is set up to deploy the Helm chart to a GKE cluster. The workflow:

  • Checks out the repository, sets up the Google Cloud SDK.
  • Initializes and applies the Terraform module to copy the Helm charts.
  • Deploys the Helm chart to the GKE cluster using Helm.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors