Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add base and identity layers #853

Merged
merged 23 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ runs:
# renovate: datasource=github-tags depName=k3d-io/k3d versioning=semver
run: curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=v5.7.4 bash

- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Install UDS CLI
shell: bash
# renovate: datasource=github-tags depName=defenseunicorns/uds-cli versioning=semver
run: brew install defenseunicorns/tap/uds@0.16.0
uses: defenseunicorns/setup-uds@b987a32bac3baeb67bfb08f5e1544e2f9076ee8a # v1.0.0
with:
# renovate: datasource=github-tags depName=defenseunicorns/uds-cli versioning=semver
version: v0.16.0

- name: Install Lula
uses: defenseunicorns/lula-action/setup@badad8c4b1570095f57e66ffd62664847698a3b9 # v0.0.1
Expand Down
98 changes: 6 additions & 92 deletions .github/filters.yaml
Original file line number Diff line number Diff line change
@@ -1,98 +1,12 @@
all:
- "**"

authservice:
- "src/authservice/**"
- "!**/*.md"
- "!**/*.jpg"
- "!**/*.png"
- "!**/*.gif"
- "!**/*.svg"

grafana:
- "src/grafana/**"
- "!**/*.md"
- "!**/*.jpg"
- "!**/*.png"
- "!**/*.gif"
- "!**/*.svg"

istio:
base:
- "packages/base/**"
- "src/istio/**"
- "!**/*.md"
- "!**/*.jpg"
- "!**/*.png"
- "!**/*.gif"
- "!**/*.svg"
- "src/pepr/**"

keycloak:
identity-authorization:
- "packages/identity-authorization/**"
- "src/keycloak/**"
- "!**/*.md"
- "!**/*.jpg"
- "!**/*.png"
- "!**/*.gif"
- "!**/*.svg"

kiali:
- "src/kiali/**"
- "!**/*.md"
- "!**/*.jpg"
- "!**/*.png"
- "!**/*.gif"
- "!**/*.svg"

loki:
- "src/loki/**"
- "!**/*.md"
- "!**/*.jpg"
- "!**/*.png"
- "!**/*.gif"
- "!**/*.svg"

metrics-server:
- "src/metrics-server/**"
- "!**/*.md"
- "!**/*.jpg"
- "!**/*.png"
- "!**/*.gif"
- "!**/*.svg"

neuvector:
- "src/neuvector/**"
- "!**/*.md"
- "!**/*.jpg"
- "!**/*.png"
- "!**/*.gif"
- "!**/*.svg"

prometheus-stack:
- "src/prometheus-stack/**"
- "!**/*.md"
- "!**/*.jpg"
- "!**/*.png"
- "!**/*.gif"
- "!**/*.svg"

vector:
- "src/vector/**"
- "!**/*.md"
- "!**/*.jpg"
- "!**/*.png"
- "!**/*.gif"
- "!**/*.svg"

tempo:
- "src/tempo/**"
- "!**/*.md"
- "!**/*.jpg"
- "!**/*.png"
- "!**/*.gif"
- "!**/*.svg"

velero:
- "src/velero/**"
- "!**/*.md"
- "!**/*.jpg"
- "!**/*.png"
- "!**/*.gif"
- "!**/*.svg"
- "src/authservice/**"
2 changes: 0 additions & 2 deletions .github/workflows/compliance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ jobs:
runs-on: ubuntu-latest
name: Evaluate
continue-on-error: true
# env:
# UDS_PKG: ${{ inputs.package }}
steps:
# Used to execute the uds run command
- name: Checkout repository
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,45 @@ jobs:
uses: ./.github/actions/save-logs
with:
suffix: -${{ matrix.flavor }}

publish-uds-core-layers:
if: ${{ !inputs.snapshot }}
strategy:
matrix:
flavor: [upstream, registry1, unicorn]
layer: [base, identity-authorization]
arch: [amd64, arm64]
exclude:
- flavor: registry1
arch: arm64
runs-on: ${{ matrix.arch == 'arm64' && 'uds-ubuntu-arm64-4-core' || 'uds-ubuntu-big-boy-4-core' }}
name: Publish package layers

permissions:
contents: read
packages: write
id-token: write # This is needed for OIDC federation.

steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Environment setup
uses: ./.github/actions/setup
with:
registry1Username: ${{ secrets.IRON_BANK_ROBOT_USERNAME }}
registry1Password: ${{ secrets.IRON_BANK_ROBOT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}
chainguardIdentity: ${{ secrets.CHAINGUARD_IDENTITY }}

- name: Test and Publish Core Package Layer
run: uds run -f tasks/publish.yaml single-layer --set FLAVOR=${{ matrix.flavor }} --set LAYER=${{ matrix.layer }} --no-progress

- name: Debug Output
if: ${{ always() && !inputs.snapshot }}
uses: ./.github/actions/debug-output

- name: Save logs
if: always()
uses: ./.github/actions/save-logs
with:
suffix: -${{ matrix.flavor }}-${{ matrix.layer }}-${{ matrix.arch }}
1 change: 0 additions & 1 deletion .github/workflows/pull-request-conditionals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ jobs:
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
with:
filters: .github/filters.yaml
predicate-quantifier: every

# This job triggers a separate workflow for each changed source package, if any.
run-package-test:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/slim-dev-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ on:
paths:
- src/pepr/**
- src/keycloak/**
- src/authservice/**
- src/istio/**
- src/prometheus-stack/**
- packages/slim-dev/**
- packages/base/**
- packages/identity-authorization/**
- bundles/k3d-slim-dev/**
- .github/workflows/slim-dev**
- "!**/*.md"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
inputs:
package:
type: string
description: "The name of the source package to test"
description: "The name of the core package layer to test"
required: true
flavor:
type: string
Expand All @@ -43,7 +43,7 @@ jobs:
timeout-minutes: 30
name: Test
env:
UDS_PKG: ${{ inputs.package }}
UDS_LAYER: ${{ inputs.package }}

steps:
- name: Checkout repository
Expand All @@ -57,9 +57,9 @@ jobs:
ghToken: ${{ secrets.GITHUB_TOKEN }}
chainguardIdentity: ${{ secrets.CHAINGUARD_IDENTITY }}

- name: Test a single source package
- name: Test a single layer package
if: ${{ inputs.package != 'all' && inputs.test_type == 'install' }}
run: uds run test-single-package --set FLAVOR=${{ inputs.flavor }} --no-progress
run: uds run test-single-layer --set FLAVOR=${{ inputs.flavor }} --set LAYER=${{ inputs.package }} --no-progress

- name: Test UDS Core Install
if: ${{ inputs.package == 'all' && inputs.test_type == 'install' }}
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ uds deploy k3d-core-slim-dev:0.28.0

#### Developing UDS Core

UDS Core development leverages the `uds zarf dev deploy` command. For convenience, a UDS Task is provided to setup the environment. You'll need to have [NodeJS](https://nodejs.org/en/download/) 20 or later installed to continue. Here's an example of a flow developing the [metrics-server package](./src/metrics-server/README.md):
UDS Core development leverages the `uds zarf dev deploy` command. For convenience, a UDS Task is provided to setup the environment. You'll need to have [NodeJS](https://nodejs.org/en/download/) 20 or later installed to continue. Here's an example of a flow developing the [identity-authorization layer](./package/identity-authorization/README.md):

```bash
# Create the dev environment
Expand All @@ -90,8 +90,8 @@ npx pepr dev
# If not developing the Pepr module (can be run multiple times):
npx pepr deploy

# Deploy the package (can be run multiple times)
uds run dev-deploy --set PKG=metrics-server
# Deploy the layer (can be run multiple times)
uds run dev-deploy --set LAYER=identity-authorization
```

#### Testing UDS Core
Expand All @@ -102,10 +102,10 @@ You can perform a complete test of UDS Core by running the following command:
uds run test-uds-core
```

This will create a local k3d cluster, install UDS Core, and run a series of tests against it, the same tests that are run in CI. If you want to run the tests against a specific package, you can use the `PKG` env variable. The following example runs the tests against the metrics-server package:
This will create a local k3d cluster, install UDS Core, and run a series of tests against it, the same tests that are run in CI. If you want to run the tests against a specific core layer, you can use the `LAYER` task variable. The following example runs the tests against the identity-authorization layer:

```bash
UDS_PKG=metrics-server uds run test-single-package
uds run test-single-layer --set LAYER=identity-authorization
```

Note you can specify the `--set FLAVOR=registry1` flag to test using Iron Bank images instead of the upstream images.
9 changes: 8 additions & 1 deletion bundles/k3d-slim-dev/uds-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ packages:
repository: ghcr.io/zarf-dev/packages/init
ref: v0.41.0

- name: core-slim-dev
- name: core-base
path: ../../build/
# x-release-please-start-version
ref: 0.28.0
Expand Down Expand Up @@ -66,6 +66,13 @@ packages:
- name: TENANT_SERVICE_PORTS
description: "The ports that are exposed from the tenant gateway LoadBalancer (useful for non-HTTP(S) traffic)"
path: "service.ports"

- name: core-identity-authorization
path: ../../build/
# x-release-please-start-version
ref: 0.28.0
# x-release-please-end
overrides:
keycloak:
keycloak:
variables:
Expand Down
6 changes: 2 additions & 4 deletions docs/deployment/uds-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,10 @@ You can perform a complete test of UDS Core by running the following command:
uds run test-uds-core
```

This command initiates the creation of a local k3d cluster, installs UDS Core, and executes a set of tests identical to those performed in CI. If you wish to run tests targeting a specific package, you can utilize the `PKG` environment variable.

The example below runs tests against the metrics-server package:
This will create a local k3d cluster, install UDS Core, and run a series of tests against it, the same tests that are run in CI. If you want to run the tests against a specific core layer, you can use the `LAYER` task variable. The following example runs the tests against the identity-authorization layer:

```cli
UDS_PKG=metrics-server uds run test-single-package
uds run test-single-layer --set LAYER=identity-authorization
```

{{% alert-note %}}
Expand Down
7 changes: 7 additions & 0 deletions packages/base/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# UDS Core Base

This is the base layer of UDS Core required if deploying any other layers. Currently it includes the application(s):
- Istio (and gateways)
- UDS Operator and Policies (Pepr)

As this is the base layer it can be deployed standalone for minimal functionality.
9 changes: 9 additions & 0 deletions packages/base/tasks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
includes:
- istio: ../../src/istio/tasks.yaml
- pepr: ../../src/pepr/tasks.yaml

tasks:
- name: validate
actions:
- task: istio:validate
- task: pepr:validate
11 changes: 3 additions & 8 deletions packages/slim-dev/zarf.yaml → packages/base/zarf.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
kind: ZarfPackageConfig
metadata:
name: core-slim-dev
description: "UDS Core (Istio, UDS Operator and Keycloak)"
name: core-base
description: "UDS Core (Base)"
authors: "Defense Unicorns - Product"
# x-release-please-start-version
version: "0.28.0"
# x-release-please-end
x-uds-dependencies: []

components:
- name: uds-operator-config
Expand Down Expand Up @@ -45,9 +46,3 @@ components:
required: true
import:
path: ../../src/pepr

# Keycloak
- name: keycloak
required: true
import:
path: ../../src/keycloak
8 changes: 8 additions & 0 deletions packages/identity-authorization/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# UDS Core Identity & Authorization

This layer of UDS Core provides identity management and authorization capabilities. Currently it includes the application(s):
- Keycloak (with custom plugin and realm)
- AuthService

To deploy this layer you must also deploy its dependent layer(s):
- Base
9 changes: 9 additions & 0 deletions packages/identity-authorization/tasks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
includes:
- keycloak: ../../src/keycloak/tasks.yaml
- authservice: ../../src/authservice/tasks.yaml

tasks:
- name: validate
actions:
- task: keycloak:validate
- task: authservice:validate
22 changes: 22 additions & 0 deletions packages/identity-authorization/zarf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
kind: ZarfPackageConfig
metadata:
name: core-identity-authorization
description: "UDS Core (Identity & Authorization)"
authors: "Defense Unicorns - Product"
# x-release-please-start-version
version: "0.28.0"
# x-release-please-end
x-uds-dependencies: ["base"]

components:
# Keycloak
- name: keycloak
required: true
import:
path: ../../src/keycloak

# Authservice
- name: authservice
required: true
import:
path: ../../src/authservice
3 changes: 0 additions & 3 deletions packages/slim-dev/README.md

This file was deleted.

Loading