controllers

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsSha256

func AsSha256(o interface{}) string

Hash the given element with sha256

func CallSolaceSempApi

func CallSolaceSempApi(
	s *scalablev1alpha1.SolaceScalable,
	apiPath string,
	ctx context.Context,
	solaceAdminPassword string,
) (string, bool, error)

Calls the solace SEMPV2 Api

func ConstructAttrSpecificDatas

func ConstructAttrSpecificDatas(
	s *scalablev1alpha1.SolaceScalable,
	pubSubSvcNames *[]string,
	cmData *map[string]string,
	svcIds *[]SvcId,
	ppp *Ppp,
	oP *SolaceSvcSpec,
	p int32,
	nature string,
	portsArr *[]int32,
)

func Contains

func Contains(s []string, str string) bool

func CreateIngressConsoleRules

func CreateIngressConsoleRules(s *scalablev1alpha1.SolaceScalable) []v1.IngressRule

func GetDefaultHaProxyConf

func GetDefaultHaProxyConf(servicePorts []corev1.ServicePort) *[]corev1.ServicePort

func GetMsgVpnProtocolPort

func GetMsgVpnProtocolPort(m SolaceMsgVpnResp, s string, p protocols) int

func GetSecretEnvIndex

func GetSecretEnvIndex(s *scalablev1alpha1.SolaceScalable,
	secretName string,
	ctx context.Context,
) int

func GetSecretFromKey

func GetSecretFromKey(s *scalablev1alpha1.SolaceScalable,
	secret *corev1.Secret,
	secretName string,
	ctx context.Context,
) string

func IsItInSlice

func IsItInSlice(o interface{}, list []string) bool

check if element o exist in the given slice

func Labels

Returns the resources Labels

func NewIngressConsole

func NewIngressConsole(
	s *scalablev1alpha1.SolaceScalable,
	labels map[string]string,
) *v1.Ingress

func NewPersistentVolume

func NewPersistentVolume(s *scalablev1alpha1.SolaceScalable,
	instanceId string,
	labels map[string]string,
) *corev1.PersistentVolume

func NewStatefulset

func NewStatefulset(
	s *scalablev1alpha1.SolaceScalable,
	labels map[string]string,
) *v1.StatefulSet

func NewSvcConsole

func NewSvcConsole(
	s *scalablev1alpha1.SolaceScalable,
	counter int,
) *corev1.Service

func NewSvcHaproxy

func NewSvcHaproxy(
	s *scalablev1alpha1.SolaceScalable,
	ports []corev1.ServicePort,
	d map[string]string,
) *[]corev1.ServicePort

get already existing default haproxy svc and add ports

func NewSvcPubSub

func NewSvcPubSub(
	s *scalablev1alpha1.SolaceScalable,
	svc SvcId,
	labels map[string]string,
) *corev1.Service

func NewTcpConfigmap

func NewTcpConfigmap(
	s *scalablev1alpha1.SolaceScalable,
	data map[string]string,
	nature string,
	labels map[string]string,
) *corev1.ConfigMap

Creates a new corev1.ConfigMap

func NextAvailablePort

func NextAvailablePort(
	ap []int32,
	p int32,
) int32

Searches for the next available int32 based on a given array of int32, see below's example

  • ap = [1025, 1026, 1028]
  • p = 1026
  • return 1027

func SanityzeForSvcName

func SanityzeForSvcName(s string) string

RFC 1035 Label Names Some resource types require their names to follow the DNS label standard as defined in RFC 1035. This means the name must:

1- contain at most 63 characters
2- contain only lowercase alphanumeric characters or '-'
3- start with an alphabetic character
4- end with an alphanumeric character

func UniqueAndNonZero

func UniqueAndNonZero(intSlice []int32) []int32

Removes repeated int32 and 0 elements from given slice

Types

type Attributes

type Attributes struct {
	AttributeName  string `json:"attributeName"`
	AttributeValue string `json:"attributeValue"`
}

type ClientUsernameAttribute

type ClientUsernameAttribute struct {
	AttributeName  string `json:"attributeName"`
	AttributeValue string `json:"attributeValue"`
	ClientUsername string `json:"clientUsername"`
	MsgVpnName     string `json:"msgVpnName"`
}

clientUsernames response struct

type ClientUsernameAttributes

type ClientUsernameAttributes struct {
	Data []ClientUsernameAttribute `json:"data"`
}

type Ppp

type Ppp struct {
	Protocol string  `json:"protocol"`
	Port     []int32 `json:"port"`
	PubOrSub string  `json:"pubOrSub"`
}

type SolaceClientUsernameResp

type SolaceClientUsernameResp struct {
	ClientUsername string                    `json:"clientUsername"`
	Enabled        bool                      `json:"enabled"`
	MsgVpnName     string                    `json:"msgVpnName"`
	Attributes     []ClientUsernameAttribute `json:"attributes"`
	Ports          []int32                   `json:"ports"`
}

type SolaceClientUsernamesResp

type SolaceClientUsernamesResp struct {
	Data []SolaceClientUsernameResp `json:"data"`
}

func (*SolaceClientUsernamesResp) AddClientAttributes

type SolaceMsgVpnResp

type SolaceMsgVpnResp struct {
	MsgVpnName                             string `json:"msgVpnName"`
	ServiceAmqpPlainTextListenPort         int    `json:"serviceAmqpPlainTextListenPort"`
	ServiceAmqpTlsListenPort               int    `json:"serviceAmqpTlsListenPort"`
	ServiceMqttPlainTextListenPort         int    `json:"serviceMqttPlainTextListenPort"`
	ServiceMqttTlsListenPort               int    `json:"serviceMqttTlsListenPort"`
	ServiceMqttTlsWebSocketListenPort      int    `json:"serviceMqttTlsWebSocketListenPort"`
	ServiceMqttWebSocketListenPort         int    `json:"serviceMqttWebSocketListenPort"`
	ServiceRestIncomingPlainTextListenPort int    `json:"serviceRestIncomingPlainTextListenPort"`
	ServiceRestIncomingTlsListenPort       int    `json:"serviceRestIncomingTlsListenPort"`
}

message vpns response struct

type SolaceMsgVpnsResp

type SolaceMsgVpnsResp struct {
	Data []SolaceMsgVpnResp `json:"data"`
}

func GetEnabledSolaceMsgVpns

func GetEnabledSolaceMsgVpns(
	s *scalablev1alpha1.SolaceScalable,
	data string,
) (SolaceMsgVpnsResp, error)

returns the solace's enabled msgVpns in Json format

func (*SolaceMsgVpnsResp) GetSolaceClientUsernames

func (m *SolaceMsgVpnsResp) GetSolaceClientUsernames(
	s *scalablev1alpha1.SolaceScalable,
	data string,
) (SolaceClientUsernamesResp, error)

returns the solace's clientUsernames per msgVpn in Json format

type SolaceScalableReconciler

type SolaceScalableReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

SolaceScalableReconciler reconciles a SolaceScalable object

func (*SolaceScalableReconciler) CreatePubSubSvc

func (r *SolaceScalableReconciler) CreatePubSubSvc(
	s *scalablev1alpha1.SolaceScalable,
	newSvcPubSub *corev1.Service,
	ctx context.Context,
) error

func (*SolaceScalableReconciler) CreateSolaceConsoleIngress

func (r *SolaceScalableReconciler) CreateSolaceConsoleIngress(
	solaceScalable *scalablev1alpha1.SolaceScalable,
	ingConsole *v1.Ingress,
	ctx context.Context,
) error

func (*SolaceScalableReconciler) CreateSolaceConsoleSvc

func (r *SolaceScalableReconciler) CreateSolaceConsoleSvc(
	svc *corev1.Service,
	ctx context.Context,
) error

create console service

func (*SolaceScalableReconciler) CreateSolaceLocalPv

func (*SolaceScalableReconciler) CreateSolaceTcpConfigmap

func (r *SolaceScalableReconciler) CreateSolaceTcpConfigmap(
	solaceScalable *scalablev1alpha1.SolaceScalable,
	data *map[string]string,
	nature string,
	ctx context.Context,
) (*corev1.ConfigMap, error)

create tcp ingress configmap

func (*SolaceScalableReconciler) CreateStatefulSet

func (r *SolaceScalableReconciler) CreateStatefulSet(
	ss *v1.StatefulSet,
	ctx context.Context,
) error

Check if the statefulset already exists

func (*SolaceScalableReconciler) DeletePubSubSvc

func (r *SolaceScalableReconciler) DeletePubSubSvc(
	svcList *corev1.ServiceList,
	pubSubSvcNames *[]string,
	ctx context.Context,
) error

func (*SolaceScalableReconciler) DeleteSolaceConsoleSvc

func (r *SolaceScalableReconciler) DeleteSolaceConsoleSvc(
	solaceScalable *scalablev1alpha1.SolaceScalable,
	ctx context.Context,
) error

delete unused console services

func (*SolaceScalableReconciler) GetExistingHaProxySvc

func (r *SolaceScalableReconciler) GetExistingHaProxySvc(
	solaceScalable *scalablev1alpha1.SolaceScalable,
	serviceName string,
	ctx context.Context,
) (*corev1.Service, error)

func (*SolaceScalableReconciler) GetSolaceSecret

Check if the secret already exists

func (*SolaceScalableReconciler) ListPubSubSvc

func (r *SolaceScalableReconciler) ListPubSubSvc(
	solaceScalable *scalablev1alpha1.SolaceScalable,
	ctx context.Context,
) (*corev1.ServiceList, error)

func (*SolaceScalableReconciler) Reconcile

func (r *SolaceScalableReconciler) Reconcile(
	ctx context.Context,
	request ctrl.Request,
) (ctrl.Result, error)

func (*SolaceScalableReconciler) SetupWithManager

func (r *SolaceScalableReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

func (*SolaceScalableReconciler) UpdateHAProxySvc

func (r *SolaceScalableReconciler) UpdateHAProxySvc(
	hashStore *map[string]string,
	FoundHaproxySvc *corev1.Service,
	ctx context.Context,
) error

func (*SolaceScalableReconciler) UpdateSolaceTcpConfigmap

func (r *SolaceScalableReconciler) UpdateSolaceTcpConfigmap(
	solaceScalable *scalablev1alpha1.SolaceScalable,
	configMap *corev1.ConfigMap,
	ctx context.Context,
	hashStore *map[string]string,
) error

update tcp ingress configmap

func (*SolaceScalableReconciler) UpdateStatefulSet

func (r *SolaceScalableReconciler) UpdateStatefulSet(
	ss *v1.StatefulSet,
	ctx context.Context,
	hashStore *map[string]string,
) error

Update the found object and write the result back if there are any changes

type SolaceSvcSpec

type SolaceSvcSpec struct {
	MsgVpnName     string  `json:"msgVpnName"`
	ClientUsername string  `json:"clientUsername"`
	Ppp            []Ppp   `json:"ppp"`
	AllMsgVpnPorts []int32 `json:"AllMsgVpnPorts"`
}

func (*SolaceSvcSpec) AddMsgVpnPorts

func (s *SolaceSvcSpec) AddMsgVpnPorts(m SolaceMsgVpnResp)

type SvcId

type SvcId struct {
	Name           string
	ClientUsername string
	MsgVpnName     string
	Port           int32
	TargetPort     int
	Nature         string
}

func ConstructSvcDatas

func ConstructSvcDatas(s *scalablev1alpha1.SolaceScalable,
	pubSubsvcSpecs *[]SolaceSvcSpec,
	nature string,
	portsArr *[]int32,
) (*[]string, *map[string]string, []SvcId)

pubsub SVC creation

Jump to

Keyboard shortcuts

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