controller

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: Apache-2.0 Imports: 37 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PolicyDomainAdmin = `
# project owner, allow do any with her project resources
roles:
  - domainadmin
scope: domain
policy:
  '*': allow
`
	PolicyMember = `` /* 223-byte string literal not displayed */

	PolicyProjectFA = `
# project finance administrator, allow any operation in meter
roles:
  - fa
scope: project
policy:
  meter: allow
`
	PolicyProjectOwner = `` /* 231-byte string literal not displayed */

	PolicyProjectSA = `` /* 260-byte string literal not displayed */

	PolicySysAdmin = `` /* 141-byte string literal not displayed */

	PolicySysFA = `` /* 149-byte string literal not displayed */

	PolicySysSA = `` /* 174-byte string literal not displayed */

)

Variables

View Source
var DefaultRoles map[string]string
View Source
var (
	SessionDebug bool
)

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 GetOwnerRef

GetOwnerRef returns OnecloudCluster's OwnerReference

func GetServiceType

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

GetServiceType returns component's service type

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 PolicyCreate

func PolicyCreate(s *mcclient.ClientSession, policyType string, content string, enable bool) (jsonutils.JSONObject, error)

func RequeueErrorf

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

RequeueErrorf returns a RequeueError

func RolesPublic

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

Types

type ClusterControlInterface

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

ClusterControlInterface manages Onecloud clusters

func NewClusterControl

NewClusterControl creates a new ClsuterControlInterface

type ComponentManager

type ComponentManager interface {
	GetSession() (*mcclient.ClientSession, error)
	GetSessionNoEndpoints() (*mcclient.ClientSession, error)
	GetController() *OnecloudControl
	GetCluster() *v1alpha1.OnecloudCluster
	Keystone() PhaseControl
	Region() PhaseControl
	Glance() PhaseControl
	YunionAgent() PhaseControl
	Devtool() 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, *batchv1.CronJob) 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, *apps.Deployment) 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

type IngressControlInterface interface {
	CreateIngress(*v1alpha1.OnecloudCluster, *extensions.Ingress) error
	UpdateIngress(*v1alpha1.OnecloudCluster, *extensions.Ingress) (*extensions.Ingress, error)
	DeleteIngress(*v1alpha1.OnecloudCluster, *extensions.Ingress) error
}

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

func NewIngressControl

func NewIngressControl(kubeCli kubernetes.Interface, ingressLister listers.IngressLister, recorder record.EventRecorder) 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 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
}

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) GetSession

func (*OnecloudControl) GetSessionNoEndpoints

func (w *OnecloudControl) GetSessionNoEndpoints(oc *v1alpha1.OnecloudCluster) (*mcclient.ClientSession, error)

func (*OnecloudControl) NewWaiter

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

type PhaseControl

type PhaseControl interface {
	Setup() error
	SystemInit() error
}

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

type Policies

type Policies map[string]string
var DefaultPolicies Policies

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