gatewayclient

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRequeueingMiddleware

func NewRequeueingMiddleware(logger hclog.Logger, reconciler reconcile.Reconciler) reconcile.Reconciler

NewSyncRequeuingMiddleware handles delaying requeues in the case of synchronization errors in order to not block the reconciliation loop

func RescheduleK8sError

func RescheduleK8sError(logger hclog.Logger, result ctrl.Result, err error) (ctrl.Result, error)

RescheduleK8sError allows us to reschedule all non-Kubernetes errors while not blocking the reconciliation loop because of immediate rescheduling

Types

type Client

type Client interface {
	// getters
	GetGatewayClassConfig(ctx context.Context, key types.NamespacedName) (*apigwv1alpha1.GatewayClassConfig, error)
	GetGatewayClass(ctx context.Context, key types.NamespacedName) (*gwv1beta1.GatewayClass, error)
	GetGateway(ctx context.Context, key types.NamespacedName) (*gwv1beta1.Gateway, error)
	GetGatewaysInNamespace(ctx context.Context, ns string) ([]gwv1beta1.Gateway, error)
	GetSecret(ctx context.Context, key types.NamespacedName) (*core.Secret, error)
	GetService(ctx context.Context, key types.NamespacedName) (*core.Service, error)
	GetHTTPRoute(ctx context.Context, key types.NamespacedName) (*gwv1alpha2.HTTPRoute, error)
	GetHTTPRoutes(ctx context.Context) ([]gwv1alpha2.HTTPRoute, error)
	GetHTTPRoutesInNamespace(ctx context.Context, ns string) ([]gwv1alpha2.HTTPRoute, error)
	GetTCPRoute(ctx context.Context, key types.NamespacedName) (*gwv1alpha2.TCPRoute, error)
	GetTCPRoutes(ctx context.Context) ([]gwv1alpha2.TCPRoute, error)
	GetTCPRoutesInNamespace(ctx context.Context, ns string) ([]gwv1alpha2.TCPRoute, error)
	GetMeshService(ctx context.Context, key types.NamespacedName) (*apigwv1alpha1.MeshService, error)
	GetNamespace(ctx context.Context, key types.NamespacedName) (*core.Namespace, error)
	GetDeployment(ctx context.Context, key types.NamespacedName) (*apps.Deployment, error)

	GatewayClassInUse(ctx context.Context, gc *gwv1beta1.GatewayClass) (bool, error)
	GatewayClassConfigInUse(ctx context.Context, gcc *apigwv1alpha1.GatewayClassConfig) (bool, error)
	GatewayClassesUsingConfig(ctx context.Context, gcc *apigwv1alpha1.GatewayClassConfig) (*gwv1beta1.GatewayClassList, error)
	RemoveFinalizer(ctx context.Context, object client.Object, finalizer string) (bool, error)
	EnsureFinalizer(ctx context.Context, object client.Object, finalizer string) (bool, error)

	HasManagedDeployment(ctx context.Context, gw *gwv1beta1.Gateway) (bool, error)
	IsManagedRoute(ctx context.Context, namespace string, parents []gwv1alpha2.ParentReference) (bool, error)
	GetConfigForGatewayClassName(ctx context.Context, name string) (apigwv1alpha1.GatewayClassConfig, bool, error)
	DeploymentForGateway(ctx context.Context, gw *gwv1beta1.Gateway) (*apps.Deployment, error)
	SetControllerOwnership(owner, object client.Object) error

	PodsWithLabels(ctx context.Context, labels map[string]string) ([]core.Pod, error)

	UpdateStatus(ctx context.Context, obj client.Object) error

	Update(ctx context.Context, obj client.Object) error

	CreateOrUpdateDeployment(ctx context.Context, deployment *apps.Deployment, mutators ...func() error) (bool, error)
	CreateOrUpdateSecret(ctx context.Context, secret *core.Secret, mutators ...func() error) (bool, error)
	CreateOrUpdateService(ctx context.Context, service *core.Service, mutators ...func() error) (bool, error)
	DeleteService(ctx context.Context, service *core.Service) error
	EnsureExists(ctx context.Context, obj client.Object, mutators ...func() error) (bool, error)
	EnsureServiceAccount(ctx context.Context, owner *gwv1beta1.Gateway, serviceAccount *core.ServiceAccount) error

	// referencepolicy
	GetReferenceGrantsInNamespace(ctx context.Context, namespace string) ([]gwv1alpha2.ReferenceGrant, error)
}

Client is an abstraction around interactions with Kubernetes APIs. In order to keep the error boundaries clear for our reconciliation code, care should be taken to wrap all returned errors in a K8sError type so that any Kubernetes API errors can be retried immediately.

func New

func New(client client.Client, scheme *runtime.Scheme, controllerName string) Client

func NewTestClient added in v0.2.0

func NewTestClient(list client.ObjectList, objects ...client.Object) Client

type K8sError

type K8sError struct {
	// contains filtered or unexported fields
}

K8sError is an error type that should wrap any Kubernetes API errors that the gatewayclient returns -- they're caught in the requeueing middleware to be retried immediately rather than with a delayed requeue.

func NewK8sError

func NewK8sError(err error) K8sError

func (K8sError) Error

func (s K8sError) Error() string

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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