refactor: expose decision engine in public pkg

This commit is contained in:
Safwan
2026-07-21 18:21:02 +05:00
parent 6037ca4b93
commit 0098e6aef8
49 changed files with 94 additions and 79 deletions
+6 -5
View File
@@ -17,12 +17,13 @@ import (
"k8s.io/client-go/discovery"
controllerruntime "sigs.k8s.io/controller-runtime"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/internal/pkg/config/flags"
"github.com/stakater/Reloader/internal/pkg/controller"
"github.com/stakater/Reloader/internal/pkg/csi"
"github.com/stakater/Reloader/internal/pkg/metadata"
"github.com/stakater/Reloader/internal/pkg/metrics"
"github.com/stakater/Reloader/internal/pkg/openshift"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/pkg/metadata"
)
// Environment variable names for pod identity in HA mode.
@@ -49,12 +50,12 @@ func newReloaderCommand() *cobra.Command {
RunE: run,
}
config.BindFlags(cmd.PersistentFlags(), cfg)
flags.BindFlags(cmd.PersistentFlags(), cfg)
return cmd
}
func run(cmd *cobra.Command, args []string) error {
if err := config.ApplyFlags(cfg); err != nil {
if err := flags.ApplyFlags(cfg); err != nil {
return fmt.Errorf("applying flags: %w", err)
}
@@ -115,7 +116,7 @@ func run(cmd *cobra.Command, args []string) error {
log.V(1).Info("Failed to create discovery client", "error", discErr)
}
if config.ShouldAutoDetectOpenShift() {
if flags.ShouldAutoDetectOpenShift() {
if discoveryClient != nil && openshift.HasDeploymentConfigSupport(discoveryClient, log) {
cfg.DeploymentConfigEnabled = true
}
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"context"
"time"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
)
// AlertMessage contains the details of a reload event to be sent as an alert.
+1 -1
View File
@@ -10,7 +10,7 @@ import (
"testing"
"time"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
)
// testServer creates a test HTTP server that captures the request body.
@@ -1,4 +1,4 @@
package config
package flags
import (
"fmt"
@@ -8,6 +8,8 @@ import (
"github.com/spf13/pflag"
"github.com/spf13/viper"
"k8s.io/apimachinery/pkg/labels"
"github.com/stakater/Reloader/pkg/config"
)
// v is the viper instance for configuration.
@@ -22,7 +24,7 @@ func init() {
// BindFlags binds configuration flags to the provided flag set.
// Call this before parsing flags, then call ApplyFlags after parsing.
func BindFlags(fs *pflag.FlagSet, cfg *Config) {
func BindFlags(fs *pflag.FlagSet, cfg *config.Config) {
// Auto reload
fs.Bool(
"auto-reload-all", cfg.AutoReloadAll,
@@ -265,7 +267,7 @@ func BindFlags(fs *pflag.FlagSet, cfg *Config) {
// ApplyFlags applies flag values from viper to the config struct.
// Call this after parsing flags.
func ApplyFlags(cfg *Config) error {
func ApplyFlags(cfg *config.Config) error {
// Boolean flags
cfg.AutoReloadAll = v.GetBool("auto-reload-all")
cfg.SyncAfterRestart = v.GetBool("sync-after-restart")
@@ -287,7 +289,7 @@ func ApplyFlags(cfg *Config) error {
}
// String flags
cfg.ReloadStrategy = ReloadStrategy(v.GetString("reload-strategy"))
cfg.ReloadStrategy = config.ReloadStrategy(v.GetString("reload-strategy"))
cfg.WebhookURL = v.GetString("webhook-url")
cfg.LogFormat = v.GetString("log-format")
cfg.LogLevel = v.GetString("log-level")
@@ -1,4 +1,4 @@
package config
package flags
import (
"strings"
@@ -6,6 +6,8 @@ import (
"github.com/spf13/pflag"
"github.com/spf13/viper"
"github.com/stakater/Reloader/pkg/config"
)
// resetViper resets the viper instance for testing.
@@ -17,7 +19,7 @@ func resetViper() {
func TestBindFlags(t *testing.T) {
resetViper()
cfg := NewDefault()
cfg := config.NewDefault()
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
@@ -83,7 +85,7 @@ func TestBindFlags(t *testing.T) {
func TestBindFlags_DefaultValues(t *testing.T) {
resetViper()
cfg := NewDefault()
cfg := config.NewDefault()
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
@@ -96,8 +98,8 @@ func TestBindFlags_DefaultValues(t *testing.T) {
t.Fatalf("ApplyFlags() error = %v", err)
}
if cfg.ReloadStrategy != ReloadStrategyEnvVars {
t.Errorf("ReloadStrategy = %v, want %v", cfg.ReloadStrategy, ReloadStrategyEnvVars)
if cfg.ReloadStrategy != config.ReloadStrategyEnvVars {
t.Errorf("ReloadStrategy = %v, want %v", cfg.ReloadStrategy, config.ReloadStrategyEnvVars)
}
if cfg.LogLevel != "info" {
@@ -107,7 +109,7 @@ func TestBindFlags_DefaultValues(t *testing.T) {
func TestBindFlags_CustomValues(t *testing.T) {
resetViper()
cfg := NewDefault()
cfg := config.NewDefault()
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
@@ -134,8 +136,8 @@ func TestBindFlags_CustomValues(t *testing.T) {
t.Error("AutoReloadAll should be true")
}
if cfg.ReloadStrategy != ReloadStrategyAnnotations {
t.Errorf("ReloadStrategy = %v, want %v", cfg.ReloadStrategy, ReloadStrategyAnnotations)
if cfg.ReloadStrategy != config.ReloadStrategyAnnotations {
t.Errorf("ReloadStrategy = %v, want %v", cfg.ReloadStrategy, config.ReloadStrategyAnnotations)
}
if cfg.LogLevel != "debug" {
@@ -162,7 +164,7 @@ func TestBindFlags_CustomValues(t *testing.T) {
func TestApplyFlags_SecretProviderClassAnnotations(t *testing.T) {
// Defaults are preserved when the flags are not provided.
resetViper()
cfg := NewDefault()
cfg := config.NewDefault()
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
if err := fs.Parse(nil); err != nil {
@@ -171,7 +173,7 @@ func TestApplyFlags_SecretProviderClassAnnotations(t *testing.T) {
if err := ApplyFlags(cfg); err != nil {
t.Fatalf("ApplyFlags() error = %v", err)
}
defaults := DefaultAnnotations()
defaults := config.DefaultAnnotations()
if cfg.Annotations.SecretProviderClassAuto != defaults.SecretProviderClassAuto {
t.Errorf("SecretProviderClassAuto = %q, want default %q", cfg.Annotations.SecretProviderClassAuto, defaults.SecretProviderClassAuto)
}
@@ -184,7 +186,7 @@ func TestApplyFlags_SecretProviderClassAnnotations(t *testing.T) {
// Custom values are applied from the flags.
resetViper()
cfg = NewDefault()
cfg = config.NewDefault()
fs = pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
args := []string{
@@ -212,7 +214,7 @@ func TestApplyFlags_SecretProviderClassAnnotations(t *testing.T) {
func TestApplyFlags_ExcludeAnnotations(t *testing.T) {
// Defaults are preserved when the flags are not provided.
resetViper()
cfg := NewDefault()
cfg := config.NewDefault()
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
if err := fs.Parse(nil); err != nil {
@@ -221,7 +223,7 @@ func TestApplyFlags_ExcludeAnnotations(t *testing.T) {
if err := ApplyFlags(cfg); err != nil {
t.Fatalf("ApplyFlags() error = %v", err)
}
defaults := DefaultAnnotations()
defaults := config.DefaultAnnotations()
if cfg.Annotations.ConfigmapExclude != defaults.ConfigmapExclude {
t.Errorf("ConfigmapExclude = %q, want default %q", cfg.Annotations.ConfigmapExclude, defaults.ConfigmapExclude)
}
@@ -231,7 +233,7 @@ func TestApplyFlags_ExcludeAnnotations(t *testing.T) {
// Custom values are applied from the flags.
resetViper()
cfg = NewDefault()
cfg = config.NewDefault()
fs = pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
args := []string{
@@ -255,7 +257,7 @@ func TestApplyFlags_ExcludeAnnotations(t *testing.T) {
func TestApplyFlags_IgnoreAnnotation(t *testing.T) {
// Default is preserved when the flag is not provided.
resetViper()
cfg := NewDefault()
cfg := config.NewDefault()
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
if err := fs.Parse(nil); err != nil {
@@ -264,13 +266,13 @@ func TestApplyFlags_IgnoreAnnotation(t *testing.T) {
if err := ApplyFlags(cfg); err != nil {
t.Fatalf("ApplyFlags() error = %v", err)
}
if cfg.Annotations.Ignore != DefaultAnnotations().Ignore {
t.Errorf("Ignore = %q, want default %q", cfg.Annotations.Ignore, DefaultAnnotations().Ignore)
if cfg.Annotations.Ignore != config.DefaultAnnotations().Ignore {
t.Errorf("Ignore = %q, want default %q", cfg.Annotations.Ignore, config.DefaultAnnotations().Ignore)
}
// Custom value is applied from the flag.
resetViper()
cfg = NewDefault()
cfg = config.NewDefault()
fs = pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
if err := fs.Parse([]string{"--ignore-annotation=my.company.com/reloader-ignore"}); err != nil {
@@ -305,7 +307,7 @@ func TestApplyFlags_BooleanStrings(t *testing.T) {
t.Run(
tt.name, func(t *testing.T) {
resetViper()
cfg := NewDefault()
cfg := config.NewDefault()
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
@@ -329,7 +331,7 @@ func TestApplyFlags_BooleanStrings(t *testing.T) {
func TestApplyFlags_CommaSeparatedLists(t *testing.T) {
resetViper()
cfg := NewDefault()
cfg := config.NewDefault()
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
@@ -365,7 +367,7 @@ func TestApplyFlags_CommaSeparatedLists(t *testing.T) {
func TestApplyFlags_Selectors(t *testing.T) {
resetViper()
cfg := NewDefault()
cfg := config.NewDefault()
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
@@ -397,7 +399,7 @@ func TestApplyFlags_Selectors(t *testing.T) {
func TestApplyFlags_InvalidSelector(t *testing.T) {
resetViper()
cfg := NewDefault()
cfg := config.NewDefault()
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
@@ -453,7 +455,7 @@ func TestApplyFlags_AlertingEnvVars(t *testing.T) {
t.Setenv(k, val)
}
cfg := NewDefault()
cfg := config.NewDefault()
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
@@ -486,7 +488,7 @@ func TestApplyFlags_LegacyProxyEnvVar(t *testing.T) {
t.Setenv("ALERT_WEBHOOK_PROXY", "http://legacy-proxy:8080")
cfg := NewDefault()
cfg := config.NewDefault()
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
@@ -505,7 +507,7 @@ func TestApplyFlags_LegacyProxyEnvVar(t *testing.T) {
func TestApplyFlagsCSIIntegration(t *testing.T) {
resetViper()
cfg := NewDefault()
cfg := config.NewDefault()
fs := pflag.NewFlagSet("test", pflag.ContinueOnError)
BindFlags(fs, cfg)
if err := fs.Parse([]string{"--enable-csi-integration=true"}); err != nil {
@@ -9,10 +9,10 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"github.com/stakater/Reloader/internal/pkg/alerting"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/internal/pkg/events"
"github.com/stakater/Reloader/internal/pkg/metrics"
"github.com/stakater/Reloader/internal/pkg/reload"
"github.com/stakater/Reloader/pkg/reload"
"github.com/stakater/Reloader/internal/pkg/webhook"
"github.com/stakater/Reloader/internal/pkg/workload"
)
@@ -3,7 +3,7 @@ package controller_test
import (
"testing"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/internal/pkg/testutil"
)
@@ -10,8 +10,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/internal/pkg/reload"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/pkg/reload"
)
// DeploymentReconciler reconciles Deployment objects to handle pause expiration.
+2 -2
View File
@@ -6,8 +6,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/event"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/internal/pkg/reload"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/pkg/reload"
)
// BuildEventFilter combines a resource-specific predicate with common filters.
+1 -1
View File
@@ -8,7 +8,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/event"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
)
func TestCreateEventPredicate_CreateEvent(t *testing.T) {
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"github.com/stakater/Reloader/internal/pkg/alerting"
"github.com/stakater/Reloader/internal/pkg/events"
"github.com/stakater/Reloader/internal/pkg/metrics"
"github.com/stakater/Reloader/internal/pkg/reload"
"github.com/stakater/Reloader/pkg/reload"
"github.com/stakater/Reloader/internal/pkg/webhook"
"github.com/stakater/Reloader/internal/pkg/workload"
)
+2 -2
View File
@@ -18,10 +18,10 @@ import (
csiv1 "sigs.k8s.io/secrets-store-csi-driver/apis/v1"
"github.com/stakater/Reloader/internal/pkg/alerting"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/internal/pkg/events"
"github.com/stakater/Reloader/internal/pkg/metrics"
"github.com/stakater/Reloader/internal/pkg/reload"
"github.com/stakater/Reloader/pkg/reload"
"github.com/stakater/Reloader/internal/pkg/webhook"
"github.com/stakater/Reloader/internal/pkg/workload"
)
@@ -11,8 +11,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/internal/pkg/reload"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/pkg/reload"
)
// NamespaceCache provides thread-safe access to the set of namespaces
@@ -5,7 +5,7 @@ import (
"k8s.io/apimachinery/pkg/labels"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/internal/pkg/controller"
"github.com/stakater/Reloader/internal/pkg/testutil"
)
@@ -11,10 +11,10 @@ import (
"sigs.k8s.io/controller-runtime/pkg/predicate"
"github.com/stakater/Reloader/internal/pkg/alerting"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/internal/pkg/events"
"github.com/stakater/Reloader/internal/pkg/metrics"
"github.com/stakater/Reloader/internal/pkg/reload"
"github.com/stakater/Reloader/pkg/reload"
"github.com/stakater/Reloader/internal/pkg/webhook"
"github.com/stakater/Reloader/internal/pkg/workload"
)
+1 -1
View File
@@ -7,7 +7,7 @@ import (
"k8s.io/client-go/util/retry"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/stakater/Reloader/internal/pkg/reload"
"github.com/stakater/Reloader/pkg/reload"
"github.com/stakater/Reloader/internal/pkg/workload"
)
+2 -2
View File
@@ -13,9 +13,9 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/internal/pkg/controller"
"github.com/stakater/Reloader/internal/pkg/reload"
"github.com/stakater/Reloader/pkg/reload"
"github.com/stakater/Reloader/internal/pkg/testutil"
"github.com/stakater/Reloader/internal/pkg/workload"
)
+2 -2
View File
@@ -9,10 +9,10 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"github.com/stakater/Reloader/internal/pkg/alerting"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/internal/pkg/events"
"github.com/stakater/Reloader/internal/pkg/metrics"
"github.com/stakater/Reloader/internal/pkg/reload"
"github.com/stakater/Reloader/pkg/reload"
"github.com/stakater/Reloader/internal/pkg/webhook"
"github.com/stakater/Reloader/internal/pkg/workload"
)
@@ -3,7 +3,7 @@ package controller_test
import (
"testing"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/internal/pkg/testutil"
)
@@ -8,8 +8,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/event"
csiv1 "sigs.k8s.io/secrets-store-csi-driver/apis/v1"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/internal/pkg/reload"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/pkg/reload"
)
// TestSecretProviderClassReconciler_FilterIgnoresResourceLabelSelector pins the
@@ -12,8 +12,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/reconcile"
csiv1 "sigs.k8s.io/secrets-store-csi-driver/apis/v1"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/internal/pkg/reload"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/pkg/reload"
)
// SecretProviderClassReconciler watches SecretProviderClassPodStatus (the per-pod
@@ -10,9 +10,9 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
csiv1 "sigs.k8s.io/secrets-store-csi-driver/apis/v1"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/internal/pkg/controller"
"github.com/stakater/Reloader/internal/pkg/reload"
"github.com/stakater/Reloader/pkg/reload"
"github.com/stakater/Reloader/internal/pkg/testutil"
)
+2 -2
View File
@@ -13,11 +13,11 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"github.com/stakater/Reloader/internal/pkg/alerting"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
"github.com/stakater/Reloader/internal/pkg/controller"
"github.com/stakater/Reloader/internal/pkg/events"
"github.com/stakater/Reloader/internal/pkg/metrics"
"github.com/stakater/Reloader/internal/pkg/reload"
"github.com/stakater/Reloader/pkg/reload"
"github.com/stakater/Reloader/internal/pkg/testutil"
"github.com/stakater/Reloader/internal/pkg/webhook"
"github.com/stakater/Reloader/internal/pkg/workload"
@@ -11,7 +11,7 @@ import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
)
const (
@@ -11,7 +11,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
)
// testLogger returns a no-op logger for testing.
@@ -10,8 +10,8 @@ import (
"k8s.io/apimachinery/pkg/api/errors"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/internal/pkg/workload"
"github.com/stakater/Reloader/pkg/config"
)
// Publisher handles creating and updating the metadata ConfigMap.
@@ -5,6 +5,9 @@ import (
)
// ReloadDecision contains the result of evaluating whether to reload a workload.
//
// NOTE: not part of the public API — the Workload field is an internal/pkg/workload
// type and is therefore not usable from outside this module.
type ReloadDecision struct {
// Workload is the workload accessor.
Workload workload.Workload
@@ -4,7 +4,7 @@ import (
"regexp"
"strings"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
)
// MatchResult contains the result of checking if a workload should be reloaded.
@@ -3,7 +3,7 @@ package reload
import (
"testing"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
)
func TestMatcher_ShouldReload(t *testing.T) {
@@ -6,11 +6,14 @@ import (
appsv1 "k8s.io/api/apps/v1"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/internal/pkg/workload"
"github.com/stakater/Reloader/pkg/config"
)
// PauseHandler handles pause deployment logic.
//
// NOTE: not part of the public API — its methods reference internal/pkg/workload
// and are therefore not usable from outside this module.
type PauseHandler struct {
cfg *config.Config
}
@@ -7,8 +7,8 @@ import (
appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/internal/pkg/workload"
"github.com/stakater/Reloader/pkg/config"
)
func TestPauseHandler_ShouldPause(t *testing.T) {
@@ -7,7 +7,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/predicate"
csiv1 "sigs.k8s.io/secrets-store-csi-driver/apis/v1"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
)
// resourcePredicates returns predicates for filtering resource events.
@@ -9,7 +9,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/event"
csiv1 "sigs.k8s.io/secrets-store-csi-driver/apis/v1"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
)
func TestNamespaceFilterPredicate_Create(t *testing.T) {
@@ -9,11 +9,15 @@ import (
"github.com/go-logr/logr"
corev1 "k8s.io/api/core/v1"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/internal/pkg/workload"
"github.com/stakater/Reloader/pkg/config"
)
// Service orchestrates the reload logic for ConfigMaps and Secrets.
//
// NOTE: not part of the public API — its methods reference internal/pkg/workload
// and are therefore not usable from outside this module. External, decision-only
// consumers should use Matcher instead.
type Service struct {
cfg *config.Config
log logr.Logger
@@ -10,9 +10,9 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
csiv1 "sigs.k8s.io/secrets-store-csi-driver/apis/v1"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/internal/pkg/testutil"
"github.com/stakater/Reloader/internal/pkg/workload"
"github.com/stakater/Reloader/pkg/config"
)
func TestService_ProcessConfigMap_AutoReload(t *testing.T) {
@@ -9,7 +9,7 @@ import (
corev1 "k8s.io/api/core/v1"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
)
const (
@@ -6,7 +6,7 @@ import (
corev1 "k8s.io/api/core/v1"
"github.com/stakater/Reloader/internal/pkg/config"
"github.com/stakater/Reloader/pkg/config"
)
func TestEnvVarStrategy_Apply(t *testing.T) {