Documentation
¶
Overview ¶
Package v1alpha1 contains API Schema definitions for the auth v1alpha1 API group +kubebuilder:object:generate=true +groupName=auth.alex123012.com
Index ¶
- Variables
- type Config
- func (in *Config) DeepCopy() *Config
- func (in *Config) DeepCopyInto(out *Config)
- func (in *Config) DeepCopyObject() runtime.Object
- func (r *Config) Default()
- func (r *Config) SetupWebhookWithManager(mgr ctrl.Manager) error
- func (r *Config) ValidateCreate() error
- func (r *Config) ValidateDelete() error
- func (r *Config) ValidateUpdate(old runtime.Object) error
- type ConfigList
- type ConfigSpec
- type ConfigStatus
- type DatabaseConfig
- type DatabaseType
- type PostgreSQLConfig
- type Privilege
- type PrivilegeType
- type SSLSecrets
- type Secret
- type User
- func (in *User) DeepCopy() *User
- func (in *User) DeepCopyInto(out *User)
- func (in *User) DeepCopyObject() runtime.Object
- func (r *User) Default()
- func (r *User) SetDbConfigs(dbConfigs []DatabaseConfig) *User
- func (r *User) SetPasswordSecret(name, namespace string) *User
- func (r *User) SetPrivileges(privileges []Privilege) *User
- func (r *User) SetupWebhookWithManager(mgr ctrl.Manager) error
- func (r *User) ValidateCreate() error
- func (r *User) ValidateDelete() error
- func (r *User) ValidateUpdate(old runtime.Object) error
- 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: "auth.alex123012.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 )
var (
AllTablesSchemaRegex = regexp.MustCompile(string(ALLTABLESSCHEMA))
)
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec ConfigSpec `json:"spec,omitempty"` Status ConfigStatus `json:"status,omitempty"` }
Config is the Schema for the configs API
func (*Config) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Config.
func (*Config) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*Config) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*Config) Default ¶
func (r *Config) Default()
Default implements webhook.Defaulter so a webhook will be registered for the type
func (*Config) SetupWebhookWithManager ¶
func (*Config) ValidateCreate ¶
ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (*Config) ValidateDelete ¶
ValidateDelete implements webhook.Validator so a webhook will be registered for the type
type ConfigList ¶
type ConfigList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []Config `json:"items"` }
ConfigList contains a list of Config
func (*ConfigList) DeepCopy ¶
func (in *ConfigList) DeepCopy() *ConfigList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigList.
func (*ConfigList) DeepCopyInto ¶
func (in *ConfigList) DeepCopyInto(out *ConfigList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ConfigList) DeepCopyObject ¶
func (in *ConfigList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type ConfigSpec ¶
type ConfigSpec struct { // Type of database to connect, required DatabaseType DatabaseType `json:"databaseType"` // Config for connecting for PostgreSQL compatible databases, not required. // required if DatabaseType equals to "PostgreSQL" PostgreSQL PostgreSQLConfig `json:"postgreSQL,omitempty"` }
ConfigSpec defines the desired state of Config
func (*ConfigSpec) DeepCopy ¶
func (in *ConfigSpec) DeepCopy() *ConfigSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigSpec.
func (*ConfigSpec) DeepCopyInto ¶
func (in *ConfigSpec) DeepCopyInto(out *ConfigSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ConfigStatus ¶
type ConfigStatus struct { }
ConfigStatus defines the observed state of Config
func (*ConfigStatus) DeepCopy ¶
func (in *ConfigStatus) DeepCopy() *ConfigStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigStatus.
func (*ConfigStatus) DeepCopyInto ¶
func (in *ConfigStatus) DeepCopyInto(out *ConfigStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type DatabaseConfig ¶
type DatabaseConfig struct { // Name of Config resource Name string `json:"name"` // Namespace of config resource Namespace string `json:"namespace"` }
Utility struct for Config CR specification
func (*DatabaseConfig) DeepCopy ¶
func (in *DatabaseConfig) DeepCopy() *DatabaseConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DatabaseConfig.
func (*DatabaseConfig) DeepCopyInto ¶
func (in *DatabaseConfig) DeepCopyInto(out *DatabaseConfig)
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"
)
type PostgreSQLConfig ¶
type PostgreSQLConfig 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://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"` // 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 database.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"` // SSL CA certificate, user certificate and user key K8S secrets. // 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. SSLCredentials SSLSecrets `json:"sslSecrets,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. PasswordSecret Secret `json:"passwordSecret,omitempty"` }
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 Privilege ¶
type Privilege struct { // Privilege is role name or PrivilegeType Privilege PrivilegeType `json:"privilege" postgres:"privilege_type"` // if used PrivilegeType from PrivilegeTypeTable in Privilege field // specify object to give Privilege to in database On string `json:"on,omitempty" postgres:"table_name"` // If Privilege is database specific - this field will be used to determine which db to use // (used PrivilegeType from PrivilegeTypeDatabase or PrivilegeTypeTable) Database string `json:"database,omitempty" postgres:"table_catalog"` }
func (*Privilege) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Privilege.
func (*Privilege) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PrivilegeType ¶
type PrivilegeType string
const ( SELECT PrivilegeType = "SELECT" INSERT PrivilegeType = "INSERT" UPDATE PrivilegeType = "UPDATE" DELETE PrivilegeType = "DELETE" TRUNCATE PrivilegeType = "TRUNCATE" REFERENCES PrivilegeType = "REFERENCES" TRIGGER PrivilegeType = "TRIGGER" CREATE PrivilegeType = "CREATE" CONNECT PrivilegeType = "CONNECT" TEMPORARY PrivilegeType = "TEMPORARY" TEMP PrivilegeType = "TEMP" EXECUTE PrivilegeType = "EXECUTE" USAGE PrivilegeType = "USAGE" SET PrivilegeType = "SET" ALTERSYSTEM PrivilegeType = "ALTER SYSTEM" ALLPRIVILEGES PrivilegeType = "ALL PRIVILEGES" ALL PrivilegeType = "ALL" ALLTABLESSCHEMA PrivilegeType = "ALL TABLES IN SCHEMA.*" )
func (PrivilegeType) IsAllPrivilegeType ¶
func (p PrivilegeType) IsAllPrivilegeType() bool
func (PrivilegeType) IsAllTableSchemaPrivilegeType ¶
func (p PrivilegeType) IsAllTableSchemaPrivilegeType() bool
func (PrivilegeType) IsDatabasePrivilegeType ¶
func (p PrivilegeType) IsDatabasePrivilegeType() bool
func (PrivilegeType) IsEmpty ¶
func (p PrivilegeType) IsEmpty() bool
func (PrivilegeType) IsTablePrivilegeType ¶
func (p PrivilegeType) IsTablePrivilegeType() bool
type SSLSecrets ¶
type SSLSecrets struct { // for CA certificate - secrets data key must be "ca.crt" UserSecret Secret `json:"userSecret"` // for user certificate - secrets data key must be "tls.crt" // for user key - secrets data key must be "tls.key" CASecret Secret `json:"caSecret"` }
SSLSecrets is credentials for connecting to DB with SSL certificates
func (*SSLSecrets) DeepCopy ¶
func (in *SSLSecrets) DeepCopy() *SSLSecrets
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SSLSecrets.
func (*SSLSecrets) DeepCopyInto ¶
func (in *SSLSecrets) DeepCopyInto(out *SSLSecrets)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Secret ¶
type Secret struct { // Kubernetes secret name, required Name string `json:"name"` // Kubernetes secret namespace, required Namespace string `json:"namespace"` }
Utility struct for kubernetes secret specification
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 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.
func (*User) Default ¶
func (r *User) Default()
Default implements webhook.Defaulter so a webhook will be registered for the type
func (*User) SetDbConfigs ¶
func (r *User) SetDbConfigs(dbConfigs []DatabaseConfig) *User
func (*User) SetPasswordSecret ¶
func (*User) SetPrivileges ¶
func (*User) SetupWebhookWithManager ¶
func (*User) ValidateCreate ¶
ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (*User) ValidateDelete ¶
ValidateDelete implements webhook.Validator so a webhook will be registered for the type
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 { // K8S secret with key "password" for user password to assign, not required PasswordSecret Secret `json:"passwordSecret,omitempty"` // List of Configs that will be used to create users DatabaseConfigs []DatabaseConfig `json:"databaseConfigs"` // List of database privileges that will be applied to user. // If user already exists in database - all it privileges will be // synchronized with this list (all privileges that are not defined in the lis will be revoked). Privileges []Privilege `json:"privileges"` }
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 { }
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.