server

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrProfileAlreadyExists is returned by createProfileObject when a ClusterProfile/Profile
	// with the requested identity already exists - both from the upfront existence check (the
	// common, fast-path case) and from a race lost against the actual Create call (rare, but the
	// existence check alone cannot be relied on: see ENHANCEMENTS/profile-creation-dashboard.md).
	ErrProfileAlreadyExists = errors.New("a profile with this identity already exists")

	// ErrInvalidRequest wraps every request-shape validation failure (bad Kind, missing required
	// field, more/fewer than one content flow set, ...) so handlers can map it to 400 Bad Request
	// with errors.Is, distinct from ErrProfileAlreadyExists (409) and apiserver errors (403/404/500).
	ErrInvalidRequest = errors.New("invalid request")
)

Functions

func GetManagerInstance

func GetManagerInstance() *instance

func InitializeManagerInstance

func InitializeManagerInstance(ctx context.Context, config *rest.Config, c client.Client,
	scheme *runtime.Scheme, port string, logger logr.Logger)

InitializeManagerInstance initializes manager instance

func SetOIDCProxyConfig added in v1.16.0

func SetOIDCProxyConfig(host, caFile string)

SetOIDCProxyConfig configures the OIDC-aware proxy (e.g. kube-oidc-proxy) that getKubernetesRestConfig routes the dashboard user's own bearer token to. Must be called after InitializeManagerInstance. A no-op (falling back to config.Host and the API server's own CA) when host is left empty, which is the default when no proxy is in front of the API server.

Types

type ClassifierDetails added in v1.13.0

type ClassifierDetails struct {
	Name string `json:"name"`
	// Type is either Classifier or ManagementClusterClassifier
	Type string `json:"type"`

	// Classifier-only
	ResourceSelectors            []libsveltosv1beta1.ResourceSelector            `json:"resourceSelectors,omitempty"`
	AggregatedClassification     string                                          `json:"aggregatedClassification,omitempty"`
	KubernetesVersionConstraints []libsveltosv1beta1.KubernetesVersionConstraint `json:"kubernetesVersionConstraints,omitempty"`

	// ManagementClusterClassifier-only
	MatchResources    []libsveltosv1beta1.ResourceSelector `json:"matchResources,omitempty"`
	ClassificationLua string                               `json:"classificationLua,omitempty"`

	// shared
	ClassifierLabels []ClassifierLabelEntry `json:"classifierLabels"`
	MatchingClusters []MatchingClusterEntry `json:"matchingClusters"`
}

type ClassifierLabelEntry added in v1.13.0

type ClassifierLabelEntry struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type ClassifierSummaries added in v1.13.0

type ClassifierSummaries []ClassifierSummary

func (ClassifierSummaries) Len added in v1.13.0

func (s ClassifierSummaries) Len() int

func (ClassifierSummaries) Less added in v1.13.0

func (s ClassifierSummaries) Less(i, j int) bool

func (ClassifierSummaries) Swap added in v1.13.0

func (s ClassifierSummaries) Swap(i, j int)

type ClassifierSummary added in v1.13.0

type ClassifierSummary struct {
	Name string `json:"name"`
	// Type is either Classifier or ManagementClusterClassifier
	Type                 string `json:"type"`
	LabelCount           int    `json:"labelCount"`
	MatchingClusterCount int    `json:"matchingClusterCount"`
}

type ClassifiersResult added in v1.13.0

type ClassifiersResult struct {
	TotalClassifiers int                 `json:"totalClassifiers"`
	Classifiers      []ClassifierSummary `json:"classifiers"`
}

type ClusterEventMatch added in v1.4.0

type ClusterEventMatch struct {
	ClusterNamespace string `json:"clusterNamespace"`
	ClusterName      string `json:"clusterName"`
	ClusterKind      string `json:"clusterKind"`
	ClusterInfo
	Resources []Resource `json:"resources,omitempty"`
}

type ClusterFeatureSummary

type ClusterFeatureSummary struct {
	FeatureID      libsveltosv1beta1.FeatureID     `json:"featureID"`
	Status         libsveltosv1beta1.FeatureStatus `json:"status,omitempty"`
	FailureMessage *string                         `json:"failureMessage,omitempty"`
}

func MapToClusterFeatureSummaries

func MapToClusterFeatureSummaries(featureSummaries *[]configv1beta1.FeatureSummary) []ClusterFeatureSummary

type ClusterInfo

type ClusterInfo struct {
	Labels         map[string]string `json:"labels"`
	Version        string            `json:"version"`
	Ready          bool              `json:"ready"`
	Paused         bool              `json:"paused"`
	PullMode       bool              `json:"pullMode"`
	FailureMessage *string           `json:"failureMessage"`
}

type ClusterProfileStatus

type ClusterProfileStatus struct {
	ProfileName string                        `json:"profileName"`
	ProfileType string                        `json:"profileType"`
	Namespace   string                        `json:"namespace"`
	ClusterType libsveltosv1beta1.ClusterType `json:"clusterType"`
	ClusterName string                        `json:"clusterName"`
	Summary     []ClusterFeatureSummary       `json:"summary"`
	// Dependencies is the human-readable status from ClusterSummary.Status.Dependencies.
	// Non-empty means the ClusterSummary is waiting for one or more dependencies.
	Dependencies string `json:"dependencies,omitempty"`
}

type ClusterResult

type ClusterResult struct {
	TotalClusters   int             `json:"totalClusters"`
	ManagedClusters ManagedClusters `json:"managedClusters"`
}

type CreateProfileRequest added in v1.16.0

type CreateProfileRequest struct {
	ProfileIdentity
	ClusterSelector map[string]string   `json:"clusterSelector"`
	Tier            *int32              `json:"tier,omitempty"`
	DependsOn       []string            `json:"dependsOn,omitempty"`
	HelmChart       *HelmChartInput     `json:"helmChart,omitempty"`
	YAML            *string             `json:"yaml,omitempty"`
	ExistingContent *ExistingContentRef `json:"existingContent,omitempty"`
	RemoteURL       *RemoteURLInput     `json:"remoteURL,omitempty"`
}

CreateProfileRequest is the body of POST /profile. Exactly one of HelmChart, YAML, ExistingContent or RemoteURL must be set.

type DeleteProfileRequest added in v1.16.0

type DeleteProfileRequest struct {
	ProfileIdentity
	RemoveReferencedContent bool `json:"removeReferencedContent,omitempty"`
}

DeleteProfileRequest is the body of DELETE /profile.

type DryRunHelmChange added in v1.9.0

type DryRunHelmChange struct {
	ReleaseName      string `json:"releaseName"`
	ReleaseNamespace string `json:"releaseNamespace"`
	ChartVersion     string `json:"chartVersion,omitempty"`
	Action           string `json:"action"`
	Message          string `json:"message,omitempty"`
}

DryRunHelmChange describes a simulated Helm release action.

type DryRunResourceChange added in v1.9.0

type DryRunResourceChange struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace,omitempty"`
	Group     string `json:"group,omitempty"`
	Kind      string `json:"kind"`
	Version   string `json:"version"`
	Action    string `json:"action"`
	Message   string `json:"message,omitempty"`
}

DryRunResourceChange describes a simulated Kubernetes resource action.

type DryRunResult added in v1.9.0

type DryRunResult struct {
	ProfileName string `json:"profileName"`
	ProfileKind string `json:"profileKind"`
	// Namespace is only set for namespaced Profile resources.
	Namespace string `json:"namespace,omitempty"`
	// HasChanges is true when at least one actionable change was found.
	HasChanges bool `json:"hasChanges"`
	// ReportMissing is true when no ClusterReport exists yet.
	ReportMissing      bool                   `json:"reportMissing,omitempty"`
	HelmReleaseChanges []DryRunHelmChange     `json:"helmReleaseChanges,omitempty"`
	ResourceChanges    []DryRunResourceChange `json:"resourceChanges,omitempty"`
	KustomizeChanges   []DryRunResourceChange `json:"kustomizeChanges,omitempty"`
}

DryRunResult holds the simulated changes for a profile+cluster pair. ReportMissing is true when the controller has not yet generated a ClusterReport for this profile (e.g. the profile was just created).

type EventResult added in v1.4.0

type EventResult struct {
	TotalEvents   int            `json:"totalEvents"`
	EventTriggers []EventTrigger `json:"eventTriggers"`
}

type EventTrigger added in v1.4.0

type EventTrigger struct {
	// Name of the profile
	Name string `json:"name"`
	// Number of Matching clusters
	MatchingClusters int `json:"matchingClusters"`
}

type EventTriggerDetails added in v1.4.0

type EventTriggerDetails struct {
	EventTriggerName    string                         `json:"eventTriggerName"`
	ClusterSelector     libsveltosv1beta1.Selector     `json:"clusterSelector"`
	EventSource         *libsveltosv1beta1.EventSource `json:"eventSource,omitempty"`
	ClusterEventMatches []ClusterEventMatch            `json:"clusterEventMatches,omitempty"`
}

type EventTriggerInfo added in v1.4.0

type EventTriggerInfo struct {
	ClusterSelector libsveltosv1beta1.Selector `json:"clusterSelector"`

	MatchingClusters []corev1.ObjectReference `json:"matchingClusters"`
}

type EventTriggers added in v1.4.0

type EventTriggers []EventTrigger

func (EventTriggers) Len added in v1.4.0

func (s EventTriggers) Len() int

func (EventTriggers) Less added in v1.4.0

func (s EventTriggers) Less(i, j int) bool

func (EventTriggers) Swap added in v1.4.0

func (s EventTriggers) Swap(i, j int)

type ExistingContentRef added in v1.16.0

type ExistingContentRef struct {
	Kind      string `json:"kind"`
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
}

ExistingContentRef points a profile's PolicyRefs at a ConfigMap/Secret that already exists, instead of creating a new one - the deliberate, first-class way to share content across profiles (see ENHANCEMENTS/profile-creation-dashboard.md for why this replaced an earlier OwnerReference-based ownership-tracking design).

type HelmChartInput added in v1.16.0

type HelmChartInput struct {
	RepositoryURL    string `json:"repositoryURL"`
	RepositoryName   string `json:"repositoryName,omitempty"`
	ChartName        string `json:"chartName,omitempty"`
	ChartVersion     string `json:"chartVersion,omitempty"`
	ReleaseNamespace string `json:"releaseNamespace"`
	ReleaseName      string `json:"releaseName"`
	Values           string `json:"values,omitempty"`
}

HelmChartInput is the subset of configv1beta1.HelmChart the Create form exposes.

type HelmRelease

type HelmRelease struct {
	// RepoURL URL of the repo containing the helm chart deployed
	// in the Cluster.
	// +kubebuilder:validation:MinLength=1
	RepoURL string `json:"repoURL"`

	// ReleaseName name of the release deployed in the Cluster.
	// +kubebuilder:validation:MinLength=1
	ReleaseName string `json:"releaseName"`

	// Namespace where chart is deployed in the Cluster.
	Namespace string `json:"namespace"`

	// ChartVersion is the version of the helm chart deployed in the Cluster.
	ChartVersion string `json:"chartVersion"`

	// The URL to an icon file.
	Icon string `json:"icon"`

	// LastAppliedTime identifies when this resource was last applied to the cluster.
	LastAppliedTime *metav1.Time `json:"lastAppliedTime"`

	// ProfileName is the name of the ClusterProfile/Profile that
	// caused the helm chart to be deployed
	ProfileName string `json:"profileName"`

	// LatestVersion is the highest version currently published upstream for this chart, only
	// set when it is newer than ChartVersion. Populated by addon-controller's periodic
	// outdated-Helm-chart check, independent of this release's own deployment status.
	// +optional
	LatestVersion string `json:"latestVersion,omitempty"`

	// LatestPatchVersion is the highest published version sharing ChartVersion's major/minor
	// line, only set when it is newer than ChartVersion.
	// +optional
	LatestPatchVersion string `json:"latestPatchVersion,omitempty"`

	// LastCheckedTime is when LatestVersion/LatestPatchVersion were last evaluated. Absent
	// means this release has not been checked yet.
	// +optional
	LastCheckedTime *metav1.Time `json:"lastCheckedTime,omitempty"`
}

type HelmReleaseResult

type HelmReleaseResult struct {
	TotalHelmReleases int           `json:"totalHelmReleases"`
	HelmReleases      []HelmRelease `json:"helmReleases"`
}

type ManagedCluster

type ManagedCluster struct {
	Namespace             string `json:"namespace"`
	Name                  string `json:"name"`
	ClusterInfo           `json:"clusterInfo"`
	HasIssues             bool `json:"hasIssues"`
	IsProvisioning        bool `json:"isProvisioning"`
	HasOutdatedHelmCharts bool `json:"hasOutdatedHelmCharts"`
}

type ManagedClusters

type ManagedClusters []ManagedCluster

func (ManagedClusters) Len

func (s ManagedClusters) Len() int

func (ManagedClusters) Less

func (s ManagedClusters) Less(i, j int) bool

func (ManagedClusters) Swap

func (s ManagedClusters) Swap(i, j int)

type MatchingClusterEntry added in v1.13.0

type MatchingClusterEntry struct {
	ClusterNamespace string                 `json:"clusterNamespace"`
	ClusterName      string                 `json:"clusterName"`
	ClusterType      string                 `json:"clusterType"`
	ManagedLabels    []ClassifierLabelEntry `json:"managedLabels,omitempty"`
	ConflictedLabels []UnManagedLabelEntry  `json:"conflictedLabels,omitempty"`
}

type MatchingClusters added in v0.45.0

type MatchingClusters struct {
	Cluster                 corev1.ObjectReference  `json:"cluster"`
	ClusterFeatureSummaries []ClusterFeatureSummary `json:"clusterFeatureSummaries"`
}

type Profile added in v0.42.0

type Profile struct {
	// Kind of the profile (ClusterProfile vs Profile)
	Kind string `json:"kind"`
	// Namespace of the profile (empty for ClusterProfile)
	Namespace string `json:"namespace"`
	// Name of the profile
	Name string `json:"name"`
	// List of profiles this profile depends on
	Dependencies []corev1.ObjectReference `json:"dependencies"`
	// List of profiles that depend on this profile
	Dependents []corev1.ObjectReference `json:"dependents"`
	// List of managed clusters matching this profile
	MatchingClusters []MatchingClusters `json:"matchingClusters"`
	// Profile's Spec section
	Spec configv1beta1.Spec `json:"spec"`
}

type ProfileIdentity added in v1.16.0

type ProfileIdentity struct {
	Kind      string `json:"kind"`
	Namespace string `json:"namespace,omitempty"`
	Name      string `json:"name"`
}

ProfileIdentity is the (Kind, Namespace, Name) triple identifying a ClusterProfile or Profile. Namespace is required for Profile and must be empty for ClusterProfile. Mirrors the existing Kind/Namespace convention from GET /profile (Profile.Kind in profiles.go).

type ProfileInfo added in v0.42.0

type ProfileInfo struct {
	// Tier is the ClusterProfile/Profile tier
	Tier int32 `json:"tier"`

	ClusterSelector libsveltosv1beta1.Selector `json:"clusterSelector"`

	// Dependencies is the list of ClusterProfile/Profile dependency's names
	Dependencies *libsveltosset.Set `json:"dependencies"`

	// Dependents is the list of ClusterProfile/Profile dependent's names
	Dependents *libsveltosset.Set `json:"dependents"`

	// SyncMode specifies how features are synced in a matching workload cluster.
	SyncMode configv1beta1.SyncMode `json:"syncMode"`
}

type ProfileResult added in v0.42.0

type ProfileResult struct {
	TotalProfiles int      `json:"totalProfiles"`
	Profiles      Profiles `json:"profiles"`
}

type ProfileStatusResult

type ProfileStatusResult struct {
	ProfileName string `json:"profileName"`
	ProfileType string `json:"profileType"`
	ClusterFeatureSummary
}

type Profiles added in v0.42.0

type Profiles []Profile

func (Profiles) Len added in v0.42.0

func (s Profiles) Len() int

func (Profiles) Less added in v0.42.0

func (s Profiles) Less(i, j int) bool

func (Profiles) Swap added in v0.42.0

func (s Profiles) Swap(i, j int)

type RemoteURLInput added in v1.16.0

type RemoteURLInput struct {
	URL                   string                `json:"url"`
	Interval              string                `json:"interval,omitempty"`
	SecretRef             *SecretReferenceInput `json:"secretRef,omitempty"`
	Template              bool                  `json:"template,omitempty"`
	InsecureSkipTLSVerify bool                  `json:"insecureSkipTLSVerify,omitempty"`
	PlainHTTP             bool                  `json:"plainHTTP,omitempty"`
}

RemoteURLInput is the subset of configv1beta1.RemoteURL the Create form exposes: an HTTP(S)/OCI source PolicyRefs fetch directly, with no ConfigMap/Secret created for it. Interval is a Go duration string (e.g. "5m"); left empty, the CRD's own default applies.

type Resource

type Resource struct {
	// Name of the resource deployed in the Cluster.
	// +kubebuilder:validation:MinLength=1
	Name string `json:"name"`

	// Namespace of the resource deployed in the Cluster.
	// Empty for resources scoped at cluster level.
	// +optional
	Namespace string `json:"namespace,omitempty"`

	// Group of the resource deployed in the Cluster.
	Group string `json:"group"`

	// Kind of the resource deployed in the Cluster.
	// +kubebuilder:validation:MinLength=1
	Kind string `json:"kind"`

	// Version of the resource deployed in the Cluster.
	// +kubebuilder:validation:MinLength=1
	Version string `json:"version"`

	// LastAppliedTime identifies when this resource was last applied to the cluster.
	// +optional
	LastAppliedTime *metav1.Time `json:"lastAppliedTime,omitempty"`

	// ProfileNames is a slice of the names of the ClusterProfile/Profile instances
	// that caused the helm chart to be deployed
	ProfileNames []string `json:"profileNames"`
}

type ResourceResult

type ResourceResult struct {
	TotalResources int        `json:"totalResources"`
	Resources      []Resource `json:"resources"`
}

type SecretReferenceInput added in v1.16.0

type SecretReferenceInput struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
}

SecretReferenceInput identifies an existing Secret by namespace and name. Like ExistingContentRef, this only references a Secret the caller has already created - the dashboard does not create or edit credentials.

type Stats added in v1.9.0

type Stats struct {
	CAPIClusters                 int `json:"capiClusters"`
	NotReadyCAPIClusters         int `json:"notReadyCAPIClusters"`
	SveltosClusters              int `json:"sveltosClusters"`
	NotReadySveltosClusters      int `json:"notReadySveltosClusters"`
	PullModeClusters             int `json:"pullModeClusters"`
	ClusterProfiles              int `json:"clusterProfiles"`
	Profiles                     int `json:"profiles"`
	ClusterSummaries             int `json:"clusterSummaries"`
	EventTriggers                int `json:"eventTriggers"`
	Classifiers                  int `json:"classifiers"`
	ManagementClusterClassifiers int `json:"managementClusterClassifiers"`
}

Stats holds counts of Sveltos resources accessible to the requesting user.

type Token added in v0.40.0

type Token struct {
	Value string `json:"token,omitempty"`
}

type UnManagedLabelEntry added in v1.13.0

type UnManagedLabelEntry struct {
	Key            string `json:"key"`
	FailureMessage string `json:"failureMessage,omitempty"`
}

type UpdateProfileRequest added in v1.16.0

type UpdateProfileRequest struct {
	ProfileIdentity
	SpecYAML          string            `json:"specYAML"`
	ReferencedContent map[string]string `json:"referencedContent,omitempty"`
}

UpdateProfileRequest is the body of PUT /profile. SpecYAML replaces the object's entire Spec. ReferencedContent optionally updates the data of ConfigMaps/Secrets the edited Spec's PolicyRefs point at, keyed by name.

Jump to

Keyboard shortcuts

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