controllers

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 90 Imported by: 0

Documentation

Index

Constants

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

	ProxyImageRepository = "ghcr.io/f110/heimdallr/proxy"

	RPCServerImageRepository = "ghcr.io/f110/heimdallr/rpcserver"
	DashboardImageRepository = "ghcr.io/f110/heimdallr/dashboard"
)

Variables

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

Functions

This section is empty.

Types

type Certificate

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

func NewCertificate

func NewCertificate(secret *corev1.Secret, source tls.Certificate) (Certificate, error)

func (*Certificate) MarshalCertificate

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

func (*Certificate) ToSecret

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

type ConfigConverter

type ConfigConverter struct {
}

func (ConfigConverter) Proxy

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

func (ConfigConverter) RPCPermission

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

func (ConfigConverter) Role

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

type CreateSecret

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

type EtcdCluster

type EtcdCluster struct {
	*etcdv1alpha2.EtcdCluster

	ClusterDomain string
	// contains filtered or unexported fields
}

func NewEtcdCluster

func NewEtcdCluster(c *etcdv1alpha2.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() []*EtcdMember

AllMembers returns all members of etcd, regardless of status

func (*EtcdCluster) CA

func (c *EtcdCluster) CA() (*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() (*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() etcdv1alpha2.EtcdClusterPhase

func (*EtcdCluster) DNSNames

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

func (*EtcdCluster) DefaultAnnotations added in v0.15.0

func (c *EtcdCluster) DefaultAnnotations() map[string]string

func (*EtcdCluster) DefaultLabels added in v0.15.0

func (c *EtcdCluster) DefaultLabels(etcdVersion string) map[string]string

func (*EtcdCluster) DefragmentCronJob

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

func (*EtcdCluster) DefragmentCronJobName

func (c *EtcdCluster) DefragmentCronJobName() string

func (*EtcdCluster) DiscoveryService

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

func (*EtcdCluster) EqualAnnotation added in v0.15.0

func (c *EtcdCluster) EqualAnnotation(a, b map[string]string) bool

func (*EtcdCluster) EqualLabels added in v0.15.0

func (c *EtcdCluster) EqualLabels(a, b map[string]string) bool

EqualLabels reports whether a and b are "semantic equal".

func (*EtcdCluster) EtcdRole

func (c *EtcdCluster) EtcdRole() *rbacv1.Role

func (*EtcdCluster) EtcdRoleBinding

func (c *EtcdCluster) EtcdRoleBinding() *rbacv1.RoleBinding

func (*EtcdCluster) EtcdVersion

func (c *EtcdCluster) EtcdVersion() string

func (*EtcdCluster) GetMetrics

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

func (*EtcdCluster) GetOwnedPods

func (c *EtcdCluster) GetOwnedPods(podLister listers.PodLister, pvcLister listers.PersistentVolumeClaimLister) error

func (*EtcdCluster) HasTemporaryMember

func (c *EtcdCluster) HasTemporaryMember() bool

func (*EtcdCluster) Init

func (c *EtcdCluster) Init(secretLister listers.SecretLister)

func (*EtcdCluster) InjectRestoreContainer

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

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() (Certificate, error)

func (*EtcdCluster) ServerCertSecret

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

func (*EtcdCluster) ServerCertSecretName

func (c *EtcdCluster) ServerCertSecretName() string

func (*EtcdCluster) ServerDiscoveryServiceName

func (c *EtcdCluster) ServerDiscoveryServiceName() string

func (*EtcdCluster) ServiceAccount

func (c *EtcdCluster) ServiceAccount() *corev1.ServiceAccount

func (*EtcdCluster) ServiceAccountName

func (c *EtcdCluster) ServiceAccountName() string

func (*EtcdCluster) SetAnnotationForPod

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

func (*EtcdCluster) SetCASecret

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

func (*EtcdCluster) SetClientCertSecret

func (c *EtcdCluster) SetClientCertSecret(cert *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() *EtcdMember

type EtcdController

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

func NewEtcdController

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

func (*EtcdController) ConvertToKeys

func (*EtcdController) EventSources

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

func (*EtcdController) Finalize

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

func (*EtcdController) Finalizers

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

func (*EtcdController) GetObject

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

func (*EtcdController) ListerSynced

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

func (*EtcdController) Name

func (ec *EtcdController) Name() string

func (*EtcdController) Reconcile

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

func (*EtcdController) UpdateObject

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

type EtcdMember

type EtcdMember struct {
	Pod                   *corev1.Pod
	PersistentVolumeClaim *corev1.PersistentVolumeClaim
	// TODO: Remove after v0.12
	OldVersion bool
}

type GitHubController

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

func NewGitHubController

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

func (*GitHubController) ConvertToKeys

func (*GitHubController) EventSources

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

func (*GitHubController) Finalize

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

func (*GitHubController) Finalizers

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

func (*GitHubController) GetObject

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

func (*GitHubController) ListerSynced

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

func (*GitHubController) Name

func (c *GitHubController) Name() string

func (*GitHubController) Reconcile

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

func (*GitHubController) UpdateObject

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

type HeimdallrProxy

type HeimdallrProxy struct {
	Name                      string
	Namespace                 string
	Object                    *proxyv1alpha2.Proxy
	Spec                      proxyv1alpha2.ProxySpec
	Datastore                 *etcdv1alpha2.EtcdCluster
	CASecret                  *corev1.Secret
	SigningPrivateKey         *corev1.Secret
	GithubWebhookSecret       *corev1.Secret
	CookieSecret              *corev1.Secret
	InternalTokenSecret       *corev1.Secret
	ServerCertSecret          *corev1.Secret
	IdentityProviderSecret    *corev1.Secret
	DatastoreClientCertSecret *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() []*proxyv1alpha2.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) DefaultBackends

func (r *HeimdallrProxy) DefaultBackends() []*proxyv1alpha2.Backend

func (*HeimdallrProxy) DefaultRoleBindings

func (r *HeimdallrProxy) DefaultRoleBindings() []*proxyv1alpha2.RoleBinding

func (*HeimdallrProxy) DefaultRoles

func (r *HeimdallrProxy) DefaultRoles() []*proxyv1alpha2.Role

func (*HeimdallrProxy) DefaultRpcPermissions

func (r *HeimdallrProxy) DefaultRpcPermissions() []*proxyv1alpha2.RpcPermission

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

func (r *HeimdallrProxy) Init(secretLister listers.SecretLister) 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

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

func (*HeimdallrProxy) Roles

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

func (*HeimdallrProxy) RpcPermissions

func (r *HeimdallrProxy) RpcPermissions() []*proxyv1alpha2.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

type HeimdallrProxyParams struct {
	Spec                *proxyv1alpha2.Proxy
	ThirdPartyClientSet *thirdpartyclient.Set
	ServiceLister       listers.ServiceLister
	Backends            []*proxyv1alpha2.Backend
	Roles               []*proxyv1alpha2.Role
	RpcPermissions      []*proxyv1alpha2.RpcPermission
	RoleBindings        []*proxyv1alpha2.RoleBinding
	CertManagerVersion  string
}

type IngressController

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

func NewIngressController

func NewIngressController(
	coreSharedInformerFactory coreInformers.SharedInformerFactory,
	sharedInformerFactory *client.InformerFactory,
	coreClient kubernetes.Interface,
	proxyClient *client.ProxyV1alpha2,
) *IngressController

func (*IngressController) ConvertToKeys

func (*IngressController) EventSources

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

func (*IngressController) Finalize

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

func (*IngressController) Finalizers

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

func (*IngressController) GetObject

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

func (*IngressController) ListerSynced

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

func (*IngressController) Name

func (ic *IngressController) Name() string

func (*IngressController) Reconcile

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

func (*IngressController) UpdateObject

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 Probe

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

func NewProbe

func NewProbe(addr string) *Probe

func (*Probe) Ready

func (p *Probe) Ready()

func (*Probe) ServeHTTP

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

func (*Probe) Start

func (p *Probe) Start() error

type ProxyController

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

func NewProxyController

func NewProxyController(
	ctx context.Context,
	sharedInformerFactory *client.InformerFactory,
	coreSharedInformerFactory kubeinformers.SharedInformerFactory,
	coreClient kubernetes.Interface,
	clientSet *client.Set,
	thirdPartyClientSet *thirdpartyclient.Set,
) (*ProxyController, error)

func (*ProxyController) ConvertToKeys

func (*ProxyController) EventSources

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

func (*ProxyController) Finalize

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

func (*ProxyController) Finalizers

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

func (*ProxyController) GetObject

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

func (*ProxyController) ListerSynced

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

func (*ProxyController) Name

func (c *ProxyController) Name() string

func (*ProxyController) Reconcile

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

func (*ProxyController) UpdateObject

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

type RoleBindings

type RoleBindings []*proxyv1alpha2.RoleBinding

func (RoleBindings) Select

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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