From 2c7efa2e1311c127225fcaae19d6d88ed7ea09c0 Mon Sep 17 00:00:00 2001 From: Nic Jackson Date: Tue, 24 Sep 2024 14:44:01 +0100 Subject: [PATCH] Updated to use latest HCL config, fixing bug with interpolation, updated nomad and k8s images --- Makefile | 7 +++++-- examples/container/container.hcl | 9 +++++++++ go.mod | 2 +- go.sum | 2 ++ pkg/config/resources/k8s/provider_cluster.go | 3 ++- pkg/config/resources/k8s/resource_cluster.go | 4 ++-- pkg/config/resources/nomad/resource_cluster.go | 4 ++-- 7 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 8d336182..20763ca8 100644 --- a/Makefile +++ b/Makefile @@ -54,5 +54,8 @@ generate_mocks: install_local: go build -ldflags "-X main.version=${git_commit}" -gcflags=all="-N -l" -o bin/jumppad main.go - sudo mv /usr/local/bin/jumppad /usr/local/bin/jumppad-old || true - sudo cp bin/jumppad /usr/local/bin/jumppad \ No newline at end of file + sudo mv /usr/bin/jumppad /usr/bin/jumppad-old || true + sudo cp bin/jumppad /usr/bin/jumppad + +remove_local: + sudo mv /usr/bin/jumppad-old /usr/bin/jumppad || true \ No newline at end of file diff --git a/examples/container/container.hcl b/examples/container/container.hcl index 6a5158ca..6f3f6020 100644 --- a/examples/container/container.hcl +++ b/examples/container/container.hcl @@ -112,6 +112,11 @@ resource "container" "consul" { memory = 1024 } + port { + local = 8507 + remote = 8507 + } + port_range { range = "8500-8502" enable_host = true @@ -147,6 +152,10 @@ resource "sidecar" "envoy" { name = "envoyproxy/envoy:v${variable.envoy_version}" } + environment = { + PORT = "${resource.container.consul.port.0.local}" + } + command = ["tail", "-f", "/dev/null"] volume { diff --git a/go.mod b/go.mod index 2afb6a4f..9558caa0 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( github.com/infinytum/raymond/v2 v2.0.5 github.com/jumppad-labs/connector v0.4.0 github.com/jumppad-labs/gohup v0.4.0 - github.com/jumppad-labs/hclconfig v0.24.0 + github.com/jumppad-labs/hclconfig v0.25.0 github.com/jumppad-labs/plugin-sdk v0.1.1-0.20240306185853-c09f71f81b8a github.com/kennygrant/sanitize v1.2.4 github.com/mattn/go-isatty v0.0.20 diff --git a/go.sum b/go.sum index 392a1950..b92f7f2f 100644 --- a/go.sum +++ b/go.sum @@ -692,6 +692,8 @@ github.com/jumppad-labs/gohup v0.4.0 h1:0OplHvnKnOLkqWm417sRHLSiJ4xGeb8LiSSAJ51Q github.com/jumppad-labs/gohup v0.4.0/go.mod h1:JYvZnemxJlWDyx8RbDNcCBLZSvIrYlYLnkQqR1BKFW4= github.com/jumppad-labs/hclconfig v0.24.0 h1:SyMCl2rwLC5o32CCp50fsVbJxyFFCiYoMejvfh9RJKM= github.com/jumppad-labs/hclconfig v0.24.0/go.mod h1:AOzW0btnKiqUKYVi3ioGzSPNCWsTzsJxKcqzVORccvk= +github.com/jumppad-labs/hclconfig v0.25.0 h1:CRIprG+i+Ol9s2izb6PRrt23kyGYZ1OC/XGFqdI1o/M= +github.com/jumppad-labs/hclconfig v0.25.0/go.mod h1:AOzW0btnKiqUKYVi3ioGzSPNCWsTzsJxKcqzVORccvk= github.com/jumppad-labs/log v0.0.0-20240827082827-4404884e31a7 h1:tuoFYWXAqT5BheDlQNumY1DxvkW8bjG9JOzoxpFneZs= github.com/jumppad-labs/log v0.0.0-20240827082827-4404884e31a7/go.mod h1:S9jhxE2C1+jv2PlLTAow3h+ZILzvXRhd6eBjFAUcfgI= github.com/jumppad-labs/plugin-sdk v0.1.1-0.20240306185853-c09f71f81b8a h1:fqPvAO1o/6bUIm0fwEbXcUzUCng+GDlLmSMT/5oUJUE= diff --git a/pkg/config/resources/k8s/provider_cluster.go b/pkg/config/resources/k8s/provider_cluster.go index af78b20d..87891be4 100644 --- a/pkg/config/resources/k8s/provider_cluster.go +++ b/pkg/config/resources/k8s/provider_cluster.go @@ -419,7 +419,8 @@ func (p *ClusterProvider) createK3s(ctx context.Context) error { "--kube-proxy-arg=conntrack-max-per-core=0", disableArgs, fmt.Sprintf("--snapshotter=%s", snapShotter), - fmt.Sprintf("--tls-san=%s", FQDN), + fmt.Sprintf("--tls-san=%s", FQDN), // add the FQDN for the server + fmt.Sprintf("--tls-san=%s", utils.GetDockerIP()), // add the docker host IP clusterToken, } diff --git a/pkg/config/resources/k8s/resource_cluster.go b/pkg/config/resources/k8s/resource_cluster.go index 07c48248..258df9c8 100644 --- a/pkg/config/resources/k8s/resource_cluster.go +++ b/pkg/config/resources/k8s/resource_cluster.go @@ -74,8 +74,8 @@ type KubeConfig struct { ClientKey string `hcl:"client_key" json:"client_key"` // base64 encoded client key } -const k3sBaseImage = "shipyardrun/k3s" -const k3sBaseVersion = "v1.27.4" +const k3sBaseImage = "ghcr.io/jumppad-labs/kubernetes" +const k3sBaseVersion = "v1.31.1" func (k *Cluster) Process() error { if k.APIPort == 0 { diff --git a/pkg/config/resources/nomad/resource_cluster.go b/pkg/config/resources/nomad/resource_cluster.go index 4164586c..d0ebd4ae 100644 --- a/pkg/config/resources/nomad/resource_cluster.go +++ b/pkg/config/resources/nomad/resource_cluster.go @@ -61,8 +61,8 @@ type NomadCluster struct { ExternalIP string `hcl:"external_ip,optional" json:"external_ip,omitempty"` } -const nomadBaseImage = "shipyardrun/nomad" -const nomadBaseVersion = "1.7.5" +const nomadBaseImage = "ghcr.io/jumppad-labs/nomad" +const nomadBaseVersion = "v1.8.4" type Config struct { // Specifies configuration for the Docker driver.