Skip to main content
Version: 0.1.0

Deploying Helm Charts Programmatically

Overview

This guide will show you how to deploy a Helm Chart programmatically using the Zeet GraphQL API. You can use this guide to deploy any Helm Chart from any published Helm Chart repo, or your own git repo.

Prerequisites

Before making API requests, make sure that you have the Zeet GraphQL API ready and working. You can use the Getting Started guide for reference. Before deploying, you'll want to connect a Kubernetes cluster to Zeet. You will need your Team ID, and your Zeet Cluster ID. You can grab those here:

# using v0 API endpoint:
# https://anchor.zeet.co/graphql
query {
currentUser {
teams {
team {
name
user {
id # This is $YOUR_TEAM_ID
clusters {
id # This is $YOUR_CLUSTER_ID
name
}
}
}
}
}
}

Creating a New Project

In order to deploy a Helm Chart using Zeet, you need to create a project. For this example, we'll use the api v1 endpoint. Ensure you are making requests to the correct GraphQL endpoint!

This is a two-step process. First we'll create a project, then we'll trigger a deployment:

# using v1 API endpoint:
# https://anchor.zeet.co/v1/graphql
mutation {
createProject(
input: {
teamId: $YOUR_TEAM_ID
name: "helm-project"
groupName: "api-docs"
subGroupName: "example"
blueprintId: "82114333-f1eb-4ff9-b746-dd0db9e2996d" # Official Helm Chart Blueprint ID
enabled: true
deploys: [
{
defaultWorkflowSteps: [DRIVER_PLAN, DRIVER_APPLY]
helm: {
blueprint: {
source: {
helmRepository: {
repositoryUrl: "https://grafana.github.io/helm-charts"
chart: "grafana"
}
}
}
target: {
clusterId: $YOUR_CLUSTER_ID
namespace: ""
releaseName: "grafana"
}
}
variables: []
}
]
workflow: { steps: [{ action: ORCHESTRATION_DEPLOY }] }
}
) {
id
name
workflow {
id
}
}
}

If successful, you'll get a response like:

{
"data": {
"createProject": {
"id": "d32a73b4-5e1c-4478-947f-6f65b6852bc6", // This is $YOUR_PROJECT_ID
"name": "helm-project",
"workflow": {
"id": "216e2aa9-2343-4ea8-927c-50d8dc7fc331" // This is $YOUR_WORKFLOW_ID
}
}
},
"extensions": {
"requestId": "9f212c26-feaf-418b-914e-079b5f721c55"
}
}

Deploy the Project

Finally, we'll trigger a deployment for our project:

mutation {
submitWorkflow(input: { workflowId: $YOUR_WORKFLOW_ID }) {
id
}
}

You can check the status of your deployment by querying the project:

query {
team(id: $YOUR_TEAM_ID) {
project(id: $YOUR_PROJECT_ID) {
status
}
}
}

Congrats! You've deployed a Helm Chart using the Zeet GraphQL API.