linode / linode/cloud-firewall-controller

Bug?: (Helm) unable to add rule to previously created (default) firewall

Open
#18 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
16
Forks
9
PR merge metrics
No merged PRs in 30d

Description

The helm template for the `CloudFirewall` has one big `if` statement around it:

https://github.com/linode/cloud-firewall-controller/blob/8eae0593716403589d4b070840967399b0b153d7/helm/controller/templates/firewall.yaml#L1-L1

This means that if you install the helm chart with default values, no (Helm managed) `CloudFirewall` will be created. However the Golang controller code will create a default firewall if no `CloudFirewall` exists:

https://github.com/linode/cloud-firewall-controller/blob/8eae0593716403589d4b070840967399b0b153d7/internal/controller/cloudfirewall_controller.go#L660-L679

Later on adding a rule via Helm however will now fail, because it will try to create a _Helm managed_ `CloudFirewall` (see above) where the object already exists. Helm will fail with:

```

│ Error: Unable to continue with update: CloudFirewall "primary" in namespace "kube-system" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "cloud-firewall-controller"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "kube-system"

│ with helm_release.linode_firewall_controller,
│ on main.tf line 70, in resource "helm_release" "linode_firewall_controller":
│ 70: resource "helm_release" "linode_firewall_controller" {


```

Note: the above is actually a failure of Helm wrapped in Terraform because I'm doing the `helm install` via Terraform, but that's besides the point. Helm is correct in the sense that because the original `CloudFirewall` was not created by Helm previously, it should not suddenly manage it and will therefor fail.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with helm/controller/templates/firewall.yaml and internal/controller/cloudfirewall_controller.go around the linked lines. Compare the Helm ownership metadata with the controller-created default CloudFirewall, then reproduce installing with default values followed by adding a rule. Done means that workflow no longer fails because Helm cannot adopt the existing firewall.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, helm
Domain
infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.