infrastructure

package
v1.41.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KubernetesFirewallNamePrefix string = "k8s"
	ShootPrefix                  string = "shoot--"
)

KubernetesFirewallNamePrefix is the name prefix that Kubernetes related firewall rules have.

View Source
const (
	// DefaultVPCName is the default VPC terraform name.
	DefaultVPCName = "google_compute_network.network.name"

	// TerraformerPurpose is the terraformer infrastructure purpose.
	TerraformerPurpose = "infra"

	// TerraformerOutputKeyVPCName is the name of the vpc_name terraform output variable.
	TerraformerOutputKeyVPCName = "vpc_name"
	// TerraformerOutputKeyServiceAccountEmail is the name of the service_account_email terraform output variable.
	TerraformerOutputKeyServiceAccountEmail = "service_account_email"
	// TerraformerOutputKeySubnetNodes is the name of the subnet_nodes terraform output variable.
	TerraformerOutputKeySubnetNodes = "subnet_nodes"
	// TerraformerOutputKeySubnetInternal is the name of the subnet_internal terraform output variable.
	TerraformerOutputKeySubnetInternal = "subnet_internal"
	// TerraformOutputKeyCloudNAT is the name of the cloud_nat terraform output variable.
	TerraformOutputKeyCloudNAT = "cloud_nat"
	// TerraformOutputKeyNATIPs is the name of the nat_ips terraform output variable.
	TerraformOutputKeyNATIPs = "nat_ips"
	// TerraformOutputKeyCloudRouter is the name of the cloud_router terraform output variable.
	TerraformOutputKeyCloudRouter = "cloud_router"
)

Variables

View Source
var StatusTypeMeta = metav1.TypeMeta{
	APIVersion: apiv1alpha1.SchemeGroupVersion.String(),
	Kind:       "InfrastructureStatus",
}

StatusTypeMeta is the TypeMeta of the GCP InfrastructureStatus

Functions

func CleanupKubernetesFirewalls

func CleanupKubernetesFirewalls(ctx context.Context, client gcpclient.ComputeClient, network, shootSeedNamespace string) error

CleanupKubernetesFirewalls lists all Kubernetes firewall rules and then deletes them one after another.

If a deletion fails, this method returns immediately with the encountered error.

func CleanupKubernetesRoutes

func CleanupKubernetesRoutes(ctx context.Context, client gcpclient.ComputeClient, network, shootSeedNamespace string) error

CleanupKubernetesRoutes lists all Kubernetes route rules and then deletes them one after another.

If a deletion fails, this method returns immediately with the encountered error.

func ComputeStatus

ComputeStatus computes the status based on the Terraformer and the given InfrastructureConfig.

func ComputeTerraformerTemplateValues added in v1.17.0

func ComputeTerraformerTemplateValues(
	infra *extensionsv1alpha1.Infrastructure,
	account *gcp.ServiceAccount,
	config *api.InfrastructureConfig,
	podCIDR *string,
	createSA bool,
) (map[string]interface{}, error)

ComputeTerraformerTemplateValues computes the values for the GCP Terraformer chart.

func CreateFirewallListOpts added in v1.39.0

func CreateFirewallListOpts(network, shootSeedNamespace string) gcpclient.FirewallListOpts

CreateFirewallListOpts creates the FirewallListOpts options.

func CreateRoutesListOpts added in v1.39.0

func CreateRoutesListOpts(network, shootSeedNamespace string) gcpclient.RouteListOpts

CreateRoutesListOpts creates the RouteListOpts options.

func DeleteFirewalls

func DeleteFirewalls(ctx context.Context, client gcpclient.ComputeClient, firewalls []*compute.Firewall) error

DeleteFirewalls deletes the firewalls with the given names in the given project.

If a deletion fails, it immediately returns the error of that deletion.

func DeleteRoutes

func DeleteRoutes(ctx context.Context, client gcpclient.ComputeClient, routes []*compute.Route) error

DeleteRoutes deletes the route entries with the given names in the given project.

If a deletion fails, it immediately returns the error of that deletion.

func GetServiceAccountFromInfrastructure

func GetServiceAccountFromInfrastructure(ctx context.Context, c client.Client, config *extensionsv1alpha1.Infrastructure) (*gcp.ServiceAccount, error)

GetServiceAccountFromInfrastructure retrieves the ServiceAccount from the Secret referenced in the given Infrastructure.

func ListKubernetesFirewalls

func ListKubernetesFirewalls(ctx context.Context, client gcpclient.ComputeClient, network, shootSeedNamespace string) ([]*compute.Firewall, error)

ListKubernetesFirewalls lists all firewalls that are in the given network and for the given shoot and have the KubernetesFirewallNamePrefix.

func ListKubernetesRoutes

func ListKubernetesRoutes(ctx context.Context, client gcpclient.ComputeClient, network, shootSeedNamespace string) ([]*compute.Route, error)

ListKubernetesRoutes returns a list of all routes within the shoot network which have the shoot's seed namespace as prefix.

func StatusFromTerraformState

func StatusFromTerraformState(state *TerraformState) *apiv1alpha1.InfrastructureStatus

StatusFromTerraformState computes an InfrastructureStatus from the given Terraform variables.

Types

type TerraformFiles

type TerraformFiles struct {
	Main      string
	Variables string
	TFVars    []byte
}

TerraformFiles are the files that have been rendered from the infrastructure chart.

func RenderTerraformerTemplate added in v1.17.0

func RenderTerraformerTemplate(
	infra *extensionsv1alpha1.Infrastructure,
	account *gcp.ServiceAccount,
	config *api.InfrastructureConfig,
	podCIDR *string,
	createSA bool,
) (*TerraformFiles, error)

RenderTerraformerTemplate renders the gcp-infra chart with the given values.

type TerraformState

type TerraformState struct {
	// VPCName is the name of the VPC created for an infrastructure.
	VPCName string
	// CloudRouterName is the name of the created / existing cloud router
	CloudRouterName string
	// CloudNATName is the name of the created Cloud NAT
	CloudNATName string
	// NatIPs is a list of external ips for the nat gateway
	NatIPs []apiv1alpha1.NatIP
	// ServiceAccountEmail is the service account email for a network.
	ServiceAccountEmail string
	// SubnetNodes is the CIDR of the nodes subnet of an infrastructure.
	SubnetNodes string
	// SubnetInternal is the CIDR of the internal subnet of an infrastructure.
	SubnetInternal *string
}

TerraformState is the Terraform state for an infrastructure.

func ExtractTerraformState

func ExtractTerraformState(
	ctx context.Context,
	tf terraformer.Terraformer,
	config *api.InfrastructureConfig,
	createSA bool,
) (*TerraformState, error)

ExtractTerraformState extracts the TerraformState from the given Terraformer.

Jump to

Keyboard shortcuts

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