Skip to content

Commit

Permalink
fix lint, vet, fmt, gosec issues (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
panigs7 authored Feb 22, 2022
1 parent ef7647f commit 19348c8
Show file tree
Hide file tree
Showing 28 changed files with 155 additions and 114 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Run Go Security
uses: securego/gosec@master
with:
args: -exclude=G108,G402,G307 ./...
args: -exclude=G108,G402,G307,G101,G404 ./...
test:
name: Run Go unit tests and check package coverage
runs-on: ubuntu-latest
Expand All @@ -37,7 +37,9 @@ jobs:
repository: 'dell/dell-csi-operator'
path: 'dell-csi-operator'
- name: Run unit tests and check package coverage
run: make unit-test
uses: dell/common-github-actions/go-code-tester@main
with:
threshold: 60
malware_security_scan:
name: Malware Scanner
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion api/v1/csiisilon_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ type CSIIsilonSpec struct {
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=csiisilons,scope=Namespaced

// +operator-sdk:csv:customresourcedefinitions:displayName="CSI PowerScale",resources={{Deployment,v1,isilon-controller},{DameonSet,v1,isilon-node}}
// CSIIsilon is the Schema for the csiisilons API
// +operator-sdk:csv:customresourcedefinitions:displayName="CSI PowerScale",resources={{Deployment,v1,isilon-controller},{DameonSet,v1,isilon-node}}
type CSIIsilon struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion api/v1/csipowermax_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ type CSIPowerMaxSpec struct {
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=csipowermaxes,scope=Namespaced

// +operator-sdk:csv:customresourcedefinitions:displayName="CSI PowerMax",resources={{Deployment,v1,powermax-controller},{DameonSet,v1,powermax-node}}
// CSIPowerMax is the Schema for the csipowermaxes API
// +operator-sdk:csv:customresourcedefinitions:displayName="CSI PowerMax",resources={{Deployment,v1,powermax-controller},{DameonSet,v1,powermax-node}}
type CSIPowerMax struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
3 changes: 2 additions & 1 deletion api/v1/csipowermaxrevproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// ProxyLimits is used for storing the various types of limits
// applied for a particular proxy instance
type ProxyLimits struct {
Expand Down Expand Up @@ -113,8 +114,8 @@ type CSIPowerMaxRevProxyStatus struct {
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=csipowermaxrevproxies,scope=Namespaced

// +operator-sdk:csv:customresourcedefinitions:displayName="CSI PowerMax ReverseProxy",resources={{Deployment,v1,powermax-reverseproxy}}
// CSIPowerMaxRevProxy is the Schema for the csipowermaxrevproxies API
// +operator-sdk:csv:customresourcedefinitions:displayName="CSI PowerMax ReverseProxy",resources={{Deployment,v1,powermax-reverseproxy}}
type CSIPowerMaxRevProxy struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion api/v1/csipowerstore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ type CSIPowerStoreSpec struct {
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=csipowerstores,scope=Namespaced

// +operator-sdk:csv:customresourcedefinitions:displayName="CSI PowerStore",resources={{Deployment,v1,powerstore-controller},{DameonSet,v1,powerstore-node}}
// CSIPowerStore is the Schema for the csipowerstores API
// +operator-sdk:csv:customresourcedefinitions:displayName="CSI PowerStore",resources={{Deployment,v1,powerstore-controller},{DameonSet,v1,powerstore-node}}
type CSIPowerStore struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion api/v1/csiunity_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ type CSIUnitySpec struct {
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=csiunities,scope=Namespaced

// +operator-sdk:csv:customresourcedefinitions:displayName="CSI Unity",resources={{Deployment,v1,unity-controller},{DameonSet,v1,unity-node}}
// CSIUnity is the Schema for the csiunities API
// +operator-sdk:csv:customresourcedefinitions:displayName="CSI Unity",resources={{Deployment,v1,unity-controller},{DameonSet,v1,unity-node}}
type CSIUnity struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion api/v1/csivxflexos_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ type CSIVXFlexOSSpec struct {
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=csivxflexoses,scope=Namespaced

// +operator-sdk:csv:customresourcedefinitions:displayName="CSI PowerFlex",resources={{Deployment,v1,vxflexos-controller},{DameonSet,v1,vxflexos-node}}
// CSIVXFlexOS is the Schema for the csivxflexos API
// +operator-sdk:csv:customresourcedefinitions:displayName="CSI PowerFlex",resources={{Deployment,v1,vxflexos-controller},{DameonSet,v1,vxflexos-node}}
type CSIVXFlexOS struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand Down
2 changes: 2 additions & 0 deletions api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ func (cr *CSIPowerStore) GetDriverEnvName() string {

// DriverType - type representing the type of the driver. e.g. - powermax, unity
type DriverType string

// K8sVersion - type representing the kubernetes version.
type K8sVersion string

// CSIOperatorConditionType defines the type of the last status update
Expand Down
1 change: 1 addition & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions controllers/csiisilon_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type CSIIsilonReconciler struct {
// +kubebuilder:rbac:groups="coordination.k8s.io",resources=leases,verbs=get;list;watch;create;update;delete
// +kubebuilder:rbac:groups="security.openshift.io",resources=securitycontextconstraints,resourceNames=privileged,verbs=use

// Reconcile function reconciles a CSIIsilon object
func (r *CSIIsilonReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log := r.Log.WithValues("csiisilon", req.NamespacedName)

Expand Down Expand Up @@ -130,6 +131,7 @@ func (r *CSIIsilonReconciler) ValidateDriverSpec(ctx context.Context, instance s
return nil
}

// SetupWithManager - sets up the controller
func (r *CSIIsilonReconciler) SetupWithManager(mgr ctrl.Manager) error {
c, err := controller.New("CSIIsilon", mgr, controller.Options{Reconciler: r})
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions controllers/csipowermax_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ type CSIPowerMaxReconciler struct {
// +kubebuilder:rbac:groups="coordination.k8s.io",resources=leases,verbs=get;list;watch;create;update;delete
// +kubebuilder:rbac:groups="security.openshift.io",resources=securitycontextconstraints,resourceNames=privileged,verbs=use

// Reconcile function reconciles a CSIPowermax object
func (r *CSIPowerMaxReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log := r.Log.WithValues("csipowermax", req.NamespacedName)

instance := &storagev1.CSIPowerMax{}
return utils.Reconcile(ctx, instance, req, r, log)
}

// SetupWithManager - sets up controller
func (r *CSIPowerMaxReconciler) SetupWithManager(mgr ctrl.Manager) error {
c, err := controller.New("CSIPowerMax", mgr, controller.Options{Reconciler: r})
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions controllers/csipowermaxrevproxy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type CSIPowerMaxRevProxyReconciler struct {

// +kubebuilder:rbac:groups=storage.dell.com,resources=csipowermaxrevproxies;csipowermaxrevproxies/finalizers;csipowermaxrevproxies/status,verbs=*

// Reconcile function reconciles a CSIPowerMax object
func (r *CSIPowerMaxRevProxyReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) {
reqLogger := log.WithValues("Request.Namespace", request.Namespace, "Request.Name", request.Name)
reqLogger.Info("Reconciling CSIPowerMaxRevProxy")
Expand Down Expand Up @@ -220,6 +221,7 @@ func (r *CSIPowerMaxRevProxyReconciler) Reconcile(ctx context.Context, request c
return logBannerAndReturn(reconcile.Result{Requeue: true, RequeueAfter: retryInterval}, nil, reqLogger)
}

// SetupWithManager - sets up controller
func (r *CSIPowerMaxRevProxyReconciler) SetupWithManager(mgr ctrl.Manager) error {
c, err := controller.New("CSIPowerMaxRevProxy", mgr, controller.Options{Reconciler: r})
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions controllers/csipowerstore_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type CSIPowerStoreReconciler struct {
// +kubebuilder:rbac:groups="coordination.k8s.io",resources=leases,verbs=get;list;watch;create;update;delete
// +kubebuilder:rbac:groups="security.openshift.io",resources=securitycontextconstraints,resourceNames=privileged,verbs=use

//Reconcile function reconciles a CSIPowerStore Object
func (r *CSIPowerStoreReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log := r.Log.WithValues("csipowerstore", req.NamespacedName)

Expand All @@ -76,6 +77,7 @@ func (r *CSIPowerStoreReconciler) Reconcile(ctx context.Context, req ctrl.Reques
return utils.Reconcile(ctx, csiPowerStore, req, r, log)
}

// SetupWithManager - sets up the controller
func (r *CSIPowerStoreReconciler) SetupWithManager(mgr ctrl.Manager) error {
c, err := controller.New("CSIPowerStore", mgr, controller.Options{Reconciler: r})
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions controllers/csiunity_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ type CSIUnityReconciler struct {
// +kubebuilder:rbac:groups="coordination.k8s.io",resources=leases,verbs=get;list;watch;create;update;delete
// +kubebuilder:rbac:groups="security.openshift.io",resources=securitycontextconstraints,resourceNames=privileged,verbs=use

// Reconcile function reconciles a CSIUnity Object
func (r *CSIUnityReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log := r.Log.WithValues("csiunity", req.NamespacedName)

csiUnity := &storagev1.CSIUnity{}
return utils.Reconcile(ctx, csiUnity, req, r, log)
}

// SetupWithManager - sets up controller
func (r *CSIUnityReconciler) SetupWithManager(mgr ctrl.Manager) error {
c, err := controller.New("CSIUnity", mgr, controller.Options{Reconciler: r})
if err != nil {
Expand Down
Loading

0 comments on commit 19348c8

Please sign in to comment.