Skip to content

Commit

Permalink
Merge pull request #82 from defenseunicorns/feature/everything-is-a-c…
Browse files Browse the repository at this point in the history
…omponent

Change zarf init to always install the docker registry
  • Loading branch information
jeff-mccoy authored Oct 6, 2021
2 parents 6cb3958 + 9ac3338 commit cd45237
Show file tree
Hide file tree
Showing 46 changed files with 279 additions and 293 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ generate-release:
needs:
- job: artifact-upload
script:
- release-cli create --name "Zarf ${CI_COMMIT_TAG}" --tag-name "${CI_COMMIT_TAG}" --description "Zarf Utility Cluster"
- release-cli create --name "Zarf ${CI_COMMIT_TAG}" --tag-name "${CI_COMMIT_TAG}" --description "Zarf K8s Airgap Buddy
--assets-link "{\"name\":\"zarf\",\"url\":\"https://zarf-public.s3-us-gov-west-1.amazonaws.com/release/$CI_COMMIT_TAG/zarf\"}"
--assets-link "{\"name\":\"zarf-mac-apple\",\"url\":\"https://zarf-public.s3-us-gov-west-1.amazonaws.com/release/$CI_COMMIT_TAG/zarf-mac-apple\"}"
--assets-link "{\"name\":\"zarf-mac-intel\",\"url\":\"https://zarf-public.s3-us-gov-west-1.amazonaws.com/release/$CI_COMMIT_TAG/zarf-mac-intel\"}"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Meet Zarf, K8s Airgap Buddy

Zarf is a static go binary that runs on various linux distros to deploy an airgap utility cluster including a docker registry and gitea server, batteries included. Zarf also includes an [Appliance Mode](examples/appliance/README.md) that can be used for single-purpose k3s deployments.
Zarf is a static go binary that runs on various linux distros to deploy an airgap gitops service including a docker registry and gitea server, batteries included. Zarf also includes an [Appliance Mode](examples/appliance/README.md) that can be used for single-purpose k3s deployments.

> _This repo is in transition from [Repo1](https://repo1.dso.mil/) by [DoD Platform One](http://p1.dso.mil/) to [Github](https://github.com/defenseunicorns/zarf). See [the announcments post](https://github.com/defenseunicorns/zarf/discussions/1#discussion-3560306) for the latest URLs for this project during this transition._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ spec:
builtIn:
enabled: false
config:
APP_NAME: "Zarf Utility Cluster"
APP_NAME: "Zarf Gitops Service"
server:
DISABLE_SSH: true
OFFLINE_MODE: true
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions assets/misc/registries.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
mirrors:
registry.dso.mil:
endpoint:
- "https://zarf.localhost"
- "https://127.0.0.1"
registry1.dso.mil:
endpoint:
- "https://zarf.localhost"
- "https://127.0.0.1"
docker.io:
endpoint:
- "https://zarf.localhost"
- "https://127.0.0.1"
registry-1.docker.io:
endpoint:
- "https://zarf.localhost"
- "https://127.0.0.1"
2 changes: 1 addition & 1 deletion cli/cmd/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"fmt"

"repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/internal/utils"
"github.com/defenseunicorns/zarf/cli/internal/utils"

"github.com/spf13/cobra"
)
Expand Down
6 changes: 3 additions & 3 deletions cli/cmd/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package cmd
import (
"path/filepath"

"repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/internal/k3s"
"github.com/defenseunicorns/zarf/cli/internal/k3s"

"github.com/AlecAivazis/survey/v2"
"github.com/spf13/cobra"
Expand All @@ -14,7 +14,7 @@ var initOptions = k3s.InstallOptions{}
// initCmd represents the init command
var initCmd = &cobra.Command{
Use: "init",
Short: "Deploys the utility cluster or appliance cluster on a clean linux box",
Short: "Deploys the gitops service or appliance cluster on a clean linux box",
Long: "Flags are only required if running via automation, otherwise the init command will prompt you for your configuration choices",
Run: func(cmd *cobra.Command, args []string) {
handleTLSOptions()
Expand Down Expand Up @@ -68,7 +68,7 @@ func handleTLSOptions() {
func init() {
rootCmd.AddCommand(initCmd)
initCmd.Flags().BoolVar(&initOptions.Confirmed, "confirm", false, "Confirm the install without prompting")
initCmd.Flags().StringVar(&initOptions.PKI.Host, "host", "", "Specify the host or IP for the utility cluster ingress. E.g. host=10.10.10.5 or host=utility.domain.com")
initCmd.Flags().StringVar(&initOptions.PKI.Host, "host", "", "Specify the host or IP for the gitops service ingress. E.g. host=10.10.10.5 or host=gitops.domain.com")
initCmd.Flags().StringVar(&initOptions.PKI.CertPublicPath, "server-crt", "", "Path to the server public key if not generating unique PKI")
initCmd.Flags().StringVar(&initOptions.PKI.CertPrivatePath, "server-key", "", "Path to the server private key if not generating unique PKI")
initCmd.Flags().StringVar(&initOptions.Components, "components", "", "Comma-separated list of components to install. Adding this flag will skip the init prompts for which components to install")
Expand Down
8 changes: 4 additions & 4 deletions cli/cmd/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"path/filepath"

"github.com/AlecAivazis/survey/v2"
"github.com/defenseunicorns/zarf/cli/config"
"github.com/defenseunicorns/zarf/cli/internal/packager"
"github.com/spf13/cobra"
"repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/config"
"repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/internal/packager"
)

var confirmCreate bool
Expand All @@ -15,12 +15,12 @@ var deployComponents string

var packageCmd = &cobra.Command{
Use: "package",
Short: "Pack and unpack updates for the Zarf utility cluster.",
Short: "Pack and unpack updates for the Zarf gitops service.",
}

var packageCreateCmd = &cobra.Command{
Use: "create",
Short: "Create an update package to push to the utility server (runs online)",
Short: "Create an update package to push to the gitops server (runs online)",
Run: func(cmd *cobra.Command, args []string) {
packager.Create(confirmCreate)
},
Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/pki.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cmd

import (
"github.com/defenseunicorns/zarf/cli/internal/utils"
"github.com/spf13/cobra"
"repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/internal/utils"
)

var pkiOptions = utils.PKIConfig{}
Expand Down Expand Up @@ -33,7 +33,7 @@ func init() {
pkiCmd.AddCommand(pkiRegenerate)
pkiCmd.AddCommand(pkiImport)

pkiRegenerate.Flags().StringVar(&pkiOptions.Host, "host", "zarf-server", "Specify the host or IP for the utility cluster ingress")
pkiRegenerate.Flags().StringVar(&pkiOptions.Host, "host", "zarf-server", "Specify the host or IP for the gitops service ingress")
_ = pkiRegenerate.MarkFlagRequired("host")

pkiImport.Flags().StringVar(&pkiOptions.CertPublicPath, "server-crt", "", "Path to the server public key if not generating unique PKI")
Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"io/ioutil"

"github.com/AlecAivazis/survey/v2"
"github.com/defenseunicorns/zarf/cli/internal/git"
"github.com/defenseunicorns/zarf/cli/internal/utils"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/internal/git"
"repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/internal/utils"
)

var prepareCmd = &cobra.Command{
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"os"
"strings"

"github.com/defenseunicorns/zarf/cli/internal/packager"
"github.com/spf13/cobra"
"repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/internal/packager"
)

var rootCmd = &cobra.Command{
Expand Down
6 changes: 3 additions & 3 deletions cli/cmd/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package cmd
import (
"fmt"

"github.com/defenseunicorns/zarf/cli/config"
"github.com/defenseunicorns/zarf/cli/internal/git"
craneCmd "github.com/google/go-containerregistry/cmd/crane/cmd"
"github.com/google/go-containerregistry/pkg/crane"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/mholt/archiver/v3"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/config"
"repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli/internal/git"
)

var toolsCmd = &cobra.Command{
Expand Down Expand Up @@ -59,7 +59,7 @@ var readCredsCmd = &cobra.Command{
Use: "get-admin-password",
Short: "Returns the Zarf admin password read from ~/.git-credentials",
Run: func(cmd *cobra.Command, args []string) {
authInfo := git.FindAuthForHost(config.ZarfLocal)
authInfo := git.FindAuthForHost(config.ZarfLocalIP)
fmt.Println(authInfo.Auth.Password)
},
}
Expand Down
10 changes: 1 addition & 9 deletions cli/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const K3sManifestPath = "/var/lib/rancher/k3s/server/manifests"
const K3sImagePath = "/var/lib/rancher/k3s/agent/images"
const PackageInitName = "zarf-init.tar.zst"
const PackagePrefix = "zarf-package-"
const ZarfLocal = "zarf.localhost"
const ZarfLocalIP = "127.0.0.1"
const ZarfGitUser = "zarf-git-user"

var config ZarfConfig
Expand Down Expand Up @@ -47,14 +47,6 @@ func GetComponents() []ZarfComponent {
return config.Components
}

func GetUtilityClusterImages() []string {
return config.UtilityCluster.Images
}

func GetUtilityClusterRepos() []string {
return config.UtilityCluster.Repos
}

func Load(path string) {
logContext := logrus.WithField("path", path)
logContext.Info("Loading dynamic config")
Expand Down
19 changes: 7 additions & 12 deletions cli/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ type ZarfComponent struct {
Required bool `yaml:"required"`
Manifests string `yaml:"manifests"`
Images []string `yaml:"images"`
Files []ZarfFile `yaml:"files"`
Repos []string `yaml:"repos"`
Charts []ZarfChart `yaml:"charts"`
Files []ZarfFile `yaml:"files"`
}

type ZarfMetatdata struct {
Expand Down Expand Up @@ -49,16 +50,10 @@ type ZarfBuildData struct {
Timestamp string `yaml:"timestamp"`
}

type ZarfUtilityCluster struct {
Images []string `yaml:"images"`
Repos []string `yaml:"repos"`
}

type ZarfConfig struct {
Kind string `yaml:"kind"`
Metadata ZarfMetatdata `yaml:"metadata"`
Package ZarfBuildData `yaml:"package"`
Data []ZarfData `yaml:"data"`
Components []ZarfComponent `yaml:"components"`
UtilityCluster ZarfUtilityCluster `yaml:"utilityCluster"`
Kind string `yaml:"kind"`
Metadata ZarfMetatdata `yaml:"metadata"`
Package ZarfBuildData `yaml:"package"`
Data []ZarfData `yaml:"data"`
Components []ZarfComponent `yaml:"components"`
}
19 changes: 10 additions & 9 deletions cli/go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
module repo1.dso.mil/platform-one/big-bang/apps/product-tools/zarf/cli
module github.com/defenseunicorns/zarf/cli

go 1.16

require (
github.com/AlecAivazis/survey/v2 v2.2.15
github.com/containerd/containerd v1.5.4
github.com/fatih/color v1.12.0
github.com/AlecAivazis/survey/v2 v2.3.2
github.com/containerd/containerd v1.5.7
github.com/fatih/color v1.13.0
github.com/go-git/go-git/v5 v5.4.2
github.com/goccy/go-yaml v1.9.2
github.com/goccy/go-yaml v1.9.3
github.com/google/go-containerregistry v0.6.0
github.com/mattn/go-colorable v0.1.8
github.com/mattn/go-colorable v0.1.11
github.com/mholt/archiver/v3 v3.5.0
github.com/otiai10/copy v1.6.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.2.1
github.com/ulikunitz/xz v0.5.8 // indirect; CVE-2020-16845
helm.sh/helm/v3 v3.6.1-0.20210719095234-663c5698878c
k8s.io/api v0.21.2
k8s.io/apimachinery v0.21.2
k8s.io/client-go v0.21.2
k8s.io/api v0.21.5
k8s.io/apimachinery v0.21.5
k8s.io/client-go v0.21.5
rsc.io/letsencrypt v0.0.3 // indirect
)
Loading

0 comments on commit cd45237

Please sign in to comment.