app

package
v0.0.0-...-0223a35 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSugaredLogger

func NewSugaredLogger(config *Config) *zap.SugaredLogger

Types

type Config

type Config struct {
	Debug           bool          `split_words:"true" default:"true"`
	RefreshInterval time.Duration `split_words:"true" default:"5s"`
}

func NewConfig

func NewConfig() *Config

type Docker

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

func NewDockerClient

func NewDockerClient(logger *zap.SugaredLogger, ctx context.Context) (*Docker, error)

func (*Docker) ConvertImageNameToTag

func (docker *Docker) ConvertImageNameToTag(ctx context.Context, imageName string) (string, error)

ConvertImageNameToTag converts the pretty docker image name to sha tag. e.g. alpine:3.10 -> sha256:f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418

func (*Docker) ConvertImageTagToName

func (docker *Docker) ConvertImageTagToName(ctx context.Context, imageTag string) (string, error)

ConvertImageTagToName converts the sha tag to pretty docker image name. e.g. sha256:f8c20f8bbcb684055b4fea470fdd169c86e87786940b3262335b12ec3adef418 -> alpine:3.10

func (*Docker) GetAllImages

func (docker *Docker) GetAllImages(ctx context.Context) ([]string, error)

func (*Docker) WatchForImagesChanges

func (docker *Docker) WatchForImagesChanges(ctx context.Context, watcherInfo *DockerImagesWatcher) error

type DockerImagesWatcher

type DockerImagesWatcher struct {
	OnNewImage     func(imageName string, imageTag string)
	OnRemovedImage func(imageName string, imageTag string)
}

type K8s

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

func NewK8sClient

func NewK8sClient(logger *zap.SugaredLogger) (*K8s, error)

func (*K8s) IsClusterVersionSupported

func (k8s *K8s) IsClusterVersionSupported() error

func (*K8s) RegisterWatchForChanges

func (k8s *K8s) RegisterWatchForChanges(config *Config, watcher *K8sWatcher) error

RegisterWatchForChanges watches k8s resources for added or removed pods

func (*K8s) ReplaceImageForDeployment

func (k8s *K8s) ReplaceImageForDeployment(ctx context.Context, namespace string, deploymentName string, containerName string, newImageName string) error

func (*K8s) ReplaceImageForStatefulset

func (k8s *K8s) ReplaceImageForStatefulset(ctx context.Context, namespace string, statefulsetName string, containerName string, newImageName string) error

func (*K8s) Run

func (k8s *K8s) Run(ctx context.Context) error

type K8sWatcher

type K8sWatcher struct {
	OnAddDeployment    func(deployment *appsV1.Deployment)
	OnRemoveDeployment func(deployment *appsV1.Deployment)

	OnAddStatefulSet    func(statefulSet *appsV1.StatefulSet)
	OnRemoveStatefulSet func(statefulSet *appsV1.StatefulSet)
}

type Store

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

func NewStore

func NewStore(logger *zap.SugaredLogger, docker *Docker, k8s *K8s) *Store

func (*Store) NewDockerImage

func (s *Store) NewDockerImage(ctx context.Context, imageName string)

func (*Store) NewK8sDeployment

func (s *Store) NewK8sDeployment(deployment *v1.Deployment)

func (*Store) NewK8sStatefulSet

func (s *Store) NewK8sStatefulSet(statefulSet *v1.StatefulSet)

func (*Store) RemoveDockerImage

func (s *Store) RemoveDockerImage(imageName string)

func (*Store) RemoveK8sDeployment

func (s *Store) RemoveK8sDeployment(deployment *v1.Deployment)

func (*Store) RemoveK8sStatefulSet

func (s *Store) RemoveK8sStatefulSet(statefulSet *v1.StatefulSet)

Jump to

Keyboard shortcuts

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