Skip to content
Closed
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ linters:
- recvcheck
- sqlclosecheck
- wsl
- wsl_v5 # can be discussed with the team if enforced grouping of statements is desired, but generally considered too strict
settings:
cyclop:
max-complexity: 20
Expand Down
3 changes: 2 additions & 1 deletion api/scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (
)

func AddToScheme(scheme *machineryruntime.Scheme) error {
if err := v1beta2.AddToScheme(scheme); err != nil {
err := v1beta2.AddToScheme(scheme)
if err != nil {
return fmt.Errorf("failed to add scheme on v1beta2 api: %w", err)
}

Expand Down
5 changes: 3 additions & 2 deletions api/shared/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (

// +k8s:deepcopy-gen=true
type Resource struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
apimetav1.GroupVersionKind `json:",inline"`

Name string `json:"name"`
Namespace string `json:"namespace"`
}

func (r Resource) ToUnstructured() *unstructured.Unstructured {
Expand Down
5 changes: 3 additions & 2 deletions api/shared/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
// Status defines the observed state of CustomObject.
// +k8s:deepcopy-gen=true
type Status struct {
LastOperation `json:"lastOperation,omitempty"`

// State signifies current state of CustomObject.
// Value can be one of ("Ready", "Processing", "Error", "Deleting", "Warning").
// +kubebuilder:validation:Required
Expand All @@ -24,8 +26,7 @@ type Status struct {
// All resources that are synced are considered for orphan removal on configuration changes,
// and it is used to determine effective differences from one state to the next.
// +listType=atomic
Synced []Resource `json:"synced,omitempty"`
LastOperation `json:"lastOperation,omitempty"`
Synced []Resource `json:"synced,omitempty"`
}

func (s Status) WithState(state State) Status {
Expand Down
13 changes: 7 additions & 6 deletions api/v1beta1/kyma_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ type KymaSpec struct {

// KymaStatus defines the observed state of Kyma.
type KymaStatus struct {
LastOperation `json:"lastOperation,omitempty"`

// State signifies current state of Kyma.
// Value can be one of ("Ready", "Processing", "Error", "Deleting").
State State `json:"state,omitempty"`
Expand All @@ -107,8 +109,6 @@ type KymaStatus struct {
// Active Channel
// +optional
ActiveChannel string `json:"activeChannel,omitempty"`

LastOperation `json:"lastOperation,omitempty"`
}

type ModuleStatus struct {
Expand Down Expand Up @@ -187,11 +187,15 @@ type PartialMeta struct {
type KymaList struct {
apimetav1.TypeMeta `json:",inline"`
apimetav1.ListMeta `json:"metadata,omitempty"`
Items []Kyma `json:"items"`

Items []Kyma `json:"items"`
}

// Module defines the components to be installed.
type Module struct {
// +kubebuilder:default:=CreateAndDelete
CustomResourcePolicy `json:"customResourcePolicy,omitempty"`

// Name is a unique identifier of the module.
// It is used to resolve a ModuleTemplate for creating a set of resources on the cluster.
//
Expand Down Expand Up @@ -222,9 +226,6 @@ type Module struct {
// It will be removed in the upcoming API version.
RemoteModuleTemplateRef string `json:"remoteModuleTemplateRef,omitempty"`

// +kubebuilder:default:=CreateAndDelete
CustomResourcePolicy `json:"customResourcePolicy,omitempty"`

// Managed is determining whether the module is managed or not. If the module is unmanaged, the user is responsible
// for the lifecycle of the module.
// +kubebuilder:default:=true
Expand Down
9 changes: 5 additions & 4 deletions api/v1beta1/manifest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ type Manifest struct {

// ManifestSpec defines the desired state of Manifest.
type ManifestSpec struct {
// +kubebuilder:default:=CreateAndDelete
CustomResourcePolicy `json:"customResourcePolicy,omitempty"`

// Remote indicates if Manifest should be installed on a remote cluster
Remote bool `json:"remote"`

Expand All @@ -58,9 +61,6 @@ type ManifestSpec struct {
// +nullable
// Resource specifies a resource to be watched for state updates
Resource *unstructured.Unstructured `json:"resource,omitempty"`

// +kubebuilder:default:=CreateAndDelete
CustomResourcePolicy `json:"customResourcePolicy,omitempty"`
}

// InstallInfo defines installation information.
Expand Down Expand Up @@ -108,7 +108,8 @@ const (
type ManifestList struct {
apimetav1.TypeMeta `json:",inline"`
apimetav1.ListMeta `json:"metadata,omitempty"`
Items []Manifest `json:"items"`

Items []Manifest `json:"items"`
}

//nolint:gochecknoinits // registers Kyma CRD on startup
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta1/moduletemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ type CustomStateCheck struct {
type ModuleTemplateList struct {
apimetav1.TypeMeta `json:",inline"`
apimetav1.ListMeta `json:"metadata,omitempty"`
Items []ModuleTemplate `json:"items"`

Items []ModuleTemplate `json:"items"`
}

// Target serves as a potential Installation Hint for the Controller to determine which Client to use for installation.
Expand Down
5 changes: 3 additions & 2 deletions api/v1beta1/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (

// +k8s:deepcopy-gen=true
type Resource struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
apimetav1.GroupVersionKind `json:",inline"`

Name string `json:"name"`
Namespace string `json:"namespace"`
}

func (r Resource) ToUnstructured() *unstructured.Unstructured {
Expand Down
5 changes: 3 additions & 2 deletions api/v1beta1/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
// Status defines the observed state of CustomObject.
// +k8s:deepcopy-gen=true
type Status struct {
LastOperation `json:"lastOperation,omitempty"`

// State signifies current state of CustomObject.
// Value can be one of ("Ready", "Processing", "Error", "Deleting", "Warning").
// +kubebuilder:validation:Required
Expand All @@ -24,8 +26,7 @@ type Status struct {
// All resources that are synced are considered for orphan removal on configuration changes,
// and it is used to determine effective differences from one state to the next.
// +listType=atomic
Synced []Resource `json:"synced,omitempty"`
LastOperation `json:"lastOperation,omitempty"`
Synced []Resource `json:"synced,omitempty"`
}

func (s Status) WithState(state State) Status {
Expand Down
4 changes: 2 additions & 2 deletions api/v1beta1/watcher_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ type WatcherStatus struct {
// WatcherList contains a list of Watcher.
type WatcherList struct {
apimetav1.TypeMeta `json:",inline"`

// +kubebuilder:validation:Optional
apimetav1.ListMeta `json:"metadata"`
Items []Watcher `json:"items"`

Items []Watcher `json:"items"`
}

//nolint:gochecknoinits // registers Watcher CRD on startup
Expand Down
13 changes: 7 additions & 6 deletions api/v1beta2/kyma_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ type KymaSpec struct {

// Module defines the components to be installed.
type Module struct {
// +kubebuilder:default:=CreateAndDelete
CustomResourcePolicy `json:"customResourcePolicy,omitempty"`

// Name is a unique identifier of the module.
// It is used to resolve a ModuleTemplate for creating a set of resources on the cluster.
//
Expand Down Expand Up @@ -91,9 +94,6 @@ type Module struct {
// It will be removed in the upcoming API version.
RemoteModuleTemplateRef string `json:"remoteModuleTemplateRef,omitempty"`

// +kubebuilder:default:=CreateAndDelete
CustomResourcePolicy `json:"customResourcePolicy,omitempty"`

// Managed is determining whether the module is managed or not. If the module is unmanaged, the user is responsible
// for the lifecycle of the module.
// +kubebuilder:default:=true
Expand Down Expand Up @@ -132,6 +132,8 @@ func (kyma *Kyma) GetModuleStatusMap() map[string]*ModuleStatus {

// KymaStatus defines the observed state of Kyma.
type KymaStatus struct {
shared.LastOperation `json:"lastOperation,omitempty"`

// State signifies current state of Kyma.
// Value can be one of ("Ready", "Processing", "Error", "Deleting").
State shared.State `json:"state,omitempty"`
Expand All @@ -148,8 +150,6 @@ type KymaStatus struct {
// Active Channel
// +optional
ActiveChannel string `json:"activeChannel,omitempty"`

shared.LastOperation `json:"lastOperation,omitempty"`
}

func (status *KymaStatus) GetModuleStatus(moduleName string) *ModuleStatus {
Expand Down Expand Up @@ -308,7 +308,8 @@ func (kyma *Kyma) GetNoLongerExistingModuleStatus() []*ModuleStatus {
type KymaList struct {
apimetav1.TypeMeta `json:",inline"`
apimetav1.ListMeta `json:"metadata,omitempty"`
Items []Kyma `json:"items"`

Items []Kyma `json:"items"`
}

//nolint:gochecknoinits // registers Kyma CRD on startup
Expand Down
9 changes: 5 additions & 4 deletions api/v1beta2/manifest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ func (i InstallInfo) Raw() []byte {

// ManifestSpec defines the desired state of Manifest.
type ManifestSpec struct {
// +kubebuilder:default:=CreateAndDelete
CustomResourcePolicy `json:"customResourcePolicy,omitempty"`

// Remote indicates if Manifest should be installed on a remote cluster
Remote bool `json:"remote"`

Expand All @@ -72,9 +75,6 @@ type ManifestSpec struct {
// Resource specifies a resource to be watched for state updates
Resource *unstructured.Unstructured `json:"resource,omitempty"`

// +kubebuilder:default:=CreateAndDelete
CustomResourcePolicy `json:"customResourcePolicy,omitempty"`

// LocalizedImages specifies a list of docker image references valid for the environment where the Manifest is installed.
// The list entries are corresponding to the images actually used in the K8s resources of the Kyma module.
// If provided, when the Kyma Module is installed in the target cluster, the "localized" image reference is used instead of the original one.
Expand Down Expand Up @@ -148,7 +148,8 @@ func (manifest *Manifest) IsMandatoryModule() bool {
type ManifestList struct {
apimetav1.TypeMeta `json:",inline"`
apimetav1.ListMeta `json:"metadata,omitempty"`
Items []Manifest `json:"items"`

Items []Manifest `json:"items"`
}

//nolint:gochecknoinits // registers Manifest CRD on startup
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta2/modulereleasemeta_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ type ModuleReleaseMetaSpec struct {
type ModuleReleaseMetaList struct {
apimetav1.TypeMeta `json:",inline"`
apimetav1.ListMeta `json:"metadata,omitempty"`
Items []ModuleReleaseMeta `json:"items"`

Items []ModuleReleaseMeta `json:"items"`
}

type ChannelVersionAssignment struct {
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta2/moduletemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ type CustomStateCheck struct {
type ModuleTemplateList struct {
apimetav1.TypeMeta `json:",inline"`
apimetav1.ListMeta `json:"metadata,omitempty"`
Items []ModuleTemplate `json:"items"`

Items []ModuleTemplate `json:"items"`
}

type Resource struct {
Expand Down
3 changes: 2 additions & 1 deletion api/v1beta2/watcher_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ func (watcher *Watcher) GetManagerName() string {
type WatcherList struct {
apimetav1.TypeMeta `json:",inline"`
apimetav1.ListMeta `json:"metadata,omitempty"`
Items []Watcher `json:"items"`

Items []Watcher `json:"items"`
}

//nolint:gochecknoinits // registers Watcher CRD on startup
Expand Down
Loading
Loading