k8score

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Overview

Package k8score contains the internal functions used by the k8s cmd to manage the environments

Index

Constants

This section is empty.

Variables

View Source
var EmbeddedManifestContents map[string]string

EmbeddedManifestContents holds embedded manifest files indexed by filename.

View Source
var EnvFile string

Functions

func Clean

func Clean(opts CleanOpts) (*sqlc.K8s, error)

func Delete

func Delete(opts DeleteOpts) error

func Deploy

func Deploy(opts DeployOpts) (*sqlc.K8s, error)

func Export

func Export(opts ExportOpts) error

func ForwardAndRun

func ForwardAndRun(namespace, deployment string, localPort, remotePort int, context string, fn func(host string, port int) error) error

ForwardAndRun spins up kubectl port-forward, runs fn, then cleans up.

func NewEnvDir

func NewEnvDir(customEnvFilePath, customManifestsDirPath, customPath, name, context, protocol, host string) (string, error)

NewEnvDir creates an environment directory with .env and manifest files. Uses custom files if provided, otherwise uses embedded defaults. Expands environment variables in all manifest files.

func Populate

func Populate(opts PopulateOpts) (*sqlc.K8s, error)

func Update

func Update(opts UpdateOpts) (*sqlc.K8s, error)

Update logic: find the old env, if it does not exist give an error if it exists, create a copy of it in a tmp dir if no custom env/manifests provided and not resetting, use the existing files from the tmp dir as defaults if force is set delete the K8s namespace for the original env then remove the contents of the env dir and create the updated env file and K8s manifests using existing or embedded files as appropriate deploy the updated manifests if everything goes right, delete the tmp dir and finish else restore the tmp dir, deploy the old restored env and give an error in output

Types

type CleanOpts

type CleanOpts struct {
	// Required. name of the environment
	Name string
}

func (*CleanOpts) Validate

func (c *CleanOpts) Validate() error

type DeleteOpts

type DeleteOpts struct {
	// Required. name of the environment
	Name []string
}

func (*DeleteOpts) Validate

func (d *DeleteOpts) Validate() error

type DeployOpts

type DeployOpts struct {
	// Optional. path to an env file to use. If not set the default embedded one will be used
	EnvFile string
	// Optional. path to a directory that will contain the custom manifest to use for the deploy
	ManifestDir string
	// Optional. path to a custom directory to store the .env and manifests in
	Path string
	// Required. name of the environment
	Name string
	// Optional. the K8s context to be used. uses current kubeclt default if not set
	Context string
	// Optional. the protocol to use for the deployment. currently supports http and https
	Protocol string
	// Optional. custom ip (or hostname) to use instead of using the generated one
	CustomHost string
	// Optional. use TLS-enabled ingress manifests (ingresses-secure.yaml)
	TLSEnabled bool
}

func (*DeployOpts) Validate

func (d *DeployOpts) Validate() error

type ExportOpts

type ExportOpts struct {
	// Required. Path to export the embedded manifests and .env file
	Path string
}

type PopulateOpts

type PopulateOpts struct {
	// Required. name of the environment
	Name string
	// Required. list of directories or ttl files to populate the environment with
	TTLDirs []string
	// Optional. number of parallel uploads to do to the default is 1
	Parallel int
	// Optional. weather to populate the examples or not
	PopulateExamples bool
}

func (*PopulateOpts) Validate

func (p *PopulateOpts) Validate() error

type UpdateOpts

type UpdateOpts struct {
	// Optional. path to an env file to use. If not set the default embedded one will be used
	EnvFile string
	// Optional. path to a directory that will contain the custom manifest to use for the deploy
	ManifestDir string
	// Required. name of the environment
	Name string
	// Optional. whether to do a docker compose down before updating the environment. Useful to reset the environment's database
	Force bool
	// Optional. custom ip to use instead of localhost if set
	CustomHost string
	// Optional. reset the environment config to the embedded defaults
	Reset bool
}

func (*UpdateOpts) Validate

func (u *UpdateOpts) Validate() error

Jump to

Keyboard shortcuts

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