Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateRandomStr(length int, useLetters bool, useSpecial bool, useNum bool) string
- func GenerateSimplePassword(length int) string
- func Indent2SpacesToTab(code string) string
- func Indent4SpacesToTab(code string) string
- func IndentSpacesToTab(code string, spacesPerTab int) string
- func IndentTab2Spaces(code string) string
- func IndentTab4Spaces(code string) string
- func IndentTabToSpaces(code string, spacesPerTab int) string
- func MergeStringMaps(maps ...map[string]string) map[string]string
- func NewEnvVarsFromMap(envs map[string]string) []corev1.EnvVar
- func RemoveSpecialCharacter(str string) string
- type Base64
- type Image
- type ImageOption
- type ImageOptions
- type Property
- type ResourceNameGenerator
- type XMLConfiguration
- func (x *XMLConfiguration) AddPropertiesWithMap(properties map[string]string)
- func (x *XMLConfiguration) AddProperty(p Property)
- func (x *XMLConfiguration) AddPropertyWithString(name, value, description string)
- func (x *XMLConfiguration) DeleteProperties(names ...string)
- func (x *XMLConfiguration) GetProperty(name string) (Property, bool)
- func (x *XMLConfiguration) Marshal() (string, error)
Constants ¶
const ( AppKubernetesComponentName = "app.kubernetes.io/component" AppKubernetesInstanceName = "app.kubernetes.io/instance" AppKubernetesNameName = "app.kubernetes.io/name" AppKubernetesManagedByName = "app.kubernetes.io/managed-by" AppKubernetesRoleGroupName = "app.kubernetes.io/role-group" StackDomain = "zncdata.dev" )
const (
XMLStylesheet = `<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>` + "\n"
)
Variables ¶
var ( AppMatchingLabelsNames = []string{ AppKubernetesNameName, AppKubernetesInstanceName, AppKubernetesRoleGroupName, AppKubernetesComponentName, AppKubernetesManagedByName, } )
var DefaultRepository = "qury.io/zncdatadev"
Functions ¶
func GenerateRandomStr ¶
GenerateRandomStr generates a random string of the specified length. The string can contain letters, special characters, and numbers based on the flags provided.
func GenerateSimplePassword ¶ added in v0.8.1
GenerateSimplePassword generates a simple password of the specified length. The password will contain only letters and numbers.
func Indent2SpacesToTab ¶
func Indent4SpacesToTab ¶
func IndentSpacesToTab ¶
IndentSpacesToTab converts leading spaces in a string to tabs, optimized for 2 or 4 spaces per tab.
func IndentTab2Spaces ¶
func IndentTab4Spaces ¶
func IndentTabToSpaces ¶
IndentTabToSpaces converts leading tabs in a string to a specified number of spaces per tab.
func MergeStringMaps ¶ added in v0.8.0
func NewEnvVarsFromMap ¶ added in v0.8.1
func RemoveSpecialCharacter ¶
RemoveSpecialCharacter - remove special character
Types ¶
type Image ¶ added in v0.6.0
type Image struct { Custom string Repository string ProductName string StackVersion string ProductVersion string PullPolicy corev1.PullPolicy PullSecretName string }
Image represents a container image Required fields: - ProductName - StackVersion - ProductVersion
If Custom is set, it will be used as the image tag, so the Custom field must be a valid image tag, eg. "myrepo/myimage:latest"
func NewImage ¶ added in v0.8.0
func NewImage( productName string, stackVersion string, productVersion string, opts ...ImageOption, ) *Image
NewImage creates a new Image object
Example:
image := util.NewImage( "myproduct", "1.0", "1.0.0", ) image := util.NewImage( "myproduct", "1.0", "1.0.0", func (options *util.ImageOptions) { options.Custom = "myrepo/myimage:latest" } )
func (*Image) GetImageTag ¶ added in v0.6.0
type ImageOption ¶ added in v0.8.0
type ImageOption func(*ImageOptions)
type ImageOptions ¶ added in v0.8.0
type ImageOptions struct { Custom string Repository string PullPolicy corev1.PullPolicy PullSecretName string }
type ResourceNameGenerator ¶
func NewResourceNameGenerator ¶
func NewResourceNameGenerator(instanceName, roleName, groupName string) *ResourceNameGenerator
NewResourceNameGenerator new a ResourceNameGenerator
func NewResourceNameGeneratorOneRole ¶
func NewResourceNameGeneratorOneRole(instanceName, groupName string) *ResourceNameGenerator
NewResourceNameGeneratorOneRole new a ResourceNameGenerator without roleName
func (*ResourceNameGenerator) GenerateResourceName ¶
func (r *ResourceNameGenerator) GenerateResourceName(extraSuffix string) string
GenerateResourceName generate resource Name
type XMLConfiguration ¶ added in v0.8.1
type XMLConfiguration struct { Configuration *configuration Header string }
func NewXMLConfiguration ¶ added in v0.8.1
func NewXMLConfiguration() *XMLConfiguration
func NewXMLConfigurationFromMap ¶ added in v0.8.1
func NewXMLConfigurationFromMap(properties map[string]string) *XMLConfiguration
func NewXMLConfigurationFromString ¶ added in v0.8.1
func NewXMLConfigurationFromString(xmlData string) (*XMLConfiguration, error)
func (*XMLConfiguration) AddPropertiesWithMap ¶ added in v0.8.1
func (x *XMLConfiguration) AddPropertiesWithMap(properties map[string]string)
func (*XMLConfiguration) AddProperty ¶ added in v0.8.1
func (x *XMLConfiguration) AddProperty(p Property)
func (*XMLConfiguration) AddPropertyWithString ¶ added in v0.8.1
func (x *XMLConfiguration) AddPropertyWithString(name, value, description string)
func (*XMLConfiguration) DeleteProperties ¶ added in v0.8.1
func (x *XMLConfiguration) DeleteProperties(names ...string)
func (*XMLConfiguration) GetProperty ¶ added in v0.8.1
func (x *XMLConfiguration) GetProperty(name string) (Property, bool)
func (*XMLConfiguration) Marshal ¶ added in v0.8.1
func (x *XMLConfiguration) Marshal() (string, error)