tso

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewUnderlayClientFunc = func(c client.Client) timanager.NewUnderlayClientFunc[*v1alpha1.TSOGroup, tsoapi.TSOClient] {
	return func(tg *v1alpha1.TSOGroup) (tsoapi.TSOClient, error) {
		ctx := context.Background()
		var cluster v1alpha1.Cluster
		if err := c.Get(ctx, client.ObjectKey{
			Name:      tg.Spec.Cluster.Name,
			Namespace: tg.Namespace,
		}, &cluster); err != nil {
			return nil, fmt.Errorf("cannot find cluster %s: %w", tg.Spec.Cluster.Name, err)
		}

		if coreutil.IsTLSClusterEnabled(&cluster) {
			tlsConfig, err := apicall.GetClientTLSConfig[scope.TSOGroup](ctx, c, tg)
			if err != nil {
				return nil, fmt.Errorf("cannot get tls config from secret: %w", err)
			}

			url := coreutil.TSOServiceURL(tg, true)
			return tsoapi.NewTSOClient(url, tsoRequestTimeout, tlsConfig), nil
		}

		url := coreutil.TSOServiceURL(tg, false)
		return tsoapi.NewTSOClient(url, tsoRequestTimeout, nil), nil
	}
}

Functions

func CacheKeys

func CacheKeys(tg *v1alpha1.TSOGroup) ([]string, error)

CacheKeys returns the keys of the TSOGroup. If any keys are changed, client will be renewed The first key is primary key to get client from manager

Types

type TSOClient

type TSOClient interface {
	Underlay() tsoapi.TSOClient
}

type TSOClientManager

type TSOClientManager = timanager.Manager[*v1alpha1.TSOGroup, TSOClient]

func NewTSOClientManager

func NewTSOClientManager(logger logr.Logger, c client.Client) TSOClientManager

Jump to

Keyboard shortcuts

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