Skip to content

Commit

Permalink
v2: remove HCP Link integration (#21883)
Browse files Browse the repository at this point in the history
Also prevent de-registered retired v2 types from being restored from a
snapshot, such as these hcp resources. Without doing this, anyone with
any of these types in their state store will retain them forever with no
avenue to remove them.
  • Loading branch information
rboyer authored Nov 7, 2024
1 parent 32515c7 commit a2e6923
Show file tree
Hide file tree
Showing 40 changed files with 443 additions and 3,449 deletions.
3 changes: 3 additions & 0 deletions .changelog/21883.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:feature
v2: remove HCP Link integration
```
31 changes: 1 addition & 30 deletions agent/consul/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import (
"github.com/hashicorp/consul/agent/consul/xdscapacity"
"github.com/hashicorp/consul/agent/grpc-external/services/peerstream"
"github.com/hashicorp/consul/agent/hcp"
"github.com/hashicorp/consul/agent/hcp/bootstrap"
hcpclient "github.com/hashicorp/consul/agent/hcp/client"
logdrop "github.com/hashicorp/consul/agent/log-drop"
"github.com/hashicorp/consul/agent/metadata"
Expand All @@ -65,7 +64,6 @@ import (
"github.com/hashicorp/consul/agent/token"
"github.com/hashicorp/consul/internal/controller"
"github.com/hashicorp/consul/internal/gossip/librtt"
hcpctl "github.com/hashicorp/consul/internal/hcp"
"github.com/hashicorp/consul/internal/multicluster"
"github.com/hashicorp/consul/internal/resource"
"github.com/hashicorp/consul/internal/resource/demo"
Expand Down Expand Up @@ -838,25 +836,6 @@ func NewServer(config *Config, flat Deps, externalGRPCServer *grpc.Server,
// to enable RPC forwarding.
s.grpcLeaderForwarder = flat.LeaderForwarder

if s.config.Cloud.IsConfigured() {
// Start watching HCP Link resource. This needs to be created after
// the GRPC services are set up in order for the resource service client to
// function. This uses the insecure grpc channel so that it doesn't need to
// present a valid ACL token.
go hcp.RunHCPLinkWatcher(
&lib.StopChannelContext{StopCh: shutdownCh},
logger.Named("hcp-link-watcher"),
pbresource.NewResourceServiceClient(s.insecureSafeGRPCChan),
hcp.HCPManagerLifecycleFn(
s.hcpManager,
hcpclient.NewClient,
bootstrap.LoadManagementToken,
flat.HCP.Config,
flat.HCP.DataDir,
),
)
}

s.controllerManager = controller.NewManager(
// Usage of the insecure + unsafe grpc chan is required for the controller
// manager. It must be unauthorized so that controllers do not need to
Expand Down Expand Up @@ -928,15 +907,7 @@ func NewServer(config *Config, flat Deps, externalGRPCServer *grpc.Server,
return s, nil
}

func (s *Server) registerControllers(deps Deps) error {
if s.config.Cloud.IsConfigured() {
hcpctl.RegisterControllers(
s.controllerManager, hcpctl.ControllerDependencies{
CloudConfig: deps.HCP.Config,
},
)
}

func (s *Server) registerControllers(_ Deps) error {
shim := NewExportedServicesShim(s)
multicluster.RegisterCompatControllers(s.controllerManager, multicluster.DefaultCompatControllerDependencies(shim))

Expand Down
4 changes: 1 addition & 3 deletions agent/consul/testdata/v2-resource-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ flowchart TD
demo/v1/recordlabel
demo/v2/album
demo/v2/artist
hcp/v2/link
hcp/v2/telemetrystate
internal/v1/tombstone
multicluster/v2/computedexportedservices --> multicluster/v2/exportedservices
multicluster/v2/computedexportedservices --> multicluster/v2/namespaceexportedservices
multicluster/v2/computedexportedservices --> multicluster/v2/partitionexportedservices
multicluster/v2/exportedservices
multicluster/v2/namespaceexportedservices
multicluster/v2/partitionexportedservices
```
```
2 changes: 0 additions & 2 deletions agent/consul/type_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package consul

import (
"github.com/hashicorp/consul/internal/hcp"
"github.com/hashicorp/consul/internal/multicluster"
"github.com/hashicorp/consul/internal/resource"
"github.com/hashicorp/consul/internal/resource/demo"
Expand All @@ -22,7 +21,6 @@ func NewTypeRegistry() resource.Registry {

demo.RegisterTypes(registry)
multicluster.RegisterTypes(registry)
hcp.RegisterTypes(registry)

return registry
}
68 changes: 0 additions & 68 deletions agent/hcp/link_watch.go

This file was deleted.

101 changes: 0 additions & 101 deletions agent/hcp/link_watch_test.go

This file was deleted.

107 changes: 0 additions & 107 deletions agent/hcp/manager_lifecycle.go

This file was deleted.

Loading

0 comments on commit a2e6923

Please sign in to comment.