Skip to content

Commit

Permalink
add file upstream for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jarededwards committed Nov 19, 2024
1 parent c8beea2 commit 6cd9028
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,4 @@ go.work.sum
tmp/
dist/
.vscode
./templates
colony.yaml
colony.yaml.tmpl
vendor/
13 changes: 6 additions & 7 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/konstructio/colony/internal/docker"
"github.com/konstructio/colony/internal/k8s"
"github.com/konstructio/colony/internal/logger"
"github.com/konstructio/colony/manifests/templates"
"github.com/konstructio/colony/manifests"
"github.com/konstructio/colony/scripts"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -167,22 +167,21 @@ func getInitCommand() *cobra.Command {
}

log.Info("Applying tinkerbell templates")
colonyTemplates, err := templates.Templates.ReadDir(".")
colonyTemplates, err := manifests.Templates.ReadDir(".")
if err != nil {
return fmt.Errorf("error reading templates: %w", err)
}
var manifests []string
var manifestsFiles []string

for _, file := range colonyTemplates {
content, err := templates.Templates.ReadFile(file.Name())
content, err := manifests.Templates.ReadFile(file.Name())
if err != nil {
return fmt.Errorf("error reading templates file: %w", err)
}
manifests = append(manifests, string(content))

manifestsFiles = append(manifestsFiles, string(content))
}

if err := k8sClient.ApplyManifests(ctx, manifests); err != nil {
if err := k8sClient.ApplyManifests(ctx, manifestsFiles); err != nil {
return fmt.Errorf("error applying templates: %w", err)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func (c *Client) CreateColonyK3sContainer(ctx context.Context, loadBalancerIP, l
log := logger.New(logger.Debug)

// TODO tag a new repo for permanent housing, removes templates from database
colonyTemplateURL := "https://raw.githubusercontent.com/jarededwards/k3s-datacenter/refs/heads/main/helm/colony.yaml.tmpl"
colonyTemplateURL := "https://raw.githubusercontent.com/konstructio/colony/refs/heads/add-jobs/manifests/k3s-bootstrap/colony.yaml.tmpl"
colonyTemplateYaml := filepath.Join(pwd, fmt.Sprintf("%s.tmpl", constants.ColonyYamlPath))

err := download.FileFromURL(colonyTemplateURL, colonyTemplateYaml)
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions manifests/templates.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package manifests

import (
"embed"
)

//go:embed templates/*.yaml
var Templates embed.FS

//go:embed colony/*.yaml.tmpl
var Colony embed.FS
8 changes: 0 additions & 8 deletions manifests/templates/templates.go

This file was deleted.

0 comments on commit 6cd9028

Please sign in to comment.