chart

package
v0.0.0-...-dcb3e6c Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TeamValueKeyRestrictEgress = "restrictEgress,omit"
	TeamValueKeyApiAccess      = "apiAccess,omit"
)
View Source
const TeamValueKeyPYPIAccess = "pypiAccess,omit"

Variables

View Source
var ValidateAirflowImage validator.Func = func(fl validator.FieldLevel) bool {
	image := fl.Field().Interface().(string)

	if image == "" {
		return true
	}

	imageParts := strings.Split(image, ":")
	if len(imageParts) != 2 {
		return false
	}

	return strings.HasPrefix(imageParts[0], "ghcr.io/navikt/") ||
		strings.HasPrefix(imageParts[0], "europe-north1-docker.pkg.dev") ||
		imageParts[0] == "apache/airflow"
}
View Source
var ValidateAirflowRepo validator.Func = func(fl validator.FieldLevel) bool {
	repoName := fl.Field().Interface().(string)

	parts := strings.Split(repoName, "/")
	if len(parts) != 2 {
		return false
	}

	return parts[0] == "navikt"
}
View Source
var ValidateCPUSpec validator.Func = func(fl validator.FieldLevel) bool {
	CPUSpec := fl.Field().Interface().(string)

	r, _ := regexp.Compile(`^(([0-9]+m?)|([0-9]+\.[0-9]+))$`)
	return r.MatchString(CPUSpec)
}
View Source
var ValidateMemorySpec validator.Func = func(fl validator.FieldLevel) bool {
	memorySpec := fl.Field().Interface().(string)

	if _, err := strconv.ParseFloat(memorySpec, 64); err == nil {
		memorySpec = memorySpec + "G"
	}

	r, _ := regexp.Compile(`^(([0-9]+)|([0-9][.][0-9]+))(E|P|T|G|M|K|Ei|Pi|Ti|Gi|Mi|Ki)?$`)
	return r.MatchString(memorySpec)
}
View Source
var ValidateRepoBranch validator.Func = func(fl validator.FieldLevel) bool {
	branch := fl.Field().Interface().(string)
	return !strings.Contains(branch, "/")
}

Functions

This section is empty.

Types

type AirflowConfigurableValues

type AirflowConfigurableValues struct {
	TeamID         string
	DagRepo        string `helm:"dags.gitSync.repo"`
	DagRepoBranch  string `helm:"dags.gitSync.branch"`
	AirflowImage   string `helm:"images.airflow.repository"`
	AirflowTag     string `helm:"images.airflow.tag"`
	RestrictEgress bool
	ApiAccess      bool
}

type AirflowValues

type AirflowValues struct {
	// User-configurable values
	*AirflowConfigurableValues

	// Manually save to database
	FernetKey          string // Knorten sets Helm value pointing to k8s secret
	WebserverSecretKey string // Knorten sets Helm value pointing to k8s secret

	// Generated Helm config
	ExtraEnvs               string `helm:"env"`
	WebserverEnv            string `helm:"webserver.env"`
	WebserverServiceAccount string `helm:"webserver.serviceAccount.name"`
	WorkerServiceAccount    string `helm:"workers.serviceAccount.name"`
	WorkerLabels            string `helm:"workers.labels"`
}

type Client

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

func NewClient

func NewClient(
	repo *database.Repo,
	azureClient *auth.Azure,
	mngr k8s.Manager,
	saBinder gcpapi.ServiceAccountPolicyBinder,
	saChecker gcpapi.ServiceAccountChecker,
	dryRun bool,
	airflowChartVersion, jupyterChartVersion, gcpProject, gcpRegion, topLevelDomain string,
) (*Client, error)

func (Client) DeleteAirflow

func (c Client) DeleteAirflow(ctx context.Context, teamID string) error

func (Client) DeleteJupyter

func (c Client) DeleteJupyter(ctx context.Context, teamID string) error

func (Client) SyncAirflow

func (c Client) SyncAirflow(ctx context.Context, values *AirflowConfigurableValues) error

func (Client) SyncJupyter

func (c Client) SyncJupyter(ctx context.Context, values *JupyterConfigurableValues) error

type JupyterConfigurableValues

type JupyterConfigurableValues struct {
	TeamID     string
	UserIdents []string

	// User-configurable values
	CPULimit      string `helm:"singleuser.cpu.limit"`
	CPURequest    string `helm:"singleuser.cpu.guarantee"`
	MemoryLimit   string `helm:"singleuser.memory.limit"`
	MemoryRequest string `helm:"singleuser.memory.guarantee"`
	ImageName     string `helm:"singleuser.image.name"`
	ImageTag      string `helm:"singleuser.image.tag"`
	CullTimeout   string `helm:"cull.timeout"`
	PYPIAccess    bool
	AllowList     []string
}

Jump to

Keyboard shortcuts

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