cilium

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DaemonSetName           = "cilium"
	PreflightDaemonSetName  = "cilium-pre-flight-check"
	DeploymentName          = "cilium-operator"
	PreflightDeploymentName = "cilium-pre-flight-check"
)

Variables

This section is empty.

Functions

func ChangeDiff

func ChangeDiff(currentSpec, newSpec *cluster.Spec) *types.ChangeDiff

func CheckDaemonSetReady added in v0.11.0

func CheckDaemonSetReady(daemonSet *v1.DaemonSet) error

func CheckDeploymentReady added in v0.11.0

func CheckDeploymentReady(deployment *v1.Deployment) error

func CheckPreflightDaemonSetReady added in v0.11.0

func CheckPreflightDaemonSetReady(ciliumDaemonSet, preflightDaemonSet *v1.DaemonSet) error

Types

type Cilium

type Cilium struct {
	*Upgrader
}

func NewCilium

func NewCilium(client Client, helm Helm) *Cilium

func (*Cilium) GenerateManifest

func (c *Cilium) GenerateManifest(ctx context.Context, clusterSpec *cluster.Spec, providerNamespaces []string) ([]byte, error)

type Client

type Client interface {
	ApplyKubeSpecFromBytes(ctx context.Context, cluster *types.Cluster, data []byte) error
	DeleteKubeSpecFromBytes(ctx context.Context, cluster *types.Cluster, data []byte) error
	GetDaemonSet(ctx context.Context, name, namespace, kubeconfig string) (*v1.DaemonSet, error)
	GetDeployment(ctx context.Context, name, namespace, kubeconfig string) (*v1.Deployment, error)
	RolloutRestartDaemonSet(ctx context.Context, name, namespace, kubeconfig string) error
}

type ComponentUpgradePlan added in v0.11.0

type ComponentUpgradePlan struct {
	UpgradeReason string
	OldImage      string
	NewImage      string
}

ComponentUpgradePlan contains upgrade information for a Cilium component

func (ComponentUpgradePlan) Needed added in v0.11.0

func (c ComponentUpgradePlan) Needed() bool

Needed determines if an upgrade is needed or not

type Helm

type Helm interface {
	Template(ctx context.Context, ociURI, version, namespace string, values interface{}, kubeVersion string) ([]byte, error)
}

type Installation added in v0.11.0

type Installation struct {
	DaemonSet *appsv1.DaemonSet
	Operator  *appsv1.Deployment
}

Installation represents the Cilium components installed in a cluster

func (Installation) Installed added in v0.11.0

func (i Installation) Installed() bool

Installed determines if all Cilium components are present

type ManifestConfig added in v0.11.0

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

type ManifestOpt added in v0.11.0

type ManifestOpt func(*ManifestConfig)

ManifestOpt allows to modify options for a cilium manifest

func WithKubeVersion added in v0.11.0

func WithKubeVersion(kubeVersion string) ManifestOpt

WithKubeVersion allows to generate the Cilium manifest for a different kubernetes version than the one specified in the cluster spec. Useful for upgrades scenarios where Cilium is upgraded before the kubernetes components

func WithPolicyAllowedNamespaces added in v0.11.0

func WithPolicyAllowedNamespaces(namespaces []string) ManifestOpt

WithPolicyAllowedNamespaces allows to specify which namespaces traffic should be allowed when using and "Always" policy enforcement mode

func WithRetrier added in v0.11.2

func WithRetrier(retrier *retrier.Retrier) ManifestOpt

WithRetrier introduced for optimizing unit tests

func WithUpgradeFromVersion added in v0.11.0

func WithUpgradeFromVersion(version semver.Version) ManifestOpt

WithUpgradeFromVersion allows to specify the compatibility Cilium version to use in the manifest. This is necessary for Cilium upgrades

type Templater

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

func NewTemplater

func NewTemplater(helm Helm) *Templater

func (*Templater) GenerateManifest

func (t *Templater) GenerateManifest(ctx context.Context, spec *cluster.Spec, opts ...ManifestOpt) ([]byte, error)

func (*Templater) GenerateNetworkPolicyManifest added in v0.8.0

func (t *Templater) GenerateNetworkPolicyManifest(spec *cluster.Spec, namespaces []string) ([]byte, error)

func (*Templater) GenerateUpgradePreflightManifest

func (t *Templater) GenerateUpgradePreflightManifest(ctx context.Context, spec *cluster.Spec) ([]byte, error)

type UpgradePlan added in v0.11.0

type UpgradePlan struct {
	DaemonSet ComponentUpgradePlan
	Operator  ComponentUpgradePlan
}

UpgradePlan contains information about a Cilium installation upgrade

func BuildUpgradePlan added in v0.11.0

func BuildUpgradePlan(installation *Installation, clusterSpec *cluster.Spec) UpgradePlan

BuildUpgradePlan generates the upgrade plan information for a cilium installation by comparing it with a desired cluster Spec

func (UpgradePlan) Needed added in v0.11.0

func (c UpgradePlan) Needed() bool

Needed determines if an upgrade is needed or not Returns true if any of the installation components needs an upgrade

func (UpgradePlan) Reason added in v0.11.0

func (c UpgradePlan) Reason() string

Reason returns the reason why an upgrade might be needed If no upgrade needed, returns empty string For multiple components with needed upgrades, it composes their reasons into one

type Upgrader

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

func NewUpgrader

func NewUpgrader(client Client, helm Helm) *Upgrader

func (*Upgrader) RunPostControlPlaneUpgradeSetup added in v0.9.1

func (u *Upgrader) RunPostControlPlaneUpgradeSetup(ctx context.Context, cluster *types.Cluster) error

func (*Upgrader) Upgrade

func (u *Upgrader) Upgrade(ctx context.Context, cluster *types.Cluster, currentSpec, newSpec *cluster.Spec, namespaces []string) (*types.ChangeDiff, error)

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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