Skip to content

Latest commit

 

History

History
139 lines (96 loc) · 5.06 KB

File metadata and controls

139 lines (96 loc) · 5.06 KB

Part 1: Create a Zarf Package

Zarf packages all the contents of your application into a single OCI artifact that can be deployed into an airgapped environment. In this part, you'll create a Zarf package for ArgoCD from scratch.

Create a working directory and navigate into it:

mkdir zarf-package && cd zarf-package

Step 1: Create the Package Definition

The most important piece of a Zarf package is the zarf.yaml file. It follows the Zarf package schema and defines both the package metadata and the components to deploy.

Create a zarf.yaml file with the following content:

kind: ZarfPackageConfig # ZarfPackageConfig is the package kind for most normal zarf packages
metadata:
  name: argocd       # specifies the name of our package; should be unique and stable across updates
  version: 9.4.4     # (optional) a version to track as you release updates or publish to a registry
  description: |     # (optional) a human-readable description of the package
    "A Zarf Package that deploys the ArgoCD platform"

Step 2: Add the ArgoCD Component

In a Zarf package, components are the units that define an application stack. They can include Kubernetes manifests, configuration files, Helm charts, and more. Components are defined under the components key in zarf.yaml.

For more details, see Understanding Zarf Components.

Add the following to the bottom of your zarf.yaml:

components:
  - name: argocd # specifies the name of our component; should be unique and stable across updates
    description: | # (optional) a human-readable description of the component
      "Deploys the ArgoCD packaged chart into the cluster"
    required: true # ensures this component is always deployed
    charts:
      - name: argo-cd
        version: 9.4.4
        namespace: argocd
        url: https://argoproj.github.io/argo-helm
        releaseName: argocd-baseline
        valuesFiles:
          - baseline-values.yaml

The url field points directly to the upstream ArgoCD Helm repository — the same source you'd use with helm repo add. When you build the package, Zarf fetches the chart from that URL and bundles it into the tarball, so the airgapped environment gets an unmodified copy of the upstream chart. Local chart directories are also supported if you need to package a custom or vendored chart.

Step 3: Create the Values File

The valuesFiles entry above references a baseline-values.yaml file. Create it in the same directory with the following content:

redis-ha:
  enabled: false

dex:
  enabled: false

notifications:
  enabled: false

redis:
  image:
    repository: docker.io/library/redis

Note

These values are needed at package creation time because the zarf dev find-images command (used in the next step) templates the Helm chart to discover required images. Providing values now ensures that templating succeeds.

Step 4: Find the Images

Zarf packages all required container images alongside your application so they're available in a disconnected environment. The zarf dev find-images command templates your Helm chart and identifies every image that will be needed.

Run this in your zarf-package directory:

zarf dev find-images

You should see output similar to:

components:
  - name: argocd
    images:
      - docker.io/library/redis:8.2.3-alpine
      - quay.io/argoproj/argocd:v3.3.2
      # Cosign artifacts for images - argocd
      - quay.io/argoproj/argocd:sha256-5882f28f7aaeaac397949c4511fdc1ad66c1260af44166ccf7e57aca3d7b9797.att

Copy the full images list from your output into the argocd component in your zarf.yaml, replacing the two images you added in Step 2.

Step 5: Set Up a Zarf Connect Service

Zarf Connect Services let you quickly connect to a deployed application by watching for specific Kubernetes service labels and annotations. After deployment, Zarf surfaces any discovered connect endpoints.

Add the following to your baseline-values.yaml file:

server:
  service:
    labels:
      zarf.dev/connect-name: argocd
    annotations:
      zarf.dev/connect-description: "The Argocd UI service"

This adds a label/annotation to the argocd server service which zarf can discover once deployed to the cluster.

Step 6: Build the Package

With your zarf.yaml and baseline-values.yaml in place, build the package:

zarf package create .

Zarf will pull down all referenced resources and bundle them into a package tarball. When it completes, list the directory to confirm:

ls

You should see a file named something like zarf-package-argocd-amd64-9.4.4.tar.zst (the architecture segment will match your system). Zarf also embeds a Software Bill of Materials (SBOM) into each package automatically.


Reference Solution

If you get stuck, a complete working solution is available in the solution/ directory.


Next: Part 2: Deploy a Zarf Package