designate

package
v0.0.0-...-54fe9ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2025 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// KollaServiceCommand - the command to start the service binary in the kolla container
	KollaServiceCommand = "/usr/local/bin/kolla_set_configs && /usr/local/bin/kolla_start"
	// DesignateDatabaseName - the name of the DB to store tha API schema
	DesignateDatabaseName = "designate"
)
View Source
const (
	// ServiceType -
	ServiceType = "dns"
	// ServiceName -
	ServiceName = "designate"

	// DatabaseName -
	DatabaseName = "designate"

	// DatabaseCRName - Name of the MariaDBDatabase CR
	DatabaseCRName = "designate"

	// DatabaseUsernamePrefix - used by EnsureMariaDBAccount when a new username
	// is to be generated, e.g. "designate_e5a4", "designate_78bc", etc
	DatabaseUsernamePrefix = "designate"

	// DesignatePublicPort -
	DesignatePublicPort int32 = 9001
	// DesignateInternalPort -
	DesignateInternalPort int32 = 9001

	DesignateBindKeySecret = "designate-bind-secret"

	DesignateRndcKey = "rndc-key"

	MdnsPredIPConfigMap = "designate-mdns-ip-map"

	NsRecordsConfigMap = "designate-ns-records-params"

	NsRecordsCRContent = "designate-ns-records"

	BindPredIPConfigMap = "designate-bind-ip-map"

	RndcConfDir = "/etc/designate/rndc-keys"

	PoolsYamlConfigMap = "designate-pools-yaml-config-map"

	PoolsYamlPath = "designatepoolmanager/config/pools.yaml.tmpl"

	PoolsYamlHash = "pools-yaml-hash"

	PoolsYamlContent = "pools-yaml-content"

	// BindPredictableIPHash key for status hash
	BindPredictableIPHash = "Bind IP Map"

	// RndcHash key for status hash
	RndcHash = "Rndc keys"

	// PredictableIPCommand -
	PredictableIPCommand = "/usr/local/bin/container-scripts/setipalias.sh"

	// ScriptsTemplate sprintf template for common scripts secret
	ScriptsF = "%s-scripts"

	// ConfigDataTemplate sprintf template for common config data secret
	ConfigDataTemplate = "%s-config-data"

	// DefaultOverwriteTemplate sprintf template for common default overwrite secret
	DefaultOverwriteTemplate = "%s-defaults"
)
View Source
const (
	DesignateConfigVolume  = "designate-config"
	DesignateConfigMount   = "/etc/designate"
	DesignateConfigKeyPath = "designate.conf"
	DesignatePoolsYamlPath = "pools.yaml"
)
View Source
const (
	ScriptMount = "script-mount"
	SecretMount = "secret-mount"
	ConfigMount = "config-mount"
	MergeMount  = "merge-mount"
)
View Source
const (

	// BindProvPredictablePoolSize  -
	BindProvPredictablePoolSize = 25
)
View Source
const (
	// DBSyncCommand -
	DBSyncCommand = "/usr/local/bin/kolla_set_configs && /usr/local/bin/kolla_start"
)
View Source
const (
	// InitContainerCommand -
	InitContainerCommand = "/usr/local/bin/container-scripts/init.sh"
)
View Source
const (
	MinPasswordSize = 25
)

Variables

This section is empty.

Functions

func ConfigVolumeName

func ConfigVolumeName(s string) string

func CreateDNSService

func CreateDNSService(
	name string,
	namespace string,
	details *service.OverrideSpec,
	labels map[string]string,
	port int32,
) (*service.Service, error)

CreateDNSService - helper function for creating a new serv

func CreateRndcKeySecret

func CreateRndcKeySecret() (string, error)

Create the rndc key secret

func DbSyncJob

func DbSyncJob(
	instance *designatev1beta1.Designate,
	labels map[string]string,
	annotations map[string]string,
) *batchv1.Job

DbSyncJob func

func DefaultsVolumeName

func DefaultsVolumeName(s string) string

func GeneratePoolsYamlDataAndHash

func GeneratePoolsYamlDataAndHash(BindMap, MdnsMap map[string]string, nsRecords []designatev1.DesignateNSRecord) (string, string, error)

We sort all pool resources to get the correct hash every time

func GetNextIP

func GetNextIP(predParams *NADIpam, allocatedIPs map[string]bool) (string, error)

func GetOwningDesignateName

func GetOwningDesignateName(instance client.Object) string

GetOwningDesignateName - Given a Designate-->API,Central,Worker,Mdns,Producer object, returning the parent Designate object that created it (if any)

func GetScriptConfigMapName

func GetScriptConfigMapName(crName string) string

GetScriptConfigMapName returns the name of the ConfigMap used for the config merger and the service init scripts

func GetServiceConfigConfigMapName

func GetServiceConfigConfigMapName(crName string) string

GetServiceConfigConfigMapName returns the name of the ConfigMap used to store the service configuration files

func InitContainer

func InitContainer(init APIDetails) []corev1.Container

InitContainer - init container for designate api pods

func MergedDefaultsVolumeName

func MergedDefaultsVolumeName(s string) string

func MergedVolumeName

func MergedVolumeName(s string) string

func PoolUpdateJob

func PoolUpdateJob(
	instance *designatev1beta1.Designate,
	labels map[string]string,
	annotations map[string]string,
) *batchv1.Job

func PredictableIPContainer

func PredictableIPContainer(init PredIPContainerDetails) corev1.Container

func ProcessVolumes

func ProcessVolumes(volumeDefs []VolumeMapping) ([]corev1.Volume, []corev1.VolumeMount)

ProcessVolumes takes a slice of VolumeMapping and creates corresponding slices of Volumes and Mounts. This helps keep naming and matching of volumes and mounts in sync and consistent.

func ScriptsVolumeName

func ScriptsVolumeName(s string) string

func SimpleInitContainer

func SimpleInitContainer(init InitContainerDetails) corev1.Container

Types

type APIDetails

type APIDetails struct {
	ContainerImage       string
	DatabaseHost         string
	DatabaseName         string
	OSPSecret            string
	TransportURLSecret   string
	UserPasswordSelector string
	VolumeMounts         []corev1.VolumeMount
	Privileged           bool
}

APIDetails information

type CatalogZone

type CatalogZone struct {
	FQDN    string `yaml:"fqdn"`
	Refresh int    `yaml:"refresh"`
}

type Database

type Database struct {
	Database *mariadbv1.Database
	Status   DatabaseStatus
}

Database -

type DatabaseStatus

type DatabaseStatus int

DatabaseStatus -

const (
	// DBFailed -
	DBFailed DatabaseStatus = iota
	// DBCreating -
	DBCreating DatabaseStatus = iota
	// DBCompleted -
	DBCompleted DatabaseStatus = iota
)

type InitContainerDetails

type InitContainerDetails struct {
	ContainerImage string
	VolumeMounts   []corev1.VolumeMount
	EnvVars        []corev1.EnvVar
}

type Master

type Master struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

type MessageBus

type MessageBus struct {
	SecretName string
	Status     MessageBusStatus
}

MessageBus -

type MessageBusStatus

type MessageBusStatus int

MessageBusStatus -

const (
	// MQFailed -
	MQFailed MessageBusStatus = iota
	// MQCreating -
	MQCreating MessageBusStatus = iota
	// MQCompleted -
	MQCompleted MessageBusStatus = iota
)

type NADConfig

type NADConfig struct {
	IPAM NADIpam `json:"ipam"`
}

NADConfig - IPAM parameters of the NAD

func GetNADConfig

func GetNADConfig(
	nad *networkv1.NetworkAttachmentDefinition,
) (*NADConfig, error)

type NADIpam

type NADIpam struct {
	CIDR       netip.Prefix `json:"range"`
	RangeStart netip.Addr   `json:"range_start"`
	RangeEnd   netip.Addr   `json:"range_end"`
}

func GetPredictableIPAM

func GetPredictableIPAM(networkParameters *NetworkParameters) (*NADIpam, error)

GetPredictableIPAM returns a struct describing the available IP range. If the IP pool size does not fit in given networkParameters CIDR it will return an error instead.

type Nameserver

type Nameserver struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

type NetworkParameters

type NetworkParameters struct {
	CIDR                    netip.Prefix
	ProviderAllocationStart netip.Addr
	ProviderAllocationEnd   netip.Addr
}

NetworkParameters - Parameters for the Designate networks, based on the config of the NAD

func GetNetworkParametersFromNAD

func GetNetworkParametersFromNAD(
	nad *networkv1.NetworkAttachmentDefinition,
) (*NetworkParameters, error)

GetNetworkParametersFromNAD - Extract network information from the Network Attachment Definition

type Options

type Options struct {
	Host        string `yaml:"host"`
	Port        int    `yaml:"port"`
	RNDCHost    string `yaml:"rndc_host"`
	RNDCPort    int    `yaml:"rndc_port"`
	RNDCKeyFile string `yaml:"rndc_key_file"`
}

type Pool

type Pool struct {
	Name        string                          `yaml:"name"`
	Description string                          `yaml:"description"`
	Attributes  map[string]string               `yaml:"attributes"`
	NSRecords   []designatev1.DesignateNSRecord `yaml:"ns_records"`
	Nameservers []Nameserver                    `yaml:"nameservers"`
	Targets     []Target                        `yaml:"targets"`
	CatalogZone *CatalogZone                    `yaml:"catalog_zone,omitempty"` // it is a pointer because it is optional
}

type PredIPContainerDetails

type PredIPContainerDetails struct {
	ContainerImage string
	VolumeMounts   []corev1.VolumeMount
	Command        string
	EnvVars        []corev1.EnvVar
}

type Target

type Target struct {
	Type        string   `yaml:"type"`
	Description string   `yaml:"description"`
	Masters     []Master `yaml:"masters"`
	Options     Options  `yaml:"options"`
}

type VolumeMapping

type VolumeMapping struct {
	Name      string
	Type      string
	MountPath string
	Source    string
}

func GetStandardVolumeMapping

func GetStandardVolumeMapping(instance client.Object) []VolumeMapping

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL