v1alpha2

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package v1alpha2 contains managed resources for GCP database services such as CloudSQL. +kubebuilder:object:generate=true +groupName=database.gcp.crossplane.io +versionName=v1alpha2

Index

Constants

View Source
const (
	MysqlDBVersionPrefix = "MYSQL"
	MysqlDefaultUser     = "root"

	PostgresqlDBVersionPrefix = "POSTGRES"
	PostgresqlDefaultUser     = "postgres"

	PasswordLength   = 20
	DefaultStorageGB = 10

	PrivateIPType = "PRIVATE"
	PublicIPType  = "PRIMARY"

	PrivateIPKey = "privateIP"
	PublicIPKey  = "publicIP"
)

CloudSQL version prefixes.

View Source
const (
	Group   = "database.gcp.crossplane.io"
	Version = "v1alpha2"
)

Package type metadata.

View Source
const (
	// StateRunnable represents a CloudSQL instance in a running, available, and ready state
	StateRunnable = "RUNNABLE"
)

CloudSQL instance states

Variables

View Source
var (
	// SchemeGroupVersion is group version used to register these objects
	SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
)
View Source
var (
	CloudsqlInstanceKind             = reflect.TypeOf(CloudsqlInstance{}).Name()
	CloudsqlInstanceKindAPIVersion   = CloudsqlInstanceKind + "." + SchemeGroupVersion.String()
	CloudsqlInstanceGroupVersionKind = SchemeGroupVersion.WithKind(CloudsqlInstanceKind)
)

CloudsqlInstance type metadata.

View Source
var (
	CloudsqlInstanceClassKind             = reflect.TypeOf(CloudsqlInstanceClass{}).Name()
	CloudsqlInstanceClassKindAPIVersion   = CloudsqlInstanceClassKind + "." + SchemeGroupVersion.String()
	CloudsqlInstanceClassGroupVersionKind = SchemeGroupVersion.WithKind(CloudsqlInstanceClassKind)
)

CloudsqlInstanceClass type metadata.

Functions

This section is empty.

Types

type CloudsqlInstance

type CloudsqlInstance struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   CloudsqlInstanceSpec   `json:"spec,omitempty"`
	Status CloudsqlInstanceStatus `json:"status,omitempty"`
}

A CloudsqlInstance is a managed resource that represents a Google CloudSQL instance. +kubebuilder:subresource:status +kubebuilder:printcolumn:name="STATUS",type="string",JSONPath=".status.bindingPhase" +kubebuilder:printcolumn:name="STATE",type="string",JSONPath=".status.state" +kubebuilder:printcolumn:name="CLASS",type="string",JSONPath=".spec.classRef.name" +kubebuilder:printcolumn:name="VERSION",type="string",JSONPath=".spec.databaseVersion" +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"

func (*CloudsqlInstance) ConnectionSecret

func (i *CloudsqlInstance) ConnectionSecret() *corev1.Secret

ConnectionSecret returns a connection secret for this instance

func (*CloudsqlInstance) DatabaseInstance

func (i *CloudsqlInstance) DatabaseInstance(name string) *sqladmin.DatabaseInstance

DatabaseInstance representing spec of this instance

func (*CloudsqlInstance) DatabaseUserName

func (i *CloudsqlInstance) DatabaseUserName() string

DatabaseUserName returns default database user name base on database version

func (*CloudsqlInstance) DeepCopy

func (in *CloudsqlInstance) DeepCopy() *CloudsqlInstance

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudsqlInstance.

func (*CloudsqlInstance) DeepCopyInto

func (in *CloudsqlInstance) DeepCopyInto(out *CloudsqlInstance)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CloudsqlInstance) DeepCopyObject

func (in *CloudsqlInstance) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*CloudsqlInstance) GetBindingPhase

func (i *CloudsqlInstance) GetBindingPhase() runtimev1alpha1.BindingPhase

GetBindingPhase of this CloudsqlInstance.

func (*CloudsqlInstance) GetClaimReference

func (i *CloudsqlInstance) GetClaimReference() *corev1.ObjectReference

GetClaimReference of this CloudsqlInstance.

func (*CloudsqlInstance) GetNonPortableClassReference

func (i *CloudsqlInstance) GetNonPortableClassReference() *corev1.ObjectReference

GetNonPortableClassReference of this CloudsqlInstance.

func (*CloudsqlInstance) GetProviderReference

func (i *CloudsqlInstance) GetProviderReference() *corev1.ObjectReference

GetProviderReference of this CloudsqlInstance

func (*CloudsqlInstance) GetReclaimPolicy

func (i *CloudsqlInstance) GetReclaimPolicy() runtimev1alpha1.ReclaimPolicy

GetReclaimPolicy of this CloudsqlInstance.

func (*CloudsqlInstance) GetResourceName

func (i *CloudsqlInstance) GetResourceName() string

GetResourceName based on the NameFormat spec value, If name format is not provided, resource name defaults to {{kind}}-UID If name format provided with '%s' value, resource name will result in formatted string + UID,

NOTE: only single %s substitution is supported

If name format does not contain '%s' substitution, i.e. a constant string, the constant string value is returned back

Examples:

For all examples assume "UID" = "test-uid",
and assume that "{{kind}}" = "mykind"
1. NameFormat = "", ResourceName = "mykind-test-uid"
2. NameFormat = "%s", ResourceName = "test-uid"
3. NameFormat = "foo", ResourceName = "foo"
4. NameFormat = "foo-%s", ResourceName = "foo-test-uid"
5. NameFormat = "foo-%s-bar-%s", ResourceName = "foo-test-uid-bar-%!s(MISSING)"

Note that CloudSQL instance names must begin with a letter, per: https://cloud.google.com/sql/docs/mysql/instance-settings

func (*CloudsqlInstance) GetWriteConnectionSecretToReference

func (i *CloudsqlInstance) GetWriteConnectionSecretToReference() corev1.LocalObjectReference

GetWriteConnectionSecretToReference of this CloudsqlInstance.

func (*CloudsqlInstance) IsRunnable

func (i *CloudsqlInstance) IsRunnable() bool

IsRunnable returns true if instance is in Runnable state

func (*CloudsqlInstance) SetBindingPhase

func (i *CloudsqlInstance) SetBindingPhase(p runtimev1alpha1.BindingPhase)

SetBindingPhase of this CloudsqlInstance.

func (*CloudsqlInstance) SetClaimReference

func (i *CloudsqlInstance) SetClaimReference(r *corev1.ObjectReference)

SetClaimReference of this CloudsqlInstance.

func (*CloudsqlInstance) SetConditions

func (i *CloudsqlInstance) SetConditions(c ...runtimev1alpha1.Condition)

SetConditions of this CloudsqlInstance.

func (*CloudsqlInstance) SetNonPortableClassReference

func (i *CloudsqlInstance) SetNonPortableClassReference(r *corev1.ObjectReference)

SetNonPortableClassReference of this CloudsqlInstance.

func (*CloudsqlInstance) SetReclaimPolicy

func (i *CloudsqlInstance) SetReclaimPolicy(p runtimev1alpha1.ReclaimPolicy)

SetReclaimPolicy of this CloudsqlInstance.

func (*CloudsqlInstance) SetStatus

func (i *CloudsqlInstance) SetStatus(inst *sqladmin.DatabaseInstance)

SetStatus and Available condition, and other fields base on the provided database instance

func (*CloudsqlInstance) SetWriteConnectionSecretToReference

func (i *CloudsqlInstance) SetWriteConnectionSecretToReference(r corev1.LocalObjectReference)

SetWriteConnectionSecretToReference of this CloudsqlInstance.

type CloudsqlInstanceClass

type CloudsqlInstanceClass struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// SpecTemplate is a template for the spec of a dynamically provisioned
	// CloudsqlInstance.
	SpecTemplate CloudsqlInstanceClassSpecTemplate `json:"specTemplate"`
}

A CloudsqlInstanceClass is a non-portable resource class. It defines the desired spec of resource claims that use it to dynamically provision a managed resource. +kubebuilder:printcolumn:name="PROVIDER-REF",type="string",JSONPath=".specTemplate.providerRef.name" +kubebuilder:printcolumn:name="RECLAIM-POLICY",type="string",JSONPath=".specTemplate.reclaimPolicy" +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"

func (*CloudsqlInstanceClass) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudsqlInstanceClass.

func (*CloudsqlInstanceClass) DeepCopyInto

func (in *CloudsqlInstanceClass) DeepCopyInto(out *CloudsqlInstanceClass)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CloudsqlInstanceClass) DeepCopyObject

func (in *CloudsqlInstanceClass) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*CloudsqlInstanceClass) GetReclaimPolicy

func (i *CloudsqlInstanceClass) GetReclaimPolicy() runtimev1alpha1.ReclaimPolicy

GetReclaimPolicy of this CloudsqlInstanceClass.

func (*CloudsqlInstanceClass) SetReclaimPolicy

func (i *CloudsqlInstanceClass) SetReclaimPolicy(p runtimev1alpha1.ReclaimPolicy)

SetReclaimPolicy of this CloudsqlInstanceClass.

type CloudsqlInstanceClassList

type CloudsqlInstanceClassList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []CloudsqlInstanceClass `json:"items"`
}

CloudsqlInstanceClassList contains a list of cloud memorystore resource classes.

func (*CloudsqlInstanceClassList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudsqlInstanceClassList.

func (*CloudsqlInstanceClassList) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CloudsqlInstanceClassList) DeepCopyObject

func (in *CloudsqlInstanceClassList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type CloudsqlInstanceClassSpecTemplate

type CloudsqlInstanceClassSpecTemplate struct {
	runtimev1alpha1.NonPortableClassSpecTemplate `json:",inline"`
	CloudsqlInstanceParameters                   `json:",inline"`
}

A CloudsqlInstanceClassSpecTemplate is a template for the spec of a dynamically provisioned CloudsqlInstance.

func (*CloudsqlInstanceClassSpecTemplate) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudsqlInstanceClassSpecTemplate.

func (*CloudsqlInstanceClassSpecTemplate) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CloudsqlInstanceList

type CloudsqlInstanceList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []CloudsqlInstance `json:"items"`
}

CloudsqlInstanceList contains a list of CloudsqlInstance

func (*CloudsqlInstanceList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudsqlInstanceList.

func (*CloudsqlInstanceList) DeepCopyInto

func (in *CloudsqlInstanceList) DeepCopyInto(out *CloudsqlInstanceList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CloudsqlInstanceList) DeepCopyObject

func (in *CloudsqlInstanceList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type CloudsqlInstanceParameters

type CloudsqlInstanceParameters struct {
	// AuthorizedNetworks is the list of external networks that are allowed to
	// connect to the instance using the IP. In CIDR notation, also known as
	// 'slash' notation (e.g. 192.168.100.0/24).
	// +optional
	AuthorizedNetworks []string `json:"authorizedNetworks,omitempty"`

	// PrivateNetwork is the resource link for the VPC network from which the
	// Cloud SQL instance is accessible for private IP. For example,
	// /projects/myProject/global/networks/default. This setting can be
	// updated, but it cannot be removed after it is set.
	// +optional
	PrivateNetwork string `json:"privateNetwork,omitempty"`

	// Ipv4Enabled specifies whether the instance should be assigned an IP
	// address or not.
	// +optional
	Ipv4Enabled bool `json:"ipv4Enabled,omitempty"`

	// DatabaseVersion specifies he database engine type and version. MySQL
	// Second Generation instances use MYSQL_5_7 (default) or MYSQL_5_6.
	// MySQL First Generation instances use MYSQL_5_6 (default) or MYSQL_5_5
	// PostgreSQL instances uses POSTGRES_9_6 (default) or POSTGRES_11.
	DatabaseVersion string `json:"databaseVersion"`

	// Labels to apply to this CloudSQL instance.
	// +optional
	Labels map[string]string `json:"labels,omitempty"`

	// Region specifies the geographical region of this CloudSQL instance.
	Region string `json:"region"`

	// StorageType specifies the type of the data disk, either PD_SSD or PD_HDD.
	StorageType string `json:"storageType"`

	// StorageGB specifies the size of the data disk. The minimum is 10GB.
	StorageGB int64 `json:"storageGB"`

	// Tier (or machine type) for this instance, for example db-n1-standard-1
	// (MySQL instances) or db-custom-1-3840 (PostgreSQL instances). For MySQL
	// instances, this property determines whether the instance is First or
	// Second Generation. For more information, see
	// https://cloud.google.com/sql/docs/mysql/instance-settings
	Tier string `json:"tier"`

	// NameFormat specifies the name of the extenral CloudSQL instance. The
	// first instance of the string '%s' will be replaced with the Kubernetes
	// UID of this CloudsqlInstance.
	NameFormat string `json:"nameFormat,omitempty"`
}

CloudsqlInstanceParameters define the desired state of a Google CloudSQL instance.

func (*CloudsqlInstanceParameters) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudsqlInstanceParameters.

func (*CloudsqlInstanceParameters) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CloudsqlInstanceSpec

type CloudsqlInstanceSpec struct {
	runtimev1alpha1.ResourceSpec `json:",inline"`
	CloudsqlInstanceParameters   `json:",inline"`
}

A CloudsqlInstanceSpec defines the desired state of a CloudsqlInstance.

func (*CloudsqlInstanceSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudsqlInstanceSpec.

func (*CloudsqlInstanceSpec) DeepCopyInto

func (in *CloudsqlInstanceSpec) DeepCopyInto(out *CloudsqlInstanceSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CloudsqlInstanceStatus

type CloudsqlInstanceStatus struct {
	runtimev1alpha1.ResourceStatus `json:",inline"`

	// State of this CloudsqlInstance.
	State string `json:"state,omitempty"`

	// PublicIP is used to connect to this resource from other authorized
	// networks.
	PublicIP string `json:"publicIp,omitempty"`

	// PrivateIP is used to connect to this instance from the same Network.
	PrivateIP string `json:"privateIp,omitempty"`
}

A CloudsqlInstanceStatus represents the observed state of a CloudsqlInstance.

func (*CloudsqlInstanceStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CloudsqlInstanceStatus.

func (*CloudsqlInstanceStatus) DeepCopyInto

func (in *CloudsqlInstanceStatus) DeepCopyInto(out *CloudsqlInstanceStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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