Documentation
¶
Index ¶
- Variables
- func GetManagerInstance() *instance
- func InitializeManagerInstance(ctx context.Context, config *rest.Config, c client.Client, ...)
- func SetOIDCProxyConfig(host, caFile, apiServerHost string)
- func TransformHealthCheckReport() toolscache.TransformFunc
- type ClassifierDetails
- type ClassifierLabelEntry
- type ClassifierSummaries
- type ClassifierSummary
- type ClassifiersResult
- type ClusterEventMatch
- type ClusterFeatureSummary
- type ClusterHealthProfile
- type ClusterHealthResource
- type ClusterHealthResult
- type ClusterInfo
- type ClusterProfileStatus
- type ClusterResult
- type CreateProfileRequest
- type DeleteProfileRequest
- type DryRunHelmChange
- type DryRunResourceChange
- type DryRunResult
- type EventResourcesResult
- type EventResult
- type EventTrigger
- type EventTriggerDetails
- type EventTriggerInfo
- type EventTriggers
- type ExistingContentRef
- type HelmChartInput
- type HelmRelease
- type HelmReleaseResult
- type ManagedCluster
- type ManagedClusters
- type MatchingClusterEntry
- type MatchingClusters
- type Profile
- type ProfileIdentity
- type ProfileInfo
- type ProfileResult
- type ProfileStatusResult
- type Profiles
- type RemoteURLInput
- type Resource
- type ResourceResult
- type RolloutState
- type RolloutSummary
- type SecretReferenceInput
- type Stats
- type Token
- type UnManagedLabelEntry
- type UpdateProfileRequest
Constants ¶
This section is empty.
Variables ¶
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, apiServerHost 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. apiServerHost, when set, is sent as the Host header to the proxy: see oidcProxyAPIServerHost.
func TransformHealthCheckReport ¶ added in v1.17.0
func TransformHealthCheckReport() toolscache.TransformFunc
TransformHealthCheckReport is the cache transform for HealthCheckReports. On top of managed fields it drops the collected resources (ResourceStatuses[].Resource), the only large field: nothing here reads it.
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 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 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
// MatchingResourcesCount is the number of resources matching the EventSource in the cluster.
// The resources are served, paginated, by /eventResources.
MatchingResourcesCount int `json:"matchingResourcesCount"`
}
type ClusterFeatureSummary ¶
type ClusterFeatureSummary struct {
FeatureID libsveltosv1beta1.FeatureID `json:"featureID"`
Status libsveltosv1beta1.FeatureStatus `json:"status,omitempty"`
FailureMessage *string `json:"failureMessage,omitempty"`
// DriftHistory lists the resources deployed by this feature that drifted, the most recent first.
// Only set when the profile syncMode is ContinuousWithDriftDetection and a drift was detected.
DriftHistory *configv1beta1.DriftHistory `json:"driftHistory,omitempty"`
}
func MapToClusterFeatureSummaries ¶
func MapToClusterFeatureSummaries(featureSummaries *[]configv1beta1.FeatureSummary) []ClusterFeatureSummary
type ClusterHealthProfile ¶ added in v1.17.0
type ClusterHealthProfile struct {
Kind string `json:"kind"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name"`
}
ClusterHealthProfile identifies a profile owning the HealthCheck that reported a resource.
type ClusterHealthResource ¶ added in v1.17.0
type ClusterHealthResource struct {
Group string `json:"group"`
Version string `json:"version"`
Kind string `json:"kind"`
Namespace string `json:"namespace,omitempty"`
Name string `json:"name"`
Status libsveltosv1beta1.HealthStatus `json:"status"`
Message string `json:"message,omitempty"`
// Profiles are the profiles owning the HealthCheck that reported the resource.
Profiles []ClusterHealthProfile `json:"profiles"`
// HealthCheckName is the HealthCheck that reported the resource. Set only when no profile owns it.
HealthCheckName string `json:"healthCheckName,omitempty"`
}
ClusterHealthResource is a resource of a cluster that is not Healthy.
type ClusterHealthResult ¶ added in v1.17.0
type ClusterHealthResult struct {
// State is the health state of the cluster: NotEnabled (no profile has monitoring enabled and
// no health report exists), NoData, Healthy, Suspended, Progressing or Degraded.
State healthmonitoring.State `json:"state"`
TotalResources int `json:"totalResources"`
Resources []ClusterHealthResource `json:"resources"`
}
ClusterHealthResult is the response of /clusterHealth.
type ClusterInfo ¶
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 EventResourcesResult ¶ added in v1.17.0
type EventResourcesResult struct {
// TotalResources is the number of resources matching the filters, before pagination.
TotalResources int `json:"totalResources"`
Resources []Resource `json:"resources"`
}
EventResourcesResult is the response of /eventResources.
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 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"`
// HealthStatus is the health of the resources covered by health reports. Omitted when no
// profile matching the cluster has health monitoring enabled and no health report exists.
HealthStatus healthmonitoring.State `json:"healthStatus,omitempty"`
}
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"`
// RolloutState tells whether the cluster has the latest version of the profile.
// Empty when there is nothing to report (no rollout pending and cluster not paused).
RolloutState RolloutState `json:"rolloutState,omitempty"`
}
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"`
// Rollout counts the matching clusters per rollout state. Only set while a rollout is pending.
Rollout *RolloutSummary `json:"rollout,omitempty"`
// 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 ProfileStatusResult ¶
type ProfileStatusResult struct {
ProfileName string `json:"profileName"`
ProfileType string `json:"profileType"`
// HealthStatus is the health state of the profile on the cluster. Empty when health
// monitoring is not enabled for the profile.
HealthStatus healthmonitoring.State `json:"healthStatus,omitempty"`
ClusterFeatureSummary
}
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 RolloutState ¶ added in v1.17.0
type RolloutState string
RolloutState tells where a matching cluster is in the rollout of the latest profile version. A profile with maxUpdate set is not deployed to all matching clusters at once: only maxUpdate clusters are updated in parallel, the others wait for a free slot.
const ( // RolloutStateUpdated: the cluster runs the latest version of the profile RolloutStateUpdated RolloutState = "updated" // RolloutStateUpdating: the latest version of the profile is being deployed to the cluster RolloutStateUpdating RolloutState = "updating" // RolloutStateWaiting: the cluster is queued, maxUpdate clusters are already being updated RolloutStateWaiting RolloutState = "waiting" // RolloutStatePaused: the cluster is paused, the rollout skips it RolloutStatePaused RolloutState = "paused" // RolloutStateNotReady: the cluster is not ready to be configured, the rollout skips it RolloutStateNotReady RolloutState = "notReady" )
type RolloutSummary ¶ added in v1.17.0
type RolloutSummary struct {
// MaxUpdate is the number of clusters that can be updated in parallel. 0 when maxUpdate is not set.
MaxUpdate int `json:"maxUpdate"`
Updated int `json:"updated"`
Updating int `json:"updating"`
Waiting int `json:"waiting"`
Paused int `json:"paused"`
NotReady int `json:"notReady"`
}
RolloutSummary counts the matching clusters in each rollout state. It is only reported while a rollout is pending.
type SecretReferenceInput ¶ added in v1.16.0
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 UnManagedLabelEntry ¶ added in v1.13.0
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.