v1alpha1

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

+groupName=supervisor.appscode.com

Package v1alpha1 contains API Schema definitions for the supervisor v1alpha1 API group +kubebuilder:object:generate=true +groupName=supervisor.appscode.com

Index

Constants

View Source
const (
	ResourceKindApprovalPolicy = "ApprovalPolicy"
	ResourceApprovalPolicy     = "approvalpolicy"
	ResourceApprovalPolicies   = "approvalpolicies"
)
View Source
const (
	TestEnvKey = "APPSCODE_SUPERVISOR_TEST"
	TestEnvVal = "TRUE"
)
View Source
const (
	ResourceKindClusterMaintenanceWindow = "ClusterMaintenanceWindow"
	ResourceClusterMaintenanceWindow     = "clustermaintenancewindow"
	ResourceClusterMaintenanceWindows    = "clustermaintenancewindows"
)
View Source
const (
	DefaultMaintenanceWindowKey        = "supervisor.appscode.com/is-default-maintenance-window"
	DefaultClusterMaintenanceWindowKey = "supervisor.appscode.com/is-default-cluster-maintenance-window"
	DefaultBackoffLimit                = 5
)
View Source
const (
	SuccessfullyCreatedOperation  = "SuccessfullyCreatedOperation"
	SuccessfullyExecutedOperation = "SuccessfullyExecutedOperation"
	OperationFailed               = "OperationFailed"
	BackoffLimitExceeded          = "BackoffLimitExceeded"
	WaitingForApproval            = "WaitingForApproval"
	WaitingForExecution           = "WaitingForExecution"
	WaitingForMaintenanceWindow   = "WaitingForMaintenanceWindow"
	StartedExecutingOperation     = "StartedExecutingOperation"
	RecommendationRejected        = "RecommendationRejected"
	RecommendationOutdated        = "RecommendationOutdated"
)

List of Condition and Phase reasons

View Source
const (
	ResourceKindMaintenanceWindow = "MaintenanceWindow"
	ResourceMaintenanceWindow     = "maintenancewindow"
	ResourceMaintenanceWindows    = "maintenancewindows"
)
View Source
const (
	ResourceKindRecommendation = "Recommendation"
	ResourceRecommendation     = "recommendation"
	ResourceRecommendations    = "recommendations"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "supervisor.appscode.com", Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

func GetClock

func GetClock() clockwork.Clock

func SetupWebhookClient added in v0.0.2

func SetupWebhookClient(c client.Client)

Types

type ApprovalPolicy

type ApprovalPolicy struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	// Specifies MaintenanceWindow reference for ApprovalPolicy.
	// Recommendation will be executed in this MaintenanceWindow without manual approval.
	MaintenanceWindowRef kmapi.TypedObjectReference `json:"maintenanceWindowRef"`

	// Specifies the list of TargetRef for which the ApprovalPolicy will be effective for.
	// +optional
	Targets []TargetRef `json:"targets"`
}

ApprovalPolicy is the Schema for the approvalpolicies API

func (ApprovalPolicy) CustomResourceDefinition

func (_ ApprovalPolicy) CustomResourceDefinition() *apiextensions.CustomResourceDefinition

func (*ApprovalPolicy) DeepCopy

func (in *ApprovalPolicy) DeepCopy() *ApprovalPolicy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApprovalPolicy.

func (*ApprovalPolicy) DeepCopyInto

func (in *ApprovalPolicy) DeepCopyInto(out *ApprovalPolicy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ApprovalPolicy) DeepCopyObject

func (in *ApprovalPolicy) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ApprovalPolicyList

type ApprovalPolicyList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []ApprovalPolicy `json:"items"`
}

ApprovalPolicyList contains a list of ApprovalPolicy

func (*ApprovalPolicyList) DeepCopy

func (in *ApprovalPolicyList) DeepCopy() *ApprovalPolicyList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApprovalPolicyList.

func (*ApprovalPolicyList) DeepCopyInto

func (in *ApprovalPolicyList) DeepCopyInto(out *ApprovalPolicyList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ApprovalPolicyList) DeepCopyObject

func (in *ApprovalPolicyList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type ApprovalStatus

type ApprovalStatus string

+kubebuilder:validation:Enum=Pending;Approved;Rejected

const (
	ApprovalPending  ApprovalStatus = "Pending"
	ApprovalApproved ApprovalStatus = "Approved"
	ApprovalRejected ApprovalStatus = "Rejected"
)

type ApprovedWindow

type ApprovedWindow struct {
	// Window defines the ApprovedWindow type
	// Possible values are:
	// Immediate: Recommendation will be executed immediately
	// NextAvailable: Recommendation will be executed in the next Available window
	// SpecificDates: Recommendation will be executed in the given dates.
	Window WindowType `json:"window,omitempty"`

	// MaintenanceWindow holds the reference of the MaintenanceWindow resource
	// +optional
	MaintenanceWindow *kmapi.TypedObjectReference `json:"maintenanceWindow,omitempty"`

	// Dates holds a list of DateWindow when Recommendation is permitted to execute
	// +optional
	Dates []DateWindow `json:"dates,omitempty"`
}

ApprovedWindow Scenarios:

Scenario 1: User provides nothing and default MaintenanceWindow will be used. If any default window(cluster scoped or namespaced) is not found,

Recommendation will be in `Pending` state and waiting for maintenance window to be created.
Default MaintenanceWindow Priority: NamespaceScoped > ClusterScoped.
Note: If NamespaceScoped default MaintenanceWindow is found, ClusterScoped default MaintenanceWindow is skipped(if any).

Scenario 2: User provides window type `Immediate` and ops request will be created immediately.

Scenario 3: User provides a specific MaintenanceWindow and that will be used or an error will be thrown if given MaintenanceWindow is not found.

Scenario 4: User provides window type `NextAvailable` and the ops request will be executed in the next available MaintenanceWindow.

Firstly, next namespace scoped available window will be used. If there is no MaintenanceWindow is found in the same namespace
then next available ClusterMaintenanceWindow will be used.
If there is no available Window is found in that time, Recommendation will be in `Pending` state and waiting for maintenance window
to be created.

Scenario 5: User provides window type `SpecificDates`. In this case, user must provide at least one DateWindows in the dates field.

Otherwise controller will throw an error. DateWindow is only be used for window type `SpecificDates`

func (*ApprovedWindow) DeepCopy

func (in *ApprovedWindow) DeepCopy() *ApprovedWindow

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApprovedWindow.

func (*ApprovedWindow) DeepCopyInto

func (in *ApprovedWindow) DeepCopyInto(out *ApprovedWindow)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type CVEReport added in v0.0.2

type CVEReport struct {
	Count           map[string]int  `json:"count,omitempty"`
	Vulnerabilities []Vulnerability `json:"vulnerabilities,omitempty"`
}

func (*CVEReport) DeepCopy added in v0.0.4

func (in *CVEReport) DeepCopy() *CVEReport

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CVEReport.

func (*CVEReport) DeepCopyInto added in v0.0.4

func (in *CVEReport) DeepCopyInto(out *CVEReport)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ClusterMaintenanceWindow

type ClusterMaintenanceWindow struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   MaintenanceWindowSpec   `json:"spec,omitempty"`
	Status MaintenanceWindowStatus `json:"status,omitempty"`
}

ClusterMaintenanceWindow is the Schema for the clustermaintenancewindows API

func (ClusterMaintenanceWindow) CustomResourceDefinition

func (_ ClusterMaintenanceWindow) CustomResourceDefinition() *apiextensions.CustomResourceDefinition

func (*ClusterMaintenanceWindow) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterMaintenanceWindow.

func (*ClusterMaintenanceWindow) DeepCopyInto

func (in *ClusterMaintenanceWindow) DeepCopyInto(out *ClusterMaintenanceWindow)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClusterMaintenanceWindow) DeepCopyObject

func (in *ClusterMaintenanceWindow) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*ClusterMaintenanceWindow) Default

func (r *ClusterMaintenanceWindow) Default()

Default implements webhook.Defaulter so a webhook will be registered for the type

func (*ClusterMaintenanceWindow) ValidateCreate

func (r *ClusterMaintenanceWindow) ValidateCreate() (admission.Warnings, error)

ValidateCreate implements webhook.Validator so a webhook will be registered for the type

func (*ClusterMaintenanceWindow) ValidateDelete

func (r *ClusterMaintenanceWindow) ValidateDelete() (admission.Warnings, error)

ValidateDelete implements webhook.Validator so a webhook will be registered for the type

func (*ClusterMaintenanceWindow) ValidateUpdate

ValidateUpdate implements webhook.Validator so a webhook will be registered for the type

type ClusterMaintenanceWindowList

type ClusterMaintenanceWindowList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []ClusterMaintenanceWindow `json:"items"`
}

ClusterMaintenanceWindowList contains a list of ClusterMaintenanceWindow

func (*ClusterMaintenanceWindowList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterMaintenanceWindowList.

func (*ClusterMaintenanceWindowList) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ClusterMaintenanceWindowList) DeepCopyObject

func (in *ClusterMaintenanceWindowList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type DateWindow

type DateWindow struct {
	Start metav1.Time `json:"start"`
	End   metav1.Time `json:"end"`
}

func (*DateWindow) DeepCopy

func (in *DateWindow) DeepCopy() *DateWindow

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DateWindow.

func (*DateWindow) DeepCopyInto

func (in *DateWindow) DeepCopyInto(out *DateWindow)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type DayOfWeek

type DayOfWeek string

+kubebuilder:validation:Enum=Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday

const (
	Sunday    DayOfWeek = "Sunday"
	Monday    DayOfWeek = "Monday"
	Tuesday   DayOfWeek = "Tuesday"
	Wednesday DayOfWeek = "Wednesday"
	Thursday  DayOfWeek = "Thursday"
	Friday    DayOfWeek = "Friday"
	Saturday  DayOfWeek = "Saturday"
)

type MaintenanceWindow

type MaintenanceWindow struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   MaintenanceWindowSpec   `json:"spec,omitempty"`
	Status MaintenanceWindowStatus `json:"status,omitempty"`
}

MaintenanceWindow is the Schema for the maintenancewindows API

func (MaintenanceWindow) CustomResourceDefinition

func (_ MaintenanceWindow) CustomResourceDefinition() *apiextensions.CustomResourceDefinition

func (*MaintenanceWindow) DeepCopy

func (in *MaintenanceWindow) DeepCopy() *MaintenanceWindow

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MaintenanceWindow.

func (*MaintenanceWindow) DeepCopyInto

func (in *MaintenanceWindow) DeepCopyInto(out *MaintenanceWindow)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*MaintenanceWindow) DeepCopyObject

func (in *MaintenanceWindow) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*MaintenanceWindow) Default

func (r *MaintenanceWindow) Default()

Default implements webhook.Defaulter so a webhook will be registered for the type

func (*MaintenanceWindow) ValidateCreate

func (r *MaintenanceWindow) ValidateCreate() (admission.Warnings, error)

ValidateCreate implements webhook.Validator so a webhook will be registered for the type

func (*MaintenanceWindow) ValidateDelete

func (r *MaintenanceWindow) ValidateDelete() (admission.Warnings, error)

ValidateDelete implements webhook.Validator so a webhook will be registered for the type

func (*MaintenanceWindow) ValidateUpdate

func (r *MaintenanceWindow) ValidateUpdate(old runtime.Object) (admission.Warnings, error)

ValidateUpdate implements webhook.Validator so a webhook will be registered for the type

type MaintenanceWindowList

type MaintenanceWindowList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []MaintenanceWindow `json:"items"`
}

MaintenanceWindowList contains a list of MaintenanceWindow

func (*MaintenanceWindowList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MaintenanceWindowList.

func (*MaintenanceWindowList) DeepCopyInto

func (in *MaintenanceWindowList) DeepCopyInto(out *MaintenanceWindowList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*MaintenanceWindowList) DeepCopyObject

func (in *MaintenanceWindowList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type MaintenanceWindowSpec

type MaintenanceWindowSpec struct {
	// +optional
	IsDefault bool `json:"isDefault,omitempty"`
	// If the Timezone is not set or "" or "UTC", the given times and dates are considered as UTC.
	// If the name is "Local", the given times and dates are considered as server local timezone.
	//
	// Otherwise, the Timezone should specify a location name corresponding to a file
	// in the IANA Time Zone database, such as "Asia/Dhaka", "America/New_York", .
	// Ref: https://www.iana.org/time-zones
	//      https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
	// +optional
	Timezone *string `json:"timezone,omitempty"`
	// Days consists of a map of DayOfWeek and corresponding list of TimeWindow.
	// There is `Logical OR` relationship between Days and Dates.
	// Example:
	//  days:
	//    Monday:
	//     - start: 10:40AM
	//       end: 7:00PM
	// +optional
	Days map[DayOfWeek][]TimeWindow `json:"days,omitempty"`
	// Dates consists of a list of Dates as Maintenance time.
	// Dates are always needed to be given in UTC format.
	// Format: yyyy-mm-ddThh.mm.ssZ [Here Z stands for Zero time zone / UTC time zone / GMT (+0000)]
	// Example:
	//  dates:
	//   - start: 2022-01-24T00:00:18Z
	//     end: 2022-01-24T23:41:18Z
	// +optional
	Dates []DateWindow `json:"dates,omitempty"`
}

MaintenanceWindowSpec defines the desired state of MaintenanceWindow

func (*MaintenanceWindowSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MaintenanceWindowSpec.

func (*MaintenanceWindowSpec) DeepCopyInto

func (in *MaintenanceWindowSpec) DeepCopyInto(out *MaintenanceWindowSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MaintenanceWindowStatus

type MaintenanceWindowStatus struct {
	// Specifies the current phase of the database
	// +optional
	// +kubebuilder:default=Pending
	Status ApprovalStatus `json:"status,omitempty"`
	// observedGeneration is the most recent generation observed for this resource. It corresponds to the
	// resource's generation, which is updated on mutation by the API Server.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`
	// Conditions applied to the database, such as approval or denial.
	// +optional
	Conditions []kmapi.Condition `json:"conditions,omitempty"`
}

MaintenanceWindowStatus defines the observed state of MaintenanceWindow

func (*MaintenanceWindowStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MaintenanceWindowStatus.

func (*MaintenanceWindowStatus) DeepCopyInto

func (in *MaintenanceWindowStatus) DeepCopyInto(out *MaintenanceWindowStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Operation

type Operation struct {
	metav1.GroupKind `json:",inline"`
}

func (*Operation) DeepCopy

func (in *Operation) DeepCopy() *Operation

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Operation.

func (*Operation) DeepCopyInto

func (in *Operation) DeepCopyInto(out *Operation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type OperationPhaseRules

type OperationPhaseRules struct {
	// Success defines a rule to identify the successful execution of the operation.
	// Example:
	//   success: `has(self.status.phase) && self.status.phase == 'Successful'`
	// Here self.status.phase is pointing to .status.phase field of the Operation object.
	// When .status.phase field presents and becomes `Successful`, the Success rule will satisfy.
	Success string `json:"success"`

	// InProgress defines a rule to identify that applied operation is progressing.
	// Example:
	//   inProgress: `has(self.status.phase) && self.status.phase == 'Progressing'`
	// Here self.status.phase is pointing to .status.phase field of the Operation object.
	// When .status.phase field presents and becomes `Progressing`, the InProgress rule will satisfy.
	InProgress string `json:"inProgress"`

	// Failed defines a rule to identify that applied operation is failed.
	// Example:
	//   inProgress: `has(self.status.phase) && self.status.phase == 'Failed'`
	// Here self.status.phase is pointing to .status.phase field of the Operation object.
	// When .status.phase field presents and becomes `Failed`, the Failed rule will satisfy.
	Failed string `json:"failed"`
}

OperationPhaseRules defines three identification rules of successful execution of the operation, progressing execution of the operation & failed execution of the operation. To specifies any field of the Operation object, the rule must start with the word `self`. Example:

.status.phase -> self.status.phase
.status.observedGeneration -> self.status.observedGeneration

The rules can be any valid expression supported by CEL(Common Expression Language). Ref: https://github.com/google/cel-spec

func (*OperationPhaseRules) DeepCopy added in v0.0.4

func (in *OperationPhaseRules) DeepCopy() *OperationPhaseRules

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperationPhaseRules.

func (*OperationPhaseRules) DeepCopyInto added in v0.0.4

func (in *OperationPhaseRules) DeepCopyInto(out *OperationPhaseRules)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Parallelism

type Parallelism string

+kubebuilder:validation:Enum=Namespace;Target;TargetAndNamespace

const (
	QueuePerNamespace          Parallelism = "Namespace"
	QueuePerTarget             Parallelism = "Target"
	QueuePerTargetAndNamespace Parallelism = "TargetAndNamespace"
)

type Recommendation

type Recommendation struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   RecommendationSpec   `json:"spec,omitempty"`
	Status RecommendationStatus `json:"status,omitempty"`
}

Recommendation is the Schema for the recommendations API

func (Recommendation) CustomResourceDefinition

func (_ Recommendation) CustomResourceDefinition() *apiextensions.CustomResourceDefinition

func (*Recommendation) DeepCopy

func (in *Recommendation) DeepCopy() *Recommendation

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Recommendation.

func (*Recommendation) DeepCopyInto

func (in *Recommendation) DeepCopyInto(out *Recommendation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Recommendation) DeepCopyObject

func (in *Recommendation) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Recommendation) Default

func (r *Recommendation) Default()

Default implements webhook.Defaulter so a webhook will be registered for the type

func (*Recommendation) IsAwaitingOrProgressingRecommendation added in v0.0.2

func (r *Recommendation) IsAwaitingOrProgressingRecommendation() bool

func (*Recommendation) IsAwaitingRecommendation added in v0.0.2

func (r *Recommendation) IsAwaitingRecommendation() bool

func (*Recommendation) IsProgressingRecommendation added in v0.0.2

func (r *Recommendation) IsProgressingRecommendation() bool

func (*Recommendation) ValidateCreate

func (r *Recommendation) ValidateCreate() (admission.Warnings, error)

ValidateCreate implements webhook.Validator so a webhook will be registered for the type

func (*Recommendation) ValidateDelete

func (r *Recommendation) ValidateDelete() (admission.Warnings, error)

ValidateDelete implements webhook.Validator so a webhook will be registered for the type

func (*Recommendation) ValidateUpdate

func (r *Recommendation) ValidateUpdate(old runtime.Object) (admission.Warnings, error)

ValidateUpdate implements webhook.Validator so a webhook will be registered for the type

type RecommendationList

type RecommendationList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Recommendation `json:"items"`
}

RecommendationList contains a list of Recommendation

func (*RecommendationList) DeepCopy

func (in *RecommendationList) DeepCopy() *RecommendationList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecommendationList.

func (*RecommendationList) DeepCopyInto

func (in *RecommendationList) DeepCopyInto(out *RecommendationList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RecommendationList) DeepCopyObject

func (in *RecommendationList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type RecommendationPhase

type RecommendationPhase string

+kubebuilder:validation:Enum=Pending;Skipped;Waiting;InProgress;Succeeded;Failed

const (
	Pending    RecommendationPhase = "Pending"
	Skipped    RecommendationPhase = "Skipped"
	Waiting    RecommendationPhase = "Waiting"
	InProgress RecommendationPhase = "InProgress"
	Succeeded  RecommendationPhase = "Succeeded"
	Failed     RecommendationPhase = "Failed"
)

type RecommendationSpec

type RecommendationSpec struct {
	// Description specifies the reason why this recommendation is generated.
	// +optional
	Description string `json:"description,omitempty"`

	// VulnerabilityReport specifies any kind vulnerability report like cve fixed information
	VulnerabilityReport *VulnerabilityReport `json:"vulnerabilityReport,omitempty"`

	// Target specifies the APIGroup, Kind & Name of the target resource for which the recommendation is generated
	Target core.TypedLocalObjectReference `json:"target"`

	// Operation holds a kubernetes object yaml which will be applied when this recommendation will be executed.
	// It should be a valid kubernetes resource yaml containing apiVersion, kind and metadata fields.
	// +kubebuilder:pruning:PreserveUnknownFields
	// +kubebuilder:validation:EmbeddedResource
	Operation runtime.RawExtension `json:"operation"`

	// Recommender holds the name and namespace of the component which generate this recommendation.
	Recommender kmapi.ObjectReference `json:"recommender"`

	// The recommendation will be executed within the given Deadline.
	// To maintain deadline, Parallelism can be compromised.
	// +optional
	Deadline *metav1.Time `json:"deadline,omitempty"`

	// If RequireExplicitApproval is set to `true` then the Recommendation must be Approved manually.
	// Recommendation won't be executed without manual approval and any kind of ApprovalPolicy will be ignored.
	// +optional
	RequireExplicitApproval bool `json:"requireExplicitApproval,omitempty"`

	// Rules defines OperationPhaseRules. It contains three identification rules of successful execution of the operation,
	// progressing execution of the operation & failed execution of the operation.
	// Example:
	// rules:
	//   success:    `has(self.status.phase) && self.status.phase == 'Successful'`
	//   inProgress: `has(self.status.phase) && self.status.phase == 'Progressing'`
	//   failed:     `has(self.status.phase) && self.status.phase == 'Failed'`
	Rules OperationPhaseRules `json:"rules"`

	// BackoffLimit specifies the number of retries before marking this recommendation failed.
	// By default set as five(5).
	// If BackoffLimit is zero(0), the operation will be tried to executed only once.
	// +optional
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:validation:Maximum=10
	BackoffLimit *int32 `json:"backoffLimit,omitempty"`
}

RecommendationSpec defines the desired state of Recommendation

func (*RecommendationSpec) DeepCopy

func (in *RecommendationSpec) DeepCopy() *RecommendationSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecommendationSpec.

func (*RecommendationSpec) DeepCopyInto

func (in *RecommendationSpec) DeepCopyInto(out *RecommendationSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RecommendationStatus

type RecommendationStatus struct {
	// Specifies the Approval Status of the Recommendation.
	// Possible values are `Pending`, `Approved`, `Rejected`
	// Pending: Recommendation is yet to Approved or Rejected
	// Approved: Recommendation is permitted to execute.
	// Rejected: Recommendation is rejected and never be executed.
	// +optional
	// +kubebuilder:default=Pending
	ApprovalStatus ApprovalStatus `json:"approvalStatus"`

	// Specifies the Recommendation current phase.
	// Possible values are:
	// Pending : Recommendation misses at least one pre-requisite for executing the operation.
	//           It also tells that some user action is needed.
	// Skipped : Operation is skipped because of Rejection ApprovalStatus.
	// Waiting : Recommendation is waiting for the MaintenanceWindow to execute the operation
	//           or waiting for others Recommendation to complete far maintaining Parallelism.
	// InProgress : The operation execution is successfully started and waiting for its final status.
	// Succeeded : Operation has been successfully executed.
	// Failed : Operation execution has not completed successfully i.e. encountered an error
	// +optional
	Phase RecommendationPhase `json:"phase,omitempty"`

	// A message indicating details about Recommendation current phase.
	// +optional
	// +kubebuilder:default=WaitingForApproval
	Reason string `json:"reason"`

	// Specifies Reviewer's details.
	// +optional
	Reviewer *Subject `json:"reviewer,omitempty"`

	// Specifies Reviewer's comment.
	// +optional
	Comments string `json:"comments,omitempty"`

	// Contains review timestamp
	// +optional
	ReviewTimestamp *metav1.Time `json:"reviewTimestamp,omitempty"`

	// ApprovedWindow specifies the time window configuration for the Recommendation execution.
	// +optional
	ApprovedWindow *ApprovedWindow `json:"approvedWindow,omitempty"`

	// Parallelism imposes some restriction to Recommendation execution.
	// Possible values are:
	// Namespace: Only one Recommendation can be executed at a time in a namespace.
	// Target: Only one Recommendation for a given target can be executed at a time.
	// TargetAndNamespace: Only one Recommendation for a given target can be executed at a time in a namespace.
	// +optional
	// +kubebuilder:default=Namespace
	Parallelism Parallelism `json:"parallelism,omitempty"`

	// observedGeneration is the most recent generation observed for this resource. It corresponds to the
	// resource's generation, which is updated on mutation by the API Server.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// Conditions applied to the Recommendation.
	// +optional
	Conditions []kmapi.Condition `json:"conditions,omitempty"`

	// Outdated is indicating details whether the Recommendation is outdated or not.
	// If the value is `true`, then Recommendation will not be executed. This indicates that after generating the Recommendation,
	// the targeted resource is changed in such a way that the generated Recommendation has become outdated & can't be executed anymore.
	//
	// +optional
	// +kubebuilder:default=false
	Outdated bool `json:"outdated"`

	// CreatedOperationRef holds the created operation name.
	// +optional
	CreatedOperationRef *core.LocalObjectReference `json:"createdOperationRef,omitempty"`

	// FailedAttempt holds the number of times the operation is failed.
	// +optional
	// +kubebuilder:default=0
	FailedAttempt int32 `json:"failedAttempt"`
}

RecommendationStatus defines the observed state of Recommendation

func (*RecommendationStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecommendationStatus.

func (*RecommendationStatus) DeepCopyInto

func (in *RecommendationStatus) DeepCopyInto(out *RecommendationStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ReportGenerationStatus added in v0.0.2

type ReportGenerationStatus string
const (
	ReportGenerationStatusSuccess ReportGenerationStatus = "Success"
	ReportGenerationStatusFailure ReportGenerationStatus = "Failure"
)

type Subject

type Subject struct {
	// Kind of object being referenced. Values defined by this API group are "User", "Group", and "ServiceAccount".
	// If the Authorizer does not recognized the kind value, the Authorizer should report an error.
	Kind string `json:"kind"`
	// APIGroup holds the API group of the referenced subject.
	// Defaults to "" for ServiceAccount subjects.
	// Defaults to "rbac.authorization.k8s.io" for User and Group subjects.
	// +optional
	APIGroup string `json:"apiGroup,omitempty" protobuf:"bytes,2,opt.name=apiGroup"`
	// Name of the object being referenced.
	Name string `json:"name" protobuf:"bytes,3,opt,name=name"`
	// Namespace of the referenced object.  If the object kind is non-namespace, such as "User" or "Group", and this value is not empty
	// the Authorizer should report an error.
	// +optional
	Namespace string `json:"namespace,omitempty" protobuf:"bytes,4,opt,name=namespace"`
}

Subject contains a reference to the object or user identities a role binding applies to. This can either hold a direct API object reference, or a value for non-objects such as user and group names. +structType=atomic

func (*Subject) DeepCopy

func (in *Subject) DeepCopy() *Subject

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subject.

func (*Subject) DeepCopyInto

func (in *Subject) DeepCopyInto(out *Subject)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TargetRef

type TargetRef struct {
	metav1.GroupKind `json:",inline"`
	// +optional
	Operations []Operation `json:"operations,omitempty"`
}

func (*TargetRef) DeepCopy

func (in *TargetRef) DeepCopy() *TargetRef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetRef.

func (*TargetRef) DeepCopyInto

func (in *TargetRef) DeepCopyInto(out *TargetRef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TimeWindow

type TimeWindow struct {
	Start kmapi.TimeOfDay `json:"start"`
	End   kmapi.TimeOfDay `json:"end"`
}

func (*TimeWindow) DeepCopy

func (in *TimeWindow) DeepCopy() *TimeWindow

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TimeWindow.

func (*TimeWindow) DeepCopyInto

func (in *TimeWindow) DeepCopyInto(out *TimeWindow)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Vulnerability added in v0.0.2

type Vulnerability struct {
	VulnerabilityID string `json:"vulnerabilityID,omitempty"`
	PrimaryURL      string `json:"primaryURL,omitempty"`
	Severity        string `json:"severity,omitempty"`
}

func (*Vulnerability) DeepCopy added in v0.0.4

func (in *Vulnerability) DeepCopy() *Vulnerability

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Vulnerability.

func (*Vulnerability) DeepCopyInto added in v0.0.4

func (in *Vulnerability) DeepCopyInto(out *Vulnerability)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VulnerabilityReport added in v0.0.2

type VulnerabilityReport struct {
	Status  ReportGenerationStatus `json:"status,omitempty"`
	Message string                 `json:"message,omitempty"`
	// Fixed represents the list of CVEs fixed if the recommendation is applied
	Fixed *CVEReport `json:"fixed,omitempty"`
	// Known represents the list of CVEs known to exist after the recommendation is applied
	Known *CVEReport `json:"known,omitempty"`
}

func (*VulnerabilityReport) DeepCopy added in v0.0.4

func (in *VulnerabilityReport) DeepCopy() *VulnerabilityReport

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VulnerabilityReport.

func (*VulnerabilityReport) DeepCopyInto added in v0.0.4

func (in *VulnerabilityReport) DeepCopyInto(out *VulnerabilityReport)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WindowType

type WindowType string

+kubebuilder:validation:Enum=Immediate;NextAvailable;SpecificDates

const (
	Immediate     WindowType = "Immediate"
	NextAvailable WindowType = "NextAvailable"
	SpecificDates WindowType = "SpecificDates"
)

Jump to

Keyboard shortcuts

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