service

package
v1.18.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnableStandaloneDNSProxy is the name of the option to enable standalone DNS proxy
	EnableStandaloneDNSProxy = "enable-standalone-dns-proxy"

	// StandaloneDNSProxyServerPort is the port on which the standalone DNS proxy gRPC server should listen.
	StandaloneDNSProxyServerPort = "standalone-dns-proxy-server-port"
)

Variables

View Source
var Cell = cell.Module(
	"sdp-grpc-server",
	"Provides the standalone DNS proxy gRPC server",

	cell.Config(defaultConfig),
	cell.Provide(newDefaultListener),
	cell.Provide(newServer),
)

Cell provides the standalone DNS proxy gRPC server. It is responsible for sending the DNS rules and IP cache updates to the standalone DNS proxy. It also handles the DNS responses from the standalone DNS proxy and updates the DNS rules and IP cache accordingly. It receives the DNS rules during the endpoint regeneration event and listens for ip cache updates from the ipcache.

Functions

This section is empty.

Types

type FQDNConfig

type FQDNConfig struct {
	// EnableStandaloneDNSProxy is the option to enable standalone DNS proxy
	EnableStandaloneDNSProxy bool

	// StandaloneDNSProxyServerPort is the user-configured global, Standalone DNS proxy gRPC server port
	StandaloneDNSProxyServerPort int
}

func (FQDNConfig) Flags

func (def FQDNConfig) Flags(flags *pflag.FlagSet)

type FQDNDataServer

type FQDNDataServer struct {
	pb.UnimplementedFQDNDataServer
	// contains filtered or unexported fields
}

FQDNDataServer is the server for the standalone DNS proxy grpc server It is responsible for handling the FQDN mapping requests from the SDP and sending the DNS Policy updates to the SDP.

func NewServer

func NewServer(endpointManager endpointmanager.EndpointManager, updateOnDNSMsg messagehandler.DNSMessageHandler, port int, logger *slog.Logger, listener listenConfig) *FQDNDataServer

NewServer creates a new FQDNDataServer which is used to handle the Standalone DNS Proxy grpc service

func (*FQDNDataServer) IsEnabled added in v1.18.1

func (s *FQDNDataServer) IsEnabled() bool

func (*FQDNDataServer) ListenAndServe

func (s *FQDNDataServer) ListenAndServe(ctx context.Context, health cell.Health) error

ListenAndServe starts the Standalone DNS Proxy gRPC server on the given port

func (*FQDNDataServer) OnIPIdentityCacheChange

func (s *FQDNDataServer) OnIPIdentityCacheChange(modType ipcache.CacheModification, cidr types.PrefixCluster, oldHostIP, newHostIP net.IP, oldID *ipcache.Identity, newID ipcache.Identity, encryptKey uint8, k8sMeta *ipcache.K8sMetadata, endpointFlags uint8)

OnIPIdentityCacheChange is a method to receive the IP identity cache change events

func (*FQDNDataServer) Stop

func (s *FQDNDataServer) Stop()

func (*FQDNDataServer) StreamPolicyState

func (s *FQDNDataServer) StreamPolicyState(stream pb.FQDNData_StreamPolicyStateServer) error

StreamPolicyState is a bidirectional streaming RPC to subscribe to DNS policies SDP calls this method to subscribe to DNS policies For each stream, we start a goroutine to receive the DNS policies ACKs The flow of the method is as follows: 1. Add the stream to the map( called by the client i.e SDP) 2. Start a goroutine to receive the DNS policies ACKs for that particular client. 3. Send the current state of the DNS rules to the client (We store the current state fo DNS rules during the endpoint regeneration see UpdatePolicyRulesLocked) 4. Wait for the context to be done Note: this method is left empty on purpose and will be update with the actual implementation in the future PRs for the standalone DNS proxy

func (*FQDNDataServer) UpdateMappingRequest

func (s *FQDNDataServer) UpdateMappingRequest(ctx context.Context, mappings *pb.FQDNMapping) (*pb.UpdateMappingResponse, error)

UpdateMappingRequest updates the FQDN mapping with the given data SDP sends the fqdn mapping to cilium agent Steps to update the mapping: 1. Get the endpoint from the IP 2. If the endpoint is not found, return an error 3. If the IPs are not empty, update the cilium agent with the mapping Note: this method is left empty on purpose and will be updated with the actual implementation in the future PRs for the standalone DNS proxy

func (*FQDNDataServer) UpdatePolicyRules

func (s *FQDNDataServer) UpdatePolicyRules(policies map[identity.NumericIdentity]policy.SelectorPolicy, rulesUpdate bool) error

UpdatePolicyRules updates the current state of the DNS rules with the given policies and sends the current state of the DNS rules to the client This method is called: 1. when the DNS rules are updated during the endpoint regeneration, we store the state of the DNS rules with flag rulesUpdate as true 2. when the client subscribes to DNS policies, we send the current state of the DNS rules to the client(flag rulesUpdate as false) 3. when the IP identity cache changes, we update the current state of the identity to IP mapping and send the current state of the DNS rules to the client(flag rulesUpdate as false) Note: this method is left empty on purpose and will be updated with the actual implementation in the future PRs for the standalone DNS proxy

type PolicyUpdater

type PolicyUpdater interface {
	// UpdatePolicyRules is used to update the current state of the policy rules at the
	// gRPC server. These rules are sent to the standalone DNS proxy.
	// This is currently being called whenever there is a policy regeneration event
	// for an endpoint.
	UpdatePolicyRules(map[identity.NumericIdentity]policy.SelectorPolicy, bool) error

	// IsEnabled returns true if the standalone DNS proxy is enabled
	IsEnabled() bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL