Skip to content

Commit

Permalink
feat: deploy flux to tilia cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
juliuste committed Sep 17, 2023
1 parent d926094 commit 6469163
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
16 changes: 16 additions & 0 deletions cloud-resources/flux.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
provider "flux" {
kubernetes = module.kube-hetzner.kubeconfig_data
git = {
url = "ssh://git@github.com/${local.github_org}/${local.github_repo}.git"
ssh = {
username = "git"
private_key = tls_private_key.flux_key.private_key_pem
}
}
}

resource "flux_bootstrap_git" "flux_tilia" {
depends_on = [github_repository_deploy_key.github_deploy_key_flux]
path = "kubernetes/clusters/tilia"
components_extra = ["image-reflector-controller", "image-automation-controller"]
}
18 changes: 18 additions & 0 deletions cloud-resources/github.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
variable "github_token" {}

provider "github" {
owner = "public-transport"
token = var.github_token
}

resource "tls_private_key" "flux_key" {
algorithm = "ECDSA"
ecdsa_curve = "P256"
}

resource "github_repository_deploy_key" "github_deploy_key_flux" {
title = "flux"
repository = "infrastructure"
key = tls_private_key.flux_key.public_key_openssh
read_only = false
}
10 changes: 9 additions & 1 deletion cloud-resources/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ terraform {
}
hcloud = {
source = "hetznercloud/hcloud"
version = ">= 1.41.0"
version = "~> 1.42.0"
}
flux = {
source = "fluxcd/flux"
version = "~> 1.1.0"
}
github = {
source = "integrations/github"
version = "~> 5.37.0"
}
}
}

0 comments on commit 6469163

Please sign in to comment.