controller

package
v0.0.0-...-6c4e8d0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SessionDebug                  bool
	SyncUser                      bool
	DisableInitCRD                bool
	DisableNodeSelectorController bool
	DisableSyncIngress            bool
	UseRandomServicePort          bool
	EtcdKeepFailedPods            bool
	StopServices                  bool
	MysqlCheckInterval            int
)

Functions

func AnnProm

func AnnProm(port int32) map[string]string

AnnProm adds annotations for prometheus scraping metrics

func ClusterConfigMapName

func ClusterConfigMapName(oc *v1alpha1.OnecloudCluster) string

ClusterConfigMapName returns the default OnecloudClusterConfig ConfigMap name

func ClustercertSecretName

func ClustercertSecretName(oc *v1alpha1.OnecloudCluster) string

ClusterCertSecretName returns the default cluster certs name

func ComponentConfigMapName

func ComponentConfigMapName(oc *v1alpha1.OnecloudCluster, component v1alpha1.ComponentType) string

ComponentConfigMapName returns the default ConfigMap name of the specified component type

func GetAuthURL

func GetAuthURL(oc *v1alpha1.OnecloudCluster) string

func GetDefaultProxyAgentName

func GetDefaultProxyAgentName() string

func GetOwnerRef

GetOwnerRef returns OnecloudCluster's OwnerReference

func GetServiceType

func GetServiceType(services []v1alpha1.Service, serviceName string) corev1.ServiceType

GetServiceType returns component's service type

func IsDockerComposeCluster

func IsDockerComposeCluster(oc *v1alpha1.OnecloudCluster) bool

func IsDockerComposeClusterName

func IsDockerComposeClusterName(name string) bool

func IsRequeueError

func IsRequeueError(err error) bool

IsRequeueError returns whether err is a RequeueError

func KeystoneComponentName

func KeystoneComponentName(clusterName string) string

KeystoneComponentName return keystone component name

func NewCACertAndKey

func NewCACertAndKey(certSpec *certutil.Config) (*x509.Certificate, crypto.Signer, error)

NewCACertAndKey will generate a self signed CA.

func NewClusterComponentName

func NewClusterComponentName(clusterName string, componentName v1alpha1.ComponentType) string

func NewOnecloudClientSession

func NewOnecloudClientSession(oc *v1alpha1.OnecloudCluster) (*mcclient.ClientSession, error)

func NewOnecloudSessionByToken

func NewOnecloudSessionByToken(cli *mcclient.Client, region string, token mcclient.TokenCredential) (*mcclient.ClientSession, error)

func NewOnecloudSimpleClientSession

func NewOnecloudSimpleClientSession(oc *v1alpha1.OnecloudCluster) (*mcclient.ClientSession, error)

func PoliciesPublic

func PoliciesPublic(s *mcclient.ClientSession, types []string) error

func RequeueErrorf

func RequeueErrorf(format string, a ...interface{}) error

RequeueErrorf returns a RequeueError

func RolesPublic

func RolesPublic(s *mcclient.ClientSession, roles []string) error

func RunWithSession

func RunWithSession(oc *v1alpha1.OnecloudCluster, f func(s *mcclient.ClientSession) error) error

Types

type CertsStore

type CertsStore map[string][]byte

func CreateCertPair

func CreateCertPair(oc *v1alpha1.OnecloudCluster) (CertsStore, error)

func (CertsStore) WriteCert

func (s CertsStore) WriteCert(name string, cert *x509.Certificate) error

func (CertsStore) WriteCertAndKey

func (s CertsStore) WriteCertAndKey(name string, cert *x509.Certificate, key crypto.Signer) error

func (CertsStore) WriteKey

func (s CertsStore) WriteKey(name string, key crypto.Signer) error

type ClusterControlInterface

type ClusterControlInterface interface {
	UpdateCluster(cluster *v1alpha1.OnecloudCluster, newStatus *v1alpha1.OnecloudClusterStatus, oldStatus *v1alpha1.OnecloudClusterStatus) (*v1alpha1.OnecloudCluster, error)
	GetCluster(namespace, name string) (*v1alpha1.OnecloudCluster, error)
}

ClusterControlInterface manages Onecloud clusters

func NewClusterControl

NewClusterControl creates a new ClsuterControlInterface

type ComponentManager

type ComponentManager interface {
	RunWithSession(oc *v1alpha1.OnecloudCluster, f func(s *mcclient.ClientSession) error) error
	// RunWithSessionNoEndpoints(oc *v1alpha1.OnecloudCluster, f func(s *mcclient.ClientSession) error) error
	GetController() *OnecloudControl
	GetCluster() *v1alpha1.OnecloudCluster
	Keystone() PhaseControl
	KubeServer(nodeLister corelisters.NodeLister) PhaseControl
	Region() PhaseControl
	Glance() PhaseControl
	YunionAgent() PhaseControl
	Devtool() PhaseControl
	Monitor() PhaseControl
	Cloudproxy() PhaseControl
	EChartsSSR() PhaseControl
}

type ConfigMapControlInterface

type ConfigMapControlInterface interface {
	CreateConfigMap(*v1alpha1.OnecloudCluster, *corev1.ConfigMap) error
	UpdateConfigMap(*v1alpha1.OnecloudCluster, *corev1.ConfigMap) (*corev1.ConfigMap, error)
	DeleteConfigMap(*v1alpha1.OnecloudCluster, *corev1.ConfigMap) error
}

type CronJobControlInterface

type CronJobControlInterface interface {
	CreateCronJob(*v1alpha1.OnecloudCluster, *batchv1.CronJob) error
	UpdateCronJob(*v1alpha1.OnecloudCluster, *batchv1.CronJob) (*batchv1.CronJob, error)
	DeleteCronJob(*v1alpha1.OnecloudCluster, string) error
}

func NewCronJobControl

func NewCronJobControl(
	kubeCli kubernetes.Interface, cronJobLister v1beta1.CronJobLister, recorder record.EventRecorder,
) CronJobControlInterface

type DaemonSetControlInterface

type DaemonSetControlInterface interface {
	CreateDaemonSet(*v1alpha1.OnecloudCluster, *apps.DaemonSet) error
	UpdateDaemonSet(*v1alpha1.OnecloudCluster, *apps.DaemonSet) (*apps.DaemonSet, error)
	DeleteDaemonSet(*v1alpha1.OnecloudCluster, *apps.DaemonSet) error
}

func NewDaemonSetControl

func NewDaemonSetControl(
	kubeCli kubernetes.Interface, daemonSetLister appslisters.DaemonSetLister, recorder record.EventRecorder,
) DaemonSetControlInterface

type DeploymentControlInterface

type DeploymentControlInterface interface {
	// CreateDeployment creates deployment in a OnecloudCluster.
	CreateDeployment(*v1alpha1.OnecloudCluster, *apps.Deployment) error
	// UpdateDeployment updates a deployment in a OnecloudCluster.
	UpdateDeployment(*v1alpha1.OnecloudCluster, *apps.Deployment) (*apps.Deployment, error)
	// DeleteDeployment deletes a deployment in a OnecloudCluster.
	DeleteDeployment(*v1alpha1.OnecloudCluster, string) error
}

DeploymentControlInterface defines the interface that uses to create, update, and delete Deployment

func NewDeploymentControl

func NewDeploymentControl(kubeCli kubernetes.Interface, deployLister appslisters.DeploymentLister, recorder record.EventRecorder) DeploymentControlInterface

NewDeploymentControl returns a DeploymentControlInterface

type IngressControlInterface

IngressControlInterface defines the interface that uses to create, update and delete Ingress

func NewIngressControl

func NewIngressControl(
	dCli dynamic.Interface,
	ingressLister cache.GenericLister,
	recorder record.EventRecorder,
	cv k8sutil.ClusterVersion,
) IngressControlInterface

type Object

type Object interface {
	GetName() string
}

type OnecloudCert

type OnecloudCert struct {
	Name     string
	LongName string
	BaseName string
	CAName   string
	// contains filtered or unexported fields
}

func NewClusterCACert

func NewClusterCACert() *OnecloudCert

func NewEtcdClientCert

func NewEtcdClientCert(caName string, serviceName string, certName string) *OnecloudCert

func NewEtcdClusterCACert

func NewEtcdClusterCACert() *OnecloudCert

func NewEtcdPeerCert

func NewEtcdPeerCert(caName string, serviceName string, certName string) *OnecloudCert

func NewEtcdServerCert

func NewEtcdServerCert(caName string, serviceName string, certName string) *OnecloudCert

func NewServiceCert

func NewServiceCert(caName string, serviceName string, certName string) *OnecloudCert

func (*OnecloudCert) CreateAsCA

func (*OnecloudCert) CreateFromCA

CreateFromCA makes and writes a certificate using the given CA cert and key.

func (*OnecloudCert) GetConfig

func (k *OnecloudCert) GetConfig(oc *v1alpha1.OnecloudCluster) (*certutil.Config, error)

type OnecloudCertControlInterface

type OnecloudCertControlInterface interface {
	// CreateCert
	CreateCert(oc *v1alpha1.OnecloudCluster) error

	// GetCertSecret return certs secret
	// GetCertSecret(oc *v1alpha1.OnecloudCluster) (*corev1.Secret, error)
	CreateEtcdCert(oc *v1alpha1.OnecloudCluster) error
}

func NewOnecloudCertControl

func NewOnecloudCertControl(kubeCli kubernetes.Interface, secretLister corelisters.SecretLister, recorder record.EventRecorder) OnecloudCertControlInterface

type OnecloudControl

type OnecloudControl struct {
	// contains filtered or unexported fields
}

func NewOnecloudControl

func NewOnecloudControl(kubeCli clientset.Interface) *OnecloudControl

func (*OnecloudControl) Components

func (*OnecloudControl) NewWaiter

func (*OnecloudControl) RunWithSession

func (w *OnecloudControl) RunWithSession(oc *v1alpha1.OnecloudCluster, f func(s *mcclient.ClientSession) error) error

type OnecloudRCAdminConfig

type OnecloudRCAdminConfig struct {
	AuthURL       string
	Region        string
	Username      string
	Password      string
	DomainName    string
	ProjectName   string
	ProjectDomain string
	Insecure      bool
	Debug         bool
	Timeout       int
	CertFile      string
	KeyFile       string
}

func NewOnecloudRCAdminConfig

func NewOnecloudRCAdminConfig(oc *v1alpha1.OnecloudCluster, debug bool) *OnecloudRCAdminConfig

func (*OnecloudRCAdminConfig) ToAuthInfo

func (config *OnecloudRCAdminConfig) ToAuthInfo() *auth.AuthInfo

type PhaseControl

type PhaseControl interface {
	Setup() error
	SystemInit(oc *v1alpha1.OnecloudCluster) error
}

func NewCloudproxyPhaseControl

func NewCloudproxyPhaseControl(c ComponentManager) PhaseControl

func NewDevtoolPhaseControl

func NewDevtoolPhaseControl(c ComponentManager) PhaseControl

func NewGlancePhaseControl

func NewGlancePhaseControl(c ComponentManager) PhaseControl

func NewItsmEndpointComponent

func NewItsmEndpointComponent(man ComponentManager,
	ctype v1alpha1.ComponentType,
	serviceName string,
	serviceType string,
	port int, prefix string) PhaseControl

func NewKeystonePhaseControl

func NewKeystonePhaseControl(cm ComponentManager) PhaseControl

func NewKubeServerPhaseControl

func NewKubeServerPhaseControl(cm ComponentManager, nodeLister corelisters.NodeLister) PhaseControl

func NewMonitorPhaseControl

func NewMonitorPhaseControl(c ComponentManager) PhaseControl

func NewRegionPhaseControl

func NewRegionPhaseControl(cm ComponentManager) PhaseControl

func NewRegisterEndpointComponent

func NewRegisterEndpointComponent(
	man ComponentManager,
	ctype v1alpha1.ComponentType,
	serviceName string,
	serviceType string,
	port int, prefix string,
) PhaseControl

func NewRegisterServiceComponent

func NewRegisterServiceComponent(
	man ComponentManager,
	serviceName string,
	serviceType string,
) PhaseControl

func NewTSDBEndpointComponent

func NewTSDBEndpointComponent(
	man ComponentManager,
	ctype v1alpha1.ComponentType,
	serviceName string,
	serviceType string,
	port int, prefix string,
) PhaseControl

func NewYunionAgentPhaseControl

func NewYunionAgentPhaseControl(cm ComponentManager) PhaseControl

type RequeueError

type RequeueError struct {
	// contains filtered or unexported fields
}

RequeueError is used to requeue the item, this error type should't be considered as a real error

func (*RequeueError) Error

func (re *RequeueError) Error() string

type ServiceControlInterface

type ServiceControlInterface interface {
	CreateService(*v1alpha1.OnecloudCluster, *corev1.Service) error
	UpdateService(*v1alpha1.OnecloudCluster, *corev1.Service) (*corev1.Service, error)
	DeleteService(*v1alpha1.OnecloudCluster, *corev1.Service) error
}

ServiceControlInterface manages Services used in OnecloudCluster

func NewServiceControl

func NewServiceControl(kubeCli kubernetes.Interface, svcLister corelisters.ServiceLister, recorder record.EventRecorder) ServiceControlInterface

NewServiceControl creates a new ServiceControlInterface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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