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

chore: update flux example, tests, and docs to address upstream fix #3052

Merged
merged 3 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
16 changes: 7 additions & 9 deletions examples/podinfo-flux/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ components:
- name: flux-install
namespace: flux
files:
- https://github.com/fluxcd/flux2/releases/download/v2.3.0/install.yaml
- https://github.com/fluxcd/flux2/releases/download/v2.4.0/install.yaml
images:
- ghcr.io/fluxcd/helm-controller:v1.0.1
- ghcr.io/fluxcd/image-automation-controller:v0.38.0
- ghcr.io/fluxcd/image-reflector-controller:v0.32.0
- ghcr.io/fluxcd/kustomize-controller:v1.3.0
- ghcr.io/fluxcd/notification-controller:v1.3.0
- ghcr.io/fluxcd/source-controller:v1.3.0
- ghcr.io/fluxcd/helm-controller:v1.1.0
- ghcr.io/fluxcd/image-automation-controller:v0.39.0
- ghcr.io/fluxcd/image-reflector-controller:v0.33.0
- ghcr.io/fluxcd/kustomize-controller:v1.4.0
- ghcr.io/fluxcd/notification-controller:v1.4.0
- ghcr.io/fluxcd/source-controller:v1.4.1

- name: podinfo-via-flux-git
description: Example deployment via flux (git) using the famous podinfo example
Expand Down Expand Up @@ -108,6 +108,4 @@ x-mdx: |

The Zarf agent will only automatically add the `insecure` key if the internal registry is used. If you are using a http registry outside of the cluster you will need to manually add this key.

Due to an upstream bug, HelmRepositories with an insecure registry must use IP address instead of a hostname. This is not an issue with the internal Zarf registry, which is always an IP address, but will cause Flux HelmRepositories to break if Zarf is using an external http registry with a hostname.

:::
6 changes: 0 additions & 6 deletions site/src/content/docs/ref/init-package.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,6 @@ The `zarf-agent` modifies the following [flux](https://fluxcd.io/flux/) resource

> Support for mutating OCIRepository and HelmRepository objects is in [`alpha`](/roadmap#alpha) and should be tested on non-production clusters before being deployed to production clusters.

:::caution

Due to a bug in helm, HelmRepositories with an insecure registry must use IP address instead of a hostname. This is not an issue with the internal Zarf registry, which is always an IP address, but will cause Flux HelmRepositories to break if Zarf is using an external http registry with a hostname.

:::

The `zarf-agent` modifies [ArgoCD applications](https://argo-cd.readthedocs.io/en/stable/user-guide/application-specification/) & [ArgoCD Repositories](https://argo-cd.readthedocs.io/en/stable/user-guide/private-repositories/) objects to point to the local Git Server.

> Support for mutating `Application` and `Repository` objects in ArgoCD is in [`beta`](/roadmap#beta) and should be tested on non-production clusters before being deployed to production clusters.
Expand Down
17 changes: 6 additions & 11 deletions src/test/external/ext_out_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const (
subnet = "172.31.0.0/16"
gateway = "172.31.0.1"
giteaIP = "172.31.0.99"
registryIP = "172.31.0.10"
giteaHost = "gitea.localhost"
registryHost = "registry.localhost"
clusterName = "zarf-external-test"
Expand All @@ -45,9 +44,7 @@ var outClusterCredentialArgs = []string{
"--git-url=http://" + giteaHost + ":3000",
"--registry-push-username=" + registryUser,
"--registry-push-password=" + commonPassword,
// TODO @AustinAbro321 once flux updates to a version of helm using ORAS v1.2.5 or greater we can switch back
// to using the registry host rather than creating an IP https://github.com/helm/helm/pull/12998
"--registry-url=" + registryIP + ":5000"}
"--registry-url=k3d-" + registryHost + ":5000"}

type ExtOutClusterTestSuite struct {
suite.Suite
Expand All @@ -61,7 +58,7 @@ func (suite *ExtOutClusterTestSuite) SetupSuite() {
// NOTE(mkcp): We dogsled these errors because some of these commands will error if they don't cleanup a resource,
// which is ok. A better solution would be checking for none or unexpected kinds of errors.
_ = exec.CmdWithPrint("k3d", "cluster", "delete", clusterName) // TODO(mkcp): intentionally ignored, mark nolint
_ = exec.CmdWithPrint("docker", "rm", "-f", "k3d-"+registryHost) // TODO(mkcp): intentionally ignored, mark nolint
_ = exec.CmdWithPrint("k3d", "registry", "delete", registryHost) // TODO(mkcp): intentionally ignored, mark nolint
_ = exec.CmdWithPrint("docker", "compose", "down") // TODO(mkcp): intentionally ignored, mark nolint
_ = exec.CmdWithPrint("docker", "network", "remove", network) // TODO(mkcp): intentionally ignored, mark nolint

Expand All @@ -70,12 +67,12 @@ func (suite *ExtOutClusterTestSuite) SetupSuite() {
suite.NoError(err, "unable to create the k3d registry")

// Install a k3d-managed registry server to act as the 'remote' container registry
err = exec.CmdWithPrint("docker", "run", "-d", "--restart=always", "-p", "5000:5000", "--name", "k3d-"+registryHost, "registry:2.8.3")
err = exec.CmdWithPrint("k3d", "registry", "create", registryHost, "--port", "5000")
suite.NoError(err, "unable to create the k3d registry")

// Create a k3d cluster with the proper networking and aliases
err = exec.CmdWithPrint("k3d", "cluster", "create", clusterName, "--registry-config", "registries.yaml",
"--host-alias", registryIP+":"+registryHost, "--host-alias", giteaIP+":"+giteaHost, "--network", network)
err = exec.CmdWithPrint("k3d", "cluster", "create", clusterName, "--registry-use",
"k3d-"+registryHost+":5000", "--host-alias", giteaIP+":"+giteaHost, "--network", network)
suite.NoError(err, "unable to create the k3d cluster")

// Install a gitea server via docker compose to act as the 'remote' git server
Expand All @@ -90,8 +87,6 @@ func (suite *ExtOutClusterTestSuite) SetupSuite() {
// Connect gitea to the k3d network
err = exec.CmdWithPrint("docker", "network", "connect", "--ip", giteaIP, network, giteaHost)
suite.NoError(err, "unable to connect the gitea-server to k3d")
err = exec.CmdWithPrint("docker", "network", "connect", "--ip", registryIP, network, "k3d-"+registryHost)
suite.NoError(err, "unable to connect the registry-server to k3d")
}

func (suite *ExtOutClusterTestSuite) TearDownSuite() {
Expand All @@ -102,7 +97,7 @@ func (suite *ExtOutClusterTestSuite) TearDownSuite() {
err = exec.CmdWithPrint("docker", "compose", "down")
suite.NoError(err, "unable to teardown the gitea-server")

err = exec.CmdWithPrint("docker", "rm", "-f", "k3d-"+registryHost)
err = exec.CmdWithPrint("k3d", "registry", "delete", registryHost)
suite.NoError(err, "unable to teardown the k3d registry")

err = exec.CmdWithPrint("docker", "network", "remove", network)
Expand Down
4 changes: 0 additions & 4 deletions src/test/external/registries.yaml

This file was deleted.

Loading