Documentation
¶
Overview ¶
Package v1alpha1 contains API Schema definitions for the v1alpha1 API group +kubebuilder:object:generate=true +kubebuilder:validation:Required +groupName=databaseusersoperator.com
+kubebuilder:validation:Required
Index ¶
- Variables
- type Database
- type DatabaseList
- type DatabaseRef
- type DatabaseSpec
- type DatabaseType
- type MySQLConfig
- type Name
- type NamespacedName
- type PostgreSQLConfig
- type PostgresSSLMode
- type PrivilegeSpec
- type PrivilegeType
- type Privileges
- type PrivilegesList
- type Secret
- type StatusSummary
- type User
- type UserList
- type UserSpec
- type UserStatus
Constants ¶
This section is empty.
Variables ¶
var ( // GroupVersion is group version used to register these objects. GroupVersion = schema.GroupVersion{Group: "databaseusersoperator.com", Version: "v1alpha1"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme. SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme )
Functions ¶
This section is empty.
Types ¶
type Database ¶ added in v0.1.0
type Database struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec DatabaseSpec `json:"spec,omitempty"`
}
Database is the Schema for the databases API.
func (*Database) DeepCopy ¶ added in v0.1.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Database.
func (*Database) DeepCopyInto ¶ added in v0.1.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Database) DeepCopyObject ¶ added in v0.1.0
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type DatabaseList ¶ added in v0.1.0
type DatabaseList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Database `json:"items"`
}
DatabaseList contains a list of Database.
func (*DatabaseList) DeepCopy ¶ added in v0.1.0
func (in *DatabaseList) DeepCopy() *DatabaseList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseList.
func (*DatabaseList) DeepCopyInto ¶ added in v0.1.0
func (in *DatabaseList) DeepCopyInto(out *DatabaseList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*DatabaseList) DeepCopyObject ¶ added in v0.1.0
func (in *DatabaseList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type DatabaseRef ¶ added in v0.1.0
type DatabaseRef struct {
// The name of the Database CR to create user in, required.
Name string `json:"name"`
// Reference to secret with password for user in the database, not required.
PasswordSecret Secret `json:"passwordSecret,omitempty"`
// If operator would create data for user (for example for postgres with sslMode=="verify-full"),
// it is reference to non-existed Secret, that will be created during user creation in the database, not required.
CreatedSecret NamespacedName `json:"createdSecret,omitempty"`
// List of references to Privileges CR, that will be applied to created user in the database, required.
Privileges []Name `json:"privileges"`
}
func (*DatabaseRef) DeepCopy ¶ added in v0.1.0
func (in *DatabaseRef) DeepCopy() *DatabaseRef
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseRef.
func (*DatabaseRef) DeepCopyInto ¶ added in v0.1.0
func (in *DatabaseRef) DeepCopyInto(out *DatabaseRef)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type DatabaseSpec ¶ added in v0.1.0
type DatabaseSpec struct {
// Type of database to connect (Currently it is PostgreSQL and MySQL), required
Type DatabaseType `json:"databaseType"`
// Config for connecting for PostgreSQL compatible databases, not required.
// required if DatabaseType equals to "PostgreSQL".
PostgreSQL *PostgreSQLConfig `json:"postgreSQL,omitempty"`
// Config for connecting for MySQL compatible databases, not required.
// required if DatabaseType equals to "MySQL".
MySQL *MySQLConfig `json:"mySQL,omitempty"`
}
+kubebuilder:validation:XValidation:rule="(self.databaseType == \"PostgreSQL\" && has(self.postgreSQL) && !has(self.mySQL)) || (self.databaseType == \"MySQL\" && has(self.mySQL) && !has(self.postgreSQL))",message="When .spec.databaseType is PostgreSQL use .spec.postgreSQL, When .spec.databaseType is MySQL use .spec.mySQL" DatabaseSpec defines the desired state of Database.
func (*DatabaseSpec) DeepCopy ¶ added in v0.1.0
func (in *DatabaseSpec) DeepCopy() *DatabaseSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseSpec.
func (*DatabaseSpec) DeepCopyInto ¶ added in v0.1.0
func (in *DatabaseSpec) DeepCopyInto(out *DatabaseSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type DatabaseType ¶
type DatabaseType string
Database types that are currently supported.
const ( PostgreSQL DatabaseType = "PostgreSQL" MySQL DatabaseType = "MySQL" )
type MySQLConfig ¶ added in v0.1.0
type MySQLConfig struct {
// Full DNS name/ip for database to use, required.
// If K8S service is used to connect - provide host
// as <db-service-name>.<db-service-namespace>.svc.cluster.local
// refer to --host flag in https://dev.mysql.com/doc/refman/8.0/en/connection-options.html
Host string `json:"host"`
// k8s-service/database port to connect to execute queries, defaults to 3306.
// refer to --port flag in https://dev.mysql.com/doc/refman/8.0/en/connection-options.html
Port int `json:"port"`
// Database name that will be used to connect to database, not required.
// see https://dev.mysql.com/doc/refman/8.0/en/connecting.html.
DatabaseName string `json:"databaseName,omitempty"`
// The MySQL user account to provide for the authentication process, defaults to "mysql".
// It must have at least CREATE ROLE privilege (if you won't provide superuser acess to users)
// or database superuser role if you think you'll be needed to give some users database superuser privileges
// refer to --user flag in https://dev.mysql.com/doc/refman/8.0/en/connection-options.html
// and https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html#privileges-provided-guidelines "Privilege-Granting Guidelines"
User string `json:"user"`
// Secret with password for User to connect to database
// refer to --password flag in https://dev.mysql.com/doc/refman/8.0/en/connection-options.html
PasswordSecret Secret `json:"passwordSecret,omitempty"`
// The hostname from which created users will connect
// By default "*" will be used (So users would be "<user>@*")
UsersHostname string `json:"usersHostname"`
}
func (*MySQLConfig) DeepCopy ¶ added in v0.1.0
func (in *MySQLConfig) DeepCopy() *MySQLConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MySQLConfig.
func (*MySQLConfig) DeepCopyInto ¶ added in v0.1.0
func (in *MySQLConfig) DeepCopyInto(out *MySQLConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Name ¶ added in v0.1.0
type Name struct {
// resource name
Name string `json:"name"`
}
func (*Name) DeepCopy ¶ added in v0.1.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Name.
func (*Name) DeepCopyInto ¶ added in v0.1.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (Name) ToNamespacedName ¶ added in v0.1.0
func (n Name) ToNamespacedName() types.NamespacedName
type NamespacedName ¶ added in v0.1.0
type NamespacedName struct {
// resource namespace
Namespace string `json:"namespace"`
// resource name
Name string `json:"name"`
}
func (*NamespacedName) DeepCopy ¶ added in v0.1.0
func (in *NamespacedName) DeepCopy() *NamespacedName
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespacedName.
func (*NamespacedName) DeepCopyInto ¶ added in v0.1.0
func (in *NamespacedName) DeepCopyInto(out *NamespacedName)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (NamespacedName) ToNamespacedName ¶ added in v0.1.0
func (n NamespacedName) ToNamespacedName() types.NamespacedName
type PostgreSQLConfig ¶
type PostgreSQLConfig struct {
// Full DNS name/ip for database to use, required.
// If K8S service is used to connect - provide full dns name
// as <db-service-name>.<db-service-namespace>.svc.cluster.local
// refer to --host flag in https://www.postgresql.org/docs/current/app-psql.html
Host string `json:"host"`
// k8s-service/database port to connect to execute queries, defaults to 5432.
// refer to --port flag in https://www.postgresql.org/docs/current/app-psql.html
Port int `json:"port"`
// User that will be used to connect to database, defaults to "postgres".
// It must have at least CREATEROLE privilege (if you won't provide superuser acess to users)
// or database superuser role if you think you'll be needed to give some users database superuser privileges
// refer to --username flag in https://www.postgresql.org/docs/current/app-psql.html
// and https://www.postgresql.org/docs/current/sql-grant.html "GRANT on Roles"
User string `json:"user"`
// +kubebuilder:validation:XValidation:rule="self in [\"disable\", \"allow\", \"prefer\", \"require\", \"verify-ca\", \"verify-full\"]",message="Set valid .spec.postgreSQL.sslMode"
// +kubebuilder:default=disable
// SSL mode that will be used to connect to PostgreSQL, defaults to "disable".
// Posssible values: "disable", "allow", "prefer", "require", "verify-ca", "verify-full".
// If SSL mode is "require", "verify-ca", "verify-full" - operator will generate K8S secret with
// SSL bundle (CA certificate, user certificate and user key) for User CR with same name as User CR.
// see https://www.postgresql.org/docs/current/libpq-ssl.html
SSLMode PostgresSSLMode `json:"sslMode"`
// Database name that will be used to connect to database, not required
// refer to --dbname flag in https://www.postgresql.org/docs/current/app-psql.html
DatabaseName string `json:"databaseName,omitempty"`
// Secret with SSL CA certificate ("ca.crt" key), user certificate ("tls.crt" key) and user key ("tls.key" key).
// If SSL Mode equals to "disable", "allow" or "prefer" field is not required.
// If SSL Mode equals to "require", "verify-ca" or "verify-full" - required.
// see https://www.postgresql.org/docs/current/libpq-ssl.html
SSLCredentialsSecret NamespacedName `json:"sslSecret,omitempty"`
// Secret with CA key for creating users certificates
// If SSL Mode equals to "disable", "allow" or "prefer" field is not required.
// If SSL Mode equals to "require", "verify-ca" or "verify-full" - required.
// see https://www.postgresql.org/docs/current/libpq-ssl.html
SSLCAKey Secret `json:"sslCaKey,omitempty"`
// Secret with password for User to connect to database
// If SSL Mode equals to "disable", "allow" or "prefer" field is required.
// If SSL Mode equals to "require", "verify-ca" or "verify-full" - not required.
// refer to --password flag in https://www.postgresql.org/docs/current/app-psql.html
PasswordSecret Secret `json:"passwordSecret,omitempty"`
}
+kubebuilder:validation:XValidation:rule="(self.sslMode in [\"disable\", \"allow\", \"prefer\"] && has(self.passwordSecret)) || (self.sslMode in [\"require\", \"verify-ca\", \"verify-full\"] && has(self.sslSecret) && has(self.sslCaKey))",message="When using .spec.postgreSQL.sslMode \"disable\", \"allow\" or \"prefer\" - set .spec.postgreSQL.passwordSecret" PostgreSQLConfig is config that will be used by operator to connect to PostgreSQL compatible databases.
func (*PostgreSQLConfig) DeepCopy ¶
func (in *PostgreSQLConfig) DeepCopy() *PostgreSQLConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgreSQLConfig.
func (*PostgreSQLConfig) DeepCopyInto ¶
func (in *PostgreSQLConfig) DeepCopyInto(out *PostgreSQLConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PostgresSSLMode ¶ added in v0.1.0
type PostgresSSLMode string
const ( SSLModeDISABLE PostgresSSLMode = "disable" SSLModeALLOW PostgresSSLMode = "allow" SSLModePREFER PostgresSSLMode = "prefer" SSLModeREQUIRE PostgresSSLMode = "require" SSLModeVERIFYCA PostgresSSLMode = "verify-ca" SSLModeVERIFYFULL PostgresSSLMode = "verify-full" )
type PrivilegeSpec ¶ added in v0.1.0
type PrivilegeSpec struct {
// Privilege is role name or PrivilegeType, required.
Privilege PrivilegeType `json:"privilege"`
// In database object to give privileges to, not required.
On string `json:"on,omitempty"`
// If Privilege is database specific - this field will be used to determine which db to use, not required.
Database string `json:"database,omitempty"`
}
PrivilegesSpec defines the desired state of Privileges.
func (*PrivilegeSpec) DeepCopy ¶ added in v0.1.0
func (in *PrivilegeSpec) DeepCopy() *PrivilegeSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrivilegeSpec.
func (*PrivilegeSpec) DeepCopyInto ¶ added in v0.1.0
func (in *PrivilegeSpec) DeepCopyInto(out *PrivilegeSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PrivilegeType ¶
type PrivilegeType string
type Privileges ¶ added in v0.1.0
type Privileges struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// List of privileges, required.
Privileges []PrivilegeSpec `json:"privileges,omitempty"`
}
Privileges is the Schema for the privileges API.
func (*Privileges) DeepCopy ¶ added in v0.1.0
func (in *Privileges) DeepCopy() *Privileges
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Privileges.
func (*Privileges) DeepCopyInto ¶ added in v0.1.0
func (in *Privileges) DeepCopyInto(out *Privileges)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Privileges) DeepCopyObject ¶ added in v0.1.0
func (in *Privileges) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type PrivilegesList ¶ added in v0.1.0
type PrivilegesList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Privileges `json:"items"`
}
PrivilegesList contains a list of Privileges.
func (*PrivilegesList) DeepCopy ¶ added in v0.1.0
func (in *PrivilegesList) DeepCopy() *PrivilegesList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrivilegesList.
func (*PrivilegesList) DeepCopyInto ¶ added in v0.1.0
func (in *PrivilegesList) DeepCopyInto(out *PrivilegesList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*PrivilegesList) DeepCopyObject ¶ added in v0.1.0
func (in *PrivilegesList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type Secret ¶
type Secret struct {
// Secret is secret name and namespace
Secret NamespacedName `json:"secret"`
// Kubernetes secret key with data
Key string `json:"key"`
}
Secret is a reference for kubernetes secret.
func (*Secret) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Secret.
func (*Secret) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type StatusSummary ¶ added in v0.1.0
func (*StatusSummary) DeepCopy ¶ added in v0.1.0
func (in *StatusSummary) DeepCopy() *StatusSummary
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatusSummary.
func (*StatusSummary) DeepCopyInto ¶ added in v0.1.0
func (in *StatusSummary) DeepCopyInto(out *StatusSummary)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type User ¶
type User struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec UserSpec `json:"spec,omitempty"`
Status UserStatus `json:"status,omitempty"`
}
User is the Schema for the users API.
func (*User) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new User.
func (*User) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*User) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type UserList ¶
type UserList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []User `json:"items"`
}
UserList contains a list of User.
func (*UserList) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserList.
func (*UserList) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*UserList) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type UserSpec ¶
type UserSpec struct {
// List of databases, where user needs to be created with configs for it.
Databases []DatabaseRef `json:"databases"`
}
UserSpec defines the desired state of User.
func (*UserSpec) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserSpec.
func (*UserSpec) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type UserStatus ¶
type UserStatus struct {
Summary StatusSummary `json:"summary,omitempty"`
}
UserStatus defines the observed state of User.
func (*UserStatus) DeepCopy ¶
func (in *UserStatus) DeepCopy() *UserStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserStatus.
func (*UserStatus) DeepCopyInto ¶
func (in *UserStatus) DeepCopyInto(out *UserStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.