Documentation
¶
Index ¶
Constants ¶
const ( // FeaturePullMode is the ability to manage cluster behing firewalls FeaturePullMode = Features("PullMode") // FeatureMCP is the ability to use Sveltos MCP Server FeatureMCP = Features("MCP") )
const ( PlanEnterprise = Plan("Enterprise") PlanEnterprisePlus = Plan("EnterprisePlus") )
Variables ¶
This section is empty.
Functions ¶
func GetPublicKey ¶
Types ¶
type Features ¶
type Features string
Features is all features requiring a license +kubebuilder:validation:Enum:=PullMode;MCP
type LicensePayload ¶
type LicensePayload struct {
// ID is a unique identifier for this specific license.
ID string `json:"id"`
// CustomerName is the name of the customer the license is issued to.
CustomerName string `json:"customerName"`
// Features is a list of feature strings enabled by this license.
Features []Features `json:"features"`
// Specify the type of plan
// +optional
Plan Plan `json:"plan,omitempty"`
// ExpirationDate is the exact time when the license expires.
ExpirationDate time.Time `json:"expirationDate"`
// GracePeriodDays specifies the number of days the license remains functional
// after its expiration date, during which warnings are issued.
// +optional
GracePeriodDays int `json:"gracePeriodDays,omitempty"`
// MaxClusters is the maximum number of clusters allowed for this license (optional).
// +optional
MaxClusters int `json:"maxClusters,omitempty"`
// IssuedAt is the timestamp when the license was generated and signed.
IssuedAt time.Time `json:"issuedAt"`
// ClusterFingerprint is a unique identifier derived from the target Kubernetes cluster.
// +optional
ClusterFingerprint string `json:"clusterFingerprint,omitempty"`
}
LicensePayload defines the internal structure of the data that gets signed and embedded within the Kubernetes Secret.
type LicenseVerificationResult ¶
type LicenseVerificationResult struct {
Payload *LicensePayload // The decoded license payload if found and unmarshaled
IsValid bool // True if license is fully valid
IsExpired bool // True if license is expired (either grace or enforced)
IsInGracePeriod bool // True if license is expired but within grace period
IsEnforced bool // True if license is expired and fully enforced
Message string // A human-readable message about the license status
RawError error // The underlying error (e.g., secret not found, unmarshal error, signature error)
}
LicenseVerificationResult encapsulates the outcome of the license verification.
func VerifyLicenseSecret ¶
func VerifyLicenseSecret(ctx context.Context, c client.Client, publicKey *rsa.PublicKey, logger logr.Logger) LicenseVerificationResult
VerifyLicenseSecret attempts to decode and verify the license secret. It returns a LicenseVerificationResult struct containing the license payload (if found) and various booleans indicating its validity status, along with a human-readable message. The RawError field will contain any technical errors encountered during the process. Requires permission to read Secret in projectsveltos namespace.