From 09e2d3f10e7c54ae8539f98dfaf9217146d0617c Mon Sep 17 00:00:00 2001 From: Andrii Korotkov Date: Wed, 27 Nov 2024 22:21:18 -0800 Subject: [PATCH 1/7] fix: Graceful shutdown for the API server (#18642) Closes #18642 Implements a graceful shutdown the the API server. Without this, ArgoCD API server will eventually return 502 during rolling update. However, healthcheck would return 503 if the server is terminating. Signed-off-by: Andrii Korotkov Co-authored-by: Leonardo Luz Almeida Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --- assets/swagger.json | 6 + cmd/argocd-server/commands/argocd_server.go | 17 +- pkg/apiclient/settings/settings.pb.go | 218 +++++++++++++------- server/server.go | 174 +++++++++++++--- server/server_test.go | 68 ++++++ server/settings/settings.go | 1 + server/settings/settings.proto | 1 + test/e2e/graceful_restart_test.go | 57 +++++ 8 files changed, 423 insertions(+), 119 deletions(-) create mode 100644 test/e2e/graceful_restart_test.go diff --git a/assets/swagger.json b/assets/swagger.json index 157baf3b774a9..fcbc75856db1a 100644 --- a/assets/swagger.json +++ b/assets/swagger.json @@ -4691,6 +4691,12 @@ "clusterSettings": { "type": "object", "properties": { + "additionalUrls": { + "type": "array", + "items": { + "type": "string" + } + }, "appLabelKey": { "type": "string" }, diff --git a/cmd/argocd-server/commands/argocd_server.go b/cmd/argocd-server/commands/argocd_server.go index 56bc73db87c48..08e0a07f76833 100644 --- a/cmd/argocd-server/commands/argocd_server.go +++ b/cmd/argocd-server/commands/argocd_server.go @@ -257,23 +257,26 @@ func NewCommand() *cobra.Command { stats.StartStatsTicker(10 * time.Minute) stats.RegisterHeapDumper("memprofile") argocd := server.NewServer(ctx, argoCDOpts, appsetOpts) - argocd.Init(ctx) - lns, err := argocd.Listen() - errors.CheckError(err) for { var closer func() - ctx, cancel := context.WithCancel(ctx) + serverCtx, cancel := context.WithCancel(ctx) + argocd.Init(serverCtx) + lns, err := argocd.Listen() + errors.CheckError(err) if otlpAddress != "" { - closer, err = traceutil.InitTracer(ctx, "argocd-server", otlpAddress, otlpInsecure, otlpHeaders, otlpAttrs) + closer, err = traceutil.InitTracer(serverCtx, "argocd-server", otlpAddress, otlpInsecure, otlpHeaders, otlpAttrs) if err != nil { log.Fatalf("failed to initialize tracing: %v", err) } } - argocd.Run(ctx, lns) - cancel() + argocd.Run(serverCtx, lns) if closer != nil { closer() } + cancel() + if argocd.TerminateRequested() { + break + } } }, Example: templates.Examples(` diff --git a/pkg/apiclient/settings/settings.pb.go b/pkg/apiclient/settings/settings.pb.go index 202228f7ef6f1..56fd1cbdb024c 100644 --- a/pkg/apiclient/settings/settings.pb.go +++ b/pkg/apiclient/settings/settings.pb.go @@ -103,6 +103,7 @@ type Settings struct { AppsInAnyNamespaceEnabled bool `protobuf:"varint,24,opt,name=appsInAnyNamespaceEnabled,proto3" json:"appsInAnyNamespaceEnabled,omitempty"` ImpersonationEnabled bool `protobuf:"varint,25,opt,name=impersonationEnabled,proto3" json:"impersonationEnabled,omitempty"` InstallationID string `protobuf:"bytes,26,opt,name=installationID,proto3" json:"installationID,omitempty"` + AdditionalURLs []string `protobuf:"bytes,27,rep,name=additionalUrls,proto3" json:"additionalUrls,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -323,6 +324,13 @@ func (m *Settings) GetInstallationID() string { return "" } +func (m *Settings) GetAdditionalURLs() []string { + if m != nil { + return m.AdditionalURLs + } + return nil +} + type GoogleAnalyticsConfig struct { TrackingID string `protobuf:"bytes,1,opt,name=trackingID,proto3" json:"trackingID,omitempty"` AnonymizeUsers bool `protobuf:"varint,2,opt,name=anonymizeUsers,proto3" json:"anonymizeUsers,omitempty"` @@ -756,86 +764,87 @@ func init() { func init() { proto.RegisterFile("server/settings/settings.proto", fileDescriptor_a480d494da040caa) } var fileDescriptor_a480d494da040caa = []byte{ - // 1249 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02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d, 0xab, 0xee, 0x85, 0x7c, 0x63, 0x06, 0x64, 0xd1, 0xe7, 0x92, 0x12, 0x79, 0x7a, 0xbe, 0xad, - 0x3f, 0x7e, 0x67, 0x5b, 0x27, 0x13, 0x9e, 0x93, 0x8f, 0xa8, 0x7a, 0x54, 0x72, 0x8c, 0xfd, 0x42, - 0x6d, 0x75, 0x7f, 0xb5, 0xa0, 0x9e, 0xf5, 0xd7, 0x0b, 0x14, 0xd3, 0xc0, 0x43, 0xf2, 0x05, 0x54, - 0x1e, 0xa1, 0x22, 0x3b, 0x0b, 0x33, 0x91, 0x99, 0x03, 0x1b, 0x5b, 0x0b, 0x78, 0xcb, 0xfe, 0xee, - 0x8f, 0xbf, 0x7e, 0xbc, 0x44, 0xc8, 0xa6, 0x99, 0x6d, 0xa7, 0xfb, 0xf9, 0x5c, 0x49, 0xc6, 0x00, - 0x8f, 0x30, 0xff, 0x24, 0x2f, 0x32, 0xd9, 0x5c, 0xc0, 0x4b, 0xbd, 0xde, 0x6a, 0x1a, 0x0f, 0x0d, - 0x62, 0x97, 0x3d, 0x74, 0xd2, 0x16, 0xef, 0xf5, 0x7f, 0x9b, 0xef, 0x5a, 0xbf, 0xcf, 0x77, 0xad, - 0x3f, 0xe7, 0xbb, 0xd6, 0x57, 0x1f, 0xfd, 0xbb, 0x69, 0x3a, 0x29, 0xb5, 0xdc, 0xd8, 0xf1, 0xaa, - 0x99, 0x7d, 0xef, 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x99, 0x28, 0x60, 0x2e, 0xea, 0x0b, 0x00, - 0x00, + // 1278 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4f, 0x6f, 0xdb, 0xc6, + 0x12, 0x87, 0x22, 0xc7, 0x96, 0xc6, 0xb1, 0x65, 0x6f, 0x1c, 0x87, 0xd1, 0xcb, 0xb3, 0xf5, 0x74, + 0x08, 0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2, 0x23, 0xe4, 0x3a, 0xed, 0x24, 0xb3, 0x19, 0xd4, 0xe8, 0xa5, + 0x7c, 0x73, 0x0a, 0x64, 0xde, 0xe7, 0x82, 0x12, 0x79, 0x7a, 0xb1, 0xad, 0x3f, 0x7a, 0x67, 0x5b, + 0x27, 0xdb, 0xa1, 0x9d, 0xaf, 0xb7, 0xf1, 0x9a, 0x65, 0x1b, 0xfb, 0x85, 0xda, 0xda, 0xff, 0xb9, + 0x02, 0x8d, 0xac, 0xbf, 0x5e, 0xa0, 0x9c, 0xf8, 0x0e, 0x92, 0xcf, 0xa1, 0xfa, 0x08, 0x35, 0xd9, + 0x9e, 0xdb, 0xa7, 0xcc, 0x0e, 0xd9, 0xdc, 0x9c, 0xc3, 0xdb, 0xd6, 0xb7, 0xbf, 0xff, 0xf9, 0xfd, + 0x15, 0x42, 0x36, 0xcc, 0x5e, 0x3c, 0xd9, 0xcb, 0x77, 0x52, 0x32, 0x02, 0x78, 0x84, 0xf9, 0x0f, + 0xf6, 0x32, 0x93, 0xad, 0x39, 0xbc, 0xd4, 0xeb, 0xed, 0x96, 0xf1, 0xd0, 0x24, 0x56, 0xd9, 0x43, + 0x37, 0x6d, 0xf1, 0x5e, 0xff, 0x97, 0xd9, 0x4e, 0xe5, 0xb7, 0xd9, 0x4e, 0xe5, 0x8f, 0xd9, 0x4e, + 0xe5, 0xcb, 0x0f, 0xff, 0xd9, 0x26, 0x9e, 0x94, 0x5a, 0x6e, 0xec, 0x64, 0xd9, 0xec, 0xcd, 0xf7, + 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x36, 0x87, 0xd7, 0x56, 0x26, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1009,6 +1018,17 @@ func (m *Settings) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } + if len(m.AdditionalURLs) > 0 { + for iNdEx := len(m.AdditionalURLs) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AdditionalURLs[iNdEx]) + copy(dAtA[i:], m.AdditionalURLs[iNdEx]) + i = encodeVarintSettings(dAtA, i, uint64(len(m.AdditionalURLs[iNdEx]))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0xda + } + } if len(m.InstallationID) > 0 { i -= len(m.InstallationID) copy(dAtA[i:], m.InstallationID) @@ -1797,6 +1817,12 @@ func (m *Settings) Size() (n int) { if l > 0 { n += 2 + l + sovSettings(uint64(l)) } + if len(m.AdditionalURLs) > 0 { + for _, s := range m.AdditionalURLs { + l = len(s) + n += 2 + l + sovSettings(uint64(l)) + } + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2939,6 +2965,38 @@ func (m *Settings) Unmarshal(dAtA []byte) error { } m.InstallationID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 27: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AdditionalURLs", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowSettings + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthSettings + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthSettings + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AdditionalURLs = append(m.AdditionalURLs, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipSettings(dAtA[iNdEx:]) diff --git a/server/server.go b/server/server.go index 6625461dfab03..1098fe4e927b7 100644 --- a/server/server.go +++ b/server/server.go @@ -13,13 +13,17 @@ import ( "net/url" "os" "os/exec" + "os/signal" "path" "path/filepath" "reflect" "regexp" go_runtime "runtime" + "runtime/debug" "strings" gosync "sync" + "sync/atomic" + "syscall" "time" // nolint:staticcheck @@ -187,17 +191,20 @@ type ArgoCDServer struct { db db.ArgoDB // stopCh is the channel which when closed, will shutdown the Argo CD server - stopCh chan struct{} - userStateStorage util_session.UserStateStorage - indexDataInit gosync.Once - indexData []byte - indexDataErr error - staticAssets http.FileSystem - apiFactory api.Factory - secretInformer cache.SharedIndexInformer - configMapInformer cache.SharedIndexInformer - serviceSet *ArgoCDServiceSet - extensionManager *extension.Manager + stopCh chan os.Signal + userStateStorage util_session.UserStateStorage + indexDataInit gosync.Once + indexData []byte + indexDataErr error + staticAssets http.FileSystem + apiFactory api.Factory + secretInformer cache.SharedIndexInformer + configMapInformer cache.SharedIndexInformer + serviceSet *ArgoCDServiceSet + extensionManager *extension.Manager + shutdown func() + terminateRequested atomic.Bool + available atomic.Bool } type ArgoCDServerOpts struct { @@ -329,6 +336,9 @@ func NewServer(ctx context.Context, opts ArgoCDServerOpts, appsetOpts Applicatio pg := extension.NewDefaultProjectGetter(projLister, dbInstance) ug := extension.NewDefaultUserGetter(policyEnf) em := extension.NewManager(logger, opts.Namespace, sg, ag, pg, enf, ug) + noopShutdown := func() { + log.Error("API Server Shutdown function called but server is not started yet.") + } a := &ArgoCDServer{ ArgoCDServerOpts: opts, @@ -352,6 +362,8 @@ func NewServer(ctx context.Context, opts ArgoCDServerOpts, appsetOpts Applicatio secretInformer: secretInformer, configMapInformer: configMapInformer, extensionManager: em, + shutdown: noopShutdown, + stopCh: make(chan os.Signal, 1), } err = a.logInClusterWarnings() @@ -369,6 +381,12 @@ const ( ) func (a *ArgoCDServer) healthCheck(r *http.Request) error { + if a.terminateRequested.Load() { + return errors.New("API Server is terminating and unable to serve requests.") + } + if !a.available.Load() { + return errors.New("API Server is not available. It either hasn't started or is restarting.") + } if val, ok := r.URL.Query()["full"]; ok && len(val) > 0 && val[0] == "true" { argoDB := db.NewDB(a.Namespace, a.settingsMgr, a.KubeClientset) _, err := argoDB.ListClusters(r.Context()) @@ -515,6 +533,14 @@ func (a *ArgoCDServer) Init(ctx context.Context) { // k8s.io/ go-to-protobuf uses protoc-gen-gogo, which comes from gogo/protobuf (a fork of // golang/protobuf). func (a *ArgoCDServer) Run(ctx context.Context, listeners *Listeners) { + defer func() { + if r := recover(); r != nil { + log.WithField("trace", string(debug.Stack())).Error("Recovered from panic: ", r) + a.terminateRequested.Store(true) + a.shutdown() + } + }() + a.userStateStorage.Init(ctx) metricsServ := metrics.NewMetricsServer(a.MetricsHost, a.MetricsPort) @@ -601,35 +627,118 @@ func (a *ArgoCDServer) Run(ctx context.Context, listeners *Listeners) { log.Fatal("Timed out waiting for project cache to sync") } - a.stopCh = make(chan struct{}) - <-a.stopCh + shutdownFunc := func() { + log.Info("API Server shutdown initiated. Shutting down servers...") + a.available.Store(false) + shutdownCtx, cancel := context.WithTimeout(ctx, 20*time.Second) + defer cancel() + var wg gosync.WaitGroup + + // Shutdown http server + wg.Add(1) + go func() { + defer wg.Done() + err := httpS.Shutdown(shutdownCtx) + if err != nil { + log.Errorf("Error shutting down http server: %s", err) + } + }() + + if a.useTLS() { + // Shutdown https server + wg.Add(1) + go func() { + defer wg.Done() + err := httpsS.Shutdown(shutdownCtx) + if err != nil { + log.Errorf("Error shutting down https server: %s", err) + } + }() + } + + // Shutdown gRPC server + wg.Add(1) + go func() { + defer wg.Done() + grpcS.GracefulStop() + }() + + // Shutdown metrics server + wg.Add(1) + go func() { + defer wg.Done() + err := metricsServ.Shutdown(shutdownCtx) + if err != nil { + log.Errorf("Error shutting down metrics server: %s", err) + } + }() + + if a.useTLS() { + // Shutdown tls server + wg.Add(1) + go func() { + defer wg.Done() + tlsm.Close() + }() + } + + // Shutdown tcp server + wg.Add(1) + go func() { + defer wg.Done() + tcpm.Close() + }() + + c := make(chan struct{}) + // This goroutine will wait for all servers to conclude the shutdown + // process + go func() { + defer close(c) + wg.Wait() + }() + + select { + case <-c: + log.Info("All servers were gracefully shutdown. Exiting...") + case <-shutdownCtx.Done(): + log.Warn("Graceful shutdown timeout. Exiting...") + } + } + a.shutdown = shutdownFunc + signal.Notify(a.stopCh, os.Interrupt, syscall.SIGINT, syscall.SIGTERM) + a.available.Store(true) + + select { + case signal := <-a.stopCh: + log.Infof("API Server received signal: %s", signal.String()) + // SIGUSR1 is used for triggering a server restart + if signal != syscall.SIGUSR1 { + a.terminateRequested.Store(true) + } + a.shutdown() + case <-ctx.Done(): + log.Infof("API Server: %s", ctx.Err()) + a.terminateRequested.Store(true) + a.shutdown() + } } func (a *ArgoCDServer) Initialized() bool { return a.projInformer.HasSynced() && a.appInformer.HasSynced() } +// TerminateRequested returns whether a shutdown was initiated by a signal or context cancel +// as opposed to a watch. +func (a *ArgoCDServer) TerminateRequested() bool { + return a.terminateRequested.Load() +} + // checkServeErr checks the error from a .Serve() call to decide if it was a graceful shutdown func (a *ArgoCDServer) checkServeErr(name string, err error) { - if err != nil { - if a.stopCh == nil { - // a nil stopCh indicates a graceful shutdown - log.Infof("graceful shutdown %s: %v", name, err) - } else { - log.Fatalf("%s: %v", name, err) - } + if err != nil && !errors.Is(err, http.ErrServerClosed) { + log.Errorf("Error received from server %s: %v", name, err) } else { - log.Infof("graceful shutdown %s", name) - } -} - -// Shutdown stops the Argo CD server -func (a *ArgoCDServer) Shutdown() { - log.Info("Shut down requested") - stopCh := a.stopCh - a.stopCh = nil - if stopCh != nil { - close(stopCh) + log.Infof("Graceful shutdown of %s initiated", name) } } @@ -734,9 +843,10 @@ func (a *ArgoCDServer) watchSettings() { } } log.Info("shutting down settings watch") - a.Shutdown() a.settingsMgr.Unsubscribe(updateCh) close(updateCh) + // Triggers server restart + a.stopCh <- syscall.SIGUSR1 } func (a *ArgoCDServer) rbacPolicyLoader(ctx context.Context) { diff --git a/server/server_test.go b/server/server_test.go index 1f715d00d4e91..e67a3763d592d 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -10,6 +10,8 @@ import ( "os" "path/filepath" "strings" + gosync "sync" + "syscall" "testing" "time" @@ -419,6 +421,72 @@ func TestCertsAreNotGeneratedInInsecureMode(t *testing.T) { assert.Nil(t, s.settings.Certificate) } +func TestGracefulShutdown(t *testing.T) { + port, err := test.GetFreePort() + require.NoError(t, err) + mockRepoClient := &mocks.Clientset{RepoServerServiceClient: &mocks.RepoServerServiceClient{}} + kubeclientset := fake.NewSimpleClientset(test.NewFakeConfigMap(), test.NewFakeSecret()) + redis, redisCloser := test.NewInMemoryRedis() + defer redisCloser() + s := NewServer( + context.Background(), + ArgoCDServerOpts{ + ListenPort: port, + Namespace: test.FakeArgoCDNamespace, + KubeClientset: kubeclientset, + AppClientset: apps.NewSimpleClientset(), + RepoClientset: mockRepoClient, + RedisClient: redis, + }, + ApplicationSetOpts{}, + ) + + projInformerCancel := test.StartInformer(s.projInformer) + defer projInformerCancel() + appInformerCancel := test.StartInformer(s.appInformer) + defer appInformerCancel() + appsetInformerCancel := test.StartInformer(s.appsetInformer) + defer appsetInformerCancel() + + lns, err := s.Listen() + require.NoError(t, err) + + shutdown := false + runCtx, runCancel := context.WithTimeout(context.Background(), 2*time.Second) + defer runCancel() + + err = s.healthCheck(&http.Request{URL: &url.URL{Path: "/healthz", RawQuery: "full=true"}}) + require.Error(t, err, "API Server is not running. It either hasn't started or is restarting.") + + var wg gosync.WaitGroup + wg.Add(1) + go func(shutdown *bool) { + defer wg.Done() + s.Run(runCtx, lns) + *shutdown = true + }(&shutdown) + + for { + if s.available.Load() { + err = s.healthCheck(&http.Request{URL: &url.URL{Path: "/healthz", RawQuery: "full=true"}}) + require.NoError(t, err) + break + } + time.Sleep(10 * time.Millisecond) + } + + s.stopCh <- syscall.SIGINT + + wg.Wait() + + err = s.healthCheck(&http.Request{URL: &url.URL{Path: "/healthz", RawQuery: "full=true"}}) + require.Error(t, err, "API Server is terminating and unable to serve requests.") + + assert.True(t, s.terminateRequested.Load()) + assert.False(t, s.available.Load()) + assert.True(t, shutdown) +} + func TestAuthenticate(t *testing.T) { type testData struct { test string diff --git a/server/settings/settings.go b/server/settings/settings.go index a598b5284f743..94255cbda7f5e 100644 --- a/server/settings/settings.go +++ b/server/settings/settings.go @@ -90,6 +90,7 @@ func (s *Server) Get(ctx context.Context, q *settingspkg.SettingsQuery) (*settin set := settingspkg.Settings{ URL: argoCDSettings.URL, + AdditionalURLs: argoCDSettings.AdditionalURLs, AppLabelKey: appInstanceLabelKey, ResourceOverrides: overrides, StatusBadgeEnabled: argoCDSettings.StatusBadgeEnabled, diff --git a/server/settings/settings.proto b/server/settings/settings.proto index 943aea41cd207..8c8a57f8c9f89 100644 --- a/server/settings/settings.proto +++ b/server/settings/settings.proto @@ -44,6 +44,7 @@ message Settings { bool appsInAnyNamespaceEnabled = 24; bool impersonationEnabled = 25; string installationID = 26; + repeated string additionalUrls = 27 [(gogoproto.customname) = "AdditionalURLs"]; } message GoogleAnalyticsConfig { diff --git a/test/e2e/graceful_restart_test.go b/test/e2e/graceful_restart_test.go new file mode 100644 index 0000000000000..d530b51fd13ef --- /dev/null +++ b/test/e2e/graceful_restart_test.go @@ -0,0 +1,57 @@ +package e2e + +import ( + "context" + "net/http" + "strings" + "testing" + "time" + + "github.com/stretchr/testify/require" + + "github.com/argoproj/argo-cd/v2/pkg/apiclient/settings" + "github.com/argoproj/argo-cd/v2/test/e2e/fixture" + . "github.com/argoproj/argo-cd/v2/test/e2e/fixture" +) + +func checkHealth(t *testing.T, requireHealthy bool) { + t.Helper() + resp, err := DoHttpRequest("GET", "/healthz?full=true", "") + if requireHealthy { + require.NoError(t, err) + require.Equal(t, http.StatusOK, resp.StatusCode) + } else { + if err != nil { + if !strings.Contains(err.Error(), "connection refused") && !strings.Contains(err.Error(), "connection reset by peer") { + require.NoErrorf(t, err, "If an error returned, it must be about connection refused or reset by peer") + } + } else { + require.Contains(t, []int{http.StatusOK, http.StatusServiceUnavailable}, resp.StatusCode) + } + } +} + +func TestAPIServerGracefulRestart(t *testing.T) { + EnsureCleanState(t) + + // Should be healthy. + checkHealth(t, true) + // Should trigger API server restart. + fixture.SetParamInSettingConfigMap("additionalUrls", "- http://test") + + // Wait for ~5 seconds + for i := 0; i < 50; i++ { + checkHealth(t, false) + time.Sleep(100 * time.Millisecond) + } + // One final time, should be healthy, or restart is considered too slow for tests + checkHealth(t, true) + closer, settingsClient, err := ArgoCDClientset.NewSettingsClient() + if closer != nil { + defer closer.Close() + } + require.NoError(t, err) + settings, err := settingsClient.Get(context.Background(), &settings.SettingsQuery{}) + require.NoError(t, err) + require.Equal(t, []string{"http://test"}, settings.AdditionalURLs) +} From ad980516d3281e092d30595aa8b761c111fd8e3f Mon Sep 17 00:00:00 2001 From: Andrii Korotkov Date: Thu, 28 Nov 2024 20:06:43 -0800 Subject: [PATCH 2/7] Init server only once, but keep re-initializing listeners Signed-off-by: Andrii Korotkov --- cmd/argocd-server/commands/argocd_server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/argocd-server/commands/argocd_server.go b/cmd/argocd-server/commands/argocd_server.go index 08e0a07f76833..b9b6d04c54db7 100644 --- a/cmd/argocd-server/commands/argocd_server.go +++ b/cmd/argocd-server/commands/argocd_server.go @@ -257,10 +257,10 @@ func NewCommand() *cobra.Command { stats.StartStatsTicker(10 * time.Minute) stats.RegisterHeapDumper("memprofile") argocd := server.NewServer(ctx, argoCDOpts, appsetOpts) + argocd.Init(ctx) for { var closer func() serverCtx, cancel := context.WithCancel(ctx) - argocd.Init(serverCtx) lns, err := argocd.Listen() errors.CheckError(err) if otlpAddress != "" { From 2666503e92b9033be4a915730188ad45a9716e0c Mon Sep 17 00:00:00 2001 From: Andrii Korotkov Date: Mon, 2 Dec 2024 19:49:32 -0800 Subject: [PATCH 3/7] Check error for SetParamInSettingConfigMap as needed after fresh master Signed-off-by: Andrii Korotkov --- test/e2e/graceful_restart_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/e2e/graceful_restart_test.go b/test/e2e/graceful_restart_test.go index d530b51fd13ef..774cf199fc4d1 100644 --- a/test/e2e/graceful_restart_test.go +++ b/test/e2e/graceful_restart_test.go @@ -12,6 +12,7 @@ import ( "github.com/argoproj/argo-cd/v2/pkg/apiclient/settings" "github.com/argoproj/argo-cd/v2/test/e2e/fixture" . "github.com/argoproj/argo-cd/v2/test/e2e/fixture" + "github.com/argoproj/argo-cd/v2/util/errors" ) func checkHealth(t *testing.T, requireHealthy bool) { @@ -37,7 +38,7 @@ func TestAPIServerGracefulRestart(t *testing.T) { // Should be healthy. checkHealth(t, true) // Should trigger API server restart. - fixture.SetParamInSettingConfigMap("additionalUrls", "- http://test") + errors.CheckError(fixture.SetParamInSettingConfigMap("additionalUrls", "- http://test")) // Wait for ~5 seconds for i := 0; i < 50; i++ { From e2a5e5d5569bd2397fc6e81bdf93dde7ed7820a9 Mon Sep 17 00:00:00 2001 From: Andrii Korotkov Date: Mon, 2 Dec 2024 21:23:46 -0800 Subject: [PATCH 4/7] Prevent a data race Signed-off-by: Andrii Korotkov --- .../commands/argocd_application_controller.go | 4 +++- cmd/argocd-repo-server/commands/argocd_repo_server.go | 3 ++- server/server.go | 3 ++- util/cache/redis.go | 6 +++++- util/cache/redis_test.go | 6 ++++-- util/session/state.go | 6 ++++++ 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/cmd/argocd-application-controller/commands/argocd_application_controller.go b/cmd/argocd-application-controller/commands/argocd_application_controller.go index 2670283fedc23..115f00e386778 100644 --- a/cmd/argocd-application-controller/commands/argocd_application_controller.go +++ b/cmd/argocd-application-controller/commands/argocd_application_controller.go @@ -7,6 +7,7 @@ import ( "os" "os/signal" "runtime/debug" + "sync" "syscall" "time" @@ -205,7 +206,8 @@ func NewCommand() *cobra.Command { enableK8sEvent, ) errors.CheckError(err) - cacheutil.CollectMetrics(redisClient, appController.GetMetricsServer()) + var lock sync.RWMutex + cacheutil.CollectMetrics(redisClient, appController.GetMetricsServer(), &lock) stats.RegisterStackDumper() stats.StartStatsTicker(10 * time.Minute) diff --git a/cmd/argocd-repo-server/commands/argocd_repo_server.go b/cmd/argocd-repo-server/commands/argocd_repo_server.go index e55bfda4ac075..f2f861d62d9c3 100644 --- a/cmd/argocd-repo-server/commands/argocd_repo_server.go +++ b/cmd/argocd-repo-server/commands/argocd_repo_server.go @@ -130,7 +130,8 @@ func NewCommand() *cobra.Command { askPassServer := askpass.NewServer(askpass.SocketPath) metricsServer := metrics.NewMetricsServer() - cacheutil.CollectMetrics(redisClient, metricsServer) + var lock sync.RWMutex + cacheutil.CollectMetrics(redisClient, metricsServer, &lock) server, err := reposerver.NewServer(metricsServer, cache, tlsConfigCustomizer, repository.RepoServerInitConstants{ ParallelismLimit: parallelismLimit, PauseGenerationAfterFailedGenerationAttempts: pauseGenerationAfterFailedGenerationAttempts, diff --git a/server/server.go b/server/server.go index 1098fe4e927b7..71c18550e23e2 100644 --- a/server/server.go +++ b/server/server.go @@ -205,6 +205,7 @@ type ArgoCDServer struct { shutdown func() terminateRequested atomic.Bool available atomic.Bool + storageLock *gosync.RWMutex } type ArgoCDServerOpts struct { @@ -545,7 +546,7 @@ func (a *ArgoCDServer) Run(ctx context.Context, listeners *Listeners) { metricsServ := metrics.NewMetricsServer(a.MetricsHost, a.MetricsPort) if a.RedisClient != nil { - cacheutil.CollectMetrics(a.RedisClient, metricsServ) + cacheutil.CollectMetrics(a.RedisClient, metricsServ, a.userStateStorage.GetLockObject()) } svcSet := newArgoCDServiceSet(a) diff --git a/util/cache/redis.go b/util/cache/redis.go index 5a832fd6ccd45..a6c20aa865cab 100644 --- a/util/cache/redis.go +++ b/util/cache/redis.go @@ -9,6 +9,7 @@ import ( "fmt" "io" "net" + "sync" "time" ioutil "github.com/argoproj/argo-cd/v2/util/io" @@ -200,6 +201,9 @@ func (redisHook) ProcessPipelineHook(next redis.ProcessPipelineHook) redis.Proce } // CollectMetrics add transport wrapper that pushes metrics into the specified metrics registry -func CollectMetrics(client *redis.Client, registry MetricsRegistry) { +// Lock should be shared between functions that can add/process a Redis hook. +func CollectMetrics(client *redis.Client, registry MetricsRegistry, lock *sync.RWMutex) { + lock.Lock() + defer lock.Unlock() client.AddHook(&redisHook{registry: registry}) } diff --git a/util/cache/redis_test.go b/util/cache/redis_test.go index d60c7ea268e2c..f8d3762f865e8 100644 --- a/util/cache/redis_test.go +++ b/util/cache/redis_test.go @@ -6,6 +6,7 @@ import ( "context" "io" "strconv" + "sync" "testing" "time" @@ -136,8 +137,9 @@ func TestRedisMetrics(t *testing.T) { ms := NewMockMetricsServer() redisClient := redis.NewClient(&redis.Options{Addr: mr.Addr()}) faultyRedisClient := redis.NewClient(&redis.Options{Addr: "invalidredishost.invalid:12345"}) - CollectMetrics(redisClient, ms) - CollectMetrics(faultyRedisClient, ms) + var lock sync.RWMutex + CollectMetrics(redisClient, ms, &lock) + CollectMetrics(faultyRedisClient, ms, &lock) client := NewRedisCache(redisClient, 60*time.Second, RedisCompressionNone) faultyClient := NewRedisCache(faultyRedisClient, 60*time.Second, RedisCompressionNone) diff --git a/util/session/state.go b/util/session/state.go index b4117c0d1733f..db8eda5020ee3 100644 --- a/util/session/state.go +++ b/util/session/state.go @@ -125,6 +125,10 @@ func (storage *userStateStorage) IsTokenRevoked(id string) bool { return storage.revokedTokens[id] } +func (storage *userStateStorage) GetLockObject() *sync.RWMutex { + return &storage.lock +} + type UserStateStorage interface { Init(ctx context.Context) // GetLoginAttempts return number of concurrent login attempts @@ -135,4 +139,6 @@ type UserStateStorage interface { RevokeToken(ctx context.Context, id string, expiringAt time.Duration) error // IsTokenRevoked checks if given token is revoked IsTokenRevoked(id string) bool + // GetLockObject returns a lock used by the storage + GetLockObject() *sync.RWMutex } From 109d4c52b8a4a63797df629c49cb2664a9cf057d Mon Sep 17 00:00:00 2001 From: Andrii Korotkov Date: Mon, 2 Dec 2024 21:32:53 -0800 Subject: [PATCH 5/7] Remove unused variable, don't pass lock when not necessary Signed-off-by: Andrii Korotkov --- .../commands/argocd_application_controller.go | 4 +--- cmd/argocd-repo-server/commands/argocd_repo_server.go | 3 +-- server/server.go | 1 - util/cache/redis.go | 6 ++++-- util/cache/redis_test.go | 6 ++---- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/cmd/argocd-application-controller/commands/argocd_application_controller.go b/cmd/argocd-application-controller/commands/argocd_application_controller.go index 115f00e386778..ddf6a978a42aa 100644 --- a/cmd/argocd-application-controller/commands/argocd_application_controller.go +++ b/cmd/argocd-application-controller/commands/argocd_application_controller.go @@ -7,7 +7,6 @@ import ( "os" "os/signal" "runtime/debug" - "sync" "syscall" "time" @@ -206,8 +205,7 @@ func NewCommand() *cobra.Command { enableK8sEvent, ) errors.CheckError(err) - var lock sync.RWMutex - cacheutil.CollectMetrics(redisClient, appController.GetMetricsServer(), &lock) + cacheutil.CollectMetrics(redisClient, appController.GetMetricsServer(), nil) stats.RegisterStackDumper() stats.StartStatsTicker(10 * time.Minute) diff --git a/cmd/argocd-repo-server/commands/argocd_repo_server.go b/cmd/argocd-repo-server/commands/argocd_repo_server.go index f2f861d62d9c3..c66de4da0858c 100644 --- a/cmd/argocd-repo-server/commands/argocd_repo_server.go +++ b/cmd/argocd-repo-server/commands/argocd_repo_server.go @@ -130,8 +130,7 @@ func NewCommand() *cobra.Command { askPassServer := askpass.NewServer(askpass.SocketPath) metricsServer := metrics.NewMetricsServer() - var lock sync.RWMutex - cacheutil.CollectMetrics(redisClient, metricsServer, &lock) + cacheutil.CollectMetrics(redisClient, metricsServer, nil) server, err := reposerver.NewServer(metricsServer, cache, tlsConfigCustomizer, repository.RepoServerInitConstants{ ParallelismLimit: parallelismLimit, PauseGenerationAfterFailedGenerationAttempts: pauseGenerationAfterFailedGenerationAttempts, diff --git a/server/server.go b/server/server.go index 71c18550e23e2..eaef1262cf9ba 100644 --- a/server/server.go +++ b/server/server.go @@ -205,7 +205,6 @@ type ArgoCDServer struct { shutdown func() terminateRequested atomic.Bool available atomic.Bool - storageLock *gosync.RWMutex } type ArgoCDServerOpts struct { diff --git a/util/cache/redis.go b/util/cache/redis.go index a6c20aa865cab..2c938b6998bb7 100644 --- a/util/cache/redis.go +++ b/util/cache/redis.go @@ -203,7 +203,9 @@ func (redisHook) ProcessPipelineHook(next redis.ProcessPipelineHook) redis.Proce // CollectMetrics add transport wrapper that pushes metrics into the specified metrics registry // Lock should be shared between functions that can add/process a Redis hook. func CollectMetrics(client *redis.Client, registry MetricsRegistry, lock *sync.RWMutex) { - lock.Lock() - defer lock.Unlock() + if lock != nil { + lock.Lock() + defer lock.Unlock() + } client.AddHook(&redisHook{registry: registry}) } diff --git a/util/cache/redis_test.go b/util/cache/redis_test.go index f8d3762f865e8..8cda6d8086e74 100644 --- a/util/cache/redis_test.go +++ b/util/cache/redis_test.go @@ -6,7 +6,6 @@ import ( "context" "io" "strconv" - "sync" "testing" "time" @@ -137,9 +136,8 @@ func TestRedisMetrics(t *testing.T) { ms := NewMockMetricsServer() redisClient := redis.NewClient(&redis.Options{Addr: mr.Addr()}) faultyRedisClient := redis.NewClient(&redis.Options{Addr: "invalidredishost.invalid:12345"}) - var lock sync.RWMutex - CollectMetrics(redisClient, ms, &lock) - CollectMetrics(faultyRedisClient, ms, &lock) + CollectMetrics(redisClient, ms, nil) + CollectMetrics(faultyRedisClient, ms, nil) client := NewRedisCache(redisClient, 60*time.Second, RedisCompressionNone) faultyClient := NewRedisCache(faultyRedisClient, 60*time.Second, RedisCompressionNone) From a936f2cb4a73c1453c8a63a87031160ecec8fa8d Mon Sep 17 00:00:00 2001 From: Andrii Korotkov Date: Tue, 3 Dec 2024 07:52:18 -0800 Subject: [PATCH 6/7] Try overriding URL instead of additional URLs Signed-off-by: Andrii Korotkov --- assets/swagger.json | 6 - pkg/apiclient/settings/settings.pb.go | 218 ++++++++++---------------- server/settings/settings.go | 1 - server/settings/settings.proto | 1 - test/e2e/graceful_restart_test.go | 4 +- 5 files changed, 82 insertions(+), 148 deletions(-) diff --git a/assets/swagger.json b/assets/swagger.json index fcbc75856db1a..157baf3b774a9 100644 --- a/assets/swagger.json +++ b/assets/swagger.json @@ -4691,12 +4691,6 @@ "clusterSettings": { "type": "object", "properties": { - "additionalUrls": { - "type": "array", - "items": { - "type": "string" - } - }, "appLabelKey": { "type": "string" }, diff --git a/pkg/apiclient/settings/settings.pb.go b/pkg/apiclient/settings/settings.pb.go index 56fd1cbdb024c..202228f7ef6f1 100644 --- a/pkg/apiclient/settings/settings.pb.go +++ b/pkg/apiclient/settings/settings.pb.go @@ -103,7 +103,6 @@ type Settings struct { AppsInAnyNamespaceEnabled bool `protobuf:"varint,24,opt,name=appsInAnyNamespaceEnabled,proto3" json:"appsInAnyNamespaceEnabled,omitempty"` ImpersonationEnabled bool `protobuf:"varint,25,opt,name=impersonationEnabled,proto3" json:"impersonationEnabled,omitempty"` InstallationID string `protobuf:"bytes,26,opt,name=installationID,proto3" json:"installationID,omitempty"` - AdditionalURLs []string `protobuf:"bytes,27,rep,name=additionalUrls,proto3" json:"additionalUrls,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -324,13 +323,6 @@ func (m *Settings) GetInstallationID() string { return "" } -func (m *Settings) GetAdditionalURLs() []string { - if m != nil { - return m.AdditionalURLs - } - return nil -} - type GoogleAnalyticsConfig struct { TrackingID string `protobuf:"bytes,1,opt,name=trackingID,proto3" json:"trackingID,omitempty"` AnonymizeUsers bool `protobuf:"varint,2,opt,name=anonymizeUsers,proto3" json:"anonymizeUsers,omitempty"` @@ -764,87 +756,86 @@ func init() { func init() { proto.RegisterFile("server/settings/settings.proto", fileDescriptor_a480d494da040caa) } var fileDescriptor_a480d494da040caa = []byte{ - // 1278 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4f, 0x6f, 0xdb, 0xc6, - 0x12, 0x87, 0x22, 0xc7, 0x96, 0xc6, 0xb1, 0x65, 0x6f, 0x1c, 0x87, 0xd1, 0xcb, 0xb3, 0xf5, 0x74, - 0x08, 0xf4, 0x1e, 0x5e, 0xa9, 0xd8, 0x41, 0xd1, 0x22, 0x68, 0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, 0xa5, - 0x7c, 0x73, 0x0a, 0x64, 0xde, 0xe7, 0x82, 0x12, 0x79, 0x7a, 0xb1, 0xad, 0x3f, 0x7a, 0x67, 0x5b, - 0x27, 0xdb, 0xa1, 0x9d, 0xaf, 0xb7, 0xf1, 0x9a, 0x65, 0x1b, 0xfb, 0x85, 0xda, 0xda, 0xff, 0xb9, - 0x02, 0x8d, 0xac, 0xbf, 0x5e, 0xa0, 0x9c, 0xf8, 0x0e, 0x92, 0xcf, 0xa1, 0xfa, 0x08, 0x35, 0xd9, - 0x9e, 0xdb, 0xa7, 0xcc, 0x0e, 0xd9, 0xdc, 0x9c, 0xc3, 0xdb, 0xd6, 0xb7, 0xbf, 0xff, 0xf9, 0xfd, - 0x15, 0x42, 0x36, 0xcc, 0x5e, 0x3c, 0xd9, 0xcb, 0x77, 0x52, 0x32, 0x02, 0x78, 0x84, 0xf9, 0x0f, - 0xf6, 0x32, 0x93, 0xad, 0x39, 0xbc, 0xd4, 0xeb, 0xed, 0x96, 0xf1, 0xd0, 0x24, 0x56, 0xd9, 0x43, - 0x37, 0x6d, 0xf1, 0x5e, 0xff, 0x97, 0xd9, 0x4e, 0xe5, 0xb7, 0xd9, 0x4e, 0xe5, 0x8f, 0xd9, 0x4e, - 0xe5, 0xcb, 0x0f, 0xff, 0xd9, 0x26, 0x9e, 0x94, 0x5a, 0x6e, 0xec, 0x64, 0xd9, 0xec, 0xcd, 0xf7, - 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x36, 0x87, 0xd7, 0x56, 0x26, 0x0c, 0x00, 0x00, + // 1249 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4f, 0x6f, 0x1b, 0xb7, + 0x12, 0xc7, 0x46, 0x8e, 0x2d, 0x8d, 0xe3, 0xc8, 0x66, 0x1c, 0x67, 0x23, 0xe4, 0xd9, 0x7a, 0x3a, + 0x04, 0x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7a, 0x54, 0x72, 0x8c, 0xfd, 0x42, + 0x6d, 0x75, 0x7f, 0xb5, 0xa0, 0x9e, 0xf5, 0xd7, 0x0b, 0x14, 0xd3, 0xc0, 0x43, 0xf2, 0x05, 0x54, + 0x1e, 0xa1, 0x22, 0x3b, 0x0b, 0x33, 0x91, 0x99, 0x03, 0x1b, 0x5b, 0x0b, 0x78, 0xcb, 0xfe, 0xee, + 0x8f, 0xbf, 0x7e, 0xbc, 0x44, 0xc8, 0xa6, 0x99, 0x6d, 0xa7, 0xfb, 0xf9, 0x5c, 0x49, 0xc6, 0x00, + 0x8f, 0x30, 0xff, 0x24, 0x2f, 0x32, 0xd9, 0x5c, 0xc0, 0x4b, 0xbd, 0xde, 0x6a, 0x1a, 0x0f, 0x0d, + 0x62, 0x97, 0x3d, 0x74, 0xd2, 0x16, 0xef, 0xf5, 0x7f, 0x9b, 0xef, 0x5a, 0xbf, 0xcf, 0x77, 0xad, + 0x3f, 0xe7, 0xbb, 0xd6, 0x57, 0x1f, 0xfd, 0xbb, 0x69, 0x3a, 0x29, 0xb5, 0xdc, 0xd8, 0xf1, 0xaa, + 0x99, 0x7d, 0xef, 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x99, 0x28, 0x60, 0x2e, 0xea, 0x0b, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1018,17 +1009,6 @@ func (m *Settings) MarshalToSizedBuffer(dAtA []byte) (int, error) { i -= len(m.XXX_unrecognized) copy(dAtA[i:], m.XXX_unrecognized) } - if len(m.AdditionalURLs) > 0 { - for iNdEx := len(m.AdditionalURLs) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.AdditionalURLs[iNdEx]) - copy(dAtA[i:], m.AdditionalURLs[iNdEx]) - i = encodeVarintSettings(dAtA, i, uint64(len(m.AdditionalURLs[iNdEx]))) - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0xda - } - } if len(m.InstallationID) > 0 { i -= len(m.InstallationID) copy(dAtA[i:], m.InstallationID) @@ -1817,12 +1797,6 @@ func (m *Settings) Size() (n int) { if l > 0 { n += 2 + l + sovSettings(uint64(l)) } - if len(m.AdditionalURLs) > 0 { - for _, s := range m.AdditionalURLs { - l = len(s) - n += 2 + l + sovSettings(uint64(l)) - } - } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2965,38 +2939,6 @@ func (m *Settings) Unmarshal(dAtA []byte) error { } m.InstallationID = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 27: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AdditionalURLs", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSettings - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSettings - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthSettings - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AdditionalURLs = append(m.AdditionalURLs, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipSettings(dAtA[iNdEx:]) diff --git a/server/settings/settings.go b/server/settings/settings.go index 94255cbda7f5e..a598b5284f743 100644 --- a/server/settings/settings.go +++ b/server/settings/settings.go @@ -90,7 +90,6 @@ func (s *Server) Get(ctx context.Context, q *settingspkg.SettingsQuery) (*settin set := settingspkg.Settings{ URL: argoCDSettings.URL, - AdditionalURLs: argoCDSettings.AdditionalURLs, AppLabelKey: appInstanceLabelKey, ResourceOverrides: overrides, StatusBadgeEnabled: argoCDSettings.StatusBadgeEnabled, diff --git a/server/settings/settings.proto b/server/settings/settings.proto index 8c8a57f8c9f89..943aea41cd207 100644 --- a/server/settings/settings.proto +++ b/server/settings/settings.proto @@ -44,7 +44,6 @@ message Settings { bool appsInAnyNamespaceEnabled = 24; bool impersonationEnabled = 25; string installationID = 26; - repeated string additionalUrls = 27 [(gogoproto.customname) = "AdditionalURLs"]; } message GoogleAnalyticsConfig { diff --git a/test/e2e/graceful_restart_test.go b/test/e2e/graceful_restart_test.go index 774cf199fc4d1..d126e3b9822ef 100644 --- a/test/e2e/graceful_restart_test.go +++ b/test/e2e/graceful_restart_test.go @@ -38,7 +38,7 @@ func TestAPIServerGracefulRestart(t *testing.T) { // Should be healthy. checkHealth(t, true) // Should trigger API server restart. - errors.CheckError(fixture.SetParamInSettingConfigMap("additionalUrls", "- http://test")) + errors.CheckError(fixture.SetParamInSettingConfigMap("url", "http://test")) // Wait for ~5 seconds for i := 0; i < 50; i++ { @@ -54,5 +54,5 @@ func TestAPIServerGracefulRestart(t *testing.T) { require.NoError(t, err) settings, err := settingsClient.Get(context.Background(), &settings.SettingsQuery{}) require.NoError(t, err) - require.Equal(t, []string{"http://test"}, settings.AdditionalURLs) + require.Equal(t, "http://test", settings.URL) } From 4a37d02a73a65684709d6cd711a5c06a79c1a6e7 Mon Sep 17 00:00:00 2001 From: Andrii Korotkov Date: Tue, 3 Dec 2024 09:26:12 -0800 Subject: [PATCH 7/7] Use a more specific url Signed-off-by: Andrii Korotkov --- test/e2e/graceful_restart_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/graceful_restart_test.go b/test/e2e/graceful_restart_test.go index d126e3b9822ef..6f5c6960a4f1d 100644 --- a/test/e2e/graceful_restart_test.go +++ b/test/e2e/graceful_restart_test.go @@ -38,7 +38,7 @@ func TestAPIServerGracefulRestart(t *testing.T) { // Should be healthy. checkHealth(t, true) // Should trigger API server restart. - errors.CheckError(fixture.SetParamInSettingConfigMap("url", "http://test")) + errors.CheckError(fixture.SetParamInSettingConfigMap("url", "http://test-api-server-graceful-restart")) // Wait for ~5 seconds for i := 0; i < 50; i++ { @@ -54,5 +54,5 @@ func TestAPIServerGracefulRestart(t *testing.T) { require.NoError(t, err) settings, err := settingsClient.Get(context.Background(), &settings.SettingsQuery{}) require.NoError(t, err) - require.Equal(t, "http://test", settings.URL) + require.Equal(t, "http://test-api-server-graceful-restart", settings.URL) }