Skip to content

Commit

Permalink
Merge pull request #277 from jumppad-labs/f-plugins
Browse files Browse the repository at this point in the history
F plugins
  • Loading branch information
nicholasjackson committed Feb 29, 2024
2 parents 352d9a9 + 7beece4 commit e6d810e
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 41 deletions.
8 changes: 6 additions & 2 deletions .dagger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (d *JumppadCI) Release(ctx context.Context, src *Directory, archives *Direc
d.UpdateGemFury(ctx, version, gemfuryToken, archives)

// update latest version on website
d.UpdateWebsite(ctx, version, gemfuryToken)
d.UpdateWebsite(ctx, version, githubToken)

return version, d.lastError
}
Expand Down Expand Up @@ -267,7 +267,11 @@ func (d *JumppadCI) Archive(ctx context.Context, binaries *Directory, version st
return nil, d.lastError
}

checksums.WriteString(fmt.Sprintf("%s %s\n", cs, outPath))
// checksum is returned as "checksum filename" we need to remove the filename as it is not
// the same as the release name
csParts := strings.Split(cs, " ")

checksums.WriteString(fmt.Sprintf("%s %s\n", csParts[0], outPath))
}

out = out.WithNewFile("checksums.txt", checksums.String())
Expand Down
15 changes: 10 additions & 5 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Change Log

## version v0.5.60
## version v0.9.1
* Update internal references to use the new `local.jmpd.in` domain bypassing
problems where chrome auto redirects .dev to https://.
* Update Nomad to 1.7.5

## version v0.7.0
* Add capability to add custom container registries to the image cache

Nomad and Kuberentes clusters are started in a Docker container that does not save any state to the local disk.
Expand All @@ -25,8 +30,8 @@
```hcl
# Define a custom registry that does not use authentication
resource "container_registry" "noauth" {
hostname = "noauth-registry.demo.gs" // cache can not resolve local jumppad.dev dns for some reason,
// using external dns mapped to the local ip address
hostname = "noauth-registry.demo.gs" // cache can not resolve local.jmpd.in dns for some reason,
// using external dns mapped to the local ip address
}
# Define a custom registry that uses authentication
Expand Down Expand Up @@ -62,8 +67,8 @@ resource "nomad_cluster" "dev" {
// add configuration to allow cache bypass and insecure registry
config {
docker {
no_proxy = ["insecure.container.jumppad.dev"]
insecure_registries = ["insecure.container.jumppad.dev:5003"]
no_proxy = ["insecure.container.local.jmpd.in"]
insecure_registries = ["insecure.container.local.jmpd.in:5003"]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func writeLogOutput(rc io.ReadCloser, stdout, stderr io.Writer, name string, c c
dat := make([]byte, count)
_, err = rc.Read(dat)

name = strings.TrimSuffix(name, ".jumppad.dev")
name = strings.TrimSuffix(name, utils.LocalTLD)
colorWriter.Fprintf(w, "[%s] %s", name, string(dat))
}
}
15 changes: 10 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,14 @@ var discordHelp = `
### For help and support join our community on Discord: https://discord.gg/ZuEFPJU69D ###
`

var changesVersion = "v0.7.0"
var changesVersion = "v0.9.1"

var changes = `
## version v0.9.1
* Update internal references to use the new 'local.jmpd.in' domain bypassing
problems where chrome auto redirects .dev to https://.
* Update Nomad to 1.7.5
## version v0.7.0
### Breaking Changes:
Expand Down Expand Up @@ -250,8 +255,8 @@ from insecure registries.
"""hcl
# Define a custom registry that does not use authentication
resource "container_registry" "noauth" {
hostname = "noauth-registry.demo.gs" // cache can not resolve local jumppad.dev dns for some reason,
// using external dns mapped to the local ip address
hostname = "noauth-registry.demo.gs" // cache can not resolve local.jmpd.in dns for some reason,
// using external dns mapped to the local ip address
}
# Define a custom registry that uses authentication
Expand Down Expand Up @@ -287,8 +292,8 @@ resource "nomad_cluster" "dev" {
// add configuration to allow cache bypass and insecure registry
config {
docker {
no_proxy = ["insecure.container.jumppad.dev"]
insecure_registries = ["insecure.container.jumppad.dev:5003"]
no_proxy = ["insecure.container.jmpd.in"]
insecure_registries = ["insecure.container.jmpd.in:5003"]
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/registries/build.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ resource "certificate_leaf" "registry" {
"localhost",
"auth-registry.demo.gs",
"noauth-registry.demo.gs", // have to set an external dns name as the registry resolves docker dns to localhost
"noauth.container.jumppad.dev",
"auth.container.jumppad.dev",
"noauth.container.local.jmpd.in",
"auth.container.local.jmpd.in",
]

output = data("certs")
Expand Down
2 changes: 1 addition & 1 deletion examples/registries/k8s/files/insecure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
spec:
containers:
- name: insecure
image: "insecure.container.jumppad.dev:5003/mine:v0.1.0"
image: "insecure.container.local.jmpd.in:5003/mine:v0.1.0"
ports:
- containerPort: 19092
env:
Expand Down
4 changes: 2 additions & 2 deletions examples/registries/k8s/k8s.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ resource "k8s_cluster" "k3s" {
// add configuration to allow cache bypass and insecure registry
config {
docker {
no_proxy = ["insecure.container.jumppad.dev"]
insecure_registries = ["insecure.container.jumppad.dev:5003"]
no_proxy = ["insecure.container.local.jmpd.in"]
insecure_registries = ["insecure.container.local.jmpd.in:5003"]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/registries/nomad/files/insecure.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ job "insecure" {
}

config {
image = "insecure.container.jumppad.dev:5003/mine:v0.1.0"
image = "insecure.container.local.jmpd.in:5003/mine:v0.1.0"

ports = ["http"]
}
Expand Down
4 changes: 2 additions & 2 deletions examples/registries/nomad/nomad.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ resource "nomad_cluster" "dev" {
// add configuration to allow cache bypass and insecure registry
config {
docker {
no_proxy = ["insecure.container.jumppad.dev"]
insecure_registries = ["insecure.container.jumppad.dev:5003"]
no_proxy = ["insecure.container.local.jmpd.in"]
insecure_registries = ["insecure.container.local.jmpd.in:5003"]
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/clients/connector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func (c *ConnectorImpl) GenerateLeafCert(
return nil, err
}

hosts := []string{"localhost", "*.jumppad.dev", c.options.GrpcBind}
hosts := []string{"localhost", fmt.Sprintf("*.local.%s", utils.LocalTLD), c.options.GrpcBind}
hosts = append(hosts, host...)

lc, err := crypto.GenerateLeaf(
Expand Down Expand Up @@ -325,12 +325,12 @@ func (c *ConnectorImpl) ExposeService(
dir := utils.CertsDir("")
cb, err := c.GetLocalCertBundle(dir)
if err != nil {
return "", fmt.Errorf("Unable to find certificate at location: %s, error: %s", dir, err)
return "", fmt.Errorf("unable to find certificate at location: %s, error: %s", dir, err)
}

cl, err := getClient(cb, c.options.GrpcBind)
if err != nil {
return "", fmt.Errorf("Unable to create grpc client: %s", err)
return "", fmt.Errorf("unable to create grpc client: %s", err)
}

t := shipyard.ServiceType_LOCAL
Expand Down
6 changes: 3 additions & 3 deletions pkg/clients/container/docker_tasks_volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestCreateVolumeDoesNothingWhenVolumeExists(t *testing.T) {
testutils.RemoveOn(&md.Mock, "VolumeList")

args := volume.ListOptions{Filters: filters.NewArgs()}
args.Filters.Add("name", "test.volume.jumppad.dev")
args.Filters.Add("name", "test.volume.jmpd.in")
md.On("VolumeList", mock.Anything, args).Return(volume.ListResponse{Volumes: []*volume.Volume{&volume.Volume{}}}, nil)

p, _ := NewDockerTasks(md, mic, &tar.TarGz{}, logger.NewTestLogger(t))
Expand All @@ -36,7 +36,7 @@ func TestCreateVolumeReturnsErrorWhenVolumeListError(t *testing.T) {
testutils.RemoveOn(&md.Mock, "VolumeList")

args := volume.ListOptions{Filters: filters.NewArgs()}
args.Filters.Add("name", "test.volume.jumppad.dev")
args.Filters.Add("name", "test.volume.jmpd.in")
md.On("VolumeList", mock.Anything, args).Return(volume.ListResponse{}, fmt.Errorf("Boom"))

_, err := p.CreateVolume("test")
Expand All @@ -63,5 +63,5 @@ func TestRemoveVolumeRemotesSuccesfully(t *testing.T) {
err := p.RemoveVolume("test")
assert.NoError(t, err)

md.AssertCalled(t, "VolumeRemove", mock.Anything, "test.volume.jumppad.dev", true)
md.AssertCalled(t, "VolumeRemove", mock.Anything, "test.volume.jmpd.in", true)
}
4 changes: 2 additions & 2 deletions pkg/config/resources/k8s/provider_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func TestClusterK3CreatesAServer(t *testing.T) {
assert.Contains(t, params.Command[2], "--kube-proxy-arg=conntrack-max-per-core=0")
assert.Contains(t, params.Command[3], "--disable=traefik")
assert.Contains(t, params.Command[4], "--snapshotter=overlayfs")
assert.Contains(t, params.Command[5], "--tls-san=server.test.k8s-cluster.jumppad.dev")
assert.Contains(t, params.Command[5], "--tls-san=server.test.k8s-cluster.local.jmpd.in")
}

func TestClusterK3CreatesAServerWithAdditionalPorts(t *testing.T) {
Expand Down Expand Up @@ -616,7 +616,7 @@ func TestClusterK3sDestroyGetsIDr(t *testing.T) {

err := p.Destroy()
assert.NoError(t, err)
md.AssertCalled(t, "FindContainerIDs", "server.test.k8s-cluster.jumppad.dev")
md.AssertCalled(t, "FindContainerIDs", "server.test.k8s-cluster.local.jmpd.in")
}

func TestClusterK3sDestroyWithFindIDErrorReturnsError(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/resources/nomad/resource_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type NomadCluster struct {
}

const nomadBaseImage = "shipyardrun/nomad"
const nomadBaseVersion = "1.6.1"
const nomadBaseVersion = "1.7.5"

type Config struct {
// Specifies configuration for the Docker driver.
Expand Down
12 changes: 7 additions & 5 deletions pkg/utils/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package utils

import "fmt"

var InvalidBlueprintURIError = fmt.Errorf("Inavlid blueprint URI")
var NameExceedsMaxLengthError = fmt.Errorf("Name exceeds the max length of 128 characters")
var NameContainsInvalidCharactersError = fmt.Errorf("Name contains invalid characters characters must be either a-z, A-Z, 0-9, -, _")
var InvalidBlueprintURIError = fmt.Errorf("inavlid blueprint URI")
var NameExceedsMaxLengthError = fmt.Errorf("name exceeds the max length of 128 characters")
var NameContainsInvalidCharactersError = fmt.Errorf("name contains invalid characters characters must be either a-z, A-Z, 0-9, -, _")

// ImageVolumeName is the name of the volume which stores the images for clusters
const ImageVolumeName string = "images"
Expand All @@ -16,10 +16,12 @@ const BuildImagePrefix = "jumppad.dev/localcache"
const CacheName string = "docker-cache"

// Address of the proxy used for caching docker images
const jumppadProxyAddress string = "http://default.image-cache.jumppad.dev:3128"
const jumppadProxyAddress string = "http://default.image-cache.local.jmpd.in:3128"

// Addresses to bypass when using a HTTP Proxy
const ProxyBypass string = "localhost,127.0.0.1,cluster.local,jumppad.dev,svc,consul"
const ProxyBypass string = "localhost,127.0.0.1,cluster.local,jumppad.dev,jumpd.in,svc,consul"

const LocalTLD = "jmpd.in"

const MaxRandomPort = 32767
const MinRandomPort = 30000
6 changes: 3 additions & 3 deletions pkg/utils/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,17 @@ func TestValidatesNameAndReturnsErrorWhenTooLong(t *testing.T) {

func TestFQDNReturnsCorrectValue(t *testing.T) {
fq := FQDN("test", "", "type")
assert.Equal(t, "test.type.jumppad.dev", fq)
assert.Equal(t, "test.type.local.jmpd.in", fq)
}

func TestFQDNReplacesInvalidChars(t *testing.T) {
fq := FQDN("tes&t", "", "kubernetes_cluster")
assert.Equal(t, "tes-t.kubernetes-cluster.jumppad.dev", fq)
assert.Equal(t, "tes-t.kubernetes-cluster.local.jmpd.in", fq)
}

func TestFQDNVolumeReturnsCorrectValue(t *testing.T) {
fq := FQDNVolumeName("test")
assert.Equal(t, "test.volume.jumppad.dev", fq)
assert.Equal(t, "test.volume.jmpd.in", fq)
}

func TestHomeReturnsCorrectValue(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ func ReplaceNonURIChars(s string) (string, error) {

// FQDN generates the full qualified name for a container
func FQDN(name, module, typeName string) string {
fqdn := fmt.Sprintf("%s.%s.jumppad.dev", name, typeName)
fqdn := fmt.Sprintf("%s.%s.local.%s", name, typeName, LocalTLD)
if module != "" {
fqdn = fmt.Sprintf("%s.%s.%s.jumppad.dev", name, module, typeName)
fqdn = fmt.Sprintf("%s.%s.%s.local.%s", name, module, typeName, LocalTLD)
}

// ensure that the name is valid for URI schema
Expand All @@ -115,7 +115,7 @@ func FQDNVolumeName(name string) string {
panic(err)
}

return fmt.Sprintf("%s.volume.jumppad.dev", cleanName)
return fmt.Sprintf("%s.volume.%s", cleanName, LocalTLD)
}

// CreateKubeConfigPath creates the file path for the KubeConfig file when
Expand Down

0 comments on commit e6d810e

Please sign in to comment.