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

Add an only.flavor key to Zarf components #2101

Closed
Racer159 opened this issue Oct 25, 2023 · 1 comment · Fixed by #2105
Closed

Add an only.flavor key to Zarf components #2101

Racer159 opened this issue Oct 25, 2023 · 1 comment · Fixed by #2105
Labels
enhancement ✨ New feature or request
Milestone

Comments

@Racer159
Copy link
Contributor

Is your feature request related to a problem? Please describe.

As Ezra I want the ability to specify "flavors" of Zarf packages and select between them on zarf package create so that I can swap chunks of things like images and valuesFiles without the need to have an entirely separate copy of a Zarf package definition.

Describe the solution you'd like

  • Given I have a Zarf package definition
  • And that definition has components that specify only.flavor
  • When I run zarf package create --flavor my-flavor
  • Then Zarf will include all components that match that flavor or have an empty flavor string
  • And When I run zarf package create without a flavor
  • Then Zarf will include only components that have an empty flavor string

Describe alternatives you've considered

We could have higher order keys like imageSets or have other extensions but this adds complexity without taking advantage of a lot of the base Zarf primitive manipulation that can be done through composability.

Additional context

This initial ask came from a desire to swap images to have a hardened and an upstream version of the same underlying package to help with package development and testing.

@Racer159 Racer159 added the enhancement ✨ New feature or request label Oct 25, 2023
@Racer159 Racer159 added this to the (2023.11.07) milestone Oct 25, 2023
@jeff-mccoy
Copy link
Contributor

Here's an example we worked through for Istio 1.19 where there would be an ironbank and upstream flavor:

kind: ZarfPackageConfig
metadata:
  name: uds-capabilities-istio
  description: "UDS Istio Capability"
  url: https://istio.io/latest/
  version: 1.19.0

components:
  - name: istio-controlplane
    import:
      path: common
    only:
      flavor: upstream
    images:
      - "docker.io/istio/pilot:1.19.0"
      - "docker.io/istio/proxyv2:1.19.0"

  - name: istio-controlplane
    import:
      path: common
    charts:
      - name: istiod
        valuesFiles:
          - "values/ironbank.yaml"
    only:
      flavor: ironbank
    images:
      - "registry1.dso.mil/ironbank/opensource/istio/pilot:1.19.0"
      - "registry1.dso.mil/ironbank/opensource/istio/proxyv2:1.19.0"

Racer159 added a commit that referenced this issue Nov 1, 2023
…riants (#2105)

## Description

This implements the `only.flavor` filter as a replacement for component
groups to allow the feature to be more declarative when building package
variants.

## Related Issue

Fixes #2101

## 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

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

---------

Signed-off-by: razzle <[email protected]>
Co-authored-by: razzle <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants