Compare commits

...

4 Commits

Author SHA1 Message Date
Augusto Ribeiro
971958a8e8
Merge 042eb6c579 into 9967e2caab 2026-08-12 16:11:31 +05:30
Gabriele Bartolini
9967e2caab
chore: sync CODEOWNERS with cnpg-infra policy (#1047)
Regenerates this repo's CODEOWNERS from cloudnative-pg/cnpg-infra's
`componentowners-policy.yaml`, the org's tracked desired state for
CODEOWNERS content.

- Routes ownership through this repo's dedicated GitHub owners team
instead of hardcoded usernames, so membership changes are picked up
automatically.
- Any path-scoped rule now also includes the repo's general owners, so a
path rule adds reviewers rather than silently replacing the `*` rule's
owners for that subtree (CODEOWNERS only honors the last matching
pattern, it does not merge).

See cloudnative-pg/cnpg-infra for the policy this is generated from.

Assisted-by: Claude

Signed-off-by: Gabriele Bartolini <gabriele.bartolini@enterprisedb.com>
2026-08-06 19:30:12 +10:00
Augusto Ribeiro
042eb6c579
Merge branch 'cloudnative-pg:main' into watchworkspace 2026-02-02 14:58:54 +01:00
augusto.ribeiro
5d514f481f adding a watch-namespace option in order to only watch one namespace if set
Signed-off-by: augusto.ribeiro <augusto.ribeiro@cloudkitchens.com>
Signed-off-by: augustoribeiro <augusto.mcc@gmail.com>
2026-02-02 14:57:43 +01:00
3 changed files with 25 additions and 4 deletions

View File

@ -1,5 +1,9 @@
# The CODEOWNERS file is used to define individuals or teams that are
# responsible for code in a repository. For details, please refer to
# https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/about-code-owners
# This file is generated from componentowners-policy.yaml in
# cloudnative-pg/cnpg-infra — do not hand-edit, propose changes there instead.
#
# Path-scoped rules below always include the repo's own general owners
# (the "*" line) in addition to their own specific teams/users, since
# CODEOWNERS only honors the LAST matching pattern for a given path —
# it does not merge an earlier, less-specific rule into a later one.
* @leonardoce @mnencia @gbartolini @fcanovai @armru @NiccoloFei
* @cloudnative-pg/plugin-barman-cloud-owners

View File

@ -103,5 +103,12 @@ func NewCmd() *cobra.Command {
_ = viper.BindEnv("sidecar-image", "SIDECAR_IMAGE")
cmd.Flags().String(
"watch-namespace",
"",
"The namespace to watch for CloudNativePG clusters. If empty, all namespaces will be watched.",
)
_ = viper.BindPFlag("watch-namespace", cmd.Flags().Lookup("watch-namespace"))
return cmd
}

View File

@ -30,6 +30,7 @@ import (
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/metrics/filters"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
@ -100,6 +101,14 @@ func Start(ctx context.Context) error {
metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization
}
var cacheOptions cache.Options
if viper.GetString("watch-namespace") != "" {
setupLog.Info("Watching a single namespace", "namespace", viper.GetString("watch-namespace"))
cacheOptions = cache.Options{
DefaultNamespaces: map[string]cache.Config{viper.GetString("watch-namespace"): {}},
}
}
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
Metrics: metricsServerOptions,
@ -118,6 +127,7 @@ func Start(ctx context.Context) error {
// if you are doing or is intended to do any operation such as perform cleanups
// after the manager stops then its usage might be unsafe.
LeaderElectionReleaseOnCancel: true,
Cache: cacheOptions,
})
if err != nil {
setupLog.Error(err, "unable to start manager")