controllers

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: MIT Imports: 94 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EtcdClientPort  = 2379
	EtcdPeerPort    = 2380
	EtcdMetricsPort = 2381
)
View Source
const (
	EtcdVersion = "v3.4.8"
)

Variables

View Source
var (
	ErrEtcdClusterIsNotReady = errors.New("EtcdCluster is not ready yet")
	ErrRPCServerIsNotReady   = errors.New("rpc server is not ready")
)

Functions

func RemoveFinalizer added in v0.10.0

func RemoveFinalizer(metaObj *metav1.ObjectMeta, finalizer string)

func WrapRetryError

func WrapRetryError(err error) error

Types

type Certificate

type Certificate struct {
	tls.Certificate
	// contains filtered or unexported fields
}

func NewCertificate

func NewCertificate(source tls.Certificate) (Certificate, error)

func (*Certificate) MarshalCertificate

func (c *Certificate) MarshalCertificate() []byte

func (*Certificate) ToSecret

func (c *Certificate) ToSecret() *corev1.Secret

type ConfigConverter added in v0.8.0

type ConfigConverter struct {
}

func (ConfigConverter) Proxy added in v0.8.0

func (ConfigConverter) Proxy(backends []*proxyv1alpha1.Backend, serviceLister listers.ServiceLister) ([]byte, error)

func (ConfigConverter) RPCPermission added in v0.8.0

func (ConfigConverter) RPCPermission(permissions []*proxyv1alpha1.RpcPermission) ([]byte, error)

func (ConfigConverter) Role added in v0.8.0

func (ConfigConverter) Role(backends []*proxyv1alpha1.Backend, roleList []*proxyv1alpha1.Role, roleBindings []*proxyv1alpha1.RoleBinding) ([]byte, error)

type Controller added in v0.10.0

type Controller struct {
	Base ControllerBase
	// contains filtered or unexported fields
}

func NewController added in v0.10.0

func NewController(base ControllerBase, coreClient kubernetes.Interface) *Controller

func (*Controller) EventRecorder added in v0.10.0

func (c *Controller) EventRecorder() record.EventRecorder

func (*Controller) Log added in v0.10.0

func (c *Controller) Log() *zap.Logger

func (*Controller) OnAdd added in v0.10.0

func (c *Controller) OnAdd(obj interface{})

func (*Controller) OnDelete added in v0.10.0

func (c *Controller) OnDelete(obj interface{})

func (*Controller) OnUpdate added in v0.10.0

func (c *Controller) OnUpdate(old, new interface{})

func (*Controller) ProcessKey added in v0.10.0

func (c *Controller) ProcessKey(key string) error

func (*Controller) Run added in v0.10.0

func (c *Controller) Run(ctx context.Context, workers int)

type ControllerBase added in v0.10.0

type ControllerBase interface {
	Name() string
	Finalizers() []string
	ListerSynced() []cache.InformerSynced
	EventSources() []cache.SharedIndexInformer
	ConvertToKeys() ObjectToKeyConverter
	GetObject(string) (interface{}, error)
	UpdateObject(context.Context, interface{}) error
	Reconcile(context.Context, interface{}) error
	Finalize(context.Context, interface{}) error
}

type CreateSecret

type CreateSecret struct {
	Name   string
	Known  func() bool
	Create func() (*corev1.Secret, error)
}

type EtcdCluster

type EtcdCluster struct {
	*etcdv1alpha1.EtcdCluster

	ClusterDomain string
	// contains filtered or unexported fields
}

func NewEtcdCluster

func NewEtcdCluster(c *etcdv1alpha1.EtcdCluster, clusterDomain string, log *zap.Logger, mockOpt *MockOption) *EtcdCluster

func (*EtcdCluster) AllExistMembers

func (c *EtcdCluster) AllExistMembers() []*corev1.Pod

func (*EtcdCluster) AllMembers

func (c *EtcdCluster) AllMembers() []*corev1.Pod

AllMembers returns all members of etcd, regardless of status

func (*EtcdCluster) CA

func (c *EtcdCluster) CA(s *corev1.Secret) (*corev1.Secret, error)

func (*EtcdCluster) CASecretName

func (c *EtcdCluster) CASecretName() string

func (*EtcdCluster) Client

func (c *EtcdCluster) Client(endpoints []string) (*clientv3.Client, error)

func (*EtcdCluster) ClientCertSecret

func (c *EtcdCluster) ClientCertSecret(ca *corev1.Secret) (*corev1.Secret, error)

func (*EtcdCluster) ClientCertSecretName

func (c *EtcdCluster) ClientCertSecretName() string

func (*EtcdCluster) ClientService

func (c *EtcdCluster) ClientService() *corev1.Service

func (*EtcdCluster) ClientServiceName

func (c *EtcdCluster) ClientServiceName() string

func (*EtcdCluster) CurrentInternalState

func (c *EtcdCluster) CurrentInternalState() InternalState

func (*EtcdCluster) CurrentPhase

func (c *EtcdCluster) CurrentPhase() etcdv1alpha1.EtcdClusterPhase

func (*EtcdCluster) DNSNames

func (c *EtcdCluster) DNSNames() []string

func (*EtcdCluster) DefragmentCronJob

func (c *EtcdCluster) DefragmentCronJob() *batchv1beta1.CronJob

func (*EtcdCluster) DefragmentCronJobName

func (c *EtcdCluster) DefragmentCronJobName() string

func (*EtcdCluster) DiscoveryService

func (c *EtcdCluster) DiscoveryService() *corev1.Service

func (*EtcdCluster) GetMetrics

func (c *EtcdCluster) GetMetrics(addr string) ([]*dto.MetricFamily, error)

func (*EtcdCluster) HasTemporaryMember added in v0.9.0

func (c *EtcdCluster) HasTemporaryMember() bool

func (*EtcdCluster) IsPodReady

func (c *EtcdCluster) IsPodReady(pod *corev1.Pod) bool

func (*EtcdCluster) NeedRepair

func (c *EtcdCluster) NeedRepair(pod *corev1.Pod) bool

func (*EtcdCluster) PermanentMembers

func (c *EtcdCluster) PermanentMembers() []*corev1.Pod

func (*EtcdCluster) ServerCert

func (c *EtcdCluster) ServerCert(ca *corev1.Secret) (Certificate, error)

func (*EtcdCluster) ServerCertSecret

func (c *EtcdCluster) ServerCertSecret(ca *corev1.Secret) (*corev1.Secret, error)

func (*EtcdCluster) ServerCertSecretName

func (c *EtcdCluster) ServerCertSecretName() string

func (*EtcdCluster) ServerDiscoveryServiceName

func (c *EtcdCluster) ServerDiscoveryServiceName() string

func (*EtcdCluster) SetAnnotationForPod

func (c *EtcdCluster) SetAnnotationForPod(pod *corev1.Pod)

func (*EtcdCluster) SetCASecret

func (c *EtcdCluster) SetCASecret(ca *corev1.Secret)

func (*EtcdCluster) SetOwnedPods

func (c *EtcdCluster) SetOwnedPods(pods []*corev1.Pod)

func (*EtcdCluster) SetServerCertSecret

func (c *EtcdCluster) SetServerCertSecret(cert *corev1.Secret)

func (*EtcdCluster) ShouldUpdate

func (c *EtcdCluster) ShouldUpdate(pod *corev1.Pod) bool

func (*EtcdCluster) ShouldUpdateServerCertificate

func (c *EtcdCluster) ShouldUpdateServerCertificate(certPem []byte) bool

func (*EtcdCluster) TemporaryMember

func (c *EtcdCluster) TemporaryMember() *corev1.Pod

type EtcdController

type EtcdController struct {
	*Controller
	// contains filtered or unexported fields
}

func NewEtcdController

func NewEtcdController(
	sharedInformerFactory informers.SharedInformerFactory,
	coreSharedInformerFactory kubeinformers.SharedInformerFactory,
	coreClient kubernetes.Interface,
	client clientset.Interface,
	cfg *rest.Config,
	clusterDomain string,
	runOutsideCluster bool,
	transport http.RoundTripper,
	mockOpt *MockOption,
) (*EtcdController, error)

func (*EtcdController) ConvertToKeys added in v0.10.0

func (ec *EtcdController) ConvertToKeys() ObjectToKeyConverter

func (*EtcdController) EventSources added in v0.10.0

func (ec *EtcdController) EventSources() []cache.SharedIndexInformer

func (*EtcdController) Finalize added in v0.10.0

func (ec *EtcdController) Finalize(_ context.Context, _ interface{}) error

func (*EtcdController) Finalizers added in v0.10.0

func (ec *EtcdController) Finalizers() []string

func (*EtcdController) GetObject added in v0.10.0

func (ec *EtcdController) GetObject(key string) (interface{}, error)

func (*EtcdController) ListerSynced added in v0.10.0

func (ec *EtcdController) ListerSynced() []cache.InformerSynced

func (*EtcdController) Name added in v0.10.0

func (ec *EtcdController) Name() string

func (*EtcdController) Reconcile added in v0.10.0

func (ec *EtcdController) Reconcile(ctx context.Context, obj interface{}) error

func (*EtcdController) UpdateObject added in v0.10.0

func (ec *EtcdController) UpdateObject(ctx context.Context, obj interface{}) error

type GitHubController

type GitHubController struct {
	*Controller
	// contains filtered or unexported fields
}

func NewGitHubController

func NewGitHubController(
	sharedInformerFactory informers.SharedInformerFactory,
	coreSharedInformerFactory kubeinformers.SharedInformerFactory,
	coreClient kubernetes.Interface,
	client clientset.Interface,
	transport http.RoundTripper,
) (*GitHubController, error)

func (*GitHubController) ConvertToKeys added in v0.10.0

func (c *GitHubController) ConvertToKeys() ObjectToKeyConverter

func (*GitHubController) EventSources added in v0.10.0

func (c *GitHubController) EventSources() []cache.SharedIndexInformer

func (*GitHubController) Finalize added in v0.10.0

func (c *GitHubController) Finalize(ctx context.Context, obj interface{}) error

func (*GitHubController) Finalizers added in v0.10.0

func (c *GitHubController) Finalizers() []string

func (*GitHubController) GetObject added in v0.10.0

func (c *GitHubController) GetObject(key string) (interface{}, error)

func (*GitHubController) ListerSynced added in v0.10.0

func (c *GitHubController) ListerSynced() []cache.InformerSynced

func (*GitHubController) Name added in v0.10.0

func (c *GitHubController) Name() string

func (*GitHubController) Reconcile added in v0.10.0

func (c *GitHubController) Reconcile(ctx context.Context, obj interface{}) error

func (*GitHubController) UpdateObject added in v0.10.0

func (c *GitHubController) UpdateObject(ctx context.Context, obj interface{}) error

type HeimdallrProxy

type HeimdallrProxy struct {
	Name                string
	Namespace           string
	Object              *proxyv1alpha1.Proxy
	Spec                proxyv1alpha1.ProxySpec
	Datastore           *etcdv1alpha1.EtcdCluster
	CASecret            *corev1.Secret
	SigningPrivateKey   *corev1.Secret
	GithubWebhookSecret *corev1.Secret
	CookieSecret        *corev1.Secret
	InternalTokenSecret *corev1.Secret

	RPCServer       *process
	ProxyServer     *process
	DashboardServer *process
	// contains filtered or unexported fields
}

func NewHeimdallrProxy

func NewHeimdallrProxy(opt HeimdallrProxyParams) *HeimdallrProxy

func (*HeimdallrProxy) Backends

func (r *HeimdallrProxy) Backends() []*proxyv1alpha1.Backend

func (*HeimdallrProxy) CASecretName

func (r *HeimdallrProxy) CASecretName() string

func (*HeimdallrProxy) Certificate

func (r *HeimdallrProxy) Certificate() runtime.Object

func (*HeimdallrProxy) CertificateSecretName

func (r *HeimdallrProxy) CertificateSecretName() string

func (*HeimdallrProxy) ConfigForDashboard

func (r *HeimdallrProxy) ConfigForDashboard() (*corev1.ConfigMap, error)

func (*HeimdallrProxy) ConfigForMain

func (r *HeimdallrProxy) ConfigForMain() (*corev1.ConfigMap, error)

func (*HeimdallrProxy) ConfigForRPCServer

func (r *HeimdallrProxy) ConfigForRPCServer() (*corev1.ConfigMap, error)

func (*HeimdallrProxy) ConfigNameForDashboard

func (r *HeimdallrProxy) ConfigNameForDashboard() string

func (*HeimdallrProxy) ConfigNameForMain

func (r *HeimdallrProxy) ConfigNameForMain() string

func (*HeimdallrProxy) ConfigNameForRPCServer

func (r *HeimdallrProxy) ConfigNameForRPCServer() string

func (*HeimdallrProxy) ControlObject

func (r *HeimdallrProxy) ControlObject(obj metav1.Object)

func (*HeimdallrProxy) CookieSecretName

func (r *HeimdallrProxy) CookieSecretName() string

func (*HeimdallrProxy) DeploymentNameForDashboard

func (r *HeimdallrProxy) DeploymentNameForDashboard() string

func (*HeimdallrProxy) DeploymentNameForMain

func (r *HeimdallrProxy) DeploymentNameForMain() string

func (*HeimdallrProxy) DeploymentNameForRPCServer

func (r *HeimdallrProxy) DeploymentNameForRPCServer() string

func (*HeimdallrProxy) EtcdCluster

func (*HeimdallrProxy) EtcdClusterName

func (r *HeimdallrProxy) EtcdClusterName() string

func (*HeimdallrProxy) EtcdHost

func (r *HeimdallrProxy) EtcdHost() string

func (*HeimdallrProxy) GithubSecretName

func (r *HeimdallrProxy) GithubSecretName() string

func (*HeimdallrProxy) IdealDashboard

func (r *HeimdallrProxy) IdealDashboard() (*process, error)

func (*HeimdallrProxy) IdealProxyProcess

func (r *HeimdallrProxy) IdealProxyProcess() (*process, error)

func (*HeimdallrProxy) IdealRPCServer

func (r *HeimdallrProxy) IdealRPCServer() (*process, error)

func (*HeimdallrProxy) InternalTokenSecretName

func (r *HeimdallrProxy) InternalTokenSecretName() string

func (*HeimdallrProxy) LabelsForDashboard

func (r *HeimdallrProxy) LabelsForDashboard() map[string]string

func (*HeimdallrProxy) LabelsForDefragmentJob

func (r *HeimdallrProxy) LabelsForDefragmentJob() map[string]string

func (*HeimdallrProxy) LabelsForMain

func (r *HeimdallrProxy) LabelsForMain() map[string]string

func (*HeimdallrProxy) LabelsForRPCServer

func (r *HeimdallrProxy) LabelsForRPCServer() map[string]string

func (*HeimdallrProxy) NewCA

func (r *HeimdallrProxy) NewCA() (*corev1.Secret, error)

func (*HeimdallrProxy) NewCookieSecret

func (r *HeimdallrProxy) NewCookieSecret() (*corev1.Secret, error)

func (*HeimdallrProxy) NewGithubSecret

func (r *HeimdallrProxy) NewGithubSecret() (*corev1.Secret, error)

func (*HeimdallrProxy) NewInternalTokenSecret

func (r *HeimdallrProxy) NewInternalTokenSecret() (*corev1.Secret, error)

func (*HeimdallrProxy) NewSigningPrivateKey

func (r *HeimdallrProxy) NewSigningPrivateKey() (*corev1.Secret, error)

func (*HeimdallrProxy) PodDisruptionBudgetNameForDashboard

func (r *HeimdallrProxy) PodDisruptionBudgetNameForDashboard() string

func (*HeimdallrProxy) PodDisruptionBudgetNameForMain

func (r *HeimdallrProxy) PodDisruptionBudgetNameForMain() string

func (*HeimdallrProxy) PodDisruptionBudgetNameForRPCServer

func (r *HeimdallrProxy) PodDisruptionBudgetNameForRPCServer() string

func (*HeimdallrProxy) PrivateKeySecretName

func (r *HeimdallrProxy) PrivateKeySecretName() string

func (*HeimdallrProxy) ReverseProxyConfig

func (r *HeimdallrProxy) ReverseProxyConfig() (*corev1.ConfigMap, error)

func (*HeimdallrProxy) ReverseProxyConfigName

func (r *HeimdallrProxy) ReverseProxyConfigName() string

func (*HeimdallrProxy) RoleBindings added in v0.8.0

func (r *HeimdallrProxy) RoleBindings() []*proxyv1alpha1.RoleBinding

func (*HeimdallrProxy) Roles

func (r *HeimdallrProxy) Roles() []*proxyv1alpha1.Role

func (*HeimdallrProxy) RpcPermissions

func (r *HeimdallrProxy) RpcPermissions() []*proxyv1alpha1.RpcPermission

func (*HeimdallrProxy) Secrets

func (r *HeimdallrProxy) Secrets() []CreateSecret

func (*HeimdallrProxy) ServiceNameForDashboard

func (r *HeimdallrProxy) ServiceNameForDashboard() string

func (*HeimdallrProxy) ServiceNameForInternalApi

func (r *HeimdallrProxy) ServiceNameForInternalApi() string

func (*HeimdallrProxy) ServiceNameForMain

func (r *HeimdallrProxy) ServiceNameForMain() string

func (*HeimdallrProxy) ServiceNameForRPCServer

func (r *HeimdallrProxy) ServiceNameForRPCServer() string

func (*HeimdallrProxy) Version

func (r *HeimdallrProxy) Version() string

type HeimdallrProxyParams added in v0.7.0

type HeimdallrProxyParams struct {
	Spec               *proxyv1alpha1.Proxy
	Clientset          clientset.Interface
	ServiceLister      listers.ServiceLister
	Backends           []*proxyv1alpha1.Backend
	Roles              []*proxyv1alpha1.Role
	RpcPermissions     []*proxyv1alpha1.RpcPermission
	RoleBindings       []*proxyv1alpha1.RoleBinding
	CertManagerVersion string
}

type IngressController added in v0.10.0

type IngressController struct {
	*Controller
	// contains filtered or unexported fields
}

func NewIngressController added in v0.10.0

func NewIngressController(
	coreSharedInformerFactory coreInformers.SharedInformerFactory,
	sharedInformerFactory informers.SharedInformerFactory,
	coreClient kubernetes.Interface,
	client clientset.Interface,
) *IngressController

func (*IngressController) ConvertToKeys added in v0.10.0

func (ic *IngressController) ConvertToKeys() ObjectToKeyConverter

func (*IngressController) EventSources added in v0.10.0

func (ic *IngressController) EventSources() []cache.SharedIndexInformer

func (*IngressController) Finalize added in v0.10.0

func (ic *IngressController) Finalize(ctx context.Context, obj interface{}) error

func (*IngressController) Finalizers added in v0.10.0

func (ic *IngressController) Finalizers() []string

func (*IngressController) GetObject added in v0.10.0

func (ic *IngressController) GetObject(key string) (interface{}, error)

func (*IngressController) ListerSynced added in v0.10.0

func (ic *IngressController) ListerSynced() []cache.InformerSynced

func (*IngressController) Name added in v0.10.0

func (ic *IngressController) Name() string

func (*IngressController) Reconcile added in v0.10.0

func (ic *IngressController) Reconcile(ctx context.Context, obj interface{}) error

func (*IngressController) UpdateObject added in v0.10.0

func (ic *IngressController) UpdateObject(ctx context.Context, obj interface{}) error

type InternalState

type InternalState string
const (
	InternalStateCreatingFirstMember InternalState = "creatingFirstNode"
	InternalStateCreatingMembers     InternalState = "creatingMembers"
	InternalStateRepair              InternalState = "repair"
	InternalStateRestore             InternalState = "restore"
	InternalStatePreparingUpdate     InternalState = "preparingUpdate"
	InternalStateUpdatingMember      InternalState = "updatingMember"
	InternalStateTeardownUpdating    InternalState = "teardownUpdating"
	InternalStateRunning             InternalState = "running"
)

type MockOption

type MockOption struct {
	Cluster     clientv3.Cluster
	Maintenance clientv3.Maintenance
}

type ObjectToKeyConverter added in v0.10.0

type ObjectToKeyConverter func(obj interface{}) (keys []string, err error)

type Probe added in v0.8.0

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

func NewProbe added in v0.8.0

func NewProbe(addr string) *Probe

func (*Probe) Ready added in v0.8.0

func (p *Probe) Ready()

func (*Probe) ServeHTTP added in v0.8.0

func (p *Probe) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Probe) Start added in v0.8.0

func (p *Probe) Start() error

type ProxyController

type ProxyController struct {
	*Controller
	// contains filtered or unexported fields
}

func NewProxyController

func NewProxyController(
	sharedInformerFactory informers.SharedInformerFactory,
	coreSharedInformerFactory kubeinformers.SharedInformerFactory,
	client kubernetes.Interface,
	proxyClient clientset.Interface,
) (*ProxyController, error)

func (*ProxyController) ConvertToKeys added in v0.10.0

func (c *ProxyController) ConvertToKeys() ObjectToKeyConverter

func (*ProxyController) EventSources added in v0.10.0

func (c *ProxyController) EventSources() []cache.SharedIndexInformer

func (*ProxyController) Finalize added in v0.10.0

func (c *ProxyController) Finalize(_ context.Context, _ interface{}) error

func (*ProxyController) Finalizers added in v0.10.0

func (c *ProxyController) Finalizers() []string

func (*ProxyController) GetObject added in v0.10.0

func (c *ProxyController) GetObject(key string) (interface{}, error)

func (*ProxyController) ListerSynced added in v0.10.0

func (c *ProxyController) ListerSynced() []cache.InformerSynced

func (*ProxyController) Name added in v0.10.0

func (c *ProxyController) Name() string

func (*ProxyController) Reconcile added in v0.10.0

func (c *ProxyController) Reconcile(ctx context.Context, obj interface{}) error

func (*ProxyController) UpdateObject added in v0.10.0

func (c *ProxyController) UpdateObject(ctx context.Context, obj interface{}) error

type RetryError

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

func (*RetryError) Error

func (e *RetryError) Error() string

func (*RetryError) Is

func (e *RetryError) Is(err error) bool

func (*RetryError) Unwrap

func (e *RetryError) Unwrap() error

type RoleBindings added in v0.7.0

type RoleBindings []*proxyv1alpha1.RoleBinding

func (RoleBindings) Select added in v0.7.0

Jump to

Keyboard shortcuts

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