mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-03-09 12:12:21 +01:00
Compare commits
4 Commits
dfa49943e6
...
1ef2e700c5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ef2e700c5 | ||
|
|
f12c978732 | ||
|
|
042eb6c579 | ||
|
|
5d514f481f |
10
CONTRIBUTING.md
Normal file
10
CONTRIBUTING.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Contributing to CloudNativePG
|
||||
|
||||
Thank you for your interest in contributing! 💖
|
||||
|
||||
To ensure consistency across the project, all CloudNativePG repositories follow
|
||||
a common set of guidelines regarding code of conduct, AI usage, and
|
||||
contribution workflows.
|
||||
|
||||
Please review the [CloudNativePG Project contributing guidelines](https://github.com/cloudnative-pg/governance/blob/main/CONTRIBUTING.md)
|
||||
before searching for issues, reporting bugs, or submitting a pull request.
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -31,6 +31,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"
|
||||
@ -102,6 +103,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,
|
||||
@ -120,6 +129,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")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user