Skip to content

k8_apps.core #

Constants #

const max_deployment_retries = 30

Common constants for deployment verification

const deployment_check_interval_seconds = 2

fn destroy_namespace #

fn destroy_namespace(mut k8s kubernetes.KubeClient, namespace string) !

Destroy namespace with proper error handling

fn get_master_node_ips #

fn get_master_node_ips(mut k8s kubernetes.KubeClient) ![]string

Get Kubernetes master node IPs (IPv6) Extracts IPv6 internal IPs from all k8s nodes for backend configuration

fn get_tfgw_fqdn #

fn get_tfgw_fqdn(args GetTfgwFqdnArgs) !string

Get the FQDN from TFGW status after it's generated Returns the actual FQDN (e.g., "myapp.gent02.grid.tf")

fn k8app #

fn k8app(args_ K8AppArgs) !K8App

get a k8 app instance as to be used in installers

fn kubectl_installed #

fn kubectl_installed(mut k8s kubernetes.KubeClient) !

Check if kubectl is installed and configured

fn name_fix #

fn name_fix(s string) string

//TODO: get installer kubectl, and check if installed if not do }

fn validate_hostname #

fn validate_hostname(hostname string) string

Validate and truncate hostname to meet TFGW 36-character limit TFGW gateway names cannot exceed 36 characters We reserve 4 characters for potential suffixes added by templates (e.g., "sb" for sandbox)

fn verify_deployment_ready #

fn verify_deployment_ready(args VerifyDeploymentArgs) !bool

Verify deployment is ready with retry logic

fn verify_pod_ready #

fn verify_pod_ready(args VerifyPodArgs) !

Verify pod is ready with retry logic Checks if a pod exists and is in Running phase

fn verify_tfgw_deployment #

fn verify_tfgw_deployment(args VerifyTfgwArgs) !

Verify TFGW deployment FQDN generation Checks if TFGW custom resource has generated an FQDN with retry logic

struct GetTfgwFqdnArgs #

@[params]
struct GetTfgwFqdnArgs {
pub mut:
	tfgw_name string                @[required]
	namespace string                @[required]
	k8s       kubernetes.KubeClient @[required]
	retry     int = max_deployment_retries
}

Parameters for getting TFGW FQDN

struct K8App #

struct K8App {
pub mut:
	kube_client  kubernetes.KubeClient @[skip]
	namespace    string
	hostname     string
	app_name     string
	app_instance string
}

struct K8AppArgs #

@[params]
struct K8AppArgs {
pub mut:
	namespace    string = 'default' // namespace where deployed
	app_instance string @[required]
	app_name     string @[required] // e.g. cryptpad, nextcloud, etc
}

struct VerifyDeploymentArgs #

@[params]
struct VerifyDeploymentArgs {
pub mut:
	deployment_name string                @[required] // name of the deployment to check
	namespace       string                @[required] // namespace where deployment is located
	k8s             kubernetes.KubeClient @[required]
	retry           int = max_deployment_retries
}

Parameters for verifying deployment readiness

struct VerifyPodArgs #

@[params]
struct VerifyPodArgs {
pub mut:
	pod_name  string                @[required] // name of the pod to check
	namespace string                @[required] // namespace where pod is located
	k8s       kubernetes.KubeClient @[required]
	retry     int = max_deployment_retries
}

Parameters for verifying pod readiness

struct VerifyTfgwArgs #

@[params]
struct VerifyTfgwArgs {
pub mut:
	tfgw_name string                @[required] // tfgw service generating the FQDN
	namespace string                @[required] // namespace name for deployments/services
	k8s       kubernetes.KubeClient @[required]
	retry     int = max_deployment_retries
}

Parameters for verifying TFGW deployment