kubernetes

package
v0.0.0-...-86aec00 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterNamespace

func FilterNamespace(namespace string, includeExpr []*regexp.Regexp, excludeExpr []*regexp.Regexp) bool

Types

type ArgoCDAppFilter

type ArgoCDAppFilter func(*ArgoCDApplication) bool

func NewDestinationNamespaceFilter

func NewDestinationNamespaceFilter(opts FiltersOptions) (ArgoCDAppFilter, error)

type ArgoCDApplication

type ArgoCDApplication struct {
	Name                 string                   `json:"name"`
	DestinationNamespace string                   `json:"destination-namespace"`
	Project              string                   `json:"project"`
	Server               string                   `json:"server"`
	RepoURL              string                   `json:"repoURL"`
	ChartFilePath        string                   `json:"path"`
	Chart                string                   `json:"chart"`
	CurrentVersion       string                   `json:"version"`
	RepoBackendType      versions.RepoBackendType `json:"repobackendtype"` // Git or Helm
	GitRevision          string                   // master / dev / ...
}

type Client

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

func NewClient

func NewClient(logger *slog.Logger) (*Client, error)

func (*Client) ListArgoApplications

func (c *Client) ListArgoApplications(ctx context.Context, namespace string, filters ...ArgoCDAppFilter) ([]*ArgoCDApplication, error)

ListArgoApplications Retrieve helm-based argocd Applications from a kubernetes cluster's namespace'

func (*Client) ListDeployments

func (c *Client) ListDeployments(ctx context.Context, request ListRequest) (*v1.DeploymentList, error)

func (*Client) ListSecrets

func (c *Client) ListSecrets(ctx context.Context, namespace string) (*v1.SecretList, error)

type DestinationNamespaceFilterOptions

type DestinationNamespaceFilterOptions struct {
	NamespaceFilterOptions `yaml:",inline"`
}

type FiltersOptions

type FiltersOptions struct {
	// Destination namespace of Argocd Applications
	DestinationNamespaceFilterOptions `yaml:"destination-namespace"`
}

type KubernetesClient

type KubernetesClient interface {
	ListArgoApplications(ctx context.Context, namespace string, filters ...ArgoCDAppFilter) ([]*ArgoCDApplication, error)
	ListSecrets(ctx context.Context, namespace string) (*v1.SecretList, error)
	ListDeployments(ctx context.Context, request ListRequest) (*appsv1.DeploymentList, error)
}

type KubernetesClientMock

type KubernetesClientMock struct {
	mock.Mock
}

func (*KubernetesClientMock) ListArgoApplications

func (m *KubernetesClientMock) ListArgoApplications(ctx context.Context, namespace string, filters ...ArgoCDAppFilter) ([]*ArgoCDApplication, error)

func (*KubernetesClientMock) ListDeployments

func (m *KubernetesClientMock) ListDeployments(ctx context.Context, request ListRequest) (*appsv1.DeploymentList, error)

func (*KubernetesClientMock) ListSecrets

func (m *KubernetesClientMock) ListSecrets(ctx context.Context, namespace string) (*v1.SecretList, error)

type ListRequest

type ListRequest struct {
	Namespace     string
	LabelSelector map[string]string
}

type NamespaceFilterOptions

type NamespaceFilterOptions struct {
	Include []string `yaml:"include"`
	Exclude []string `yaml:"exclude"`
}

func (NamespaceFilterOptions) Compile

func (ds NamespaceFilterOptions) Compile() ([]*regexp.Regexp, []*regexp.Regexp, error)

Returns a converted-to-*regexp.Regexp version of NamespaceFilterOptions.Include and NamespaceFilterOptions.Exclude

Jump to

Keyboard shortcuts

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