client

package
v0.5.23 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 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 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 added in v0.4.3

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

func IgnoreForbiddenNotFound added in v0.4.6

func IgnoreForbiddenNotFound(err error) bool

func K8sMockTestHelper added in v0.3.1

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

func K8sTestHelper added in v0.3.1

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

func OwnerReferenceResolver added in v0.3.0

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 added in v0.3.0

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

func (Client) WithContext added in v0.3.0

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

type Config

type Config struct {
	Contexts []string `hcl:"contexts,optional"`
	// contains filtered or unexported fields
}

func NewConfig added in v0.5.11

func NewConfig(f cqproto.ConfigFormat) *Config

func (Config) Example

func (c Config) Example() string

func (Config) Format added in v0.5.11

func (c Config) Format() cqproto.ConfigFormat

type CronJobsClient added in v0.3.0

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

type DaemonSetsClient added in v0.3.0

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

type DeploymentsClient added in v0.3.0

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

type EndpointsClient added in v0.3.1

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

type JobsClient added in v0.3.0

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

type LimitRangesClient added in v0.3.1

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

type NamespacesClient added in v0.3.0

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

type NetworkPoliciesClient added in v0.3.0

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 added in v0.3.0

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 added in v0.3.0

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

type ResourceQuotasClient added in v0.3.1

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

type RoleBindingsClient added in v0.3.0

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

type RolesClient added in v0.3.0

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

type ServiceAccountsClient added in v0.3.1

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 added in v0.3.0

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

type TestOptions added in v0.3.1

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