Documentation ¶
Overview ¶
Example ¶
a, err := api.NewAPI(api.WithClientOptions(client.AuthFromEnv(false))) if err != nil { log.Fatalf("failed to initialize API client: %s", err) } cluster := Cluster{Name: "example", NeedsServiceVMs: pointer.Bool(true)} if err := a.Create(context.TODO(), &cluster); err != nil { log.Fatalf("failed to create cluster: %s", err) } if err := gs.AwaitCompletion(context.TODO(), a, &cluster); err != nil { log.Fatalf("failed to await cluster creation: %s", err) } // define node pool with a single replica, 2 GiB of system memory and 20 GiB of disk space nodePool := NodePool{Name: "example-np-00", Cluster: cluster, Replicas: pointer.Int(1), Memory: 2 * 1073741824, DiskSize: 20 * 1073741824} if err := a.Create(context.TODO(), &nodePool); err != nil { log.Fatalf("failed to create nodepool: %s", err) } if err := gs.AwaitCompletion(context.TODO(), a, &nodePool); err != nil { log.Fatalf("failed to await nodepool creation: %s", err) }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrManagedPrefixSet = errors.New("managed prefixes cannot be set on create")
ErrManagedPrefixSet is returned if a prefix is both set to managed and also set to an existing prefix on create
Functions ¶
func GetKubeConfig ¶
GetKubeConfig retrieves the kubeconfig
func RemoveKubeConfig ¶
RemoveKubeConfig triggers the "Remove kubeconfig" automation rule
Types ¶
type Cluster ¶
type Cluster struct { gs.GenericService gs.HasState // Identifier of the cluster Identifier string `json:"identifier,omitempty" anxcloud:"identifier"` // Name of the cluster. Must be an RFC 1123 hostname in lowercase Name string `json:"name,omitempty"` // Kubernetes version to be used for the cluster. We recommend to use the default value. Version string `json:"version,omitempty"` // Location where the cluster will be deployed Location corev1.Location `json:"location,omitempty"` // If set to true, Service VMs providing load balancers and outbound masquerade are created for this cluster. // Default: true. Optional value can be set via pkg/utils/pointer.Bool NeedsServiceVMs *bool `json:"needs_service_vms,omitempty"` // If enabled, Service VMs are configured as NAT gateways connecting the internal cluster network to the internet. // Requires Service VMs. EnableNATGateways *bool `json:"enable_nat_gateways,omitempty"` // If enabled, Service VMs are set up as LBaaS hosts enabling K8s services of type LoadBalancer. // Requires Service VMs. EnableLBaaS *bool `json:"enable_lbaas,omitempty"` // Identifier of an internal v4 prefix (to be) assigned to the cluster. If ManageInternalIPv4Prefix // is set to false, the Prefix given in this field is used when creating the cluster, otherwise a new // prefix will be created automatically. The API will always return the Prefix for the Cluster, // when ManageInternalIPv4Prefix is true, this will be the Prefix that was created automatically. InternalIPv4Prefix *common.PartialResource `json:"internal_ipv4_prefix,omitempty"` // Identifier of an external v4 prefix (to be) assigned to the cluster. If ManageExternalIPv4Prefix // is set to false, the Prefix given in this field is used when creating the cluster, otherwise a new // prefix will be created automatically. The API will always return the Prefix for the Cluster, // when ManageExternalIPv4Prefix is true, this will be the Prefix that was created automatically. ExternalIPv4Prefix *common.PartialResource `json:"external_ipv4_prefix,omitempty"` // Identifier of an external v6 prefix (to be) assigned to the cluster. If ManageExternalIPv6Prefix // is set to false, the Prefix given in this field is used when creating the cluster, otherwise a new // prefix will be created automatically. The API will always return the Prefix for the Cluster, // when ManageExternalIPv6Prefix is true, this will be the Prefix that was created automatically. ExternalIPv6Prefix *common.PartialResource `json:"external_ipv6_prefix,omitempty"` // If set to true an internal v4 prefix is automatically created for the cluster. Defaults to true if not set. ManageInternalIPv4Prefix *bool `json:"manage_internal_ipv4_prefix,omitempty"` // If set to true an external v4 prefix is automatically created for the cluster. Defaults to true if not set. ManageExternalIPv4Prefix *bool `json:"manage_external_ipv4_prefix,omitempty"` // If set to true an external v6 prefix is automatically created for the cluster. Defaults to true if not set. ManageExternalIPv6Prefix *bool `json:"manage_external_ipv6_prefix,omitempty"` // Contains a kubeconfig if available KubeConfig *string `json:"kubeconfig,omitempty"` // Enable autoscaling for this cluster. You will need to explicitly configure // your node pools for autoscaling, please refer to the provided [Autoscaling documentation] // for details. Defaults to false if unset. // // [Autoscaling documentation]: https://engine.anexia-it.com/docs/en/module/kubernetes/user-guide/autoscaling EnableAutoscaling *bool `json:"autoscaling,omitempty"` // Container Network Interface plugin to be installed on the cluster. // Only the default value is supported. Default: canal = Canal CniPlugin string `json:"cni_plugin,omitempty"` // Space-separated list of IP networks in CIDR notation, which are allowed to access the cluster's API server. // If left empty, there will be no IP address-based restrictions. ApiServerAllowlist string `json:"apiserver_allowlist,omitempty"` // IP families to use for external networking. // Addresses from the selected protocols will be allocated for the cluster's Service VMs and load balancing, // if those are enabled. One of: IPv4 = IPv4, DualStack = IPv4 & IPv6. Default: DualStack ExternalIPFamilies string `json:"external_ip_families,omitempty"` }
Cluster represents a Kubernetes cluster This resource does not support updates
func (*Cluster) EndpointURL ¶
EndpointURL returns the common URL for operations on Cluster resource
func (*Cluster) FilterAPIRequestBody ¶
FilterAPIRequestBody adds the CommonRequestBody
type NodePool ¶
type NodePool struct { gs.GenericService gs.HasState // Identifier of the node pool Identifier string `json:"identifier,omitempty" anxcloud:"identifier"` // Name of the node pool. Must be an RFC 1123 hostname in lowercase Name string `json:"name,omitempty"` // Cluster in which the node pool is deployed Cluster Cluster `json:"cluster,omitempty" anxcloud:"filterable"` // Number of replicas. Can be changed via machine controller. // Default: 3 (see FAQ for more details) Optional value can be set via pkg/utils/pointer.Int Replicas *int `json:"replicas,omitempty"` // Number of computation cores for each node. The provided cores will be "performance" type CPUs. Must be at least 1 and no more than 16 CPUs int `json:"cpus,omitempty"` // RAM size for each node in bytes. Must be a multiple of 1 GiB, at least 2 GiB and no more than 64 GiB Memory int `json:"memory,omitempty"` // Size of the disk for each node in bytes. Its performance type will be the default Anexia Engine provides for the given location. // Must be a multiple of 1 GiB, at least 20 GiB and no more than 1600 GiB DiskSize int `json:"disk_size,omitempty"` // Operating system for deployment on the nodes. Default: Flatcar Linux OperatingSystem OperatingSystem `json:"operating_system,omitempty"` }
NodePool represents a Kubernetes node pool This resource does not support updates
func (*NodePool) EndpointURL ¶
EndpointURL returns the common URL for operations on NodePool resource
func (*NodePool) FilterAPIRequestBody ¶
FilterAPIRequestBody adds the CommonRequestBody and unwraps the identifiers of related Objects
type OperatingSystem ¶
type OperatingSystem string
OperatingSystem is a typed string for available OS templates
const ( // FlatcarLinux is currently the only available OS template available for Kubernetes Node Pools FlatcarLinux OperatingSystem = "Flatcar Linux" )