Skip to content

Commit

Permalink
Remove lint ignore for comments
Browse files Browse the repository at this point in the history
Signed-off-by: killianmuldoon <[email protected]>
  • Loading branch information
killianmuldoon committed Sep 25, 2023
1 parent 830aa85 commit 3bd563c
Show file tree
Hide file tree
Showing 92 changed files with 308 additions and 134 deletions.
10 changes: 5 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,25 +268,25 @@ issues:
- linters:
- revive
text: "package-comments"
path: ^(main|(packaging|apis|controllers|feature|test|pkg)\/.*)\.go$
path: ^(apis/(v1alpha3|v1alpha4)\/.*)\.go$
- linters:
- stylecheck
text: "ST1000"
path: ^(main|(packaging|apis|controllers|feature|test|pkg)\/.*)\.go$
path: ^(apis/(v1alpha3|v1alpha4)\/.*)\.go$
- linters:
- revive
text: exported (.*) should have comment (.*)or be unexported
path: "^(apis|controllers|packaging|pkg)/.*.go"
path: ^(apis/(v1alpha3|v1alpha4)\/.*)\.go$

# wrong comment
- linters:
- revive
text: comment on exported (.*) should be of the form (.*)
path: "^(apis|packaging|pkg/(constants|services|util))/"
path: ^(apis/(v1alpha3|v1alpha4)\/.*)\.go$
- linters:
- stylecheck
text: ST1021|ST1020
path: "^(apis|packaging|pkg/(constants|services|util))/"
path: ^(apis/(v1alpha3|v1alpha4)\/.*)\.go$

# gosec
- linters:
Expand Down
2 changes: 2 additions & 0 deletions apis/v1alpha3/vsphereclusteridentity_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
)

const (
// SecretIdentitySetFinalizer is the finalizer for VSphereCluster credentials secrets .
SecretIdentitySetFinalizer = "vspherecluster/infrastructure.cluster.x-k8s.io"
)

Expand Down Expand Up @@ -94,6 +95,7 @@ type VSphereClusterIdentity struct {
}

// +kubebuilder:object:root=true

// VSphereClusterIdentityList contains a list of VSphereClusterIdentity
//
// Deprecated: This type will be removed in one of the next releases.
Expand Down
2 changes: 2 additions & 0 deletions apis/v1alpha4/vspherecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@ type VSphereCluster struct {
Status VSphereClusterStatus `json:"status,omitempty"`
}

// GetConditions returns the conditions for the VSphereCluster.
func (c *VSphereCluster) GetConditions() clusterv1alpha4.Conditions {
return c.Status.Conditions
}

// GetConditions sets conditions on the VSphereCluster.
func (c *VSphereCluster) SetConditions(conditions clusterv1alpha4.Conditions) {
c.Status.Conditions = conditions
}
Expand Down
2 changes: 2 additions & 0 deletions apis/v1alpha4/vsphereclusteridentity_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
)

const (
// SecretIdentitySetFinalizer is the finalizer for VSphereCluster credentials secrets .
SecretIdentitySetFinalizer = "vspherecluster/infrastructure.cluster.x-k8s.io"
)

Expand Down Expand Up @@ -94,6 +95,7 @@ type VSphereClusterIdentity struct {
}

// +kubebuilder:object:root=true

// VSphereClusterIdentityList contains a list of VSphereClusterIdentity
//
// Deprecated: This type will be removed in one of the next releases.
Expand Down
17 changes: 8 additions & 9 deletions apis/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:godot
package v1beta1

import (
Expand Down Expand Up @@ -206,7 +205,7 @@ type VirtualMachineCloneSpec struct {
HardwareVersion string `json:"hardwareVersion,omitempty"`
}

// VSphereMachineTemplateResource describes the data needed to create a VSphereMachine from a template
// VSphereMachineTemplateResource describes the data needed to create a VSphereMachine from a template.
type VSphereMachineTemplateResource struct {

// Standard object's metadata.
Expand All @@ -218,10 +217,10 @@ type VSphereMachineTemplateResource struct {
Spec VSphereMachineSpec `json:"spec"`
}

// VSphereMachineProviderConditionType is a valid value for VSphereMachineProviderCondition.Type
// VSphereMachineProviderConditionType is a valid value for VSphereMachineProviderCondition.Type.
type VSphereMachineProviderConditionType string

// Valid conditions for an VSphere machine instance
// Valid conditions for an VSphere machine instance.
const (
// MachineCreated indicates whether the machine has been created or not. If not,
// it should include a reason and message for the failure.
Expand All @@ -247,7 +246,7 @@ func (v APIEndpoint) String() string {
return fmt.Sprintf("%s:%d", v.Host, v.Port)
}

// PCIDeviceSpec defines virtual machine's PCI configuration
// PCIDeviceSpec defines virtual machine's PCI configuration.
type PCIDeviceSpec struct {
// DeviceID is the device ID of a virtual machine's PCI, in integer.
// Defaults to the eponymous property value in the template from which the
Expand Down Expand Up @@ -461,17 +460,17 @@ const (
VirtualMachineStateReady = "ready"
)

// VirtualMachinePowerState describe the power state of a VM
// VirtualMachinePowerState describe the power state of a VM.
type VirtualMachinePowerState string

const (
// VirtualMachinePowerStatePoweredOn is the string representing a VM in powered on state
// VirtualMachinePowerStatePoweredOn is the string representing a VM in powered on state.
VirtualMachinePowerStatePoweredOn VirtualMachinePowerState = "poweredOn"

// VirtualMachinePowerStatePoweredOff is the string representing a VM in powered off state
// VirtualMachinePowerStatePoweredOff is the string representing a VM in powered off state.
VirtualMachinePowerStatePoweredOff = "poweredOff"

// VirtualMachinePowerStateSuspended is the string representing a VM in suspended state
// VirtualMachinePowerStateSuspended is the string representing a VM in suspended state.
VirtualMachinePowerStateSuspended = "suspended"
)

Expand Down
12 changes: 7 additions & 5 deletions apis/v1beta1/vspherecluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:godot
package v1beta1

import (
Expand All @@ -32,11 +31,12 @@ const (
// VCenterVersion conveys the API version of the vCenter instance.
type VCenterVersion string

// NewVCenterVersion returns a VCenterVersion for the passed string.
func NewVCenterVersion(version string) VCenterVersion {
return VCenterVersion(version)
}

// VSphereClusterSpec defines the desired state of VSphereCluster
// VSphereClusterSpec defines the desired state of VSphereCluster.
type VSphereClusterSpec struct {
// Server is the address of the vSphere endpoint.
Server string `json:"server,omitempty"`
Expand Down Expand Up @@ -84,7 +84,7 @@ type ClusterModule struct {
ModuleUUID string `json:"moduleUUID"`
}

// VSphereClusterStatus defines the observed state of VSphereClusterSpec
// VSphereClusterStatus defines the observed state of VSphereClusterSpec.
type VSphereClusterStatus struct {
// +optional
Ready bool `json:"ready,omitempty"`
Expand All @@ -109,7 +109,7 @@ type VSphereClusterStatus struct {
// +kubebuilder:printcolumn:name="ControlPlaneEndpoint",type="string",JSONPath=".spec.controlPlaneEndpoint[0]",description="API Endpoint",priority=1
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of Machine"

// VSphereCluster is the Schema for the vsphereclusters API
// VSphereCluster is the Schema for the vsphereclusters API.
type VSphereCluster struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -118,17 +118,19 @@ type VSphereCluster struct {
Status VSphereClusterStatus `json:"status,omitempty"`
}

// GetConditions returns the conditions for the VSphereCluster.
func (c *VSphereCluster) GetConditions() clusterv1.Conditions {
return c.Status.Conditions
}

// SetConditions sets conditions on the VSphereCluster.
func (c *VSphereCluster) SetConditions(conditions clusterv1.Conditions) {
c.Status.Conditions = conditions
}

// +kubebuilder:object:root=true

// VSphereClusterList contains a list of VSphereCluster
// VSphereClusterList contains a list of VSphereCluster.
type VSphereClusterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
21 changes: 16 additions & 5 deletions apis/v1beta1/vsphereclusteridentity_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:godot
package v1beta1

import (
Expand All @@ -23,10 +22,13 @@ import (
)

const (
SecretIdentitySetFinalizer = "vspherecluster/infrastructure.cluster.x-k8s.io"
// SecretIdentitySetFinalizer is the finalizer for VSphereCluster credentials secrets .
SecretIdentitySetFinalizer = "vspherecluster/infrastructure.cluster.x-k8s.io"
// VSphereClusterIdentityFinalizer is the finalizer for VSphereClusterIdentityFinalizer credentials secrets.
VSphereClusterIdentityFinalizer = "vsphereclusteridentity/infrastructure.cluster.x-k8s.io"
)

// VSphereClusterIdentitySpec contains a secret reference and a group of allowed namespaces.
type VSphereClusterIdentitySpec struct {
// SecretName references a Secret inside the controller namespace with the credentials to use
// +kubebuilder:validation:MinLength=1
Expand All @@ -39,6 +41,7 @@ type VSphereClusterIdentitySpec struct {
AllowedNamespaces *AllowedNamespaces `json:"allowedNamespaces,omitempty"`
}

// VSphereClusterIdentityStatus contains the status of the VSphereClusterIdentity.
type VSphereClusterIdentityStatus struct {
// +optional
Ready bool `json:"ready,omitempty"`
Expand All @@ -48,19 +51,24 @@ type VSphereClusterIdentityStatus struct {
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
}

// AllowedNamespaces restricts the namespaces this VSphereClusterIdentity can be used from.
type AllowedNamespaces struct {
// Selector is a standard Kubernetes LabelSelector. A label query over a set of resources.
// +optional
Selector metav1.LabelSelector `json:"selector"`
}

// VSphereIdentityKind is the kind of mechanism used to handle credentials for the VCenter API.
type VSphereIdentityKind string

var (
// VSphereClusterIdentityKind is used when a VSphereClusterIdentity is referenced in a VSphereCluster.
VSphereClusterIdentityKind = VSphereIdentityKind("VSphereClusterIdentity")
SecretKind = VSphereIdentityKind("Secret")
// SecretKind is used when a secret is referenced directly in a VSphereCluster.
SecretKind = VSphereIdentityKind("Secret")
)

// VSphereIdentityReference is the mechanism used to handle credentials for the VCenter API.
type VSphereIdentityReference struct {
// Kind of the identity. Can either be VSphereClusterIdentity or Secret
// +kubebuilder:validation:Enum=VSphereClusterIdentity;Secret
Expand All @@ -71,10 +79,12 @@ type VSphereIdentityReference struct {
Name string `json:"name"`
}

// GetConditions returns the conditions for the VSphereClusterIdentity.
func (c *VSphereClusterIdentity) GetConditions() clusterv1.Conditions {
return c.Status.Conditions
}

// SetConditions sets the conditions on the VSphereClusterIdentity.
func (c *VSphereClusterIdentity) SetConditions(conditions clusterv1.Conditions) {
c.Status.Conditions = conditions
}
Expand All @@ -84,7 +94,7 @@ func (c *VSphereClusterIdentity) SetConditions(conditions clusterv1.Conditions)
// +kubebuilder:storageversion
// +kubebuilder:subresource:status

// VSphereClusterIdentity defines the account to be used for reconciling clusters
// VSphereClusterIdentity defines the account to be used for reconciling clusters.
type VSphereClusterIdentity struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -94,7 +104,8 @@ type VSphereClusterIdentity struct {
}

// +kubebuilder:object:root=true
// VSphereClusterIdentityList contains a list of VSphereClusterIdentity

// VSphereClusterIdentityList contains a list of VSphereClusterIdentity.
type VSphereClusterIdentityList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
6 changes: 3 additions & 3 deletions apis/v1beta1/vsphereclustertemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:godot
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// VSphereClusterTemplateSpec defines the desired state of VSphereClusterTemplate
// VSphereClusterTemplateSpec defines the desired state of VSphereClusterTemplate.
type VSphereClusterTemplateSpec struct {
Template VSphereClusterTemplateResource `json:"template"`
}
Expand All @@ -30,7 +29,7 @@ type VSphereClusterTemplateSpec struct {
// +kubebuilder:resource:path=vsphereclustertemplates,scope=Namespaced,categories=cluster-api
// +kubebuilder:storageversion

// VSphereClusterTemplate is the Schema for the vsphereclustertemplates API
// VSphereClusterTemplate is the Schema for the vsphereclustertemplates API.
type VSphereClusterTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -51,6 +50,7 @@ func init() {
objectTypes = append(objectTypes, &VSphereClusterTemplate{}, &VSphereClusterTemplateList{})
}

// VSphereClusterTemplateResource describes the data for creating a VSphereCluster from a template.
type VSphereClusterTemplateResource struct {
Spec VSphereClusterSpec `json:"spec"`
}
13 changes: 8 additions & 5 deletions apis/v1beta1/vspheredeploymentzone_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

//nolint:godot
package v1beta1

import (
Expand All @@ -29,7 +28,7 @@ const (
DeploymentZoneFinalizer = "vspheredeploymentzone.infrastructure.cluster.x-k8s.io"
)

// VSphereDeploymentZoneSpec defines the desired state of VSphereDeploymentZone
// VSphereDeploymentZoneSpec defines the desired state of VSphereDeploymentZone.
type VSphereDeploymentZoneSpec struct {

// Server is the address of the vSphere endpoint.
Expand All @@ -47,7 +46,7 @@ type VSphereDeploymentZoneSpec struct {
PlacementConstraint PlacementConstraint `json:"placementConstraint"`
}

// PlacementConstraint is the context information for VM placements within a failure domain
// PlacementConstraint is the context information for VM placements within a failure domain.
type PlacementConstraint struct {
// ResourcePool is the name or inventory path of the resource pool in which
// the virtual machine is created/located.
Expand All @@ -60,6 +59,7 @@ type PlacementConstraint struct {
Folder string `json:"folder,omitempty"`
}

// Network holds information about the network.
type Network struct {
// Name is the network name for this machine's VM.
Name string `json:"name,omitempty"`
Expand All @@ -73,6 +73,7 @@ type Network struct {
DHCP6 *bool `json:"dhcp6,omitempty"`
}

// VSphereDeploymentZoneStatus contains the status for a VSphereDeploymentZone.
type VSphereDeploymentZoneStatus struct {
// Ready is true when the VSphereDeploymentZone resource is ready.
// If set to false, it will be ignored by VSphereClusters
Expand All @@ -89,7 +90,7 @@ type VSphereDeploymentZoneStatus struct {
// +kubebuilder:resource:path=vspheredeploymentzones,scope=Cluster,categories=cluster-api
// +kubebuilder:subresource:status

// VSphereDeploymentZone is the Schema for the vspheredeploymentzones API
// VSphereDeploymentZone is the Schema for the vspheredeploymentzones API.
type VSphereDeploymentZone struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -98,17 +99,19 @@ type VSphereDeploymentZone struct {
Status VSphereDeploymentZoneStatus `json:"status,omitempty"`
}

// GetConditions returns the conditions for the VSphereDeploymentZone.
func (z *VSphereDeploymentZone) GetConditions() clusterv1.Conditions {
return z.Status.Conditions
}

// SetConditions sets the conditions on the VSphereDeploymentZone.
func (z *VSphereDeploymentZone) SetConditions(conditions clusterv1.Conditions) {
z.Status.Conditions = conditions
}

// +kubebuilder:object:root=true

// VSphereDeploymentZoneList contains a list of VSphereDeploymentZone
// VSphereDeploymentZoneList contains a list of VSphereDeploymentZone.
type VSphereDeploymentZoneList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
Loading

0 comments on commit 3bd563c

Please sign in to comment.