rhmotransport

package
v2.0.0-...-6ed2e0c Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCatalogServerService

func GetCatalogServerService(k8sclient client.Client, deployedNamespace string) (*corev1.Service, error)

func GetCertFromConfigMap

func GetCertFromConfigMap(k8sclient client.Client, deployedNamespace string, reqLogger logr.Logger) ([]byte, error)

func SetTransportForKubeServiceAuth

func SetTransportForKubeServiceAuth(authBuilder IAuthBuilder, reqLogger logr.Logger) (*http.Client, error)

func WithBearerAuth

func WithBearerAuth(rt http.RoundTripper, token string) http.RoundTripper

Types

type AuthBuilderConfig

type AuthBuilderConfig struct {
	K8sclient         client.Client
	DeployedNamespace string
	*ServiceAccountClient
	Logger logr.Logger
	*AuthValues
	Error error
}

func ProvideAuthBuilder

func ProvideAuthBuilder(k8sclient client.Client, operatorConfig *config.OperatorConfig, kubeInterface kubernetes.Interface, reqLogger logr.Logger) *AuthBuilderConfig

func (*AuthBuilderConfig) FindAuthOffCluster

func (a *AuthBuilderConfig) FindAuthOffCluster() (*AuthValues, error)

type AuthValues

type AuthValues struct {
	ServiceFound bool
	Cert         []byte
	AuthToken    string
}

type IAuthBuilder

type IAuthBuilder interface {
	FindAuthOffCluster() (*AuthValues, error)
}

type ServiceAccountClient

type ServiceAccountClient struct {
	KubernetesInterface kubernetes.Interface
	Token               *Token
	TokenRequestObj     *authv1.TokenRequest
	Client              typedv1.ServiceAccountInterface
	sync.Mutex
}

func ProvideServiceAccountClient

func ProvideServiceAccountClient(namespace string, kubernetesInterface kubernetes.Interface) *ServiceAccountClient

func (*ServiceAccountClient) GetToken

func (s *ServiceAccountClient) GetToken(targetServiceAccount string, client typedv1.ServiceAccountInterface, tr *authv1.TokenRequest, opts metav1.CreateOptions) (string, error)

func (*ServiceAccountClient) NewServiceAccountToken

func (s *ServiceAccountClient) NewServiceAccountToken(targetServiceAccountName string, audience string, expireSecs int64, reqLogger logr.Logger) (string, error)

type Token

type Token struct {
	AuthToken           *string
	ExpirationTimestamp metav1.Time
}

type TransportWithHeader

type TransportWithHeader struct {
	http.Header
	// contains filtered or unexported fields
}

func (TransportWithHeader) RoundTrip

func (m TransportWithHeader) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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