cilium

package
v0.20.4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DaemonSetName is the default name for the Cilium DS installed in EKS-A clusters.
	DaemonSetName = "cilium"
	// PreflightDaemonSetName is the default name for the Cilium preflight DS installed
	// in EKS-A clusters during Cilium upgrades.
	PreflightDaemonSetName = "cilium-pre-flight-check"
	// DeploymentName is the default name for the Cilium Operator installed in EKS-A clusters.
	DeploymentName = "cilium-operator"
	// PreflightDeploymentName is the default name for the Cilium preflight deployment used during upgrades.
	PreflightDeploymentName = "cilium-pre-flight-check"
	// ConfigMapName is the default name for the Cilium ConfigMap
	// containing Cilium's configuration.
	ConfigMapName = "cilium-config"
	// ServiceName is the default name for the Cilium Service installed in EKS-A clusters.
	ServiceName = "cilium-agent"
)
View Source
const (
	// PolicyEnforcementConfigMapKey is the key used in the "cilium-config" ConfigMap to
	// store the value for the PolicyEnforcementMode.
	PolicyEnforcementConfigMapKey = "enable-policy"

	// PolicyEnforcementComponentName is the ConfigComponentUpdatePlan name for the
	// PolicyEnforcement configuration component.
	PolicyEnforcementComponentName = "PolicyEnforcementMode"

	// EgressMasqueradeInterfacesMapKey is the key used in the "cilium-config" ConfigMap to
	// store the value for the EgressMasqueradeInterfaces.
	EgressMasqueradeInterfacesMapKey = "egress-masquerade-interfaces"

	// EgressMasqueradeInterfacesComponentName is the ConfigComponentUpdatePlan name for the
	// egressMasqueradeInterfaces configuration component.
	EgressMasqueradeInterfacesComponentName = "EgressMasqueradeInterfaces"
)

Variables

This section is empty.

Functions

func ChangeDiff

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

ChangeDiff returns the change diff between the current and new cluster specs.

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 Config added in v0.13.0

type Config struct {
	// AllowedNamespaces defines k8s namespaces from/which traffic is allowed
	// when PolicyEnforcementMode is Always. For other values of PolicyEnforcementMode
	// it is ignored.
	AllowedNamespaces []string

	// Spec is the complete EKS-A cluster definition
	Spec *cluster.Spec
}

Config defines a Cilium installation for an EKS-A cluster.

type ConfigComponentUpdatePlan added in v0.13.0

type ConfigComponentUpdatePlan struct {
	Name               string
	UpdateReason       string
	OldValue, NewValue string
}

ConfigComponentUpdatePlan contains update information for a Cilium config component.

type ConfigUpdatePlan added in v0.13.0

type ConfigUpdatePlan struct {
	UpdateReason string
	Components   []ConfigComponentUpdatePlan
}

ConfigUpdatePlan contains update information for the Cilium config.

func (ConfigUpdatePlan) Needed added in v0.13.0

func (c ConfigUpdatePlan) Needed() bool

Needed determines if an upgrade is needed or not.

type HelmClientFactory added in v0.17.6

type HelmClientFactory interface {
	Get(ctx context.Context, clus *anywherev1.Cluster) (helm.Client, error)
}

HelmClientFactory provides a helm client for a cluster.

type Installation added in v0.11.0

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

Installation is an installation of EKSA Cilium components.

func GetInstallation added in v0.16.0

func GetInstallation(ctx context.Context, client client.Client) (*Installation, error)

GetInstallation creates a new Installation instance. The returned installation's DaemonSet, Operator and ConfigMap fields will be nil if they could not be found within the target cluster.

func (Installation) Installed added in v0.11.0

func (i Installation) Installed() bool

Installed determines if all EKS-A Embedded Cilium components are present. It identifies EKS-A Embedded Cilium by the image name. If the ConfigMap doesn't exist we still considered Cilium is installed. The installation might not be complete but it can be functional.

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(helmFactory HelmClientFactory) *Templater

NewTemplater returns a new 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 VersionedComponentUpgradePlan
	Operator  VersionedComponentUpgradePlan
	ConfigMap ConfigUpdatePlan
}

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) ConfigUpdateNeeded added in v0.13.0

func (c UpgradePlan) ConfigUpdateNeeded() bool

ConfigUpdateNeeded determines if an upgrade is needed on the cilium config or not.

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.

func (UpgradePlan) VersionUpgradeNeeded added in v0.13.0

func (c UpgradePlan) VersionUpgradeNeeded() bool

VersionUpgradeNeeded determines if a version upgrade is needed or not Returns true if any of the installation components needs an upgrade.

type VersionedComponentUpgradePlan added in v0.13.0

type VersionedComponentUpgradePlan struct {
	UpgradeReason string
	OldImage      string
	NewImage      string
}

VersionedComponentUpgradePlan contains upgrade information for a Cilium versioned component.

func (VersionedComponentUpgradePlan) Needed added in v0.13.0

Needed determines if an upgrade is needed or not.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
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