Documentation ¶
Index ¶
- Constants
- func AssignIP(assignIPDetails AssignIPDetails) (net.IPNet, []ospdirectorv1beta1.IPReservation, error)
- func BigIntToIP(inipint big.Int) net.IP
- func CreateOrGetCustomConfigMap(r ReconcilerCommon, configMap *corev1.ConfigMap) (string, error)
- func CreateOrGetHostname(hostStore HostnameStore, host *Hostname) error
- func CreateOrUpdatePvc(r ReconcilerCommon, obj metav1.Object, pv *Pvc) (*corev1.PersistentVolumeClaim, controllerutil.OperationResult, error)
- func CreateOrUpdateSecret(r ReconcilerCommon, obj metav1.Object, secret *corev1.Secret) (string, controllerutil.OperationResult, error)
- func DeleteJob(job *batchv1.Job, kclient kubernetes.Interface, log logr.Logger) (bool, error)
- func DeletePodsWithLabel(r ReconcilerCommon, obj metav1.Object, labelSelectorMap map[string]string) error
- func DeleteReplicasetsWithLabel(r ReconcilerCommon, obj metav1.Object, labelSelectorMap map[string]string) error
- func DeleteSecretsWithLabel(r ReconcilerCommon, obj metav1.Object, labelSelectorMap map[string]string) error
- func DeleteSecretsWithName(r ReconcilerCommon, cond *ospdirectorv1beta1.Condition, name string, ...) error
- func DeleteServicesWithLabel(r ReconcilerCommon, obj metav1.Object, labelSelectorMap map[string]string) error
- func EncodePrivateKeyToPEM(privateKey *rsa.PrivateKey) string
- func EnsureConfigMaps(r ReconcilerCommon, obj metav1.Object, cms []Template, ...) error
- func EnsureSecrets(r ReconcilerCommon, obj metav1.Object, sts []Template, ...) error
- func ExecuteTemplate(templateFile string, data interface{}) string
- func ExecuteTemplateData(templateData string, data interface{}) string
- func ExecuteTemplateFile(filename string, data interface{}) string
- func GeneratePasswords() map[string]interface{}
- func GeneratePrivateKey(bitSize int) (*rsa.PrivateKey, error)
- func GeneratePublicKey(privatekey *rsa.PublicKey) (string, error)
- func GetAllNetworkAttachmentDefinitions(r ReconcilerCommon, obj metav1.Object) (map[string]networkv1.NetworkAttachmentDefinition, error)
- func GetAllPodsWithLabel(r ReconcilerCommon, labelSelectorMap map[string]string, namespace string) (*corev1.PodList, error)
- func GetAllTemplates(path string, kind string, templateType string, version string) []string
- func GetBmhHosts(r ReconcilerCommon, namespace string, labelSelector map[string]string) (*metal3v1alpha1.BareMetalHostList, error)
- func GetCidrParts(cidr string) (string, int, error)
- func GetConfigMap(r ReconcilerCommon, object client.Object, cond *ospdirectorv1beta1.Condition, ...) (*corev1.ConfigMap, ctrl.Result, error)
- func GetConfigMapAndHashWithName(r ReconcilerCommon, configMapName string, namespace string) (*corev1.ConfigMap, string, error)
- func GetConfigMaps(r ReconcilerCommon, obj runtime.Object, configMaps []string, namespace string, ...) ([]ospdirectorv1beta1.Hash, error)
- func GetControlPlane(r ReconcilerCommon, obj metav1.Object) (ospdirectorv1beta1.OpenStackControlPlane, reconcile.Result, error)
- func GetCustomFencingRoles(customBinaryData map[string][]byte) ([]string, error)
- func GetDataFromSecret(r ReconcilerCommon, object client.Object, cond *ospdirectorv1beta1.Condition, ...) (string, ctrl.Result, error)
- func GetDeletionAnnotatedBmhHosts(r ReconcilerCommon, namespace string, labelSelector map[string]string) ([]string, error)
- func GetFencingRoles() []string
- func GetIPRange(ip net.IP, ipnet net.IPNet) (net.IP, net.IP, error)
- func GetLabels(obj metav1.Object, controller string, custom map[string]string) map[string]string
- func GetOr(m map[string]interface{}, key, fallback string) interface{}
- func GetSecret(r ReconcilerCommon, secretName string, secretNamespace string) (*corev1.Secret, string, error)
- func GetSecrets(r ReconcilerCommon, secretNamespace string, labelSelectorMap map[string]string) (*corev1.SecretList, error)
- func GetServicesListWithLabel(r ReconcilerCommon, namespace string, labelSelectorMap map[string]string) (*corev1.ServiceList, error)
- func GetTemplateData(t Template) map[string]string
- func GetTemplatesPath() string
- func GetVirtualMachineInstances(r ReconcilerCommon, namespace string, labelSelectorMap map[string]string) (*virtv1.VirtualMachineInstanceList, error)
- func GetVirtualMachines(r ReconcilerCommon, namespace string, labelSelectorMap map[string]string) (*virtv1.VirtualMachineList, error)
- func IPToBigInt(IPv6Addr net.IP) *big.Int
- func InitMap(m *map[string]string)
- func IsIPv4(ip net.IP) bool
- func IsIPv6(ip net.IP) bool
- func IsJSON(s string) error
- func IsSet(m map[string]interface{}, key string) interface{}
- func IterateForAssignment(assignIPDetails AssignIPDetails) (net.IP, []ospdirectorv1beta1.IPReservation, error)
- func LogErrorForObject(r ReconcilerCommon, err error, msg string, object metav1.Object, ...)
- func LogForObject(r ReconcilerCommon, msg string, object metav1.Object, params ...interface{})
- func MergeEnvs(envs []corev1.EnvVar, newEnvs EnvSetterMap) []corev1.EnvVar
- func MergeMaps(baseMap map[string]interface{}, extraMaps ...map[string]interface{}) map[string]interface{}
- func MergeStringMaps(baseMap map[string]string, extraMaps ...map[string]string) map[string]string
- func ObjectHash(i interface{}) (string, error)
- func OpenStackBackupOverridesReconcile(client client.Client, instance InstanceCommon) (bool, error)
- func RemoveIndex(s []string, index int) []string
- func SSHKeySecret(name string, namespace string, labels map[string]string) (*corev1.Secret, error)
- func StringInSlice(a string, list []string) bool
- func WaitOnJob(job *batchv1.Job, client client.Client, log logr.Logger) (bool, error)
- func WrapErrorForObject(msg string, object client.Object, err error) error
- type AssignIPDetails
- type AssignmentError
- type EnvSetter
- type EnvSetterMap
- type Hostname
- type HostnameStore
- type InstanceCommon
- type List
- type Pair
- type Pvc
- type ReconcilerCommon
- type TType
- type Template
Constants ¶
const ( // OwnerLabel - OwnerLabel = "osp-director" // GroupLabel - GroupLabel = OwnerLabel + ".openstack.org" // OwnerUIDLabelSelector - OwnerUIDLabelSelector = GroupLabel + "/uid" // OwnerNameSpaceLabelSelector - OwnerNameSpaceLabelSelector = GroupLabel + "/namespace" // OwnerNameLabelSelector - OwnerNameLabelSelector = GroupLabel + "/name" // OwnerControllerNameLabelSelector - OwnerControllerNameLabelSelector = GroupLabel + "/controller" // OSPHostnameLabelSelector - Tripleo Hostname OSPHostnameLabelSelector = GroupLabel + "/osphostname" // HostRemovalAnnotation - Annotation key placed on VM or BMH resources to target them for scale-down HostRemovalAnnotation = GroupLabel + "/delete-host" // MustGatherSecret - Label placed on secrets that are safe to collect with must-gater MustGatherSecret = GroupLabel + "/must-gather-secret" // FinalizerName - FinalizerName = GroupLabel // ServiceAccountAnnotationName - ServiceAccountAnnotationName = "kubernetes.io/service-account.name" // TripleOServicesDefaultKeyName - TripleOServicesDefaultKeyName = "ServicesDefault" // TripleOPacemakerServiceName - TripleOPacemakerServiceName = "OS::TripleO::Services::Pacemaker" // TripleORolesDataFile - TripleORolesDataFile = "roles_data.yaml" )
const ( // BITSIZE - BITSIZE int = 4096 )
Variables ¶
This section is empty.
Functions ¶
func AssignIP ¶
func AssignIP(assignIPDetails AssignIPDetails) (net.IPNet, []ospdirectorv1beta1.IPReservation, error)
AssignIP assigns an IP using a range and a reserve list.
func CreateOrGetCustomConfigMap ¶
func CreateOrGetCustomConfigMap(r ReconcilerCommon, configMap *corev1.ConfigMap) (string, error)
CreateOrGetCustomConfigMap -
func CreateOrGetHostname ¶
func CreateOrGetHostname( hostStore HostnameStore, host *Hostname, ) error
CreateOrGetHostname -
func CreateOrUpdatePvc ¶
func CreateOrUpdatePvc(r ReconcilerCommon, obj metav1.Object, pv *Pvc) (*corev1.PersistentVolumeClaim, controllerutil.OperationResult, error)
CreateOrUpdatePvc -
func CreateOrUpdateSecret ¶
func CreateOrUpdateSecret(r ReconcilerCommon, obj metav1.Object, secret *corev1.Secret) (string, controllerutil.OperationResult, error)
CreateOrUpdateSecret -
func DeleteJob ¶
DeleteJob func kclient required to properly cleanup the job depending pods with DeleteOptions
func DeletePodsWithLabel ¶
func DeletePodsWithLabel(r ReconcilerCommon, obj metav1.Object, labelSelectorMap map[string]string) error
DeletePodsWithLabel - Delete all pods in namespace of the obj matching label selector
func DeleteReplicasetsWithLabel ¶
func DeleteReplicasetsWithLabel(r ReconcilerCommon, obj metav1.Object, labelSelectorMap map[string]string) error
DeleteReplicasetsWithLabel - Delete all replicasets in namespace of the obj matching label selector
func DeleteSecretsWithLabel ¶
func DeleteSecretsWithLabel(r ReconcilerCommon, obj metav1.Object, labelSelectorMap map[string]string) error
DeleteSecretsWithLabel - Delete all secrets in namespace of the obj matching label selector
func DeleteSecretsWithName ¶ added in v1.2.0
func DeleteSecretsWithName( r ReconcilerCommon, cond *ospdirectorv1beta1.Condition, name string, namespace string, ) error
DeleteSecretsWithName - Delete names secret object in namespace
func DeleteServicesWithLabel ¶
func DeleteServicesWithLabel(r ReconcilerCommon, obj metav1.Object, labelSelectorMap map[string]string) error
DeleteServicesWithLabel - Delete all services in namespace of the obj matching label selector
func EncodePrivateKeyToPEM ¶
func EncodePrivateKeyToPEM(privateKey *rsa.PrivateKey) string
EncodePrivateKeyToPEM encodes Private Key from RSA to PEM format
func EnsureConfigMaps ¶
func EnsureConfigMaps(r ReconcilerCommon, obj metav1.Object, cms []Template, envVars *map[string]EnvSetter) error
EnsureConfigMaps - get all configmaps required, verify they exist and add the hash to env and status
func EnsureSecrets ¶
func EnsureSecrets(r ReconcilerCommon, obj metav1.Object, sts []Template, envVars *map[string]EnvSetter) error
EnsureSecrets - get all secrets required, verify they exist and add the hash to env and status
func ExecuteTemplate ¶
ExecuteTemplate creates a template from the file and execute it with the specified data
func ExecuteTemplateData ¶
ExecuteTemplateData creates a template from string and execute it with the specified data
func ExecuteTemplateFile ¶
ExecuteTemplateFile creates a template from the file and execute it with the specified data Note: mschuppert - can be removed when all operators switched
to the above ones.
func GeneratePasswords ¶
func GeneratePasswords() map[string]interface{}
GeneratePasswords creates the passwords for a tripleo deployment
func GeneratePrivateKey ¶
func GeneratePrivateKey(bitSize int) (*rsa.PrivateKey, error)
GeneratePrivateKey creates a RSA Private Key of specified byte size
func GeneratePublicKey ¶
GeneratePublicKey take a rsa.PublicKey and return bytes suitable for writing to .pub file returns in the format "ssh-rsa ..."
func GetAllNetworkAttachmentDefinitions ¶
func GetAllNetworkAttachmentDefinitions(r ReconcilerCommon, obj metav1.Object) (map[string]networkv1.NetworkAttachmentDefinition, error)
GetAllNetworkAttachmentDefinitions - get all NetworkAttachmentDefinition
func GetAllPodsWithLabel ¶
func GetAllPodsWithLabel(r ReconcilerCommon, labelSelectorMap map[string]string, namespace string) (*corev1.PodList, error)
GetAllPodsWithLabel - get all pods from namespace with a specific label
func GetAllTemplates ¶
GetAllTemplates get all files from a templates sub folder
func GetBmhHosts ¶
func GetBmhHosts(r ReconcilerCommon, namespace string, labelSelector map[string]string) (*metal3v1alpha1.BareMetalHostList, error)
GetBmhHosts -
func GetCidrParts ¶ added in v1.2.0
GetCidrParts - returns addr and cidr suffix
func GetConfigMap ¶ added in v1.2.0
func GetConfigMap( r ReconcilerCommon, object client.Object, cond *ospdirectorv1beta1.Condition, conditionDetails ospdirectorv1beta1.ConditionDetails, configMapName string, requeueTimeout int, ) (*corev1.ConfigMap, ctrl.Result, error)
GetConfigMap - Get config map
if the config map is not found, requeue after requeueTimeout in seconds
func GetConfigMapAndHashWithName ¶
func GetConfigMapAndHashWithName(r ReconcilerCommon, configMapName string, namespace string) (*corev1.ConfigMap, string, error)
GetConfigMapAndHashWithName -
func GetConfigMaps ¶
func GetConfigMaps(r ReconcilerCommon, obj runtime.Object, configMaps []string, namespace string, envVars *map[string]EnvSetter) ([]ospdirectorv1beta1.Hash, error)
GetConfigMaps - get all configmaps required, verify they exist and add the hash to env and status
func GetControlPlane ¶
func GetControlPlane(r ReconcilerCommon, obj metav1.Object) (ospdirectorv1beta1.OpenStackControlPlane, reconcile.Result, error)
GetControlPlane -
func GetCustomFencingRoles ¶
GetCustomFencingRoles - return a list of any custom roles included in custom tarball that require fencing support
func GetDataFromSecret ¶ added in v1.2.0
func GetDataFromSecret( r ReconcilerCommon, object client.Object, cond *ospdirectorv1beta1.Condition, conditionDetails ospdirectorv1beta1.ConditionDetails, secretName string, requeueTimeout int, key string, ) (string, ctrl.Result, error)
GetDataFromSecret - Get data from Secret
if the secret or data is not found, requeue after requeueTimeout in seconds
func GetDeletionAnnotatedBmhHosts ¶
func GetDeletionAnnotatedBmhHosts(r ReconcilerCommon, namespace string, labelSelector map[string]string) ([]string, error)
GetDeletionAnnotatedBmhHosts -
func GetFencingRoles ¶
func GetFencingRoles() []string
GetFencingRoles - roles that normally require fencing
func GetIPRange ¶
GetIPRange returns the first and last IP in a range
func GetOr ¶
GetOr returns the value of m[key] if it exists, fallback otherwise. As a special case, it also returns fallback if the value of m[key] is the empty string
func GetSecret ¶
func GetSecret(r ReconcilerCommon, secretName string, secretNamespace string) (*corev1.Secret, string, error)
GetSecret -
func GetSecrets ¶
func GetSecrets(r ReconcilerCommon, secretNamespace string, labelSelectorMap map[string]string) (*corev1.SecretList, error)
GetSecrets -
func GetServicesListWithLabel ¶
func GetServicesListWithLabel(r ReconcilerCommon, namespace string, labelSelectorMap map[string]string) (*corev1.ServiceList, error)
GetServicesListWithLabel - Get all services in namespace of the obj matching label selector
func GetTemplatesPath ¶
func GetTemplatesPath() string
GetTemplatesPath get path to templates, either running local or deployed as container
func GetVirtualMachineInstances ¶
func GetVirtualMachineInstances(r ReconcilerCommon, namespace string, labelSelectorMap map[string]string) (*virtv1.VirtualMachineInstanceList, error)
GetVirtualMachineInstances -
func GetVirtualMachines ¶
func GetVirtualMachines(r ReconcilerCommon, namespace string, labelSelectorMap map[string]string) (*virtv1.VirtualMachineList, error)
GetVirtualMachines -
func IPToBigInt ¶
IPToBigInt converts a net.IP to a big.Int
func IsSet ¶
IsSet returns the value of m[key] if key exists, otherwise false Different from getOr because it will return zero values.
func IterateForAssignment ¶
func IterateForAssignment(assignIPDetails AssignIPDetails) (net.IP, []ospdirectorv1beta1.IPReservation, error)
IterateForAssignment iterates given an IP/IPNet and a list of reserved IPs
func LogErrorForObject ¶ added in v1.2.0
func LogErrorForObject(r ReconcilerCommon, err error, msg string, object metav1.Object, params ...interface{})
LogErrorForObject -
func LogForObject ¶ added in v1.2.0
func LogForObject(r ReconcilerCommon, msg string, object metav1.Object, params ...interface{})
LogForObject -
func MergeEnvs ¶
func MergeEnvs(envs []corev1.EnvVar, newEnvs EnvSetterMap) []corev1.EnvVar
MergeEnvs - merge envs
func MergeMaps ¶
func MergeMaps(baseMap map[string]interface{}, extraMaps ...map[string]interface{}) map[string]interface{}
MergeMaps - merge two or more maps
func MergeStringMaps ¶ added in v1.2.0
MergeStringMaps - merge two or more string->map maps
func ObjectHash ¶
ObjectHash creates a deep object hash and return it as a safe encoded string
func OpenStackBackupOverridesReconcile ¶ added in v1.2.0
func OpenStackBackupOverridesReconcile(client client.Client, instance InstanceCommon) (bool, error)
OpenStackBackupOverridesReconcile - Should a controller pause reconciliation for a particular resource given potential backup operations?
func RemoveIndex ¶
RemoveIndex - remove int from slice
func SSHKeySecret ¶
SSHKeySecret - func
func StringInSlice ¶
StringInSlice - is string in slice
Types ¶
type AssignIPDetails ¶
type AssignIPDetails struct { IPnet net.IPNet RangeStart net.IP RangeEnd net.IP // RoleReservelist - Reservelist of all reservations of the role RoleReservelist []ospdirectorv1beta1.IPReservation // Reservelist - Reservelist of all reservations Reservelist []ospdirectorv1beta1.IPReservation ExcludeRanges []string HostRef string Hostname string VIP bool Deleted bool }
AssignIPDetails -
type AssignmentError ¶
type AssignmentError struct {
// contains filtered or unexported fields
}
AssignmentError defines an IP assignment error.
func (AssignmentError) Error ¶
func (a AssignmentError) Error() string
type EnvSetter ¶
EnvSetter -
func EnvDownwardAPI ¶
EnvDownwardAPI - set env from FieldRef->FieldPath, e.g. status.podIP
type HostnameStore ¶
HostnameStore -
type InstanceCommon ¶ added in v1.2.0
type InstanceCommon interface { // Place anything we want from "inherited" (metav1 types, etc) funcs here GetName() string GetNamespace() string // Place our types' custom funcs here IsReady() bool }
InstanceCommon - common OSP-D resource instance interface
type Pvc ¶
type Pvc struct { Name string Namespace string Size string Labels map[string]string StorageClass string AccessMode []corev1.PersistentVolumeAccessMode }
Pvc - pvc details
type ReconcilerCommon ¶
type ReconcilerCommon interface { GetClient() client.Client GetKClient() kubernetes.Interface GetLogger() logr.Logger GetScheme() *runtime.Scheme }
ReconcilerCommon - common reconciler interface
type TType ¶
type TType string
TType - TemplateType
const ( // TemplateTypeScripts - config type TemplateTypeScripts TType = "bin" // TemplateTypeConfig - config type TemplateTypeConfig TType = "config" // TemplateTypeCustom - custom config type TemplateTypeCustom TType = "custom" // TemplateTypeNone - none type, don't add configs from a directory, only files from AdditionalData TemplateTypeNone TType = "none" )
type Template ¶
type Template struct { Name string Namespace string Type TType InstanceType string SecretType corev1.SecretType // Secrets only, defaults to "Opaque" AdditionalTemplate map[string]string CustomData map[string]string Labels map[string]string Annotations map[string]string ConfigOptions map[string]interface{} SkipSetOwner bool // skip setting ownership on the associated configmap Version ospdirectorv1beta1.OSPVersion }
Template - config map and secret details