client

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextFieldName = "context"
	ContextFieldDesc = "Name of the context from k8s configuration."
)

Variables

View Source
var CommonContextField = schema.Column{
	Name:        ContextFieldName,
	Description: ContextFieldDesc,
	Type:        schema.TypeString,
	Resolver:    ResolveContext,
}

Functions

func APIFilterContextMultiplex

func APIFilterContextMultiplex(path string) func(meta schema.ClientMeta) []schema.ClientMeta

APIFilterContextMultiplex returns a list of clients for each context from the cq config

func Configure

func Configure(logger hclog.Logger, config interface{}) (schema.ClientMeta, diag.Diagnostics)

func ContextMultiplex

func ContextMultiplex(meta schema.ClientMeta) []schema.ClientMeta

ContextMultiplex returns a list of clients for each context from the cq config

func DeleteContextFilter

func DeleteContextFilter(meta schema.ClientMeta, _ *schema.Resource) []interface{}

DeleteContextFilter returns a delete filter that cleans up the data belonging to the k8s context.

func ErrorClassifier

func ErrorClassifier(_ schema.ClientMeta, resourceName string, err error) diag.Diagnostics

func IgnoreForbiddenNotFound

func IgnoreForbiddenNotFound(err error) bool

func K8sMockTestHelper

func K8sMockTestHelper(t *testing.T, table *schema.Table, builder func(*testing.T, *gomock.Controller) Services, options TestOptions)

func K8sTestHelper

func K8sTestHelper(t *testing.T, table *schema.Table, snapshotDirPath string)

func OwnerReferenceResolver

func OwnerReferenceResolver(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error

func ResolveContext

func ResolveContext(_ context.Context, meta schema.ClientMeta, r *schema.Resource, c schema.Column) error

ResolveContext is a resolver that fills the k8s context field.

Types

type Client

type Client struct {
	Log hclog.Logger

	Context string
	// contains filtered or unexported fields
}

func (*Client) Logger

func (c *Client) Logger() hclog.Logger

func (*Client) Services

func (c *Client) Services() Services

func (*Client) SetServices

func (c *Client) SetServices(s map[string]Services)

func (Client) WithContext

func (c Client) WithContext(context string) *Client

type Config

type Config struct {
	Contexts []string `hcl:"contexts,optional"`
}

func (Config) Example

func (Config) Example() string

type CronJobsClient

type CronJobsClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*batchv1.CronJobList, error)
}

type DaemonSetsClient

type DaemonSetsClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*appsv1.DaemonSetList, error)
}

type DeploymentsClient

type DeploymentsClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*appsv1.DeploymentList, error)
}

type EndpointsClient

type EndpointsClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*corev1.EndpointsList, error)
}

type JobsClient

type JobsClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*batchv1.JobList, error)
}

type LimitRangesClient

type LimitRangesClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*corev1.LimitRangeList, error)
}

type NamespacesClient

type NamespacesClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*corev1.NamespaceList, error)
}

type NetworkPoliciesClient

type NetworkPoliciesClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*networkingv1.NetworkPolicyList, error)
}

type NodesClient

type NodesClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*corev1.NodeList, error)
}

type OwnerReferences

type OwnerReferences struct {
	ResourceUID types.UID
	v1.OwnerReference
}

type PodsClient

type PodsClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*corev1.PodList, error)
}

type ReplicaSetsClient

type ReplicaSetsClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*appsv1.ReplicaSetList, error)
}

type ResourceQuotasClient

type ResourceQuotasClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*corev1.ResourceQuotaList, error)
}

type RoleBindingsClient

type RoleBindingsClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*rbacv1.RoleBindingList, error)
}

type RolesClient

type RolesClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*rbacv1.RoleList, error)
}

type ServiceAccountsClient

type ServiceAccountsClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*corev1.ServiceAccountList, error)
}

type Services

type Services struct {
	Client *kubernetes.Clientset

	CronJobs        CronJobsClient
	DaemonSets      DaemonSetsClient
	Deployments     DeploymentsClient
	Endpoints       EndpointsClient
	Jobs            JobsClient
	LimitRanges     LimitRangesClient
	Namespaces      NamespacesClient
	NetworkPolicies NetworkPoliciesClient
	Nodes           NodesClient
	Pods            PodsClient
	ReplicaSets     ReplicaSetsClient
	ResourceQuotas  ResourceQuotasClient
	RoleBindings    RoleBindingsClient
	Roles           RolesClient
	ServiceAccounts ServiceAccountsClient
	Services        ServicesClient
	StatefulSets    StatefulSetsClient
}

type ServicesClient

type ServicesClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*corev1.ServiceList, error)
}

type StatefulSetsClient

type StatefulSetsClient interface {
	List(ctx context.Context, opts metav1.ListOptions) (*appsv1.StatefulSetList, error)
}

type TestOptions

type TestOptions struct {
	SkipEmptyJsonB bool
}

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