configuration

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNew

func CreateNew(params ConfigureSubcommandOptions, reader io.Reader)

CreateNew asks the user for configuration input and then creates a configuration file based on the answers

func IsDockerhub

func IsDockerhub(options *AppOptions) bool

IsDockerhub returns if the configuration options point to Dockerhub

func IsGCR

func IsGCR(options *AppOptions) bool

IsGCR returns if the configuration options point to GCR

func ReadPlan

func ReadPlan(planPath string, uncompressData bool) []containerregistry.Repository

ReadPlan reads a plan file and returns the parsed repositories

func WritePlan

func WritePlan(parsedRepos []containerregistry.Repository, planPath string)

WritePlan writes the parsed repos in a plan file; the plan file can then be used to remove specific images

Types

type AppOptions

AppOptions groups all the possible application options in a single struct

type ApplyPlanCommonSubcommandOptions

type ApplyPlanCommonSubcommandOptions struct {
	// Plan file to write, or to read from for deleting images
	Plan string
	// Config is the path of the configuration file
	Config                     string
	GoogleContainerRegistry    GoogleContainerRegistry
	DockerhubContainerRegistry DockerhubContainerRegistry
	Keep                       KeepImages
}

ApplyPlanCommonSubcommandOptions defines the common options between plan and apply subcommands

type ApplySubcommandOptions

type ApplySubcommandOptions struct {
	SubcommandEnabled bool
}

ApplySubcommandOptions defines the options of the apply subcommand

type Configuration

type Configuration struct {
	GCR       GoogleContainerRegistry    `json:",omitempty"`
	Dockerhub DockerhubContainerRegistry `json:",omitempty"`
	Keep      KeepImages
}

Configuration struct shows the structure of the configuration file used by this app

type ConfigureSubcommandOptions

type ConfigureSubcommandOptions struct {
	SubcommandEnabled bool
	// Config is where to save the configuration file
	Config string
}

ConfigureSubcommandOptions defines the options of the configure subcommand

type DockerhubContainerRegistry

type DockerhubContainerRegistry struct {
	Username string
	Password string
	// Namespace is where do you want us to search for images, could be same as the username, could be an org name etc
	Namespace string
}

DockerhubContainerRegistry keeps the needed data for the google container registry

type GoogleContainerRegistry

type GoogleContainerRegistry struct {
	Host  string
	Token string
}

GoogleContainerRegistry keeps the needed data for the google container registry

type Image

type Image struct {
	Tags         []string
	Digests      []string
	Repositories []string
}

Image defines various image-related fields

type KeepImages

type KeepImages struct {
	// Keep images younger than e.g. 5d
	YoungerThan string
	// Keep at least N images
	AtLeast int
	// Keep the images used in the below contexts
	UsedIn UsedIn
	// Keep images with the below image-related characteristics
	Image Image
}

KeepImages specifies what conditions we should use in order to keep images from being deleted

type KubernetesCluster

type KubernetesCluster struct {
	Context       string
	Namespace     string
	RunningInside bool // RunningInside means that faulty-crane is running inside this cluster and thus the k8s client needs specific options to communicate with this cluster
}

KubernetesCluster encapsulates all the information needed per kubernetes cluster

type PlanSubcommandOptions

type PlanSubcommandOptions struct {
	SubcommandEnabled bool
}

PlanSubcommandOptions defines the options of the plan subcommand

type ShowSubcommandOptions

type ShowSubcommandOptions struct {
	SubcommandEnabled bool
	// Plan is the path to the plan file to show
	Plan       string
	Analytical bool
}

ShowSubcommandOptions defines the options of the show subcommand

type UsedIn

type UsedIn struct {
	KubernetesClusters []KubernetesCluster
}

UsedIn defines a list of resources that could use container images

type UserInput

type UserInput struct {
	ContainerRegistryLink      string
	ContainerRegistryUsername  string
	ContainerRegistryPassword  string
	ContainerRegistryNamespace string
	YoungerThan                string
	KubernetesClusters         []string
	ImageTags                  []string
	ImageDigests               []string
	ImageIDs                   []string
}

UserInput is a struct holding the user's answers

func AskUserInput

func AskUserInput(readDevice io.Reader) UserInput

AskUserInput asks for user input in order to create a new configuration

Jump to

Keyboard shortcuts

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