Skip to content

Commit

Permalink
Add Big Bang YOLO mode support (#1681)
Browse files Browse the repository at this point in the history
## Description

Add Big Bang YOLO mode support 

## Related Issue

Addresses #1670 

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow)
followed

---------

Co-authored-by: Wayne Starr <[email protected]>
  • Loading branch information
willswire and Racer159 authored May 17, 2023
1 parent c16b935 commit 7d496fd
Show file tree
Hide file tree
Showing 10 changed files with 306 additions and 33 deletions.
26 changes: 26 additions & 0 deletions examples/big-bang-yolo-mode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Big Bang (YOLO Mode)

This package deploys [Big Bang](https://repo1.dso.mil/platform-one/big-bang/bigbang) using the Zarf `bigbang` extension with YOLO mode enabled. You can learn about YOLO mode [here](https://docs.zarf.dev/docs/faq#what-is-yolo-mode-and-why-would-i-use-it). An example of this configuration is below:

```yaml
components:
- name: flux-private-registry
required: true
manifests:
- name: private-registry
namespace: flux-system
files:
- secrets/private-registry.yaml
- name: bigbang
required: true
extensions:
bigbang:
version: 2.0.0
valuesFiles:
- config/credentials.yaml
- config/ingress.yaml
- config/kyverno.yaml
- config/loki.yaml
```
The `provision-flux-credentials` component is required to create the necessary secret to pull flux images from [registry1.dso.mil](https://registry1.dso.mil). In the provided `zarf.yaml` for this example, we demonstrate providing account credentials via Zarf Variables, although there are other ways to populate the data in `private-registry.yaml`.
5 changes: 5 additions & 0 deletions examples/big-bang-yolo-mode/config/credentials.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
registryCredentials:
registry: registry1.dso.mil
username: "###ZARF_VAR_REGISTRY1_USERNAME###"
password: "###ZARF_VAR_REGISTRY1_CLI_SECRET###"
email: ""
128 changes: 128 additions & 0 deletions examples/big-bang-yolo-mode/config/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Configure Istio
domain: "bigbang.dev"

istio:
gateways:
public:
tls: # certs for *.bigbang.dev
key: |
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDDvKUzWiZucm6/
8D2Nx4KVe8t6uHtARpw112f4yGv7xKcOJkbxLbVtor8pj/HS5tRSZq2ziIQl9y98
8TVAOBezgzPPMDxOqDeyHl5gAtqzpK/eSPmueZIhR88BH2+SMYqa5kxmjn752Rf0
jVeCrVdQ5MD9rqA00oQi/zO+gQQoz6QSuiEQ2pSKYB3gv9oIoJorIU1n4qLYAezn
TvFwjmKWPPhRdyslpcAi1rVO+mVX3Y2DKU/CfpWNFVVT+H788Srn4yP6iWUymfQU
vHOXII1erMnES2H9BDffumrRf3m3IpgueQ3vPhB8ftjFZozURj2t/WSeaKsyQSoZ
Wr99DWxpAgMBAAECggEAAW8ARsACSAzOgtlfmgo8Cpw9gUiYnn/l5P8O4+OT5uQp
1RCytFGBYqwuej9zpffK1k+qNgZp8V0+G8wod6/xfH8Zggr4ZhsVTVirmEhtEaPD
Jf2i1oRNbbD48yknyApU2Y2WQaoJhArzAfeHDI34db83KqR8x+ZC0X7NAjgvr5zS
b0OfY2tht4oxEWh2m67FzlFgF+cWyszRYyfvHfOFBqLesuCnSfMoOzmbT3SlnxHo
6GSa1e/kCJVzFJNb74BZTIH0w6Ar/a0QG829VXivqj8lRENU/1xUI2JhNz4RdH7F
6MeiwQbq4pWjHfh4djuzQFIwOgCnSNRnNuNywOVuAQKBgQDjleEI1XFQawXmHtHu
6GMhbgptRoSUyutDDdo2MHGvDbxDOIsczIBjxCuYAM47nmGMuWbDJUN+2VQAX32J
WZagRxWikxnEqv3B7No7tLSQ42rRo/tDBrZPCCuS9u/ZJM4o7MCa/VzTtbicGOCh
bTIoTeEtT2piIdkrjHFGGlYOLQKBgQDcLNFHrSJCkHfCo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/32+IVQtQi0Cdd4Xn+GOdwiK1O5tmLOsbdJ1Fu/7xk9TND
TwIDAQABo4IBRjCCAUIwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
SwYIKwYBBQUHAQEEPzA9MDsGCCsGAQUFBzAChi9odHRwOi8vYXBwcy5pZGVudHJ1
c3QuY29tL3Jvb3RzL2RzdHJvb3RjYXgzLnA3YzAfBgNVHSMEGDAWgBTEp7Gkeyxx
+tvhS5B1/8QVYIWJEDBUBgNVHSAETTBLMAgGBmeBDAECATA/BgsrBgEEAYLfEwEB
ATAwMC4GCCsGAQUFBwIBFiJodHRwOi8vY3BzLnJvb3QteDEubGV0c2VuY3J5cHQu
b3JnMDwGA1UdHwQ1MDMwMaAvoC2GK2h0dHA6Ly9jcmwuaWRlbnRydXN0LmNvbS9E
U1RST09UQ0FYM0NSTC5jcmwwHQYDVR0OBBYEFHm0WeZ7tuXkAXOACIjIGlj26Ztu
MA0GCSqGSIb3DQEBCwUAA4IBAQAKcwBslm7/DlLQrt2M51oGrS+o44+/yQoDFVDC
5WxCu2+b9LRPwkSICHXM6webFGJueN7sJ7o5XPWioW5WlHAQU7G75K/QosMrAdSW
9MUgNTP52GE24HGNtLi1qoJFlcDyqSMo59ahy2cI2qBDLKobkx/J3vWraV0T9VuG
WCLKTVXkcGdtwlfFRjlBz4pYg1htmf5X6DYO8A4jqv2Il9DjXA6USbW1FzXSLr9O
he8Y4IWS6wY7bCkjCWDcRQJMEhg76fsO3txE+FiYruq9RUWhiF1myv4Q6W+CyBFC
Dfvp7OOGAN6dEOM4+qR9sdjoSYKEBpsr6GtPAQw4dy753ec5
-----END CERTIFICATE-----
27 changes: 27 additions & 0 deletions examples/big-bang-yolo-mode/config/kyverno.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use Kyverno instead of Gatekeeper
gatekeeper:
enabled: false
clusterAuditor:
enabled: false
kyverno:
enabled: true
kyvernoPolicies:
enabled: true
values:
policies:
disallow-shared-subpath-volume-writes:
validationFailureAction: audit
restrict-host-ports:
validationFailureAction: audit
restrict-capabilities:
validationFailureAction: audit
restrict-image-registries:
validationFailureAction: audit
disallow-host-namespaces:
validationFailureAction: audit
disallow-privileged-containers:
validationFailureAction: audit
require-non-root-user:
validationFailureAction: audit
restrict-host-path-mount-pv:
validationFailureAction: audit
15 changes: 15 additions & 0 deletions examples/big-bang-yolo-mode/config/loki.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Use Loki instead of EFK
elasticsearchKibana:
enabled: false

eckOperator:
enabled: false

fluentbit:
enabled: false

loki:
enabled: true

promtail:
enabled: true
18 changes: 18 additions & 0 deletions examples/big-bang-yolo-mode/secrets/private-registry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Secret
metadata:
name: private-registry
namespace: flux-system
type: kubernetes.io/dockerconfigjson
stringData:
.dockerconfigjson: |-
{
"auths": {
"registry1.dso.mil": {
"username": "###ZARF_VAR_REGISTRY1_USERNAME###",
"password": "###ZARF_VAR_REGISTRY1_CLI_SECRET###",
"email": "",
"auth": "###ZARF_VAR_REGISTRY1_AUTH###"
}
}
}
42 changes: 42 additions & 0 deletions examples/big-bang-yolo-mode/zarf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
kind: ZarfPackageConfig

metadata:
name: yolo-big-bang
description: "Deploy Big Bang Core in YOLO mode"
version: 2.0.0
url: https://p1.dso.mil/products/big-bang
architecture: amd64
yolo: true

variables:
- name: REGISTRY1_USERNAME
description: "The username for pulling images from registry1.dso.mil"
required: true
prompt: true
- name: REGISTRY1_CLI_SECRET
description: "The CLI secret for pulling images from registry1.dso.mil"
required: true
prompt: true
- name: REGISTRY1_AUTH
description: "A base64 encoded concatenation of 'REGISTRY1_USERNAME:REGISTRY1_CLI_SECRET'"
required: true
prompt: true

components:
- name: flux-private-registry
required: true
manifests:
- name: private-registry
namespace: flux-system
files:
- secrets/private-registry.yaml
- name: bigbang
required: true
extensions:
bigbang:
version: 2.0.0
valuesFiles:
- config/credentials.yaml
- config/ingress.yaml
- config/kyverno.yaml
- config/loki.yaml
72 changes: 42 additions & 30 deletions src/extensions/bigbang/bigbang.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var tenMins = metav1.Duration{

// Run Mutates a component that should deploy Big Bang to a set of manifests
// that contain the flux deployment of Big Bang
func Run(tmpPaths types.ComponentPaths, c types.ZarfComponent) (types.ZarfComponent, error) {
func Run(YOLO bool, tmpPaths types.ComponentPaths, c types.ZarfComponent) (types.ZarfComponent, error) {
var err error
if err := utils.CreateDirectory(tmpPaths.Temp, 0700); err != nil {
return c, fmt.Errorf("unable to component temp directory: %w", err)
Expand Down Expand Up @@ -72,8 +72,10 @@ func Run(tmpPaths types.ComponentPaths, c types.ZarfComponent) (types.ZarfCompon
// Add the flux manifests to the list of manifests to be pulled down by Zarf.
manifests = append(manifests, fluxManifest)

// Add the images to the list of images to be pulled down by Zarf.
c.Images = append(c.Images, images...)
if !YOLO {
// Add the images to the list of images to be pulled down by Zarf.
c.Images = append(c.Images, images...)
}
}

// Configure helm to pull down the Big Bang chart.
Expand Down Expand Up @@ -107,16 +109,19 @@ func Run(tmpPaths types.ComponentPaths, c types.ZarfComponent) (types.ZarfCompon
}

// Add the Big Bang repo to the list of repos to be pulled down by Zarf.
bbRepo := fmt.Sprintf("%s@%s", cfg.Repo, cfg.Version)
c.Repos = append(c.Repos, bbRepo)

if !YOLO {
bbRepo := fmt.Sprintf("%s@%s", cfg.Repo, cfg.Version)
c.Repos = append(c.Repos, bbRepo)
}
// Parse the template for GitRepository objects and add them to the list of repos to be pulled down by Zarf.
gitRepos, hrDependencies, hrValues, err := findBBResources(template)
if err != nil {
return c, fmt.Errorf("unable to find Big Bang resources: %w", err)
}
for _, gitRepo := range gitRepos {
c.Repos = append(c.Repos, gitRepo)
if !YOLO {
for _, gitRepo := range gitRepos {
c.Repos = append(c.Repos, gitRepo)
}
}

// Generate a list of HelmReleases that need to be deployed in order.
Expand Down Expand Up @@ -200,24 +205,26 @@ func Run(tmpPaths types.ComponentPaths, c types.ZarfComponent) (types.ZarfCompon
})

// Select the images needed to support the repos for this configuration of Big Bang.
for _, hr := range hrDependencies {
namespacedName := getNamespacedNameFromMeta(hr.Metadata)
gitRepo := gitRepos[hr.NamespacedSource]
values := hrValues[namespacedName]
if !YOLO {
for _, hr := range hrDependencies {
namespacedName := getNamespacedNameFromMeta(hr.Metadata)
gitRepo := gitRepos[hr.NamespacedSource]
values := hrValues[namespacedName]

images, err := helm.FindImagesForChartRepo(gitRepo, "chart", values)
if err != nil {
return c, fmt.Errorf("unable to find images for chart repo: %w", err)
}

images, err := helm.FindImagesForChartRepo(gitRepo, "chart", values)
if err != nil {
return c, fmt.Errorf("unable to find images for chart repo: %w", err)
c.Images = append(c.Images, images...)
}

c.Images = append(c.Images, images...)
// Make sure the list of images is unique.
c.Images = utils.Unique(c.Images)
}

// Make sure the list of images is unique.
c.Images = utils.Unique(c.Images)

// Create the flux wrapper around Big Bang for deployment.
manifest, err := addBigBangManifests(tmpPaths.Temp, cfg)
manifest, err := addBigBangManifests(YOLO, tmpPaths.Temp, cfg)
if err != nil {
return c, err
}
Expand Down Expand Up @@ -358,7 +365,7 @@ func findBBResources(t string) (gitRepos map[string]string, helmReleaseDeps map[
}

// addBigBangManifests creates the manifests component for deploying Big Bang.
func addBigBangManifests(manifestDir string, cfg *extensions.BigBang) (types.ZarfManifest, error) {
func addBigBangManifests(YOLO bool, manifestDir string, cfg *extensions.BigBang) (types.ZarfManifest, error) {
// Create a manifest component that we add to the zarf package for bigbang.
manifest := types.ZarfManifest{
Name: bb,
Expand Down Expand Up @@ -386,16 +393,21 @@ func addBigBangManifests(manifestDir string, cfg *extensions.BigBang) (types.Zar
return manifest, err
}

// Create the zarf-credentials secret manifest.
if err := addManifest("bb-ext-zarf-credentials.yaml", manifestZarfCredentials(cfg.Version)); err != nil {
return manifest, err
}
var hrValues []fluxHelmCtrl.ValuesReference

// Create the list of values manifests starting with zarf-credentials.
hrValues := []fluxHelmCtrl.ValuesReference{{
Kind: "Secret",
Name: "zarf-credentials",
}}
// If YOLO mode is enabled, do not include the zarf-credentials secret
if !YOLO {
// Create the zarf-credentials secret manifest.
if err := addManifest("bb-ext-zarf-credentials.yaml", manifestZarfCredentials(cfg.Version)); err != nil {
return manifest, err
}

// Create the list of values manifests starting with zarf-credentials.
hrValues = []fluxHelmCtrl.ValuesReference{{
Kind: "Secret",
Name: "zarf-credentials",
}}
}

// Loop through the valuesFrom list and create a manifest for each.
for _, path := range cfg.ValuesFiles {
Expand Down
Loading

0 comments on commit 7d496fd

Please sign in to comment.