Documentation ¶
Overview ¶
Package cluster contains Jackal-specific cluster management functions.
Package cluster contains Jackal-specific cluster management functions.
Package cluster contains Jackal-specific cluster management functions.
Package cluster contains Jackal-specific cluster management functions.
Package cluster contains Jackal-specific cluster management functions.
Package cluster contains Jackal-specific cluster management functions.
Package cluster contains Jackal-specific cluster management functions.
Package cluster contains Jackal-specific cluster management functions.
Index ¶
- Constants
- type Cluster
- func (c *Cluster) Connect(target string) (*k8s.Tunnel, error)
- func (c *Cluster) ConnectToJackalRegistryEndpoint(registryInfo types.RegistryInfo) (string, *k8s.Tunnel, error)
- func (c *Cluster) ConnectTunnelInfo(zt TunnelInfo) (*k8s.Tunnel, error)
- func (c *Cluster) DeleteJackalNamespace()
- func (c *Cluster) DisableRegHPAScaleDown() error
- func (c *Cluster) EnableRegHPAScaleDown() error
- func (c *Cluster) GenerateGitPullCreds(namespace, name string, gitServerInfo types.GitServerInfo) *corev1.Secret
- func (c *Cluster) GenerateRegistryPullCreds(namespace, name string, registryInfo types.RegistryInfo) *corev1.Secret
- func (c *Cluster) GetDeployedJackalPackages() ([]types.DeployedPackage, []error)
- func (c *Cluster) GetDeployedPackage(packageName string) (deployedPackage *types.DeployedPackage, err error)
- func (c *Cluster) GetInstalledChartsForComponent(packageName string, component types.JackalComponent) (installedCharts []types.InstalledChart, err error)
- func (c *Cluster) HandleDataInjection(wg *sync.WaitGroup, data types.JackalDataInjection, ...)
- func (c *Cluster) InitJackalState(initOptions types.JackalInitOptions) error
- func (c *Cluster) LoadJackalState() (state *types.JackalState, err error)
- func (c *Cluster) MergeJackalState(oldState *types.JackalState, initOptions types.JackalInitOptions, ...) (*types.JackalState, error)
- func (c *Cluster) PackageSecretNeedsWait(deployedPackage *types.DeployedPackage, component types.JackalComponent, ...) (needsWait bool, waitSeconds int, hookName string)
- func (c *Cluster) PrintConnectTable() error
- func (c *Cluster) RecordPackageDeployment(pkg types.JackalPackage, components []types.DeployedComponent, ...) (deployedPackage *types.DeployedPackage, err error)
- func (c *Cluster) RecordPackageDeploymentAndWait(pkg types.JackalPackage, components []types.DeployedComponent, ...) (deployedPackage *types.DeployedPackage, err error)
- func (c *Cluster) SaveJackalState(state *types.JackalState) error
- func (c *Cluster) StartInjectionMadness(tmpDir string, imagesDir string, injectorSeedSrcs []string)
- func (c *Cluster) StopInjectionMadness() error
- func (c *Cluster) StripJackalLabelsAndSecretsFromNamespaces()
- func (c *Cluster) UpdateJackalManagedGitSecrets(state *types.JackalState)
- func (c *Cluster) UpdateJackalManagedImageSecrets(state *types.JackalState)
- type DockerConfig
- type DockerConfigEntry
- type DockerConfigEntryWithAuth
- type TunnelInfo
Constants ¶
const ( JackalNamespaceName = "jackal" JackalStateSecretName = "jackal-state" JackalStateDataKey = "state" JackalPackageInfoLabel = "package-deploy-info" JackalInitPackageInfoName = "jackal-package-init" )
Jackal Cluster Constants.
const ( JackalRegistry = "REGISTRY" JackalLogging = "LOGGING" JackalGit = "GIT" JackalInjector = "INJECTOR" JackalInjectorName = "zarf-injector" JackalInjectorPort = 5000 JackalRegistryName = "jackal-docker-registry" JackalRegistryPort = 5000 JackalGitServerName = "jackal-gitea-http" JackalGitServerPort = 3000 )
Jackal specific connect strings
const ( // DefaultTimeout is the default time to wait for a cluster to be ready. DefaultTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
Cluster is a wrapper for the k8s package that provides Jackal-specific cluster management functions.
func NewCluster ¶
NewCluster creates a new Cluster instance and validates connection to the cluster by fetching the Kubernetes version.
func NewClusterOrDie ¶
func NewClusterOrDie() *Cluster
NewClusterOrDie creates a new Cluster instance and waits up to 30 seconds for the cluster to be ready or throws a fatal error.
func NewClusterWithWait ¶
NewClusterWithWait creates a new Cluster instance and waits for the given timeout for the cluster to be ready.
func (*Cluster) ConnectToJackalRegistryEndpoint ¶
func (c *Cluster) ConnectToJackalRegistryEndpoint(registryInfo types.RegistryInfo) (string, *k8s.Tunnel, error)
ConnectToJackalRegistryEndpoint determines if a registry endpoint is in cluster, and if so opens a tunnel to connect to it
func (*Cluster) ConnectTunnelInfo ¶
func (c *Cluster) ConnectTunnelInfo(zt TunnelInfo) (*k8s.Tunnel, error)
ConnectTunnelInfo connects to the cluster with the provided TunnelInfo
func (*Cluster) DeleteJackalNamespace ¶
func (c *Cluster) DeleteJackalNamespace()
DeleteJackalNamespace deletes the Jackal namespace from the connected cluster.
func (*Cluster) DisableRegHPAScaleDown ¶
DisableRegHPAScaleDown disables the HPA scale down for the Jackal Registry.
func (*Cluster) EnableRegHPAScaleDown ¶
EnableRegHPAScaleDown enables the HPA scale down for the Jackal Registry.
func (*Cluster) GenerateGitPullCreds ¶
func (c *Cluster) GenerateGitPullCreds(namespace, name string, gitServerInfo types.GitServerInfo) *corev1.Secret
GenerateGitPullCreds generates a secret containing the git credentials.
func (*Cluster) GenerateRegistryPullCreds ¶
func (c *Cluster) GenerateRegistryPullCreds(namespace, name string, registryInfo types.RegistryInfo) *corev1.Secret
GenerateRegistryPullCreds generates a secret containing the registry credentials.
func (*Cluster) GetDeployedJackalPackages ¶
func (c *Cluster) GetDeployedJackalPackages() ([]types.DeployedPackage, []error)
GetDeployedJackalPackages gets metadata information about packages that have been deployed to the cluster. We determine what packages have been deployed to the cluster by looking for specific secrets in the Jackal namespace. Returns a list of DeployedPackage structs and a list of errors.
func (*Cluster) GetDeployedPackage ¶
func (c *Cluster) GetDeployedPackage(packageName string) (deployedPackage *types.DeployedPackage, err error)
GetDeployedPackage gets the metadata information about the package name provided (if it exists in the cluster). We determine what packages have been deployed to the cluster by looking for specific secrets in the Jackal namespace.
func (*Cluster) GetInstalledChartsForComponent ¶
func (c *Cluster) GetInstalledChartsForComponent(packageName string, component types.JackalComponent) (installedCharts []types.InstalledChart, err error)
GetInstalledChartsForComponent returns any installed Helm Charts for the provided package component.
func (*Cluster) HandleDataInjection ¶
func (c *Cluster) HandleDataInjection(wg *sync.WaitGroup, data types.JackalDataInjection, componentPath *layout.ComponentPaths, dataIdx int)
HandleDataInjection waits for the target pod(s) to come up and inject the data into them todo: this currently requires kubectl but we should have enough k8s work to make this native now.
func (*Cluster) InitJackalState ¶
func (c *Cluster) InitJackalState(initOptions types.JackalInitOptions) error
InitJackalState initializes the Jackal state with the given temporary directory and init configs.
func (*Cluster) LoadJackalState ¶
func (c *Cluster) LoadJackalState() (state *types.JackalState, err error)
LoadJackalState returns the current jackal/jackal-state secret data or an empty JackalState.
func (*Cluster) MergeJackalState ¶
func (c *Cluster) MergeJackalState(oldState *types.JackalState, initOptions types.JackalInitOptions, services []string) (*types.JackalState, error)
MergeJackalState merges init options for provided services into the provided state to create a new state struct
func (*Cluster) PackageSecretNeedsWait ¶
func (c *Cluster) PackageSecretNeedsWait(deployedPackage *types.DeployedPackage, component types.JackalComponent, skipWebhooks bool) (needsWait bool, waitSeconds int, hookName string)
PackageSecretNeedsWait checks if a package component has a running webhook that needs to be waited on.
func (*Cluster) PrintConnectTable ¶
PrintConnectTable will print a table of all Jackal connect matches found in the cluster.
func (*Cluster) RecordPackageDeployment ¶
func (c *Cluster) RecordPackageDeployment(pkg types.JackalPackage, components []types.DeployedComponent, connectStrings types.ConnectStrings, generation int) (deployedPackage *types.DeployedPackage, err error)
RecordPackageDeployment saves metadata about a package that has been deployed to the cluster.
func (*Cluster) RecordPackageDeploymentAndWait ¶
func (c *Cluster) RecordPackageDeploymentAndWait(pkg types.JackalPackage, components []types.DeployedComponent, connectStrings types.ConnectStrings, generation int, component types.JackalComponent, skipWebhooks bool) (deployedPackage *types.DeployedPackage, err error)
RecordPackageDeploymentAndWait records the deployment of a package to the cluster and waits for any webhooks to complete.
func (*Cluster) SaveJackalState ¶
func (c *Cluster) SaveJackalState(state *types.JackalState) error
SaveJackalState takes a given state and persists it to the Jackal/jackal-state secret.
func (*Cluster) StartInjectionMadness ¶
StartInjectionMadness initializes a Jackal injection into the cluster.
func (*Cluster) StopInjectionMadness ¶
StopInjectionMadness handles cleanup once the seed registry is up.
func (*Cluster) StripJackalLabelsAndSecretsFromNamespaces ¶
func (c *Cluster) StripJackalLabelsAndSecretsFromNamespaces()
StripJackalLabelsAndSecretsFromNamespaces removes metadata and secrets from existing namespaces no longer manged by Jackal.
func (*Cluster) UpdateJackalManagedGitSecrets ¶
func (c *Cluster) UpdateJackalManagedGitSecrets(state *types.JackalState)
UpdateJackalManagedGitSecrets updates all Jackal-managed git secrets in all namespaces based on state
func (*Cluster) UpdateJackalManagedImageSecrets ¶
func (c *Cluster) UpdateJackalManagedImageSecrets(state *types.JackalState)
UpdateJackalManagedImageSecrets updates all Jackal-managed image secrets in all namespaces based on state
type DockerConfig ¶
type DockerConfig struct {
Auths DockerConfigEntry `json:"auths"`
}
DockerConfig contains the authentication information from the machine's docker config.
type DockerConfigEntry ¶
type DockerConfigEntry map[string]DockerConfigEntryWithAuth
DockerConfigEntry contains a map of DockerConfigEntryWithAuth for a registry.
type DockerConfigEntryWithAuth ¶
type DockerConfigEntryWithAuth struct {
Auth string `json:"auth"`
}
DockerConfigEntryWithAuth contains a docker config authentication string.
type TunnelInfo ¶
type TunnelInfo struct {
// contains filtered or unexported fields
}
TunnelInfo is a struct that contains the necessary info to create a new k8s.Tunnel
func NewTunnelInfo ¶
func NewTunnelInfo(namespace, resourceType, resourceName, urlSuffix string, localPort, remotePort int) TunnelInfo
NewTunnelInfo returns a new TunnelInfo object for connecting to a cluster