generated from mrsimonemms/new
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95a959b
commit 97e6bdd
Showing
12 changed files
with
407 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright 2024 Simon Emms <[email protected]> | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
resource "helm_release" "hcloud_ccm" { | ||
chart = "hcloud-cloud-controller-manager" | ||
name = "hccm" | ||
atomic = true | ||
cleanup_on_fail = true | ||
namespace = "kube-system" | ||
repository = "https://charts.hetzner.cloud" | ||
version = var.hetzner_cloud_config_manager_version | ||
wait = true | ||
|
||
set { | ||
name = "networking.enabled" | ||
value = "true" | ||
} | ||
|
||
set { | ||
name = "networking.clusterCIDR" | ||
value = var.k3s_cluster_cidr | ||
} | ||
|
||
depends_on = [kubernetes_secret_v1.hcloud] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright 2024 Simon Emms <[email protected]> | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
resource "helm_release" "cilium" { | ||
chart = "cilium" | ||
name = "cilium" | ||
atomic = true | ||
cleanup_on_fail = true | ||
namespace = "kube-system" | ||
repository = "https://helm.cilium.io" | ||
version = var.cilium_version | ||
wait = true | ||
|
||
set { | ||
name = "ipv4NativeRoutingCIDR" | ||
value = var.k3s_cluster_cidr | ||
} | ||
|
||
set { | ||
name = "ipam.mode" | ||
value = "kubernetes" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Copyright 2024 Simon Emms <[email protected]> | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
resource "kubernetes_namespace_v1" "external_dns" { | ||
metadata { | ||
name = "external-dns" | ||
} | ||
|
||
wait_for_default_service_account = true | ||
|
||
depends_on = [helm_release.cilium] | ||
} | ||
|
||
resource "kubernetes_secret_v1" "external_dns" { | ||
metadata { | ||
name = "cloudflare" | ||
namespace = kubernetes_namespace_v1.external_dns.metadata[0].name | ||
} | ||
|
||
data = { | ||
cloudflare_api_token = var.cloudflare_api_token | ||
} | ||
|
||
depends_on = [helm_release.cilium] | ||
} | ||
|
||
resource "helm_release" "external_dns" { | ||
chart = "oci://registry-1.docker.io/bitnamicharts/external-dns" | ||
name = "external-dns" | ||
atomic = true | ||
cleanup_on_fail = true | ||
namespace = kubernetes_namespace_v1.external_dns.metadata[0].name | ||
version = var.external_dns_version | ||
wait = true | ||
|
||
set { | ||
name = "provider" | ||
value = "cloudflare" | ||
} | ||
|
||
set { | ||
name = "cloudflare.secretName" | ||
value = kubernetes_secret_v1.external_dns.metadata[0].name | ||
} | ||
|
||
depends_on = [kubernetes_manifest.csi_driver] | ||
} | ||
|
||
resource "random_integer" "load_balancer_id" { | ||
min = 1000 | ||
max = 9999 | ||
} | ||
|
||
resource "helm_release" "ingress_nginx" { | ||
chart = "ingress-nginx" | ||
name = "ingress-nginx" | ||
atomic = true | ||
cleanup_on_fail = true | ||
create_namespace = true | ||
namespace = "ingress-nginx" | ||
repository = "https://kubernetes.github.io/ingress-nginx" | ||
version = var.ingress_nginx_version | ||
wait = true | ||
|
||
dynamic "set" { | ||
for_each = { | ||
"load-balancer.hetzner.cloud/name" = "ingress-nginx-${random_integer.load_balancer_id.result}" | ||
"load-balancer.hetzner.cloud/network-zone" = var.load_balancer_region | ||
"load-balancer.hetzner.cloud/type" = var.load_balancer_type | ||
"load-balancer.hetzner.cloud/use-private-ip" = "true" | ||
"load-balancer.hetzner.cloud/uses-proxyprotocol" = "true" | ||
} | ||
content { | ||
name = "controller.service.annotations.${replace(set.key, ".", "\\.")}" | ||
value = set.value | ||
} | ||
} | ||
|
||
depends_on = [kubernetes_manifest.csi_driver] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.