Skip to content
56 changes: 49 additions & 7 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,50 @@
version: "2"
run:
concurrency: 4
timeout: 10m

issues:
exclude-files:
- "zz_generated.*\\.go$"
- "tmp/.*"
allow-parallel-runners: true
linters:
default: none
enable:
- copyloopvar
- errcheck
- govet
- ineffassign
- misspell
- nakedret
- prealloc
- revive
- staticcheck
- unconvert
- unused
settings:
revive:
rules:
- name: comment-spacings
misspell:
ignore-rules:
- "clas"
exclusions:
generated: lax
rules:
- linters:
- lll
path: api/*
- linters:
- dupl
- lllgit ad
path: internal/*
paths:
- zz_generated.*\.go$
- tmp/.*
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ package main

import (
"fmt" // we need to import something here so golint is happy
//+kubebuilder:scaffold:imports
// +kubebuilder:scaffold:imports
)

func main() {
fmt.Println("I should never be called")
//+kubebuilder:scaffold:builder
// +kubebuilder:scaffold:builder
}
EOF
```
Expand Down
6 changes: 3 additions & 3 deletions api/core/v1alpha1/apiserver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ type APIServerAccess struct {
ExpirationTimestamp *metav1.Time `json:"expirationTimestamp,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// APIServer is the Schema for the APIServer API
// +kubebuilder:resource:shortName=as
Expand All @@ -113,7 +113,7 @@ type APIServer struct {
Status APIServerStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// APIServerList contains a list of APIServer
type APIServerList struct {
Expand Down
6 changes: 3 additions & 3 deletions api/core/v1alpha1/authentication_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
// Default sets the default values for the AuthenticationSpec.
// This modifies the receiver object.
func (as *AuthenticationSpec) Default() {
if as.AuthenticationConfiguration.EnableSystemIdentityProvider == nil {
as.AuthenticationConfiguration.EnableSystemIdentityProvider = ptr.To(true)
if as.EnableSystemIdentityProvider == nil {
as.EnableSystemIdentityProvider = ptr.To(true)
}
}

Expand Down Expand Up @@ -79,7 +79,7 @@ func ValidateIdp(idp IdentityProvider, fldPath *field.Path) field.ErrorList {
// isLowerCaseLetter checks if the given string is a lowercase letter.
func isLowerCaseLetter(s string) bool {
for _, r := range s {
if !(unicode.IsLetter(r) && unicode.IsLower(r)) {
if !(unicode.IsLetter(r) && unicode.IsLower(r)) { //nolint:staticcheck
return false
}
}
Expand Down
6 changes: 3 additions & 3 deletions api/core/v1alpha1/cloudorchestrator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ type CloudOrchestratorStatus struct {
ComponentsHealthy int `json:"componentsHealthy"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=co
// +kubebuilder:printcolumn:name="Successfully_Reconciled",type=string,JSONPath=`.status.conditions[?(@.type=="CloudOrchestratorReconciliation")].status`
// +kubebuilder:printcolumn:name="Deleted",type="date",JSONPath=".metadata.deletionTimestamp"
Expand All @@ -66,7 +66,7 @@ type CloudOrchestrator struct {
Status CloudOrchestratorStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// CloudOrchestratorList contains a list of CloudOrchestrator
type CloudOrchestratorList struct {
Expand Down
2 changes: 1 addition & 1 deletion api/core/v1alpha1/component_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type ObservedGenerations struct {

// CommonComponentStatus contains fields which all component resources' statuses must contain.
type CommonComponentStatus struct {
// Conditions containts the conditions of the component.
// Conditions contains the conditions of the component.
// For each component, this is expected to contain at least one condition per top-level node that component has in the ManagedControlPlane's spec.
// This condition is expected to be named "<node>Healthy" and to describe the general availability of the functionality configured by that top-level node.
Conditions ComponentConditionList `json:"conditions,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions api/core/v1alpha1/internalconfiguration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type InternalConfigurationSpec struct {
Components InternalConfigurationComponents `json:"components,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// InternalConfiguration is the Schema for the InternalConfigurations API
// +kubebuilder:resource:shortName=icfg
Expand All @@ -27,7 +27,7 @@ type InternalConfiguration struct {
Spec InternalConfigurationSpec `json:"spec,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// InternalConfigurationList contains a list of InternalConfiguration
type InternalConfigurationList struct {
Expand Down
6 changes: 3 additions & 3 deletions api/core/v1alpha1/landscaper_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ type LandscaperSpec struct {
LandscaperConfiguration `json:",inline"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// Landscaper is the Schema for the laasinstances API
// +kubebuilder:resource:shortName=ls
Expand All @@ -54,7 +54,7 @@ type Landscaper struct {
Status LandscaperStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// LandscaperList contains a list of Landscaper
type LandscaperList struct {
Expand Down
6 changes: 3 additions & 3 deletions api/core/v1alpha1/managedcontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ const (
MCPStatusDeleting MCPStatus = "Deleting"
)

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// ManagedControlPlane is the Schema for the ManagedControlPlane API
// +kubebuilder:resource:shortName=mcp
Expand All @@ -109,7 +109,7 @@ type ManagedControlPlane struct {
Status ManagedControlPlaneStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// ManagedControlPlaneList contains a list of ManagedControlPlane
type ManagedControlPlaneList struct {
Expand Down
4 changes: 2 additions & 2 deletions api/crds/manifests/core.openmcp.cloud_apiservers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.17.3
name: apiservers.core.openmcp.cloud
spec:
group: core.openmcp.cloud
Expand Down Expand Up @@ -266,7 +266,7 @@ spec:
type: object
conditions:
description: |-
Conditions containts the conditions of the component.
Conditions contains the conditions of the component.
For each component, this is expected to contain at least one condition per top-level node that component has in the ManagedControlPlane's spec.
This condition is expected to be named "<node>Healthy" and to describe the general availability of the functionality configured by that top-level node.
items:
Expand Down
4 changes: 2 additions & 2 deletions api/crds/manifests/core.openmcp.cloud_authentications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.17.3
name: authentications.core.openmcp.cloud
spec:
group: core.openmcp.cloud
Expand Down Expand Up @@ -174,7 +174,7 @@ spec:
type: object
conditions:
description: |-
Conditions containts the conditions of the component.
Conditions contains the conditions of the component.
For each component, this is expected to contain at least one condition per top-level node that component has in the ManagedControlPlane's spec.
This condition is expected to be named "<node>Healthy" and to describe the general availability of the functionality configured by that top-level node.
items:
Expand Down
4 changes: 2 additions & 2 deletions api/crds/manifests/core.openmcp.cloud_authorizations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.17.3
name: authorizations.core.openmcp.cloud
spec:
group: core.openmcp.cloud
Expand Down Expand Up @@ -108,7 +108,7 @@ spec:
properties:
conditions:
description: |-
Conditions containts the conditions of the component.
Conditions contains the conditions of the component.
For each component, this is expected to contain at least one condition per top-level node that component has in the ManagedControlPlane's spec.
This condition is expected to be named "<node>Healthy" and to describe the general availability of the functionality configured by that top-level node.
items:
Expand Down
4 changes: 2 additions & 2 deletions api/crds/manifests/core.openmcp.cloud_cloudorchestrators.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.17.3
name: cloudorchestrators.core.openmcp.cloud
spec:
group: core.openmcp.cloud
Expand Down Expand Up @@ -130,7 +130,7 @@ spec:
type: integer
conditions:
description: |-
Conditions containts the conditions of the component.
Conditions contains the conditions of the component.
For each component, this is expected to contain at least one condition per top-level node that component has in the ManagedControlPlane's spec.
This condition is expected to be named "<node>Healthy" and to describe the general availability of the functionality configured by that top-level node.
items:
Expand Down
2 changes: 1 addition & 1 deletion api/crds/manifests/core.openmcp.cloud_clusteradmins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.17.3
name: clusteradmins.core.openmcp.cloud
spec:
group: core.openmcp.cloud
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.17.3
name: internalconfigurations.core.openmcp.cloud
spec:
group: core.openmcp.cloud
Expand Down
4 changes: 2 additions & 2 deletions api/crds/manifests/core.openmcp.cloud_landscapers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.17.3
name: landscapers.core.openmcp.cloud
spec:
group: core.openmcp.cloud
Expand Down Expand Up @@ -64,7 +64,7 @@ spec:
properties:
conditions:
description: |-
Conditions containts the conditions of the component.
Conditions contains the conditions of the component.
For each component, this is expected to contain at least one condition per top-level node that component has in the ManagedControlPlane's spec.
This condition is expected to be named "<node>Healthy" and to describe the general availability of the functionality configured by that top-level node.
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.17.3
name: managedcomponents.core.openmcp.cloud
spec:
group: core.openmcp.cloud
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.4
controller-gen.kubebuilder.io/version: v0.17.3
name: managedcontrolplanes.core.openmcp.cloud
spec:
group: core.openmcp.cloud
Expand Down
2 changes: 1 addition & 1 deletion internal/components/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ var _ = Describe("APIServerConverter", func() {
Expect(apiServerSpecT.Type).To(Equal(mcp.Spec.Components.APIServer.Type))
Expect(apiServerSpecT.GardenerConfig).To(Equal(mcp.Spec.Components.APIServer.GardenerConfig))
Expect(apiServerSpecT.Internal.GardenerConfig.ShootOverwrite).To(Equal(icfg.Spec.Components.APIServer.GardenerConfig.ShootOverwrite))
Expect(apiServerSpecT.DesiredRegion).To(Equal(mcp.Spec.CommonConfig.DesiredRegion))
Expect(apiServerSpecT.DesiredRegion).To(Equal(mcp.Spec.DesiredRegion))
})

It("should return an error if the spec is not configured", func() {
Expand Down
2 changes: 1 addition & 1 deletion internal/components/component_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var _ = Describe("Components", func() {
commonCfg, iCommonConfig := components.GetCommonConfig(mcp, icfg)
Expect(commonCfg).ToNot(BeNil())
Expect(iCommonConfig).ToNot(BeNil())
Expect(commonCfg.DesiredRegion).To(Equal(mcp.Spec.CommonConfig.DesiredRegion))
Expect(commonCfg.DesiredRegion).To(Equal(mcp.Spec.DesiredRegion))
Expect(iCommonConfig).To(Equal(icfg.Spec.InternalCommonConfig))
})

Expand Down
4 changes: 2 additions & 2 deletions internal/controller/core/apiserver/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (cfg *APIServerProviderConfiguration) Complete(ctx context.Context) (*Compl
}
errs = append(errs, err)

res.CompletedCommonConfig, err = cfg.CommonConfig.complete()
res.CompletedCommonConfig, err = cfg.complete()
errs = append(errs, err)

return res, errors.Join(errs...)
Expand All @@ -82,7 +82,7 @@ func Validate(cfg *APIServerProviderConfiguration) error {
allErrs = append(allErrs, validateGardenerConfig(cfg.GardenerConfig, field.NewPath("gardener"))...)
}

allErrs = append(allErrs, cfg.CommonConfig.validate()...)
allErrs = append(allErrs, cfg.validate()...)

return allErrs.ToAggregate()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type GardenerConfiguration struct {
Name string `json:"name,omitempty"`

// Project is the Gardener project which should be used to create shoot clusters in it.
// The provided kubeconfig must have priviliges for this project.
// The provided kubeconfig must have privileges for this project.
Project string `json:"project,omitempty"`

// CloudProfile is the name of the Gardener CloudProfile that should be used for this shoot.
Expand Down
8 changes: 4 additions & 4 deletions internal/controller/core/apiserver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ type APIServerProvider struct {
FakeHandler apiserverhandler.APIServerHandler
}

//+kubebuilder:rbac:groups=core.openmcp.cloud,resources=apiservers,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=core.openmcp.cloud,resources=apiservers/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=core.openmcp.cloud,resources=apiservers/finalizers,verbs=update
// +kubebuilder:rbac:groups=core.openmcp.cloud,resources=apiservers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=core.openmcp.cloud,resources=apiservers/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=core.openmcp.cloud,resources=apiservers/finalizers,verbs=update

func (r *APIServerProvider) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log, ctx := utils.InitializeControllerLogger(ctx, ControllerName)
Expand All @@ -97,7 +97,7 @@ func (r *APIServerProvider) reconcile(ctx context.Context, req ctrl.Request) com
log.Debug("Resource not found")
return componentutils.ReconcileResult[*openmcpv1alpha1.APIServer]{}
}
return componentutils.ReconcileResult[*openmcpv1alpha1.APIServer]{ReconcileError: openmcperrors.WithReason(fmt.Errorf("unable to get resource '%s' from cluster: %w", req.NamespacedName.String(), err), cconst.ReasonCrateClusterInteractionProblem)}
return componentutils.ReconcileResult[*openmcpv1alpha1.APIServer]{ReconcileError: openmcperrors.WithReason(fmt.Errorf("unable to get resource '%s' from cluster: %w", req.String(), err), cconst.ReasonCrateClusterInteractionProblem)}
}

// handle operation annotation
Expand Down
Loading
Loading