tanzukubernetescluster

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceName = "tanzu-mission-control_tanzu_kubernetes_cluster"

	// Common Keys.
	NameKey     = "name"
	SpecKey     = "spec"
	VersionKey  = "version"
	ReplicasKey = "replicas"
	OSImageKey  = "os_image"
	OSArchKey   = "arch"

	// Root Keys.
	ManagementClusterNameKey = "management_cluster_name"
	ProvisionerNameKey       = "provisioner_name"
	TimeoutPolicyKey         = "timeout_policy"

	// Spec Directive Keys.
	ClusterGroupNameKey = "cluster_group_name"
	TMCManagedKey       = "tmc_managed"
	ProxyNameKey        = "proxy_name"
	ImageRegistryKey    = "image_registry"
	TopologyKey         = "topology"
	KubeConfigKey       = "kubeconfig"

	// Timeout Policy Directive Keys.
	TimeoutKey           = "timeout"
	WaitForKubeConfigKey = "wait_for_kubeconfig"
	FailOnTimeOutKey     = "fail_on_timeout"

	// Topology Directive Keys.
	ClusterClassKey     = "cluster_class"
	ControlPlaneKey     = "control_plane"
	NodePoolKey         = "nodepool"
	ClusterVariablesKey = "cluster_variables"
	NetworkKey          = "network"
	CoreAddonKey        = "core_addon"

	// Node Pool Directive Keys.
	WorkerClassKey   = "worker_class"
	FailureDomainKey = "failure_domain"
	OverridesKey     = "overrides"

	// Network Directive Keys.
	PodCIDRBlocksKey     = "pod_cidr_blocks"
	ServiceCIDRBlocksKey = "service_cidr_blocks"
	ServiceDomainKey     = "service_domain"

	// Core Addon Directive Keys.
	TypeKey     = "type"
	ProviderKey = "provider"

	// Timeout Policy Default Values.
	TimeoutDefaultValue           = 60
	WaitForKubeConfigDefaultValue = true
	FailOnTimeOutDefaultValue     = true
)

Variables

View Source
var ControlPlaneSchema = &schema.Schema{
	Type:        schema.TypeList,
	Description: "Control plane specific configuration.",
	MaxItems:    1,
	Required:    true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			ReplicasKey:    ReplicasSchema,
			OSImageKey:     OSImageSchema,
			common.MetaKey: common.Meta,
		},
	},
}
View Source
var NetworkSchema = &schema.Schema{
	Type:        schema.TypeList,
	Description: "Network specific configuration.",
	MaxItems:    1,
	Optional:    true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			PodCIDRBlocksKey: {
				Type:        schema.TypeList,
				Description: "Pod CIDR for Kubernetes pods defaults to 192.168.0.0/16.",
				Optional:    true,
				Elem: &schema.Schema{
					Type: schema.TypeString,
				},
			},
			ServiceCIDRBlocksKey: {
				Type:        schema.TypeList,
				Description: "Service CIDR for kubernetes services defaults to 10.96.0.0/12.",
				Optional:    true,
				Elem: &schema.Schema{
					Type: schema.TypeString,
				},
			},
			ServiceDomainKey: {
				Type:        schema.TypeString,
				Description: "Domain name for services.",
				Optional:    true,
			},
		},
	},
}
View Source
var NodePoolSchema = &schema.Schema{
	Type:        schema.TypeList,
	Description: "(Repeatable Block) Node pool definition for the cluster.",
	MinItems:    1,
	Required:    true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			NameKey: {
				Type:        schema.TypeString,
				Description: "Name of the node pool.",
				Required:    true,
			},
			common.DescriptionKey: {
				Type:        schema.TypeString,
				Description: "Description of the node pool.",
				Optional:    true,
			},
			SpecKey: NodePoolSpecSchema,
		},
	},
}
View Source
var NodePoolSpecSchema = &schema.Schema{
	Type:        schema.TypeList,
	Description: "Spec for the node pool.",
	MinItems:    1,
	Required:    true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			WorkerClassKey: {
				Type:        schema.TypeString,
				Description: "The name of the machine deployment class used to create the node pool.",
				Required:    true,
			},
			FailureDomainKey: {
				Type:        schema.TypeString,
				Description: "The failure domain the machines will be created in.",
				Optional:    true,
			},
			OverridesKey: {
				Type:                  schema.TypeString,
				Description:           "Overrides can be used to override cluster level variables.",
				Optional:              true,
				ValidateDiagFunc:      validateJSONString,
				DiffSuppressOnRefresh: true,
				DiffSuppressFunc:      isVariablesValuesEqual,
			},
			ReplicasKey: ReplicasSchema,
			OSImageKey:  OSImageSchema,
			common.MetaKey: {
				Type:        schema.TypeList,
				Description: "Metadata for the resource",
				Computed:    true,
				Optional:    true,
				MaxItems:    1,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						common.AnnotationsKey: {
							Type:        schema.TypeMap,
							Description: "Annotations for the resource",
							Optional:    true,
							Computed:    true,
							Elem:        &schema.Schema{Type: schema.TypeString},
						},
						common.LabelsKey: {
							Type:        schema.TypeMap,
							Description: "Labels for the resource",
							Optional:    true,
							Elem:        &schema.Schema{Type: schema.TypeString},
						},
					},
				},
			},
		},
	},
}
View Source
var OSImageSchema = &schema.Schema{
	Type:        schema.TypeList,
	Description: "OS image block",
	MaxItems:    1,
	Optional:    true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			NameKey: {
				Type:        schema.TypeString,
				Description: "The name of the OS image.",
				Required:    true,
			},
			VersionKey: {
				Type:        schema.TypeString,
				Description: "The version of the OS image.",
				Required:    true,
			},
			OSArchKey: {
				Type:        schema.TypeString,
				Description: "The architecture of the OS image.",
				Required:    true,
			},
		},
	},
}
View Source
var ReplicasSchema = &schema.Schema{
	Type:        schema.TypeInt,
	Description: "Number of replicas",
	Required:    true,
}
View Source
var TopologySchema = &schema.Schema{
	Type:        schema.TypeList,
	Description: "The cluster topology.",
	Required:    true,
	MaxItems:    1,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			VersionKey: {
				Type:        schema.TypeString,
				Description: "Kubernetes version of the cluster.",
				Required:    true,
			},
			ClusterClassKey: {
				Type:        schema.TypeString,
				Description: "The name of the cluster class for the cluster.",
				Optional:    true,
				Computed:    true,
			},
			ClusterVariablesKey: {
				Type:                  schema.TypeString,
				Description:           "Variables configuration for the cluster.",
				Required:              true,
				ValidateDiagFunc:      validateJSONString,
				DiffSuppressOnRefresh: true,
				DiffSuppressFunc:      isVariablesValuesEqual,
			},
			CoreAddonKey: {
				Type:        schema.TypeList,
				Description: "(Repeatable Block) The core addons.",
				Optional:    true,
				Elem: &schema.Resource{
					Schema: map[string]*schema.Schema{
						TypeKey: {
							Type:        schema.TypeString,
							Description: "Type of core add on",
							Required:    true,
						},
						ProviderKey: {
							Type:        schema.TypeString,
							Description: "Provider of core add on",
							Required:    true,
						},
					},
				},
			},
			NetworkKey:      NetworkSchema,
			ControlPlaneKey: ControlPlaneSchema,
			NodePoolKey:     NodePoolSchema,
		},
	},
}

Functions

func ResourceTanzuKubernetesCluster

func ResourceTanzuKubernetesCluster() *schema.Resource

Types

type ClusterClassModifierFunc

type ClusterClassModifierFunc func(tfVariable interface{}, modelVariable interface{}) interface{}

type ClusterClassValidator

type ClusterClassValidator struct {
	WorkerClasses      []string
	OpenAPIV3Validator *openapiv3.OpenAPIV3SchemaValidator
}

func (*ClusterClassValidator) ValidateClusterVariables

func (validator *ClusterClassValidator) ValidateClusterVariables(clusterVariables string, checkRequired bool) (errs []error)

func (*ClusterClassValidator) ValidateNodePools

func (validator *ClusterClassValidator) ValidateNodePools(nodePools []interface{}) (errs []error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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