Documentation
¶
Index ¶
- Constants
- Variables
- type TemplateDataSources
- func (tds *TemplateDataSources) ConfigMap(entry string) (string, error)
- func (tds *TemplateDataSources) Database() (string, error)
- func (tds *TemplateDataSources) Hostname() (string, error)
- func (tds *TemplateDataSources) Password() (string, error)
- func (tds *TemplateDataSources) Port() (int32, error)
- func (tds *TemplateDataSources) Protocol() (string, error)
- func (tds *TemplateDataSources) Query(query string) (string, error)
- func (tds *TemplateDataSources) Render(templates v1beta1.Templates) error
- func (tds *TemplateDataSources) Secret(entry string) (string, error)
- func (tds *TemplateDataSources) Username() (string, error)
Constants ¶
View Source
const ( DEFAULT_TEMPLATE_VALUE = "{{ .Protocol }}://{{ .Username }}:{{ .Password }}@{{ .Hostname }}:{{ .Port }}/{{ .Database }}" DEFAULT_TEMPLATE_NAME = "CONNECTION_STRING" TEMPLATE_ANNOTATION_KEY = "kinda.rocks/db-operator-templated-keys" )
Variables ¶
View Source
var DEFAULT_TEMPLATES []*v1beta1.Template = []*v1beta1.Template{ { Name: DEFAULT_TEMPLATE_NAME, Template: DEFAULT_TEMPLATE_VALUE, Secret: true, }, }
Functions ¶
This section is empty.
Types ¶
type TemplateDataSources ¶
type TemplateDataSources struct { DatabaseK8sObj *v1beta1.Database SecretK8sObj *corev1.Secret ConfigMapK8sObj *corev1.ConfigMap DatabaseObj database.Database DatabaseUser *database.DatabaseUser }
TemplateDataSource should be only the database resource
func NewTemplateDataSource ¶
func NewTemplateDataSource( databaseK8s *v1beta1.Database, secretK8s *corev1.Secret, configmapK8s *corev1.ConfigMap, db database.Database, databaseUser *database.DatabaseUser, ) (*TemplateDataSources, error)
NewTemplateDataSource is used to init the struct that should handle the templating of secrets and other key-values that can be later used by applications. If DbUser (second argument) is provided, the templater will be working with a secret that belongs to a dbuser
func (*TemplateDataSources) ConfigMap ¶
func (tds *TemplateDataSources) ConfigMap(entry string) (string, error)
Get the data from the Database ConfigMap
func (*TemplateDataSources) Database ¶
func (tds *TemplateDataSources) Database() (string, error)
func (*TemplateDataSources) Hostname ¶
func (tds *TemplateDataSources) Hostname() (string, error)
Hostname
func (*TemplateDataSources) Password ¶
func (tds *TemplateDataSources) Password() (string, error)
Password return the main user password, if dbuser is nil, otherwise it returns a password of a DbUser
func (*TemplateDataSources) Protocol ¶
func (tds *TemplateDataSources) Protocol() (string, error)
func (*TemplateDataSources) Query ¶
func (tds *TemplateDataSources) Query(query string) (string, error)
Get the data directly from the database
func (*TemplateDataSources) Render ¶
func (tds *TemplateDataSources) Render(templates v1beta1.Templates) error
func (*TemplateDataSources) Secret ¶
func (tds *TemplateDataSources) Secret(entry string) (string, error)
Get the data from the Database Secret
func (*TemplateDataSources) Username ¶
func (tds *TemplateDataSources) Username() (string, error)
Username return the main user username, if dbuser is nil, otherwise it returns a name of a DbUser
Click to show internal directories.
Click to hide internal directories.