scheduler_k3s

package module
v0.0.0-...-e9fe295 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 73 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultIngressClass = "nginx"
View Source
const DefaultKubeContext = ""
View Source
const GlobalProcessType = "--global"
View Source
const KubeConfigPath = "/etc/rancher/k3s/k3s.yaml"
View Source
const TriggerAuthPropertyPrefix = "trigger-auth."

Variables

View Source
var (
	// DefaultProperties is a map of all valid k3s properties with corresponding default property values
	DefaultProperties = map[string]string{
		"deploy-timeout":      "",
		"letsencrypt-server":  "",
		"image-pull-secrets":  "",
		"namespace":           "",
		"rollback-on-failure": "",
	}

	// GlobalProperties is a map of all valid global k3s properties
	GlobalProperties = map[string]bool{
		"deploy-timeout":         true,
		"image-pull-secrets":     true,
		"ingress-class":          true,
		"kube-context":           true,
		"kubeconfig-path":        true,
		"letsencrypt-server":     true,
		"letsencrypt-email-prod": true,
		"letsencrypt-email-stag": true,
		"namespace":              true,
		"network-interface":      true,
		"rollback-on-failure":    true,
		"token":                  true,
	}
)
View Source
var DeployLogPrinter = func(format string, v ...interface{}) {
	message := strings.TrimSpace(fmt.Sprintf(format, v...))
	if message == "" {
		return
	}
	r := []rune(message)
	r[0] = unicode.ToUpper(r[0])
	s := string(r)

	if strings.HasPrefix(s, "Beginning wait") {
		common.LogExclaim(s)
	} else if strings.HasPrefix(s, "Warning:") {
		common.LogExclaim(s)
	} else {
		common.LogVerboseQuiet(s)
	}
}
View Source
var DevNullPrinter = func(format string, v ...interface{}) {}
View Source
var HelmCharts = []HelmChart{
	{
		ChartPath:       "cert-manager",
		CreateNamespace: true,
		Namespace:       "cert-manager",
		ReleaseName:     "cert-manager",
		RepoURL:         "https://charts.jetstack.io",
		Version:         "v1.13.3",
	},
	{
		ChartPath:       "longhorn",
		CreateNamespace: true,
		Namespace:       "longhorn-system",
		ReleaseName:     "longhorn",
		RepoURL:         "https://charts.longhorn.io",
		Version:         "1.5.3",
	},
	{
		ChartPath:       "traefik",
		CreateNamespace: true,
		Namespace:       "traefik",
		ReleaseName:     "traefik",
		RepoURL:         "https://helm.traefik.io/traefik",
		Version:         "26.0.0",
	},
	{
		ChartPath:       "ingress-nginx",
		CreateNamespace: true,
		Namespace:       "ingress-nginx",
		ReleaseName:     "ingress-nginx",
		RepoURL:         "https://kubernetes.github.io/ingress-nginx",
		Version:         "4.10.0",
	},
	{
		ChartPath:       "keda",
		CreateNamespace: true,
		Namespace:       "keda",
		ReleaseName:     "keda",
		RepoURL:         "https://kedacore.github.io/charts",
		Version:         "2.13.1",
	},
}
View Source
var HelmRepositories = []HelmRepository{
	{
		Name: "jetstack",
		URL:  "https://charts.jetstack.io",
	},
	{
		Name: "longhorn",
		URL:  "https://charts.longhorn.io",
	},
	{
		Name: "traefik",
		URL:  "https://helm.traefik.io/traefik",
	},
}
View Source
var KubernetesManifests = []Manifest{
	{
		Name:    "system-upgrader",
		Version: "0.13.2",
		Path:    "https://github.com/rancher/system-upgrade-controller/releases/download/v0.13.2/system-upgrade-controller.yaml",
	},
}
View Source
var ServerLabels = map[string]string{
	"svccontroller.k3s.cattle.io/enablelb": "true",
}
View Source
var WorkerLabels = map[string]string{
	"node-role.kubernetes.io/worker": "worker",
}

Functions

func CommandAnnotationsSet

func CommandAnnotationsSet(appName string, processType string, resourceType string, key string, value string) error

CommandAnnotationsSet set or clear a scheduler-k3s annotation for an app

func CommandAutoscalingAuthReport

func CommandAutoscalingAuthReport(appName string, format string, global bool, includeMetadata bool) error

CommandAutoscalingAuthReport displays a scheduler-k3s autoscaling keda trigger authentication report for one or more apps

func CommandAutoscalingAuthSet

func CommandAutoscalingAuthSet(appName string, trigger string, metadata map[string]string, global bool) error

CommandAutoscalingAuthSet set or clear a scheduler-k3s autoscaling keda trigger authentication object for an app

func CommandClusterAdd

func CommandClusterAdd(role string, remoteHost string, serverIP string, allowUknownHosts bool, taintScheduling bool) error

CommandClusterAdd adds a server to the k3s cluster

func CommandClusterList

func CommandClusterList(format string) error

CommandClusterList lists the nodes in the k3s cluster

func CommandClusterRemove

func CommandClusterRemove(nodeName string) error

CommandClusterRemove removes a node from the k3s cluster

func CommandInitialize

func CommandInitialize(ingressClass string, serverIP string, taintScheduling bool) error

CommandInitialize initializes a k3s cluster on the local server

func CommandLabelsSet

func CommandLabelsSet(appName string, processType string, resourceType string, key string, value string) error

CommandLabelsSet set or clear a scheduler-k3s label for an app

func CommandReport

func CommandReport(appName string, format string, infoFlag string) error

CommandReport displays a scheduler-k3s report for one or more apps

func CommandSet

func CommandSet(appName string, property string, value string) error

CommandSet set or clear a scheduler-k3s property for an app

func CommandShowKubeconfig

func CommandShowKubeconfig() error

CommandShowKubeconfig displays the kubeconfig file contents

func CommandUninstall

func CommandUninstall() error

func KubernetesClientConfig

func KubernetesClientConfig(kubeconfigPath string, kubecontext string) clientcmd.ClientConfig

KubernetesClientConfig returns a Kubernetes client config

func ReportAutoscalingAuthSingleApp

func ReportAutoscalingAuthSingleApp(appName string, format string, includeMetadata bool) error

ReportAutoscalingAuthSingleApp is an internal function that displays the scheduler-k3s autoscaling-auth report for one app

func ReportSingleApp

func ReportSingleApp(appName string, format string, infoFlag string) error

ReportSingleApp is an internal function that displays the scheduler-k3s report for one or more apps

func TriggerInstall

func TriggerInstall() error

TriggerInstall runs the install step for the scheduler-k3s plugin

func TriggerPostAppCloneSetup

func TriggerPostAppCloneSetup(oldAppName string, newAppName string) error

TriggerPostAppCloneSetup creates new scheduler-k3s files

func TriggerPostAppRenameSetup

func TriggerPostAppRenameSetup(oldAppName string, newAppName string) error

TriggerPostAppRenameSetup renames scheduler-k3s files

func TriggerPostDelete

func TriggerPostDelete(appName string) error

TriggerPostDelete destroys the scheduler-k3s data for a given app container

func TriggerSchedulerAppStatus

func TriggerSchedulerAppStatus(scheduler string, appName string) error

TriggerSchedulerAppStatus returns the status of an app on the scheduler

func TriggerSchedulerDeploy

func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) error

TriggerSchedulerDeploy deploys an image tag for a given application

func TriggerSchedulerEnter

func TriggerSchedulerEnter(scheduler string, appName string, processType string, podName string, args []string) error

TriggerSchedulerEnter enters a container for a given application

func TriggerSchedulerLogs

func TriggerSchedulerLogs(scheduler string, appName string, processType string, tail bool, quiet bool, numLines int64) error

TriggerSchedulerLogs displays logs for a given application

func TriggerSchedulerPostDelete

func TriggerSchedulerPostDelete(scheduler string, appName string) error

TriggerSchedulerPostDelete destroys the scheduler-k3s data for a given app container

func TriggerSchedulerRun

func TriggerSchedulerRun(scheduler string, appName string, envCount int, args []string) error

TriggerSchedulerRun runs a command in an ephemeral container

func TriggerSchedulerRunList

func TriggerSchedulerRunList(scheduler string, appName string, format string) error

TriggerSchedulerRunList lists one-off run pods for a given application

func TriggerSchedulerStop

func TriggerSchedulerStop(scheduler string, appName string) error

TriggerSchedulerStop stops an application

Types

type AddRepositoryInput

type AddRepositoryInput struct {
	Name string
	URL  string
}

type AnnotateNodeInput

type AnnotateNodeInput struct {
	// Name is the Kubernetes node name
	Name string
	// Key is the annotation key
	Key string
	// Value is the annotation value
	Value string
}

AnnotateNodeInput contains all the information needed to annotates a Kubernetes node

type AppValues

type AppValues struct {
	Global    GlobalValues             `yaml:"global"`
	Processes map[string]ProcessValues `yaml:"processes"`
}

type ApplyKubernetesManifestInput

type ApplyKubernetesManifestInput struct {
	// Manifest is the path to the Kubernetes manifest
	Manifest string
}

type Chart

type Chart struct {
	ApiVersion string `yaml:"apiVersion"`
	AppVersion string `yaml:"appVersion"`
	Name       string `yaml:"name"`
	Version    string `yaml:"version"`
	Icon       string `yaml:"icon"`
}

type ChartInput

type ChartInput struct {
	ChartPath         string
	Namespace         string
	ReleaseName       string
	RepoURL           string
	RollbackOnFailure bool
	Timeout           time.Duration
	Wait              bool
	Version           string
	Values            map[string]interface{}
}

type ClusterIssuer

type ClusterIssuer struct {
	Email        string `yaml:"email"`
	Enabled      bool   `yaml:"enabled"`
	IngressClass string `yaml:"ingress_class"`
	Name         string `yaml:"name"`
	Server       string `yaml:"server"`
}

type ClusterIssuerValues

type ClusterIssuerValues struct {
	ClusterIssuers map[string]ClusterIssuer `yaml:"cluster_issuers"`
}

type ClusterKedaValues

type ClusterKedaValues struct {
	Global struct {
		Annotations ProcessAnnotations `yaml:"annotations,omitempty"`
	} `yaml:"global"`
	Secrets map[string]string `yaml:"secrets"`
	Type    string            `yaml:"type"`
}

type CreateJobInput

type CreateJobInput struct {
	// Job is the Kubernetes job
	Job batchv1.Job

	// Namespace is the Kubernetes namespace
	Namespace string
}

CreateJobInput contains all the information needed to create a Kubernetes job

type CreateNamespaceInput

type CreateNamespaceInput struct {
	// Name is the name of the Kubernetes namespace
	Name v1.Namespace
}

CreateNamespaceInput contains all the information needed to create a Kubernetes namespace

type DebugRenderer

type DebugRenderer struct {
}

func (*DebugRenderer) Run

func (p *DebugRenderer) Run(renderedManifests *bytes.Buffer) (*bytes.Buffer, error)

type DeleteIngressInput

type DeleteIngressInput struct {
	// Name is the Kubernetes ingress name
	Name string

	// Namespace is the Kubernetes namespace
	Namespace string
}

DeleteIngressInput contains all the information needed to delete a Kubernetes ingress

type DeleteJobInput

type DeleteJobInput struct {
	// Name is the Kubernetes job name
	Name string

	// Namespace is the Kubernetes namespace
	Namespace string
}

DeleteJobInput contains all the information needed to delete a Kubernetes job

type DeleteNodeInput

type DeleteNodeInput struct {
	// Name is the Kubernetes node name
	Name string
}

DeleteNodeInput contains all the information needed to delete a Kubernetes node

type DeleteSecretInput

type DeleteSecretInput struct {
	// Name is the Kubernetes secret name
	Name string

	// Namespace is the Kubernetes namespace
	Namespace string
}

DeleteSecretInput contains all the information needed to delete a Kubernetes secret

type EnterPodInput

type EnterPodInput struct {
	// Clientset is the kubernetes clientset
	Clientset KubernetesClient

	// Command is the command to run
	Command []string

	// Entrypoint is the entrypoint to run
	Entrypoint string

	// SelectedContainerName is the container name to enter
	SelectedContainerName string

	// SelectedPod is the pod to enter
	SelectedPod v1.Pod

	// WaitTimeout is the timeout to wait for the pod to be ready
	WaitTimeout int
}

EnterPodInput contains all the information needed to enter a pod

type ExecHealthcheck

type ExecHealthcheck struct {
	Command []string `yaml:"command,omitempty"`
}

type GetAutoscalingInput

type GetAutoscalingInput struct {
	// AppName is the name of the app
	AppName string

	// ProcessType is the process type
	ProcessType string

	// Replicas is the number of replicas
	Replicas int

	// KedaValues is the keda values
	KedaValues GlobalKedaValues
}

GetAutoscalingInput contains all the information needed to get autoscaling config

type GetNodeInput

type GetNodeInput struct {
	// Name is the Kubernetes node name
	Name string
}

GetNodeInput contains all the information needed to get a Kubernetes node

type GetPodInput

type GetPodInput struct {
	// Name is the Kubernetes pod name
	Name string

	// Namespace is the Kubernetes namespace
	Namespace string
}

GetJobInput contains all the information needed to get a Kubernetes job

type GlobalImage

type GlobalImage struct {
	ImagePullSecrets string `yaml:"image_pull_secrets"`
	Name             string `yaml:"name"`
	PullSecretBase64 string `yaml:"pull_secret_base64"`
	Type             string `yaml:"type"`
	WorkingDir       string `yaml:"working_dir"`
}

type GlobalKedaValues

type GlobalKedaValues struct {
	// Authentications is a map of authentication objects to use for keda
	Authentications map[string]KedaAuthentication `yaml:"authentications"`

	// GlobalAuthentications is a map of global authentication objects to use for keda
	GlobalAuthentications map[string]KedaAuthentication `yaml:"global_authentications"`
}

GlobalKedaValues contains the global keda configuration

type GlobalNetwork

type GlobalNetwork struct {
	IngressClass string `yaml:"ingress_class"`
	PrimaryPort  int32  `yaml:"primary_port"`
}

type GlobalValues

type GlobalValues struct {
	Annotations  ProcessAnnotations `yaml:"annotations,omitempty"`
	AppName      string             `yaml:"app_name"`
	DeploymentID string             `yaml:"deploment_id"`
	Image        GlobalImage        `yaml:"image"`
	Labels       ProcessLabels      `yaml:"labels,omitempty"`
	Keda         GlobalKedaValues   `yaml:"keda"`
	Namespace    string             `yaml:"namespace"`
	Network      GlobalNetwork      `yaml:"network"`
	Secrets      map[string]string  `yaml:"secrets,omitempty"`
}

type HTTPHeader

type HTTPHeader struct {
	Name  string `yaml:"name"`
	Value string `yaml:"value"`
}

type HTTPHealthcheck

type HTTPHealthcheck struct {
	Path        string       `yaml:"path,omitempty"`
	Port        int32        `yaml:"port,omitempty"`
	Host        string       `yaml:"host,omitempty"`
	Scheme      URIScheme    `yaml:"scheme,omitempty"`
	HTTPHeaders []HTTPHeader `yaml:"httpHeaders,omitempty"`
}

type HelmAgent

type HelmAgent struct {
	Configuration *action.Configuration
	Namespace     string
	Logger        action.DebugLog
}

func NewHelmAgent

func NewHelmAgent(namespace string, logger action.DebugLog) (*HelmAgent, error)

func (*HelmAgent) AddRepository

func (h *HelmAgent) AddRepository(ctx context.Context, helmRepo AddRepositoryInput) error

func (*HelmAgent) ChartExists

func (h *HelmAgent) ChartExists(releaseName string) (bool, error)

func (*HelmAgent) DeleteRevision

func (h *HelmAgent) DeleteRevision(ctx context.Context, releaseName string, revision int) error

func (*HelmAgent) GetValues

func (h *HelmAgent) GetValues(releaseName string) (map[string]interface{}, error)

func (*HelmAgent) InstallChart

func (h *HelmAgent) InstallChart(ctx context.Context, input ChartInput) error

func (*HelmAgent) InstallOrUpgradeChart

func (h *HelmAgent) InstallOrUpgradeChart(ctx context.Context, input ChartInput) error

func (*HelmAgent) ListRevisions

func (h *HelmAgent) ListRevisions(ctx context.Context, releaseName string) ([]Release, error)

func (*HelmAgent) UninstallChart

func (h *HelmAgent) UninstallChart(releaseName string) error

func (*HelmAgent) UpgradeChart

func (h *HelmAgent) UpgradeChart(ctx context.Context, input ChartInput) error

type HelmChart

type HelmChart struct {
	ChartPath       string
	CreateNamespace bool
	Namespace       string
	Path            string
	ReleaseName     string
	RepoURL         string
	Version         string
}

type HelmRepository

type HelmRepository struct {
	Name string
	URL  string
}

type Job

type Job struct {
	AppName          string
	Command          []string
	DeploymentID     int64
	Entrypoint       string
	Env              map[string]string
	ID               string
	Image            string
	ImagePullSecrets string
	ImageSourceType  string
	Interactive      bool
	Labels           map[string]string
	Namespace        string
	ProcessType      string
	Schedule         string
	Suffix           string
	RemoveContainer  bool
	WorkingDir       string
}

type KedaAuthentication

type KedaAuthentication struct {
	// Name is the name of the authentication object
	Name string `yaml:"name"`

	// Kind is the kind of authentication object
	Kind KedaAuthenticationKind `yaml:"kind,omitempty"`

	// Type is the type of authentication to use
	Type string `yaml:"type"`

	// Secrets is a map of secrets to use for authentication
	Secrets map[string]string `yaml:"secrets,omitempty"`
}

KedaAuthentication contains the authentication configuration for keda

type KedaAuthenticationKind

type KedaAuthenticationKind string
const (
	KedaAuthenticationKind_ClusterTriggerAuthentication KedaAuthenticationKind = "ClusterTriggerAuthentication"
	KedaAuthenticationKind_TriggerAuthentication        KedaAuthenticationKind = "TriggerAuthentication"
)

type KubernetesClient

type KubernetesClient struct {
	// Client is the Kubernetes client
	Client kubernetes.Clientset

	// DynamicClient is the Kubernetes dynamic client
	DynamicClient dynamic.Interface

	// KubeConfigPath is the path to the Kubernetes config
	KubeConfigPath string

	// RestClient is the Kubernetes REST client
	RestClient rest.Interface

	// RestConfig is the Kubernetes REST config
	RestConfig rest.Config
}

KubernetesClient is a wrapper around the Kubernetes client

func NewKubernetesClient

func NewKubernetesClient() (KubernetesClient, error)

NewKubernetesClient creates a new Kubernetes client

func (KubernetesClient) AnnotateNode

func (k KubernetesClient) AnnotateNode(ctx context.Context, input AnnotateNodeInput) error

AnnotateNode annotates a Kubernetes node

func (KubernetesClient) ApplyKubernetesManifest

func (k KubernetesClient) ApplyKubernetesManifest(ctx context.Context, input ApplyKubernetesManifestInput) error

func (KubernetesClient) CreateJob

func (k KubernetesClient) CreateJob(ctx context.Context, input CreateJobInput) (batchv1.Job, error)

CreateJob creates a Kubernetes job

func (KubernetesClient) CreateNamespace

func (k KubernetesClient) CreateNamespace(ctx context.Context, input CreateNamespaceInput) (v1.Namespace, error)

CreateNamespace creates a Kubernetes namespace

func (KubernetesClient) DeleteIngress

func (k KubernetesClient) DeleteIngress(ctx context.Context, input DeleteIngressInput) error

DeleteIngress deletes a Kubernetes ingress

func (KubernetesClient) DeleteJob

func (k KubernetesClient) DeleteJob(ctx context.Context, input DeleteJobInput) error

DeleteJob deletes a Kubernetes job

func (KubernetesClient) DeleteNode

func (k KubernetesClient) DeleteNode(ctx context.Context, input DeleteNodeInput) error

DeleteNode deletes a Kubernetes node

func (KubernetesClient) DeleteSecret

func (k KubernetesClient) DeleteSecret(ctx context.Context, input DeleteSecretInput) error

DeleteSecret deletes a Kubernetes secret

func (KubernetesClient) GetNode

func (k KubernetesClient) GetNode(ctx context.Context, input GetNodeInput) (Node, error)

GetNode gets a Kubernetes node

func (KubernetesClient) GetPod

func (k KubernetesClient) GetPod(ctx context.Context, input GetPodInput) (v1.Pod, error)

GetJob gets a Kubernetes job

func (KubernetesClient) LabelNode

func (k KubernetesClient) LabelNode(ctx context.Context, input LabelNodeInput) error

LabelNode labels a Kubernetes node

func (KubernetesClient) ListClusterTriggerAuthentications

ListClusterTriggerAuthentications lists Kubernetes trigger authentications

func (KubernetesClient) ListCronJobs

func (k KubernetesClient) ListCronJobs(ctx context.Context, input ListCronJobsInput) ([]batchv1.CronJob, error)

ListCronJobs lists Kubernetes cron jobs

func (KubernetesClient) ListDeployments

func (k KubernetesClient) ListDeployments(ctx context.Context, input ListDeploymentsInput) ([]appsv1.Deployment, error)

ListDeployments lists Kubernetes deployments

func (KubernetesClient) ListIngresses

func (k KubernetesClient) ListIngresses(ctx context.Context, input ListIngressesInput) ([]networkingv1.Ingress, error)

ListIngresses lists Kubernetes ingresses

func (KubernetesClient) ListNamespaces

func (k KubernetesClient) ListNamespaces(ctx context.Context) ([]v1.Namespace, error)

ListNamespaces lists Kubernetes namespaces

func (KubernetesClient) ListNodes

func (k KubernetesClient) ListNodes(ctx context.Context, input ListNodesInput) ([]v1.Node, error)

ListNodes lists Kubernetes nodes

func (KubernetesClient) ListPods

func (k KubernetesClient) ListPods(ctx context.Context, input ListPodsInput) ([]v1.Pod, error)

ListPods lists Kubernetes pods

func (KubernetesClient) ListTriggerAuthentications

ListTriggerAuthentications lists Kubernetes trigger authentications

func (KubernetesClient) Ping

func (k KubernetesClient) Ping() error

func (KubernetesClient) ScaleDeployment

func (k KubernetesClient) ScaleDeployment(ctx context.Context, input ScaleDeploymentInput) error

ScaleDeployment scales a Kubernetes deployment

type LabelNodeInput

type LabelNodeInput struct {
	// Name is the Kubernetes node name
	Name string
	// Key is the label key
	Key string
	// Value is the label value
	Value string
}

LabelNodeInput contains all the information needed to label a Kubernetes node

type ListClusterTriggerAuthenticationsInput

type ListClusterTriggerAuthenticationsInput struct {
	// Namespace is the Kubernetes namespace
	Namespace string

	// LabelSelector is the Kubernetes label selector
	LabelSelector string
}

ListClusterTriggerAuthenticationsInput contains all the information needed to list Kubernetes trigger authentications

type ListCronJobsInput

type ListCronJobsInput struct {
	// LabelSelector is the Kubernetes label selector
	LabelSelector string

	// Namespace is the Kubernetes namespace
	Namespace string
}

ListCronJobsInput contains all the information needed to list Kubernetes cron jobs

type ListDeploymentsInput

type ListDeploymentsInput struct {
	// Namespace is the Kubernetes namespace
	Namespace string

	// LabelSelector is the Kubernetes label selector
	LabelSelector string
}

ListDeploymentsInput contains all the information needed to list Kubernetes deployments

type ListIngressesInput

type ListIngressesInput struct {
	// Namespace is the Kubernetes namespace
	Namespace string

	// LabelSelector is the Kubernetes label selector
	LabelSelector string
}

ListIngressesInput contains all the information needed to list Kubernetes ingresses

type ListNodesInput

type ListNodesInput struct {
	// LabelSelector is the Kubernetes label selector
	LabelSelector string
}

ListNodesInput contains all the information needed to list Kubernetes nodes

type ListPodsInput

type ListPodsInput struct {
	// Namespace is the Kubernetes namespace
	Namespace string

	// LabelSelector is the Kubernetes label selector
	LabelSelector string
}

ListPodsInput contains all the information needed to list Kubernetes pods

type ListTriggerAuthenticationsInput

type ListTriggerAuthenticationsInput struct {
	// Namespace is the Kubernetes namespace
	Namespace string

	// LabelSelector is the Kubernetes label selector
	LabelSelector string
}

ListTriggerAuthenticationsInput contains all the information needed to list Kubernetes trigger authentications

type Manifest

type Manifest struct {
	Name    string
	Version string
	Path    string
}

type NameSorter

type NameSorter []ProcessPortMap

func (NameSorter) Len

func (a NameSorter) Len() int

func (NameSorter) Less

func (a NameSorter) Less(i, j int) bool

func (NameSorter) Swap

func (a NameSorter) Swap(i, j int)

type Node

type Node struct {
	// Name is the name of the node
	Name string

	// Roles is the roles of the node
	Roles []string

	// Ready is whether the node is ready
	Ready bool

	// RemoteHost is the remote host
	RemoteHost string

	// Version is the version of the node
	Version string
}

Node contains information about a node

func (Node) String

func (n Node) String() string

String returns a string representation of the node

type PortMap

type PortMap struct {
	ContainerPort int32  `json:"container_port"`
	HostPort      int32  `json:"host_port"`
	Scheme        string `json:"scheme"`
}

func (PortMap) IsAllowedHttp

func (p PortMap) IsAllowedHttp() bool

func (PortMap) IsAllowedHttps

func (p PortMap) IsAllowedHttps() bool

func (PortMap) String

func (p PortMap) String() string

type PortmapProtocol

type PortmapProtocol string
const (
	PortmapProtocol_TCP PortmapProtocol = "TCP"
	PortmapProtocol_UDP PortmapProtocol = "UDP"
)

type ProcessAnnotations

type ProcessAnnotations struct {
	CertificateAnnotations               map[string]string `yaml:"certificate,omitempty"`
	CronJobAnnotations                   map[string]string `yaml:"cronjob,omitempty"`
	DeploymentAnnotations                map[string]string `yaml:"deployment,omitempty"`
	IngressAnnotations                   map[string]string `yaml:"ingress,omitempty"`
	JobAnnotations                       map[string]string `yaml:"job,omitempty"`
	KedaScalingObjectAnnotations         map[string]string `yaml:"keda_scaled_object,omitempty"`
	KedaSecretAnnotations                map[string]string `yaml:"keda_secret,omitempty"`
	KedaTriggerAuthenticationAnnotations map[string]string `yaml:"keda_trigger_authentication,omitempty"`
	PodAnnotations                       map[string]string `yaml:"pod,omitempty"`
	SecretAnnotations                    map[string]string `yaml:"secret,omitempty"`
	ServiceAccountAnnotations            map[string]string `yaml:"serviceaccount,omitempty"`
	ServiceAnnotations                   map[string]string `yaml:"service,omitempty"`
	TraefikIngressRouteAnnotations       map[string]string `yaml:"traefik_ingressroute,omitempty"`
	TraefikMiddlewareAnnotations         map[string]string `yaml:"traefik_middleware,omitempty"`
}

type ProcessAutoscaling

type ProcessAutoscaling struct {
	// CooldownPeriodSeconds is the number of seconds after a scaling event before another can be triggered
	CooldownPeriodSeconds int `yaml:"cooldown_period_seconds,omitempty"`

	// Enabled is a flag to enable autoscaling
	Enabled bool `yaml:"enabled"`

	// MaxReplicas is the maximum number of replicas to scale to
	MaxReplicas int `yaml:"max_replicas,omitempty"`

	// MinReplicas is the minimum number of replicas to scale to
	MinReplicas int `yaml:"min_replicas,omitempty"`

	// PollingIntervalSeconds is the number of seconds between polling for new metrics
	PollingIntervalSeconds int `yaml:"polling_interval_seconds,omitempty"`

	// Triggers is a list of triggers to use for autoscaling
	Triggers []ProcessAutoscalingTrigger `yaml:"triggers,omitempty"`

	// Type is the type of autoscaling to use
	Type string `yaml:"type"`
}

ProcessAutoscaling contains the autoscaling configuration for a process

type ProcessAutoscalingTrigger

type ProcessAutoscalingTrigger struct {
	// Name is the name of the trigger
	Name string `yaml:"name"`

	// Type is the type of trigger to use
	Type string `yaml:"type"`

	// Metadata is a map of key-value pairs that can be used to store arbitrary trigger data
	Metadata map[string]string `yaml:"metadata,omitempty"`

	// AuthenticationRef is a reference to an authentication object
	AuthenticationRef *ProcessAutoscalingTriggerAuthenticationRef `yaml:"authenticationRef,omitempty"`
}

ProcessAutoscalingTrigger is a trigger to use for autoscaling

type ProcessAutoscalingTriggerAuthenticationRef

type ProcessAutoscalingTriggerAuthenticationRef struct {
	// Name is the name of the authentication object
	Name string `yaml:"name"`

	// Kind is the kind of authentication object
	Kind string `yaml:"kind,omitempty"`
}

ProcessAutoscalingTriggerAuthenticationRef is a reference to an authentication object

type ProcessCron

type ProcessCron struct {
	ID       string `yaml:"id"`
	Schedule string `yaml:"schedule"`
	Suffix   string `yaml:"suffix"`
}

type ProcessDomains

type ProcessDomains struct {
	Name string `yaml:"name"`
	Slug string `yaml:"slug"`
}

type ProcessHealthcheck

type ProcessHealthcheck struct {
	Exec      *ExecHealthcheck `yaml:"exec,omitempty"`
	HTTPGet   *HTTPHealthcheck `yaml:"httpGet,omitempty"`
	TCPSocket *TCPHealthcheck  `yaml:"tcpSocket,omitempty"`

	InitialDelaySeconds           int32  `yaml:"initialDelaySeconds,omitempty"`
	TimeoutSeconds                int32  `yaml:"timeoutSeconds,omitempty"`
	PeriodSeconds                 int32  `yaml:"periodSeconds,omitempty"`
	SuccessThreshold              int32  `yaml:"successThreshold,omitempty"`
	FailureThreshold              int32  `yaml:"failureThreshold,omitempty"`
	TerminationGracePeriodSeconds *int64 `yaml:"terminationGracePeriodSeconds,omitempty"`
}

type ProcessHealthchecks

type ProcessHealthchecks struct {
	Liveness        ProcessHealthcheck `yaml:"liveness,omitempty"`
	Readiness       ProcessHealthcheck `yaml:"readiness,omitempty"`
	Startup         ProcessHealthcheck `yaml:"startup,omitempty"`
	MinReadySeconds int32              `yaml:"min_ready_seconds,omitempty"`
}

type ProcessLabels

type ProcessLabels struct {
	CertificateLabels         map[string]string `yaml:"certificate,omitempty"`
	CronJobLabels             map[string]string `yaml:"cronjob,omitempty"`
	DeploymentLabels          map[string]string `yaml:"deployment,omitempty"`
	IngressLabels             map[string]string `yaml:"ingress,omitempty"`
	JobLabels                 map[string]string `yaml:"job,omitempty"`
	PodLabels                 map[string]string `yaml:"pod,omitempty"`
	SecretLabels              map[string]string `yaml:"secret,omitempty"`
	ServiceAccountLabels      map[string]string `yaml:"serviceaccount,omitempty"`
	ServiceLabels             map[string]string `yaml:"service,omitempty"`
	TraefikIngressRouteLabels map[string]string `yaml:"traefik_ingressroute,omitempty"`
	TraefikMiddlewareLabels   map[string]string `yaml:"traefik_middleware,omitempty"`
}

type ProcessPortMap

type ProcessPortMap struct {
	ContainerPort int32           `yaml:"container_port"`
	HostPort      int32           `yaml:"host_port"`
	Scheme        string          `yaml:"scheme"`
	Protocol      PortmapProtocol `yaml:"protocol"`
	Name          string          `yaml:"name"`
}

type ProcessResources

type ProcessResources struct {
	NvidiaGPU string `yaml:"nvidia.com/gpu,omitempty"`
	CPU       string `yaml:"cpu,omitempty"`
	Memory    string `yaml:"memory,omitempty"`
}

type ProcessResourcesMap

type ProcessResourcesMap struct {
	Limits   ProcessResources `yaml:"limits,omitempty"`
	Requests ProcessResources `yaml:"requests,omitempty"`
}

type ProcessTls

type ProcessTls struct {
	Enabled    bool   `yaml:"enabled"`
	IssuerName string `yaml:"issuer_name"`
}

type ProcessType

type ProcessType string
const (
	ProcessType_Cron   ProcessType = "cron"
	ProcessType_Job    ProcessType = "job"
	ProcessType_Web    ProcessType = "web"
	ProcessType_Worker ProcessType = "worker"
)

type ProcessValues

type ProcessValues struct {
	Annotations  ProcessAnnotations  `yaml:"annotations,omitempty"`
	Args         []string            `yaml:"args,omitempty"`
	Autoscaling  ProcessAutoscaling  `yaml:"autoscaling,omitempty"`
	Cron         ProcessCron         `yaml:"cron,omitempty"`
	Healthchecks ProcessHealthchecks `yaml:"healthchecks,omitempty"`
	Labels       ProcessLabels       `yaml:"labels,omitempty"`
	ProcessType  ProcessType         `yaml:"process_type"`
	Replicas     int32               `yaml:"replicas"`
	Resources    ProcessResourcesMap `yaml:"resources,omitempty"`
	Web          ProcessWeb          `yaml:"web,omitempty"`
}

type ProcessWeb

type ProcessWeb struct {
	Domains  []ProcessDomains `yaml:"domains,omitempty"`
	PortMaps []ProcessPortMap `yaml:"port_maps,omitempty"`
	TLS      ProcessTls       `yaml:"tls"`
}

type Release

type Release struct {
	Name      string
	Namespace string
	Version   int
}

type ScaleDeploymentInput

type ScaleDeploymentInput struct {
	// Name is the Kubernetes deployment name
	Name string

	// Namespace is the Kubernetes namespace
	Namespace string

	// Replicas is the number of replicas to scale to
	Replicas int32
}

ScaleDeploymentInput contains all the information needed to scale a Kubernetes deployment

type StartCommandInput

type StartCommandInput struct {
	// AppName is the name of the app
	AppName string
	// ProcessType is the process type
	ProcessType string
	// ImageSourceType is the image source type
	ImageSourceType string
	// Port is the port
	Port int32
	// Env is the environment variables
	Env map[string]string
}

StartCommandInput contains all the information needed to get the start command

type StartCommandOutput

type StartCommandOutput struct {
	// Command is the start command
	Command []string
}

StartCommandOutput contains the start command

type TCPHealthcheck

type TCPHealthcheck struct {
	Port int32  `yaml:"port,omitempty"`
	Host string `yaml:"host,omitempty"`
}

type URIScheme

type URIScheme string
const (
	URISchemeHTTP  URIScheme = "HTTP"
	URISchemeHTTPS URIScheme = "HTTPS"
)

type WaitForNodeToExistInput

type WaitForNodeToExistInput struct {
	Clientset  KubernetesClient
	Namespace  string
	RetryCount int
	NodeName   string
}

type WaitForPodBySelectorRunningInput

type WaitForPodBySelectorRunningInput struct {
	Clientset     KubernetesClient
	Namespace     string
	LabelSelector string
	PodName       string
	Timeout       int
	Waiter        func(ctx context.Context, clientset KubernetesClient, podName, namespace string) wait.ConditionWithContextFunc
}

type WaitForPodToExistInput

type WaitForPodToExistInput struct {
	Clientset     KubernetesClient
	Namespace     string
	RetryCount    int
	PodName       string
	LabelSelector string
}

type WriteYamlInput

type WriteYamlInput struct {
	Object interface{}
	Path   string
}

Directories

Path Synopsis
src

Jump to

Keyboard shortcuts

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