statusresource

package module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2020 License: Apache-2.0 Imports: 25 Imported by: 1

README

CircleCI

statusresource

Package statusresource implements primitives for CR status management within Giant Swarm Kubernetes guest clusters.

Statuses

Statuses are written under .status.cluster.conditions in the CR, in the following format :

    - lastTransitionTime: "2019-07-05T07:42:24.076879904Z"
      status: "True"
      type: Created

Allowed status type are defined in apiextensions as StatusClusterType*.

Decisions for status transition are made based on number and version of nodes.

Documentation

Index

Constants

View Source
const (
	Name = "status"
)

Variables

This section is empty.

Functions

func IsAlreadyRegisteredError

func IsAlreadyRegisteredError(err error) bool

IsAlreadyRegisteredError asserts alreadyRegisteredError.

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func IsMissingLabel

func IsMissingLabel(err error) bool

IsMissingLabel asserts missingLabelError.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound asserts notFoundError.

Types

type CollectorSet

type CollectorSet struct {
	*collector.Set
}

Set is basically only a wrapper for the operator's collector implementations. It eases the iniitialization and prevents some weird import mess so we do not have to alias packages. There is also the benefit of the helper type kept private so we do not need to expose this magic.

func NewCollectorSet

func NewCollectorSet(config CollectorSetConfig) (*CollectorSet, error)

type CollectorSetConfig

type CollectorSetConfig struct {
	Logger  micrologger.Logger
	Watcher func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
}

type LegacyStatusCollector

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

func NewLegacyStatusCollector

func NewLegacyStatusCollector(config LegacyStatusCollectorConfig) (*LegacyStatusCollector, error)

func (*LegacyStatusCollector) Collect

func (c *LegacyStatusCollector) Collect(ch chan<- prometheus.Metric) error

func (*LegacyStatusCollector) Describe

func (c *LegacyStatusCollector) Describe(ch chan<- *prometheus.Desc) error

type LegacyStatusCollectorConfig

type LegacyStatusCollectorConfig struct {
	Logger  micrologger.Logger
	Watcher func(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
}

type Patch

type Patch struct {
	Op    string      `json:"op"`
	Path  string      `json:"path"`
	Value interface{} `json:"value"`
}

type Provider

type Provider interface {
	ClusterStatus() providerv1alpha1.StatusCluster
}

type Resource

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

func NewResource

func NewResource(config ResourceConfig) (*Resource, error)

func (*Resource) EnsureCreated

func (r *Resource) EnsureCreated(ctx context.Context, obj interface{}) error

func (*Resource) EnsureDeleted

func (r *Resource) EnsureDeleted(ctx context.Context, obj interface{}) error

func (*Resource) Name

func (r *Resource) Name() string

type ResourceConfig

type ResourceConfig struct {
	BackOffFactory      func() backoff.Interface
	ClusterEndpointFunc func(v interface{}) (string, error)
	ClusterIDFunc       func(v interface{}) (string, error)
	ClusterStatusFunc   func(v interface{}) (providerv1alpha1.StatusCluster, error)
	// TODO replace this with a G8sClient to fetch the node versions from the
	// NodeConfig status once we can use the NodeConfig for general node
	// management. As of now NodeConfig CRs are still used for draining in older
	// tenant clusters.
	Logger        micrologger.Logger
	NodeCountFunc func(v interface{}) (int, error)
	// RESTClient needs to be configured with a serializer capable of serializing
	// and deserializing the object which is watched by the informer. Otherwise
	// deserialization will fail when trying to manage the cluster status.
	//
	// For standard k8s object this is going to be e.g.
	//
	//     k8sClient.CoreV1().RESTClient()
	//
	// For CRs of giantswarm this is going to be e.g.
	//
	//     g8sClient.CoreV1alpha1().RESTClient()
	//
	RESTClient               rest.Interface
	TenantCluster            tenantcluster.Interface
	VersionBundleVersionFunc func(v interface{}) (string, error)
}

type Status

type Status struct {
	Cluster providerv1alpha1.StatusCluster `json:"cluster" yaml:"cluster"`
}

Jump to

Keyboard shortcuts

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