Commit Graph
201 Commits
Author SHA1 Message Date
Tomás MotaandGitHub 54403eb901 fix potential panic when acessing empty list (#88)
while fixing #87, noticed a couple lines down that if the containers
spec has more than 1 container, the code probably intends to set
Spec.Containers to a list with a single container, but is instead
setting it to an empty list. The very next lines are trying to access
the 1st element of this empty list, which will result in a panic
2025-12-29 21:56:37 +01:00
Tomás MotaandGitHub 54c3139ee2 Remove pod label overwriting (#87)
Pod labels are being set in line 242, and the`podLabels` variable
already contains the extra `"app.kubernetes.io/name": "netbird-router"`
label, so lines 244-246 are effectively just overwriting any labels that
have been set in the crd.

This is blocking us from using this crd because we need a label
disabling istio injection for the peer to work correctly.
2025-12-29 21:53:18 +01:00
Maycon SantosandGitHub 731a3c9ea1 Update Dockerfile.kubectl (#89) 2025-12-17 13:24:51 +01:00
M. EssamandGitHub c86ef5c530 Fix helm chart releaser multiple charts separate version (#84) 2025-12-17 11:23:52 +01:00
M. EssamandGitHub f1b131be7d Refactor uninstallation process (#74)
Docs PR: https://github.com/netbirdio/docs/pull/457

Changes:
* Split kubernetes-operator Chart to operator only chart
(kubernetes-operator) and configuration chart (netbird-operator-config)
* Remove delete validation webhooks for non-needed resources
* Allow abandoning Groups when still linked to a resource for over a
minute after deletion
* Fix duplciate Network Resource retrying heavily
* Fix SetupKey creation duplication
* Skip deleting routing peer since deleting network automatically
deletes it anyway
2025-11-25 20:36:17 +02:00
Christian De LeonandGitHub 6c855c5d4e Fix: extra-dns-labels not being applied to pods (#82)
# Fix: NetBird extra-dns-labels not being applied to pods

## Problem

The `netbird.io/extra-dns-labels` annotation was not working when
applied to pods. Despite the webhook detecting the annotation and adding
it to the NetBird container configuration, the extra DNS labels were not
appearing in the NetBird UI or being applied to registered peers.

## Root Cause

The pod webhook had two issues:

1. **Invalid setup key argument**: The webhook was passing
`--setup-key-file /etc/nbkey` to the NetBird client, but this file path
was never created. The setup key was already being passed via the
`NB_SETUP_KEY` environment variable, making the file-based approach
unnecessary and causing confusion in the client startup.

2. **NetBird CLI flag bug**: The webhook was using the
`--extra-dns-labels` command line flag, but NetBird has a known issue
([netbirdio/netbird#4282](https://github.com/netbirdio/netbird/issues/4282))
where this flag is not properly processed. The workaround is to use the
`NB_EXTRA_DNS_LABELS` environment variable instead.

## Solution

- Removed the `--setup-key-file` argument entirely since the setup key
is provided via environment variable
- Removed all command line arguments from the NetBird container
- Added `NB_EXTRA_DNS_LABELS` environment variable when the
`netbird.io/extra-dns-labels` annotation is present
- NetBird client now uses only environment variables for configuration,
which is more reliable and matches the pattern used by the NBRoutingPeer
controller

## Changes

**Before:**
```go
args := []string{
    "--setup-key-file", "/etc/nbkey",
    "-m", managementURL,
}
// ... add extra-dns-labels to args
```

**After:**
```go
envVars := []corev1.EnvVar{
    {Name: "NB_SETUP_KEY", ValueFrom: ...},
    {Name: "NB_MANAGEMENT_URL", Value: managementURL},
}
// ... conditionally add NB_EXTRA_DNS_LABELS to envVars
```

## Testing

1. Create a deployment with the `netbird.io/setup-key` and
`netbird.io/extra-dns-labels` annotations:
```yaml
annotations:
  netbird.io/setup-key: my-setup-key
  netbird.io/extra-dns-labels: "my-label,another-label"
```

2. Verify the environment variable is set:
```bash
kubectl get pod <pod-name> -o jsonpath='{.spec.containers[?(@.name=="netbird")].env[*]}' | jq .
```

3. Check the NetBird UI to confirm the extra DNS labels appear on the
registered peer

4. Verify the NetBird container logs show successful registration
without errors

## References

- NetBird issue: https://github.com/netbirdio/netbird/issues/4282
- Documentation: [Extra DNS
Labels](https://docs.netbird.io/how-to/routing-traffic-to-private-networks#extra-dns-labels)

---

This fix ensures that the `netbird.io/extra-dns-labels` annotation works
as documented and provides a more robust configuration method by using
environment variables consistently across all NetBird deployments in the
operator.
2025-11-24 19:00:58 +02:00
M. EssamandGitHub d8eb7cb513 Bump Helm appVersion to 0.1.5 (#81) 2025-11-23 12:05:26 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
408e20f999 Bump golang.org/x/net from 0.33.0 to 0.38.0 (#75)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.33.0 to
0.38.0.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/golang/net/commit/e1fcd82abba34df74614020343be8eb1fe85f0d9"><code>e1fcd82</code></a>
html: properly handle trailing solidus in unquoted attribute value in
foreign...</li>
<li><a
href="https://github.com/golang/net/commit/ebed060e8f30f20235f74808c22125fd86b15edd"><code>ebed060</code></a>
internal/http3: fix build of tests with GOEXPERIMENT=nosynctest</li>
<li><a
href="https://github.com/golang/net/commit/1f1fa29e0a46fffe18c43a9da8daa5a0b180dfa9"><code>1f1fa29</code></a>
publicsuffix: regenerate table</li>
<li><a
href="https://github.com/golang/net/commit/12150816f701c912a32a376754ab28dd3878833a"><code>1215081</code></a>
http2: improve error when server sends HTTP/1</li>
<li><a
href="https://github.com/golang/net/commit/312450e473eae9f9e6173ad895c80bc5ea2f79ad"><code>312450e</code></a>
html: ensure &lt;search&gt; tag closes &lt;p&gt; and update tests</li>
<li><a
href="https://github.com/golang/net/commit/09731f9bf919b00b344c763894cd1920b3d96d90"><code>09731f9</code></a>
http2: improve handling of lost PING in Server</li>
<li><a
href="https://github.com/golang/net/commit/55989e24b972a90ab99308fdc7ea1fb58a96fef1"><code>55989e2</code></a>
http2/h2c: use ResponseController for hijacking connections</li>
<li><a
href="https://github.com/golang/net/commit/2914f46773171f4fa13e276df1135bafef677801"><code>2914f46</code></a>
websocket: re-recommend gorilla/websocket</li>
<li><a
href="https://github.com/golang/net/commit/99b3ae0643f9a2f9d820fcbba5f9e4c83b23bd48"><code>99b3ae0</code></a>
go.mod: update golang.org/x dependencies</li>
<li><a
href="https://github.com/golang/net/commit/85d1d54551b68719346cb9fec24b911da4e452a1"><code>85d1d54</code></a>
go.mod: update golang.org/x dependencies</li>
<li>Additional commits viewable in <a
href="https://github.com/golang/net/compare/v0.33.0...v0.38.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=golang.org/x/net&package-manager=go_modules&previous-version=0.33.0&new-version=0.38.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/netbirdio/kubernetes-operator/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-31 15:03:54 +01:00
M. EssamandGitHub 4b98bf9ff9 Add feature to add default labels to all resources (#62)
Fixes #41 
Thanks to @mhartmann-jaconi for the Helm changes in #42
2025-10-07 13:59:50 +03:00
dependabot[bot]andGitHub 1b36287705 Bump golang.org/x/oauth2 from 0.23.0 to 0.27.0 (#64)
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from
0.23.0 to 0.27.0
2025-08-19 16:21:15 +03:00
M Essam Hamed 20b3ba60ba Add optional Volume mounting for Client containers 2025-08-10 10:25:13 +03:00
M Essam Hamed 2606b87173 Add uninstallation doc to README 2025-08-08 14:14:25 +03:00
athulandM. Essam c38b37202b fix(template): properly indent all spec fields using toYaml and nindent 4 in routingpeers.yaml 2025-08-08 13:26:04 +03:00
athulandM. Essam 877c894248 Add support for tolerations, nodeSelector, and resources in NBRoutingPeer deployment spec 2025-08-07 21:58:39 +03:00
rarroubaandM. Essam a24beb58d9 fix: typo in spec of Job kubernetes-service-expose 2025-08-05 19:39:20 +03:00
Maycon SantosandGitHub 43065a2ade chart version 0.1.12 (#56) 2025-07-17 15:10:37 +02:00
David FryandGitHub 2dbe491081 customize failure policy for webhooks (#55) 2025-07-17 09:35:35 +02:00
Maycon SantosandGitHub 48c2f42b00 add support to routing client image (#49) 2025-07-10 12:57:12 +02:00
M. EssamandGitHub 09249b6b62 Fix returning ctrl.Result and error preventing backoff (#50) 2025-07-10 10:52:48 +02:00
Frederic RoggonandGitHub 0cf1dbafd4 [Docs] Typo Fix - removed sentence that does not belong there (#45)
typo fix - removed sentence that does not belong there
2025-05-24 17:08:03 +02:00
M. EssamandGitHub 7b08362a37 Bump chart version to 0.1.10 (#39) 2025-05-02 19:37:36 +02:00
David FryandM. Essam 00d8a6ddfb fix keyfromsecret structure 2025-05-02 14:46:57 +03:00
Maycon SantosandGitHub 6c6557b2fd Bump chart version to 0.1.9 (#37) 2025-05-01 20:53:57 +02:00
David FryandGitHub 18a5b55839 use env entries instead of envFrom (#36)
The reason for this PR is that currently if the secret doesn’t have the
key NB_API_KEY yet at deployment time, the deployment will still run and
pull in an env list that doesn’t include NB_API_KEY since the envFrom
will just pull any and all keys it finds in the secret and makes env
vars out of them. then at a later point, once the NB_API_KEY key is
populated in the secret, one has to bounce the pod to get the key to be
picked up.

if you use the env: valueFrom syntax using a named key, if that named
key doesn’t exist, the deployment should give an error and retry until
the secret key is available
2025-05-01 14:52:03 +02:00
M Essam Hamed 8ff64b433c Add documentation 2025-04-16 14:45:23 +02:00
M Essam Hamed 38445c58fa Add support for policy auto-creation 2025-04-16 14:45:23 +02:00
Mykola DzhamandM. Essam 924f17f525 Fix Job field name 2025-04-13 22:36:59 +02:00
M. EssamandGitHub 3f4137a153 Fix conditional RBAC to be added on NetBird key existence (#26)
Operator checks for existence of NetBird API key to create controllers
for Service, NBResource, NBPolicy ...etc, while the Helm chart checks
for Values.ingress.enabled, this causes crashes if NetBird API Key is
provided but ingress.enabled is set to `false`.

This fixes this discrepancy by checking NetBird API key in Helm instead
of ingress enabled value.

resolves #13
2025-04-07 08:05:39 +02:00
M. EssamandGitHub b06e9b1de2 Add docs for Kubernetes API (#27)
Add simple instruction for exposing kubernetes API as a Network
Resource.
2025-04-07 08:05:26 +02:00
Maycon SantosandGitHub f98f0d7d61 Update chart version 2025-04-01 14:33:12 +02:00
Maycon SantosandGitHub c37b8f7432 fix kubernetes api resource template (#20) 2025-03-31 17:27:42 +02:00
Maycon SantosandGitHub 08ce0a06c9 Update Chart.yaml 2025-03-30 22:58:49 +02:00
Maycon SantosandGitHub d7991ebcf3 Update app version 2025-03-30 22:58:37 +02:00
Maycon SantosandGitHub 3596e902e2 Update Chart.yaml (#19) 2025-03-30 22:15:42 +02:00
c4d73d83b1 Feature/kubernetes api access (#17)
Co-authored-by: M Essam Hamed <github@messam.xyz>
2025-03-30 21:16:44 +02:00
219ee9a0b6 Add support for multiple policies (#16)
Change policy annotation to support comma-separated list of policies.

---------

Co-authored-by: Maycon Santos <mlsmaycon@gmail.com>
2025-03-28 13:50:09 +01:00
M. EssamandGitHub 6a33bffb65 Add unit tests to new controllers and fix minor bugs (#12) 2025-03-28 08:55:41 +01:00
Misha BraginandGitHub ac8348cda6 Add CLA (#15) 2025-03-19 15:12:18 +01:00
Maycon SantosandGitHub face38a812 Update/helm (#11) 2025-03-06 16:17:00 +01:00
Misha BraginandGitHub f147b33665 Add example steps (#10) 2025-03-06 15:32:17 +01:00
Maycon SantosandGitHub b8b268e2f9 Update version docs and chart base image (#9) 2025-03-06 14:26:12 +01:00
M. EssamandGitHub 1b77e77dfa Fix TCP Policy deletion when policy is already deleted (#8)
Fix NBPolicy deletion when TCP policy is already deleted
2025-03-06 14:24:46 +01:00
166091b8e0 Add ingress feature to controller (#5)
Co-authored-by: Maycon Santos <mlsmaycon@gmail.com>
2025-03-06 09:57:45 +01:00
M. EssamandGitHub cea60745d2 Remove goreleaser and fix helm packaging (#6)
Goreleaser was causing issues when helm chart action created releases
for packaged helm chart, this PR replaces goreleaser with a much simpler
build and push model, and returns packaged helm charts to normal.
2025-03-05 09:03:04 +01:00
M. EssamandGitHub 3716e5daba Merge pull request #4 from netbirdio/feat/extra-dns-labels
feat: add extra dns labels annotation
2025-02-22 20:19:58 +02:00
Hakan Sariman 289d6f25d3 add extra dns labels annotation 2025-02-22 14:32:22 +03:00
M. EssamandGitHub 74f9959ae2 Disable goreleaser scm publish (#3)
Disables unused scm release from goreleaser as we don't need to publish
binaries
2025-01-30 15:19:35 +01:00
M. EssamandGitHub 1adda8e0a6 Merge pull request #2 from netbirdio/fix/release-workflow
Fix release workflows
2025-01-30 00:42:27 +02:00
M Essam Hamed 0219fe8aad Fix release workflows
- Check for dirty repository in release
- Fix helm release workflow name
- Rename dist dir to manifests as dist is used by goreleaser
2025-01-30 00:33:03 +02:00
M. EssamandGitHub 64091a6439 Add initial version with help and admission controller (#1)
- It adds a helm chart that will be hosted in the Github pages URL of this repository
- an admission controller operator 
- Basic documentation for installing the operator, configuring CRDs and example pod configuration
2025-01-29 22:44:09 +01:00