infrastructure

package
v0.0.0-...-2faeebd Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2019 License: Apache-2.0, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

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"
)
View Source
const (
	KubernetesFirewallNamePrefix string = "k8s"
)

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

Variables

View Source
var (
	// StatusTypeMeta is the TypeMeta of the GCP InfrastructureStatus
	StatusTypeMeta = metav1.TypeMeta{
		APIVersion: gcpv1alpha1.SchemeGroupVersion.String(),
		Kind:       "InfrastructureStatus",
	}
)

Functions

func CleanupKubernetesFirewalls

func CleanupKubernetesFirewalls(ctx context.Context, client gcpclient.Interface, projectID, 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.Interface, projectID, 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 ComputeTerraformerChartValues

func ComputeTerraformerChartValues(
	infra *extensionsv1alpha1.Infrastructure,
	account *internal.ServiceAccount,
	config *gcpv1alpha1.InfrastructureConfig,
	cluster *controller.Cluster,
) map[string]interface{}

ComputeTerraformerChartValues computes the values for the GCP Terraformer chart.

func DeleteFirewalls

func DeleteFirewalls(ctx context.Context, client gcpclient.Interface, projectID string, firewalls []string) 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.Interface, projectID string, routes []string) 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) (*internal.ServiceAccount, error)

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

func ListKubernetesFirewalls

func ListKubernetesFirewalls(ctx context.Context, client gcpclient.Interface, projectID, network, shootSeedNamespace string) ([]string, 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.Interface, projectID, network, shootSeedNamespace string) ([]string, 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) *gcpv1alpha1.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 RenderTerraformerChart

RenderTerraformerChart 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
	// 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(tf *terraformer.Terraformer, config *gcpv1alpha1.InfrastructureConfig) (*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