dextarget

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppTarget

type AppTarget struct {
	*v1alpha1.App
}

AppTarget wraps a Giant Swarm App CR to implement the DexTarget interface

func NewAppTarget

func NewAppTarget(app *v1alpha1.App) *AppTarget

NewAppTarget creates a new AppTarget wrapper

func (*AppTarget) AddSecretConfig

func (a *AppTarget) AddSecretConfig(secretName, secretNamespace string) error

func (*AppTarget) AttachSecretConfig added in v0.16.2

func (a *AppTarget) AttachSecretConfig(ctx context.Context, c client.Client) (bool, error)

func (*AppTarget) GetClusterLabel

func (a *AppTarget) GetClusterLabel() string

func (*AppTarget) GetClusterValuesConfigMapRef

func (a *AppTarget) GetClusterValuesConfigMapRef() (name, namespace string)

func (*AppTarget) GetNamespacedName

func (a *AppTarget) GetNamespacedName() types.NamespacedName

func (*AppTarget) GetObject

func (a *AppTarget) GetObject() client.Object

func (*AppTarget) GetOrganizationLabel

func (a *AppTarget) GetOrganizationLabel() string

func (*AppTarget) GetTargetType

func (a *AppTarget) GetTargetType() string

func (*AppTarget) HasClusterValuesConfig

func (a *AppTarget) HasClusterValuesConfig() bool

func (*AppTarget) HasSecretConfig

func (a *AppTarget) HasSecretConfig(secretName string) bool

func (*AppTarget) HasUserConfigWithConnectors

func (a *AppTarget) HasUserConfigWithConnectors(ctx context.Context, c client.Client) (bool, error)

func (*AppTarget) IsBeingDeleted

func (a *AppTarget) IsBeingDeleted() bool

func (*AppTarget) ManagesSecretConfig added in v0.16.2

func (a *AppTarget) ManagesSecretConfig() bool

ManagesSecretConfig returns true — for App CRs dex-operator injects the secret reference into spec.extraConfigs directly.

func (*AppTarget) RemoveSecretConfig

func (a *AppTarget) RemoveSecretConfig(secretName, secretNamespace string) error

type DexTarget

type DexTarget interface {
	client.Object

	// GetNamespacedName returns the namespaced name of the target
	GetNamespacedName() types.NamespacedName

	// GetClusterLabel returns the cluster label value if present
	GetClusterLabel() string

	// GetOrganizationLabel returns the organization label value if present
	GetOrganizationLabel() string

	// HasUserConfigWithConnectors returns true if the target has user-defined connector config
	// that should prevent dex-operator from managing connectors
	HasUserConfigWithConnectors(ctx context.Context, client client.Client) (bool, error)

	// HasClusterValuesConfig returns true if the target has a cluster values configmap reference
	HasClusterValuesConfig() bool

	// GetClusterValuesConfigMapRef returns the name and namespace of the cluster values configmap
	GetClusterValuesConfigMapRef() (name, namespace string)

	// HasSecretConfig returns true if the dex secret config is already present
	HasSecretConfig(secretName string) bool

	// AddSecretConfig adds the dex secret config reference to the target
	// For App CR: adds to .spec.extraConfigs with priority
	// For HelmRelease: adds to .spec.valuesFrom
	AddSecretConfig(secretName, secretNamespace string) error

	// RemoveSecretConfig removes the dex secret config reference from the target
	RemoveSecretConfig(secretName, secretNamespace string) error

	// IsBeingDeleted returns true if the target is being deleted
	IsBeingDeleted() bool

	// GetTargetType returns the type of the target ("App" or "HelmRelease")
	GetTargetType() string

	// GetObject returns the underlying Kubernetes object for use with client.Update
	// This is needed because the wrapper types don't have GVK registered in the scheme
	GetObject() client.Object

	// AttachSecretConfig persists the secret config reference added by AddSecretConfig
	// to the target. For App CRs and HelmReleases not managed by Flux, this performs a client Update;
	// for HelmRelease targets managed by Flux, this is a no-op.
	// Returns true if the target was actually modified.
	AttachSecretConfig(ctx context.Context, c client.Client) (bool, error)

	// ManagesSecretConfig returns true if dex-operator should inject and manage
	// the dex config secret reference directly on this target.
	// For App CR targets this is always true.
	// For HelmRelease targets it is true only if the HelmRelease is self-managed
	// (no Flux Kustomization labels) — Flux-managed HelmReleases must declare the
	// entry in their Git manifest to avoid SSA ownership conflicts.
	ManagesSecretConfig() bool
}

DexTarget is an interface that abstracts the common functionality between Giant Swarm App CRs and Flux HelmReleases for dex-operator configuration injection.

type HelmReleaseTarget

type HelmReleaseTarget struct {
	*helmv2.HelmRelease
}

HelmReleaseTarget wraps a Flux HelmRelease to implement the DexTarget interface

func NewHelmReleaseTarget

func NewHelmReleaseTarget(hr *helmv2.HelmRelease) *HelmReleaseTarget

NewHelmReleaseTarget creates a new HelmReleaseTarget wrapper

func (*HelmReleaseTarget) AddSecretConfig

func (h *HelmReleaseTarget) AddSecretConfig(secretName, secretNamespace string) error

func (*HelmReleaseTarget) AttachSecretConfig added in v0.16.2

func (h *HelmReleaseTarget) AttachSecretConfig(ctx context.Context, c client.Client) (bool, error)

AttachSecretConfig persists valuesFrom changes for self-managed HelmReleases via a plain Update. For Flux-managed HelmReleases this is a no-op — the entry must be declared in the Git-managed manifest to avoid Flux ownership conflicts. Returns true if the target was actually modified.

func (*HelmReleaseTarget) GetClusterLabel

func (h *HelmReleaseTarget) GetClusterLabel() string

func (*HelmReleaseTarget) GetClusterValuesConfigMapRef

func (h *HelmReleaseTarget) GetClusterValuesConfigMapRef() (name, namespace string)

func (*HelmReleaseTarget) GetNamespacedName

func (h *HelmReleaseTarget) GetNamespacedName() types.NamespacedName

func (*HelmReleaseTarget) GetObject

func (h *HelmReleaseTarget) GetObject() client.Object

func (*HelmReleaseTarget) GetOrganizationLabel

func (h *HelmReleaseTarget) GetOrganizationLabel() string

func (*HelmReleaseTarget) GetTargetType

func (h *HelmReleaseTarget) GetTargetType() string

func (*HelmReleaseTarget) HasClusterValuesConfig

func (h *HelmReleaseTarget) HasClusterValuesConfig() bool

func (*HelmReleaseTarget) HasSecretConfig

func (h *HelmReleaseTarget) HasSecretConfig(secretName string) bool

HasSecretConfig returns true if the dex config secret is referenced in valuesFrom.

func (*HelmReleaseTarget) HasUserConfigWithConnectors

func (h *HelmReleaseTarget) HasUserConfigWithConnectors(ctx context.Context, c client.Client) (bool, error)

func (*HelmReleaseTarget) IsBeingDeleted

func (h *HelmReleaseTarget) IsBeingDeleted() bool

func (*HelmReleaseTarget) ManagesSecretConfig added in v0.16.2

func (h *HelmReleaseTarget) ManagesSecretConfig() bool

ManagesSecretConfig returns true for self-managed HelmReleases (dex-operator can safely inject the valuesFrom entry) and false for Flux-managed ones (entry must be declared in the Git manifest to avoid SSA ownership conflicts).

func (*HelmReleaseTarget) RemoveSecretConfig

func (h *HelmReleaseTarget) RemoveSecretConfig(secretName, secretNamespace string) error

RemoveSecretConfig is a no-op for Flux-managed HelmRelease targets. For self-managed HelmReleases it removes the entry from valuesFrom in memory.

Jump to

Keyboard shortcuts

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