Skip to content

Commit

Permalink
chore: fix upgrade path for functional layers, add doc for usage
Browse files Browse the repository at this point in the history
  • Loading branch information
mjnagel committed Oct 10, 2024
1 parent 26ea612 commit 210b70b
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 25 deletions.
53 changes: 53 additions & 0 deletions docs/deployment/functional-layers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: UDS Core Functional Layers
type: docs
weight: 9
---

## Background

Context on the inclusion of "functional layers" can be viewed in our [ADR](https://github.com/defenseunicorns/uds-core/blob/main/docs/adrs/0002-uds-core-functional-layers.md). In short, UDS Core publishes smaller zarf packages that contain subsets of core's capabilities, grouped by their function (such as monitoring, logging, backup/restore, etc) to allow more flexibility in deployment. This helps to support resource constrained environments (edge deployments) and other situations where an environment has different needs than the default core stack.

Each layer is published as an individual OCI Zarf package. Package sources can be viewed under the [`packages` directory](https://github.com/defenseunicorns/uds-core/tree/main/packages), with each folder containing a readme detailing the contents and any dependencies. All layers assume the requirement of the base layer which provides Istio, the UDS Operator, and UDS Policy Engine.

{{% alert-caution %}}
By removing pieces of core from your deployment you may affect your security and compliance posture as well as reduce functionality of the stack. Deploying core using these layers should be the exception in most cases and only done after carefully weighing needs for your environment.
{{% /alert-caution %}}

## Example Usage

Functional layers are designed to be composed in a UDS bundle for deployment. The below example includes all layers in a working order. Note that base must be the first layer, and any other layers must come in order of dependencies where applicable. When constructing your bundle with layers you are able to leave out any layers that do not suite your deployment environment, and add any overrides (per layer) that you may need.

```yaml
kind: UDSBundle
metadata:
name: functional-layer-core-bundle
description: An example bundle for deploying all of core using functional layers
version: "0.1.0"

packages:
- name: core-base
repository: ghcr.io/defenseunicorns/packages/uds/core-base
ref: 0.29.0-upstream
- name: core-identity-authorization
repository: ghcr.io/defenseunicorns/packages/uds/core-identity-authorization
ref: 0.29.0-upstream
- name: core-metrics-server
repository: ghcr.io/defenseunicorns/packages/uds/core-metrics-server
ref: 0.29.0-upstream
- name: core-runtime-security
repository: ghcr.io/defenseunicorns/packages/uds/core-runtime-security
ref: 0.29.0-upstream
- name: core-logging
repository: ghcr.io/defenseunicorns/packages/uds/core-logging
ref: 0.29.0-upstream
- name: core-monitoring
repository: ghcr.io/defenseunicorns/packages/uds/core-monitoring
ref: 0.29.0-upstream
- name: core-ui
repository: ghcr.io/defenseunicorns/packages/uds/core-ui
ref: 0.29.0-upstream
- name: core-backup-restore
repository: ghcr.io/defenseunicorns/packages/uds/core-backup-restore
ref: 0.29.0-upstream
```
23 changes: 23 additions & 0 deletions src/istio/common/chart/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
19 changes: 19 additions & 0 deletions src/istio/common/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SPDX-License-Identifier: AGPL-3.0-or-later OR Commercial
apiVersion: v2
name: uds-global-istio-config
description: Global Istio configuration for UDS

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
1 change: 1 addition & 0 deletions src/istio/common/chart/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# SPDX-License-Identifier: AGPL-3.0-or-later OR Commercial
17 changes: 12 additions & 5 deletions src/istio/common/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,22 @@ components:
namespace: istio-system
valuesFiles:
- "../values/values.yaml"
manifests:
- name: uds-global-istio-config
namespace: istio-system
files:
- "manifests/envoy-filters.yaml"
- "manifests/peer-authentication.yaml"
- "manifests/pepr-istio-config.yaml"
version: 0.1.0
localPath: chart
actions:
onDeploy:
before:
- description: "Fix helm ownership if necessary for clean helm upgrade"
mute: true
cmd: |
./zarf tools kubectl annotate EnvoyFilter misdirected-request -n istio-system meta.helm.sh/release-name=uds-global-istio-config --overwrite || true
./zarf tools kubectl annotate EnvoyFilter remove-server-header -n istio-system meta.helm.sh/release-name=uds-global-istio-config --overwrite || true
./zarf tools kubectl annotate PeerAuthentication default-istio-system -n istio-system meta.helm.sh/release-name=uds-global-istio-config --overwrite || true
./zarf tools kubectl annotate PeerAuthentication permissive-pepr-webhook -n pepr-system meta.helm.sh/release-name=uds-global-istio-config --overwrite || true
./zarf tools kubectl annotate PeerAuthentication permissive-pepr-webhook-watcher -n pepr-system meta.helm.sh/release-name=uds-global-istio-config --overwrite || true
after:
- description: "Ensure istio-injection is enabled for Pepr"
mute: true
cmd: "./zarf tools kubectl label namespace pepr-system istio-injection=enabled --overwrite"
20 changes: 0 additions & 20 deletions src/pepr/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,3 @@ components:
- name: module
valuesFiles:
- values.yaml
actions:
onDeploy:
before:
- mute: true
description: "Update helm ownership for Pepr resources if necessary during the upgrade"
cmd: |
./zarf tools kubectl annotate secret -n pepr-system pepr-uds-core-api-token meta.helm.sh/release-name=module --overwrite || true
./zarf tools kubectl annotate secret -n pepr-system pepr-uds-core-module meta.helm.sh/release-name=module --overwrite || true
./zarf tools kubectl annotate secret -n pepr-system pepr-uds-core-tls meta.helm.sh/release-name=module --overwrite || true
./zarf tools kubectl annotate serviceaccount -n pepr-system pepr-uds-core meta.helm.sh/release-name=module --overwrite || true
./zarf tools kubectl annotate clusterrolebinding pepr-uds-core meta.helm.sh/release-name=module --overwrite || true
./zarf tools kubectl annotate clusterrole pepr-uds-core meta.helm.sh/release-name=module --overwrite || true
./zarf tools kubectl annotate role -n pepr-system pepr-uds-core-store meta.helm.sh/release-name=module --overwrite || true
./zarf tools kubectl annotate rolebinding -n pepr-system pepr-uds-core-store meta.helm.sh/release-name=module --overwrite || true
./zarf tools kubectl annotate service -n pepr-system pepr-uds-core meta.helm.sh/release-name=module --overwrite || true
./zarf tools kubectl annotate service -n pepr-system pepr-uds-core-watcher meta.helm.sh/release-name=module --overwrite || true
./zarf tools kubectl annotate deployment -n pepr-system pepr-uds-core meta.helm.sh/release-name=module --overwrite || true
./zarf tools kubectl annotate deployment -n pepr-system pepr-uds-core-watcher meta.helm.sh/release-name=module --overwrite || true
./zarf tools kubectl annotate mutatingwebhookconfiguration -n pepr-system pepr-uds-core meta.helm.sh/release-name=module --overwrite || true
./zarf tools kubectl annotate validatingwebhookconfiguration -n pepr-system pepr-uds-core meta.helm.sh/release-name=module --overwrite || true

0 comments on commit 210b70b

Please sign in to comment.