Skip to content

Commit

Permalink
implement component choice groups (#488)
Browse files Browse the repository at this point in the history
* implement component choice groups
* fix test & handle default values w/--confirm again
* add test case to ensure second component was not created when first is chosen
  • Loading branch information
jeff-mccoy authored May 24, 2022
1 parent 473cbd5 commit 4683bd0
Show file tree
Hide file tree
Showing 20 changed files with 662 additions and 169 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ package-example-game: ## Create the Doom example
package-example-component-scripts: ## Create component script example
cd examples/component-scripts && ../../$(ZARF_BIN) package create --confirm && mv zarf-package-* ../../build/

.PHONY: package-example-component-choice
package-example-component-choice: ## Create component choice example
cd examples/component-choice && ../../$(ZARF_BIN) package create --confirm && mv zarf-package-* ../../build/

.PHONY: package-example-component-variables
package-example-component-variables: ## Create component script example
cd examples/component-variables && ../../$(ZARF_BIN) package create --confirm && mv zarf-package-* ../../build/
Expand Down Expand Up @@ -128,6 +132,9 @@ test-e2e: ## Run e2e tests. Will automatically build any required dependencies t
@if [ ! -f zarf-package-component-scripts-$(ARCH).tar.zst ]; then\
$(MAKE) package-example-component-scripts;\
fi
@if [ ! -f zarf-package-component-choice-$(ARCH).tar.zst ]; then\
$(MAKE) package-example-component-choice;\
fi
@if [ ! -f zarf-package-component-variables-$(ARCH).tar.zst ]; then\
$(MAKE) package-example-component-variables;\
fi
Expand Down
1 change: 1 addition & 0 deletions examples/component-choice/blank-file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Just some simple file....
18 changes: 18 additions & 0 deletions examples/component-choice/zarf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
kind: ZarfPackageConfig
metadata:
name: component-choice
description: "Test component to demonstrate grouping components for a user to choose from"

components:
- name: first-choice
group: example-choice
files:
- source: blank-file.txt
target: first-choice-file.txt

- name: second-choice
group: example-choice
default: true
files:
- source: blank-file.txt
target: second-choice-file.txt
File renamed without changes
File renamed without changes
26 changes: 4 additions & 22 deletions examples/big-bang/README.md → packages/big-bang-core/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
# Example: Big Bang Core

This example shows a deployment of [Big Bang Core](https://repo1.dso.mil/platform-one/big-bang/bigbang) using Zarf.
This package deploys [Big Bang Core](https://repo1.dso.mil/platform-one/big-bang/bigbang) using Zarf.

![pods](.images/pods.png)

![helmreleases](.images/helmreleases.png)

## Known Issues

- Inside the Vagrant VM the services are available on the standard port `443`. Outside the VM if you want to pull something up in your browser that traffic is being routed to port `8443` to avoid needing to be root when running the Vagrant box.
- Due to issues with Elasticsearch this example doesn't work yet in some distros. It does work in the Vagrant VM detailed below. Upcoming work to update to the latest version of Big Bang and swap the EFK stack out for the PLG stack (Promtail, Loki, Grafana) should resolve this issue
- Currently this example does the equivalent of `kustomize build | kubectl apply -f -`, which means Flux will be used to deploy everything, but it won't be watching a Git repository for changes. Upcoming work is planned to update the example so that you will be able to open up a Git repo in the private Gitea server inside the cluster, commit and push a change, and see that change get reflected in the deployment.
- Currently this package does the equivalent of `kustomize build | kubectl apply -f -`, which means Flux will be used to deploy everything, but it won't be watching a Git repository for changes. Upcoming work is planned to update the package so that you will be able to open up a Git repo in the private Gitea server inside the cluster, commit and push a change, and see that change get reflected in the deployment.

## Prerequisites

1. Install [Vagrant](https://www.vagrantup.com/)
1. Install `make`
1. Install `sha256sum` (on Mac it's `brew install coreutils`)
> NOTE:
> Big Bang requires an AMD64 system to deploy as Iron Bank does not yet support ARM. You will need to deploy to a cluster that is running AMD64. Specifically, M1 Apple computers are not supported locally and you will need to provision a remote cluster to work with Big Bang currently.
## Instructions

Expand All @@ -33,10 +28,6 @@ cd zarf/examples
make fetch-release
```

> NOTE:
>
> If you have any issues with `make fetch-release` you can try `make build-release` instead. It will build the files instead of downloading them. You'll need Golang installed.
### Build the deploy package

```shell
Expand All @@ -51,10 +42,6 @@ make package-example-big-bang
make vm-init
```

> NOTE:
>
> All subsequent commands should be happening INSIDE the Vagrant VM
### Initialize Zarf

```shell
Expand Down Expand Up @@ -99,10 +86,5 @@ make vm-destroy

## Troubleshooting

### Elasticsearch isn't working when I try to deploy the Big Bang package on KinD (or K3d, or any other distro other than K3s)
That's a known issue. This example is only supported right now when using the K3s cluster that Zarf is able to deploy when running `zarf init`. Updating to the latest version of Big Bang and swapping the EFK stack out for the PLG stack should fix this issue. It's on the roadmap™.
### I'm getting "Misdirected Request" when trying to get to any of the services in my browser
Run the `kubectl delete` command documented above to delete the buggy EnvoyFilter. Updating to the latest version of Big Bang will fix this issue. It's on the roadmap™.

### My computer crashed!
Close all those hundreds of chrome tabs, shut down all non-essential programs, and try again. Big Bang is a HOG. If you have less than 32GB of RAM you're in for a rough time.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bases:
- ../core-prod

configMapGenerator:
- name: environment
namespace: bigbang
behavior: merge
files:
- values.yaml
222 changes: 222 additions & 0 deletions packages/big-bang-core/kustomization/core-light/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
clusterAuditor:
values:
resources:
requests:
cpu: "100m"
memory: "512Mi"
limits:
cpu: "500m"
memory: "512Mi"

gatekeeper:
values:
controllerManager:
resources:
limits:
cpu: "1"
memory: "2Gi"
requests:
cpu: "175m"
memory: "512Mi"
audit:
resources:
limits:
cpu: "1.2"
memory: "2Gi"
requests:
cpu: "200m"
memory: "768Mi"

istio:
ingressGateways:
public-ingressgateway:
kubernetesResourceSpec:
resources:
requests:
cpu: "100m"
memory: "512Mi"
limits:
cpu: "500m"
memory: "512Mi"
values:
istiod:
resources:
requests:
cpu: "100m"
memory: "1Gi"
limits:
cpu: "500m"
memory: "1Gi"
hpaSpec:
maxReplicas: 1

istiooperator:
values:
operator:
resources:
limits:
cpu: "500m"
memory: "256Mi"
requests:
cpu: "100m"
memory: "256Mi"

jaeger:
values:
jaeger:
spec:
allInOne:
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "128Mi"
collector:
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "128Mi"
resources:
limits:
cpu: "500m"
memory: "128Mi"
requests:
cpu: "100m"
memory: "128Mi"

kiali:
values:
resources:
requests:
cpu: "100m"
memory: "256Mi"
limits:
cpu: "500m"
memory: "256Mi"
cr:
spec:
deployment:
resources:
requests:
cpu: "100m"
memory: "368Mi"
limits:
cpu: "500m"
memory: "368Mi"

monitoring:
values:
cleanUpgrade:
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "256Mi"
cpu: "200m"
alertmanager:
alertmanagerSpec:
resources:
limits:
cpu: "500m"
memory: "256Mi"
requests:
cpu: "100m"
memory: "256Mi"
grafana:
resources:
limits:
cpu: "500m"
memory: "512Mi"
requests:
cpu: "100m"
memory: "256Mi"
sidecar:
resources:
limits:
cpu: "500m"
memory: "100Mi"
requests:
cpu: "50m"
memory: "50Mi"
downloadDashboards:
resources:
limits:
cpu: "20m"
memory: "20Mi"
requests:
cpu: "20m"
memory: "20Mi"
kube-state-metrics:
resources:
limits:
cpu: "500m"
memory: "128Mi"
requests:
cpu: "10m"
memory: "128Mi"
prometheus-node-exporter:
resources:
limits:
cpu: "500m"
memory: "128Mi"
requests:
cpu: "100m"
memory: "128Mi"
prometheusOperator:
admissionWebhooks:
patch:
resources:
limits:
cpu: "100m"
memory: "128Mi"
requests:
cpu: "50m"
memory: "128Mi"
cleanupProxy:
resources:
limits:
cpu: "100m"
memory: "128Mi"
requests:
cpu: "50m"
memory: "128Mi"
resources:
limits:
cpu: "500m"
memory: "512Mi"
requests:
cpu: "100m"
memory: "512Mi"
prometheusConfigReloader:
resources:
requests:
cpu: "50m"
memory: "128Mi"
limits:
cpu: "100m"
memory: "128Mi"
prometheus:
prometheusSpec:
resources:
limits:
cpu: "300m"
memory: "2Gi"
requests:
cpu: "100m"
memory: "2Gi"

twistlock:
values:
resources:
limits:
memory: "1Gi"
cpu: "500m"
requests:
memory: "1Gi"
cpu: "100m"
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ networkPolicies:
nodeCidr: "0.0.0.0/0"
vpcCidr: "0.0.0.0/0"

kiali:
enabled: false

istio:
enabled: true
ingressGateways:
Expand Down
25 changes: 19 additions & 6 deletions examples/big-bang/zarf.yaml → packages/big-bang-core/zarf.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
kind: ZarfPackageConfig
metadata:
name: big-bang-core-demo
description: "Demo Zarf basic deployment of Big Bang Core"
description: "Deploy Big Bang Core"
# Big Bang / Iron Bank are only amd64
architecture: amd64

Expand All @@ -11,12 +11,9 @@ components:
import:
path: ../../packages/flux-iron-bank

- name: big-bang
- name: big-bang-core-assets
description: "Git repositories and OCI images used by Big Bang Core"
required: true
manifests:
- name: big-bang-config
kustomizations:
- "kustomization"
repos:
- https://repo1.dso.mil/platform-one/big-bang/[email protected]
- https://repo1.dso.mil/platform-one/big-bang/apps/core/[email protected]
Expand Down Expand Up @@ -78,3 +75,19 @@ components:
# twistlock
- registry1.dso.mil/ironbank/twistlock/console/console:22.01.840
- registry1.dso.mil/ironbank/twistlock/defender/defender:22.01.840

- name: big-bang-core-limited-resources
description: "Deploy a lightweight version of Big Bang Core using limited resources"
group: big-bang-variant
manifests:
- name: big-bang-config
kustomizations:
- "kustomization/core-light"

- name: big-bang-core-standard
description: "Deploy Big Bang Core with a standard configuration"
group: big-bang-variant
manifests:
- name: big-bang-config
kustomizations:
- "kustomization/core-standard"
Loading

0 comments on commit 4683bd0

Please sign in to comment.