Commit Graph

904 Commits

Author SHA1 Message Date
Hidde Beydals b4d647afd6
build: update cifuzz workflow
- Update actions to their latest versions.
- Use SHA to (potentially) allow enabling Dependabot.
- Move caching responsibility to `actions/setup-go` (supported since
  >=v3).

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-20 10:42:00 +01:00
Hidde Beydals b807af38b6
Merge pull request #642 from fluxcd/release-0.31.1
Release v0.31.1
2023-03-10 15:46:50 +01:00
Hidde Beydals 2290e274df
Release v0.31.1
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-10 15:31:51 +01:00
Hidde Beydals 99f6339f07
Merge pull request #641 from fluxcd/improve-cgroup-discovery
oomwatch: auto detect well known cgroup paths
2023-03-10 15:27:04 +01:00
Hidde Beydals b732420f26
oomwatch: auto detect well known cgroup paths
This commit adds support for recognizing cgroup v1 paths, and allows for
the configuration of alternative absolute path locations using
`--oom-watch-max-memory-path` and `--oom-watch-current-memory-path`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-10 15:08:17 +01:00
Hidde Beydals 629cd0682d
Merge pull request #639 from fluxcd/drift-detection-heading
spec: change drift detection heading
2023-03-09 18:41:57 +01:00
Hidde Beydals 7973dea5bb
spec: change drift detection heading
Signed-off-by: Hidde Beydals <hiddeco@users.noreply.github.com>
2023-03-09 18:28:54 +01:00
Hidde Beydals 45a712a6db
Merge pull request #637 from fluxcd/fix-changelog-heading
Fix sub-header of v0.31.0 changelog
2023-03-08 17:26:37 +01:00
Hidde Beydals c7de861635
Fix sub-header of v0.31.0 changelog
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-08 17:04:02 +01:00
Hidde Beydals 3e310a8a3c
Merge pull request #636 from fluxcd/release-0.31.0
Release v0.31.0
2023-03-08 17:00:35 +01:00
Hidde Beydals 4c7c04c78d
Release v0.31.0
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-08 16:46:43 +01:00
Hidde Beydals 732df6154b
Merge pull request #635 from fluxcd/fix-release-update-sc-deps
Update source-controller to v0.36.0
2023-03-08 15:35:08 +01:00
Hidde Beydals ef569c3e17
Update source-controller to v0.36.0
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-08 15:15:08 +01:00
Hidde Beydals 13eeb6429b
release: pass `--yes` to cosign in signs
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-08 13:48:41 +01:00
Hidde Beydals a26a041dd7
Merge pull request #633 from fluxcd/runtime-logger-klog 2023-03-08 01:21:01 +01:00
Hidde Beydals 3cb5b5c934
Use `logger.SetLogger` to also configure `klog`
This uses the newly introduced helper from runtime, which also
configures the logger for `klog`.

Resulting in all logs now being properly formatted, even when logged by
internal Kubernetes elements like the leader election or a dynamic
client.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-08 00:26:27 +01:00
Hidde Beydals 834b9286de
Merge pull request #634 from fluxcd/update-release-workflow
build: update release workflow
2023-03-08 00:25:47 +01:00
Hidde Beydals 2a75c33205
build: update scan workflow
- fossa-contrib/fossa-action to v2

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 18:45:59 +01:00
Hidde Beydals 75fbb909c9
build: update nightly workflow
- docker/build-push-action to v4
- Drop `platforms` from `docker/setup-qemu-action` step, as this is
  the default.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 18:42:57 +01:00
Hidde Beydals 12dcf4a513
build: update release workflow
- docker/build-push-action to v4
- sigstore/cosign-installer to v3
- goreleaser/goreleaser-action to v4

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 18:42:20 +01:00
Hidde Beydals 352b7f2c2c
Merge pull request #628 from fluxcd/oom-watcher
Introduce OOM watcher to allow graceful shutdown
2023-03-07 10:57:11 +01:00
Hidde Beydals c4566a5459
oomwatch: small tweaks
- Change memory usage percent threshold to `uint8` to no longer allow
  fractions.
- Validate interval to prevent configurations `<50ms`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 10:39:31 +01:00
Hidde Beydals cceb71d56e
oomwatch: add test coverage
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 10:39:31 +01:00
Hidde Beydals 62456c94ff
Add OOM watcher to allow graceful shutdown
This commit introduces an OOM watcher, which can be enabled using
`--feature-gates=OOMWatch=true`. The OOM watcher watches the current
memory usage as reported by cgroups via `memory.current` and cancels
the context when it reaches a certain threshold compared to
`memory.max` (default `95`%, configurable using
`--oom-watch-memory-threshold`).

This allows ongoing Helm processes to gracefully exit with a failure
before the controller is forcefully OOM killed, preventing a deadlock
of releases in a pending state.

The OOM watcher polls the `memory.current` file on an interval (default
`500ms`, configurable using `--oom-watch-interval`), as subscribing to
file updates using inotify is not possible for cgroups (v2) except for
`*.events` files. Which does provide signals using `memory.events`, but
these will generally be too late for our use case. As for example `high`
equals `max` in most containers, buying us little time to gracefully
stop our processes.

In addition, because we simply watch current usage compared to max
usage in bytes. This approach should work for cgroups v1 as well, given
this has (most of the time) files for these values available, albeit
at times at different locations. For which this commit does not
introduce a flag yet, but the library takes into account that it could
be configured at some point.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-07 10:39:19 +01:00
Hidde Beydals 154000e583
Merge pull request #630 from fluxcd/kube-improvements 2023-03-07 10:09:21 +01:00
Hidde Beydals b68592c4cb
runner: reset RESTMapper after CRD change
As otherwise with a persistent discovery client and/or REST mapper
configuration, newly installed CRDs will not be recognized and cause a
`resource mapping not found for name` error.

In addition, remove the `ServerGroups` and `Invalidate` calls. As this
is later done (again) by Helm when gathering server capabilities.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-06 16:54:48 +01:00
Hidde Beydals 34d87ccc24
kube: unify clients into single RESTClientGetter
This drops the twofold implementation in favor of a single
`MemoryRESTClientGetter` which can work with an arbitrary `rest.Config`.

The new `MemoryRESTClientGetter` lazy-loads and caches the objects it
initializes, thereby creating at most one instance of each object for
the duration of the reconcile of a single `HelmRelease` object.

Based on some initial tests, this seems to reduce the overal memory
footprint of the controller.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-06 11:21:18 +01:00
Hidde Beydals 90a03d05f6
Merge pull request #627 from fluxcd/update-xx
Update tonistiigi/xx to 1.2.1
2023-03-02 17:48:22 +01:00
Hidde Beydals 043dad959c
Update tonistiigi/xx to 1.2.1
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 17:00:55 +01:00
Hidde Beydals 7d3904f035
Merge pull request #626 from fluxcd/update-deps
Update dependencies
2023-03-02 16:00:59 +01:00
Hidde Beydals f803e222bf
e2e: increase timeout on delete-ns test
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 15:45:28 +01:00
Hidde Beydals 344717a292
Update dependencies
- github.com/fluxcd/pkg/apis/event to v0.4.1
- github.com/fluxcd/pkg/apis/kustomize to v0.8.1
- github.com/fluxcd/pkg/apis/meta to v0.19.1
- github.com/fluxcd/pkg/runtime to v0.30.0
- sigs.k8s.io/controller-runtime to v0.14.5
- github.com/containerd/containerd to v1.6.18

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 14:42:54 +01:00
Hidde Beydals 8becd60cbd
api: update dependencies
- github.com/fluxcd/pkg/apis/kustomize to v0.8.1
- github.com/fluxcd/pkg/apis/meta to v0.19.1
- sigs.k8s.io/controller-runtime to v0.14.5

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 14:41:32 +01:00
Hidde Beydals 1f5c565123
Merge pull request #623 from aryan9600/sa-check
check if service account exists before uninstalling release
2023-03-02 14:41:10 +01:00
Sanskar Jaiswal 5dbdbd1299 check if service account exists before uninstalling release
Check if the service account to be impersonated actually exists
and proceed with uninstalling the Helm release only if it does.
Otherwise, skip uninstalling the release and carry on with finalization.
Add an e2e test to check if deleting a namespace with the RBAC and
HelmRelease succeeds with the namespace being fully deleted.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2023-03-02 18:13:26 +05:30
Hidde Beydals 8d7b650a22
Merge pull request #625 from fluxcd/helm-log-levels
runner: configure Helm action cfg log levels
2023-03-02 10:22:41 +01:00
Hidde Beydals c277c4b800
runner: simplify DebugLog wrapper
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 10:01:09 +01:00
Hidde Beydals 3b25041385
runner: configure Helm action cfg log levels
This reduces the amount of log lines pushed to `debug` by configuring the kube
client and storage loggers to only log to `trace`.

In addition, the log buffer used in events will now just contain the
most relevant information about a failure as reported by the Helm action
itself, and not the in-depth information from the underlying client
and/or storage.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-02 09:58:35 +01:00
Hidde Beydals 877c4c7d39
Merge pull request #624 from fluxcd/build-go-1.20
build: update to Go 1.20
2023-03-01 16:05:04 +01:00
Hidde Beydals f1a270aefb
build: update to Go 1.20
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-01 15:52:08 +01:00
Hidde Beydals 78117fccc1
Merge pull request #621 from fluxcd/allow-dns-lookups
helm: enable DNS with AllowDNSLookups feature gate
2023-03-01 15:51:41 +01:00
Hidde Beydals f24cf9dc83
helm: enable DNS with AllowDNSLookups feature gate
This allows install and upgrade actions to use DNS lookups while
rendering Helm templates after it got disabled in Helm due to possible
security risks.

It is enabled (globally) on the controller by configuring
`--feature-gates=AllowDNSLookups=true`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-01 13:55:13 +01:00
Hidde Beydals 9abcdd6a41
Merge pull request #622 from fluxcd/update-deps
Update dependencies
2023-03-01 13:54:24 +01:00
Hidde Beydals 9d3fd3d83b
Update dependencies
- github.com/fluxcd/source-controller/api to v0.35.2
- github.com/onsi/gomega to v1.27.2
- k8s.io/api to v0.26.2
- k8s.io/apiextensions-apiserver to v0.26.2
- k8s.io/apimachinery to v0.26.2
- k8s.io/cli-runtime to v0.26.2
- k8s.io/client-go to v0.26.2
- k8s.io/utils to v0.0.0-20230220204549-a5ecb0141aa5
- Unpin github.com/emicklei/go-restful as it is no longer an (indirect)
  dependency.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-01 13:38:03 +01:00
Hidde Beydals 87044ba4a0
api: update dependencies
- k8s.io/apiextensions-apiserver v0.26.2
- k8s.io/apimachinery v0.26.2

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-01 13:30:37 +01:00
Hidde Beydals 788115965a
Merge pull request #617 from fluxcd/detect-drift
Experimental support of drift detection
2023-03-01 13:17:33 +01:00
Hidde Beydals 38ea587370
Change to `helm.toolkit.fluxcd.io/driftDetection`
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-01 13:04:13 +01:00
Hidde Beydals ff07f52dee
docs: enrich drift detection docs
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-01 13:04:12 +01:00
Hidde Beydals 8389593288
diff: prettify premature diff log
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-01 10:27:46 +01:00
Hidde Beydals 9153649f23
diff: add premature diff debug log
As there are currently no other utilities to properly see what change
the controller detected, this allows people to have an insight into
the observed changes by configuring the controller with
`--log-level=debug`.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2023-03-01 10:25:07 +01:00