Removing hash at end of cluster name

This commit is contained in:
vandomej 2025-09-28 17:52:27 -07:00
parent 81bf9e28bf
commit b06d9ad39e
4 changed files with 7 additions and 25 deletions

View file

@ -381,7 +381,7 @@ cluster:
# Provides control plane specific configuration options.
controlPlane:
endpoint: https://10.5.0.2:6443 # Endpoint is the canonical controlplane endpoint, which can be an IP address or a DNS hostname.
clusterName: evo-npcs-infra-96c16945 # Configures the cluster's name.
clusterName: evo-npcs-infra # Configures the cluster's name.
# Provides cluster specific network configuration options.
network:
dnsDomain: cluster.local # The domain used by Kubernetes DNS.

View file

@ -1,6 +1,6 @@
context: evo-npcs-infra-96c16945
context: evo-npcs-infra
contexts:
evo-npcs-infra-96c16945:
evo-npcs-infra:
endpoints: []
ca: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJQakNCOGFBREFnRUNBaEFEZWlMUlkxdXNWMURsc3VmOGh1Y2dNQVVHQXl0bGNEQVFNUTR3REFZRFZRUUsKRXdWMFlXeHZjekFlRncweU5UQTVNamt3TURFNU1UbGFGdzB6TlRBNU1qY3dNREU1TVRsYU1CQXhEakFNQmdOVgpCQW9UQlhSaGJHOXpNQ293QlFZREsyVndBeUVBcUpsMS9uNmRLVjNMazZwT01kN0pCU2RpMlljdGNaTnFDeFVtCjRSY0J5RHlqWVRCZk1BNEdBMVVkRHdFQi93UUVBd0lDaERBZEJnTlZIU1VFRmpBVUJnZ3JCZ0VGQlFjREFRWUkKS3dZQkJRVUhBd0l3RHdZRFZSMFRBUUgvQkFVd0F3RUIvekFkQmdOVkhRNEVGZ1FVOTQ2UUoreXdHNVFqMGpabApFWUZnbWdwZUd6a3dCUVlESzJWd0EwRUFYb2RmTHBtMnVrcmdzOFVqZDFOeWJpN2ZtWUVCTkQzZzFKbzhWMlVKCkZnWkR2aEFTSENpT3gvNkxSM2tPQVIybGtjbC95QktZai9YUUM3MWtzdmR5Qnc9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
crt: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJLRENCMjZBREFnRUNBaEFYaG85d1NYbHhIUEcvMHd0YkNER1NNQVVHQXl0bGNEQVFNUTR3REFZRFZRUUsKRXdWMFlXeHZjekFlRncweU5UQTVNamt3TURFNU1UbGFGdzB5TmpBNU1qa3dNREU1TVRsYU1CTXhFVEFQQmdOVgpCQW9UQ0c5ek9tRmtiV2x1TUNvd0JRWURLMlZ3QXlFQVZZbVpqOGZxYUNJb282NnNMZDAyWEdUL0dmNC90VW00ClpSOVNDY2VjbURtalNEQkdNQTRHQTFVZER3RUIvd1FFQXdJSGdEQVRCZ05WSFNVRUREQUtCZ2dyQmdFRkJRY0QKQWpBZkJnTlZIU01FR0RBV2dCVDNqcEFuN0xBYmxDUFNObVVSZ1dDYUNsNGJPVEFGQmdNclpYQURRUUJUd09hQgpOczVIM09Beld6bjVzTm9xT2pZNzY5MkxhRnhXV3hGWXRhZFpyS3ZhcWt5V0xHdWx1ZmR1ajFRTU0wU2lvdlhoCndZTkEzNWh5SWkwTzZjSUkKLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=

View file

@ -384,7 +384,7 @@ cluster:
# Provides control plane specific configuration options.
controlPlane:
endpoint: https://10.5.0.2:6443 # Endpoint is the canonical controlplane endpoint, which can be an IP address or a DNS hostname.
clusterName: evo-npcs-infra-96c16945 # Configures the cluster's name.
clusterName: evo-npcs-infra # Configures the cluster's name.
# Provides cluster specific network configuration options.
network:
dnsDomain: cluster.local # The domain used by Kubernetes DNS.

View file

@ -34,32 +34,14 @@ variable "talos_version" {
default = "v1.11.1"
}
locals {
# Generate unique cluster name each time
unique_cluster_name = "${var.cluster_name}-${random_id.cluster_suffix.hex}"
}
resource "random_id" "cluster_suffix" {
byte_length = 4
keepers = {
# Regenerate when any of these values change
cluster_name = var.cluster_name
memory_mb = var.memory_mb
vcpu_count = var.vcpu_count
talos_version = var.talos_version
cleanup_script_hash = filesha1("${path.module}/cleanup.sh")
}
}
resource "null_resource" "talos_cluster" {
triggers = {
cluster_name = local.unique_cluster_name
cluster_name = var.cluster_name
memory_mb = var.memory_mb
vcpu_count = var.vcpu_count
talos_version = var.talos_version
config_hash = sha1(join("", [
local.unique_cluster_name,
var.cluster_name,
tostring(var.memory_mb),
tostring(var.vcpu_count),
var.talos_version,
@ -89,7 +71,7 @@ resource "null_resource" "talos_cluster" {
sudo --preserve-env=HOME talosctl cluster create \
--provisioner=qemu \
--name ${self.triggers.cluster_name} \
--talosconfig ${path.module}/talosconfig \
--talosconfig ${path.module}/config/talosconfig \
--controlplanes 1 \
--workers 0 \
--memory ${self.triggers.memory_mb} \