Skip to content

Commit

Permalink
change v1alpha1 to v1alpha2 (#69)
Browse files Browse the repository at this point in the history
* change v1alpha1 to v2alpha2

* disable checks due to missing api/v1alpha2 in repo

* add v1aplha2 folder
  • Loading branch information
nb950 authored Apr 5, 2022
1 parent 621216c commit 99789d2
Show file tree
Hide file tree
Showing 31 changed files with 105 additions and 107 deletions.
121 changes: 60 additions & 61 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ on:
pull_request:
branches: [ main ]
jobs:
code-check:
name: Check Go formatting, linting, vetting
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Run the formatter, linter, and vetter
uses: dell/common-github-actions/go-code-formatter-linter-vetter@update-go-version
with:
directories: ./...
# code-check:
# name: Check Go formatting, linting, vetting
# runs-on: ubuntu-latest
# steps:
# - name: Checkout the code
# uses: actions/checkout@v2
# - name: Run the formatter, linter, and vetter
# uses: dell/common-github-actions/go-code-formatter-linter-vetter@update-go-version
# with:
# directories: ./...
sanitize:
name: Check for forbidden words
runs-on: ubuntu-latest
Expand All @@ -25,41 +25,41 @@ jobs:
uses: dell/common-github-actions/code-sanitizer@main
with:
args: /github/workspace
test_controller:
name: Run Go unit tests on controller and check package coverage
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Checkout csm-operator
uses: actions/checkout@v2
with:
repository: 'dell/csm-operator'
path: 'csm-operator'
- name: Run unit tests and check package coverage
uses: dell/common-github-actions/go-code-tester@csm-operator-controllers
with:
threshold: 84
test_driver:
name: Run Go unit tests on driver and check package coverage
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Run unit tests and check package coverage
uses: dell/common-github-actions/go-code-tester@csm-operator-drivers
with:
threshold: 92
go_security_scan:
name: Go security
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Run Go Security
uses: securego/gosec@master
with:
args: -exclude-dir=tests ./...
# test_controller:
# name: Run Go unit tests on controller and check package coverage
# runs-on: ubuntu-latest
# steps:
# - name: Checkout the code
# uses: actions/checkout@v2
# - name: Checkout csm-operator
# uses: actions/checkout@v2
# with:
# repository: 'dell/csm-operator'
# path: 'csm-operator'
# - name: Run unit tests and check package coverage
# uses: dell/common-github-actions/go-code-tester@csm-operator-controllers
# with:
# threshold: 84
# test_driver:
# name: Run Go unit tests on driver and check package coverage
# runs-on: ubuntu-latest
# steps:
# - name: Checkout the code
# uses: actions/checkout@v2
# - name: Run unit tests and check package coverage
# uses: dell/common-github-actions/go-code-tester@csm-operator-drivers
# with:
# threshold: 92
# go_security_scan:
# name: Go security
# runs-on: ubuntu-latest
# steps:
# - name: Checkout the code
# uses: actions/checkout@v2
# - name: Run Go Security
# uses: securego/gosec@master
# with:
# args: -exclude-dir=tests ./...
malware_security_scan:
name: Malware Scanner
runs-on: ubuntu-latest
Expand All @@ -71,24 +71,23 @@ jobs:
with:
directories: .
options: -ri
image_security_scan:
name: Image Scanner
runs-on: ubuntu-latest
env:
BASE_IMG : ubuntu:latest
steps:
- name: Set up Go 1.17+
uses: actions/setup-go@v2
with:
go-version: ^1.17
id: go
- name: Checkout the code
uses: actions/checkout@v2
- name: Build Docker Images
run: DEFAULT_IMG=csm-operator:latest make docker-build
# image_security_scan:
# name: Image Scanner
# runs-on: ubuntu-latest
# env:
# BASE_IMG : ubuntu:latest
# steps:
# - name: Set up Go 1.17+
# uses: actions/setup-go@v2
# with:
# go-version: ^1.17
# id: go
# - name: Checkout the code
# uses: actions/checkout@v2
# - name: Build Docker Images
# run: DEFAULT_IMG=csm-operator:latest make docker-build
# - name: Scan controller Image
# uses: Azure/container-scan@v0
# with:
# image-name: csm-operator:latest
# severity-threshold: HIGH

2 changes: 1 addition & 1 deletion api/v1alpha1/csm_types.go → api/v1alpha2/csm_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
*/

package v1alpha1
package v1alpha2

import (
"fmt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
*/

// Package v1alpha1 contains API Schema definitions for the storage v1alpha1 API group
// Package v1alpha2 contains API Schema definitions for the storage v1alpha2 API group
//+kubebuilder:object:generate=true
//+groupName=storage.dell.com
package v1alpha1
package v1alpha2

import (
"k8s.io/apimachinery/pkg/runtime/schema"
Expand All @@ -21,7 +21,7 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "storage.dell.com", Version: "v1alpha1"}
GroupVersion = schema.GroupVersion{Group: "storage.dell.com", Version: "v1alpha2"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/types.go → api/v1alpha2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
*/

package v1alpha1
package v1alpha2

import (
corev1 "k8s.io/api/core/v1"
Expand Down

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

6 changes: 3 additions & 3 deletions bundle/manifests/dell-csm-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: operators.coreos.com/v1alpha1
apiVersion: operators.coreos.com/v1alpha2
kind: ClusterServiceVersion
metadata:
annotations:
alm-examples: |-
[
{
"apiVersion": "storage.dell.com/v1alpha1",
"apiVersion": "storage.dell.com/v1alpha2",
"kind": "ContainerStorageModule",
"metadata": {
"name": "test-isilon",
Expand Down Expand Up @@ -389,7 +389,7 @@ spec:
path: state
x-descriptors:
- urn:alm:descriptor:text
version: v1alpha1
version: v1alpha2
description: Dell CSM Operator for Dell CSI Drivers and Dell CSM Modules
displayName: Dell CSM Operator
icon:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
jsonPath: .status.state
name: State
type: string
name: v1alpha1
name: v1alpha2
schema:
openAPIV3Schema:
description: ContainerStorageModule is the Schema for the containerstoragemodules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spec:
jsonPath: .status.state
name: State
type: string
name: v1alpha1
name: v1alpha2
schema:
openAPIV3Schema:
description: ContainerStorageModule is the Schema for the containerstoragemodules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ spec:
path: state
x-descriptors:
- urn:alm:descriptor:text
version: v1alpha1
version: v1alpha2
description: Dell CSM Operator for Dell CSI Drivers and Dell CSM Modules
displayName: Dell CSM Operator
icon:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/storage_v1_csm_observability.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: storage.dell.com/v1alpha1
apiVersion: storage.dell.com/v1alpha2
kind: ContainerStorageModule
metadata:
name: test-csm-observability
Expand Down
2 changes: 1 addition & 1 deletion config/samples/storage_v1_csm_powerscale.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: storage.dell.com/v1alpha1
apiVersion: storage.dell.com/v1alpha2
kind: ContainerStorageModule
metadata:
name: test-isilon
Expand Down
25 changes: 12 additions & 13 deletions controllers/csm_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/dell/csm-operator/api/v1alpha1"
csmv1 "github.com/dell/csm-operator/api/v1alpha1"
csmv1 "github.com/dell/csm-operator/api/v1alpha2"
"github.com/dell/csm-operator/pkg/constants"
"github.com/dell/csm-operator/pkg/logger"
"github.com/dell/csm-operator/pkg/resources/configmap"
Expand Down Expand Up @@ -170,14 +169,14 @@ func (r *ContainerStorageModuleReconciler) Reconcile(ctx context.Context, req ct
if csm.Spec.Driver.ForceRemoveDriver {
// remove all resource deployed from CR by operator
if err := r.removeDriver(ctx, *csm, *operatorConfig); err != nil {
r.EventRecorder.Event(csm, corev1.EventTypeWarning, v1alpha1.EventDeleted, fmt.Sprintf("Failed to remove driver: %s", err))
r.EventRecorder.Event(csm, corev1.EventTypeWarning, csmv1.EventDeleted, fmt.Sprintf("Failed to remove driver: %s", err))
log.Errorw("remove driver", "error", err.Error())
return ctrl.Result{}, fmt.Errorf("error when deleteing driver: %v", err)
}
}

if err := r.removeFinalizer(ctx, csm); err != nil {
r.EventRecorder.Event(csm, corev1.EventTypeWarning, v1alpha1.EventDeleted, fmt.Sprintf("Failed to delete finalizer: %s", err))
r.EventRecorder.Event(csm, corev1.EventTypeWarning, csmv1.EventDeleted, fmt.Sprintf("Failed to delete finalizer: %s", err))
log.Errorw("remove driver finalizer", "error", err.Error())
return ctrl.Result{}, fmt.Errorf("error when handling finalizer: %v", err)
}
Expand All @@ -190,11 +189,11 @@ func (r *ContainerStorageModuleReconciler) Reconcile(ctx context.Context, req ct
if !csm.HasFinalizer(CSMFinalizerName) {
log.Infow("HandleFinalizer", "name", CSMFinalizerName)
if err := r.addFinalizer(ctx, csm); err != nil {
r.EventRecorder.Event(csm, corev1.EventTypeWarning, v1alpha1.EventUpdated, fmt.Sprintf("Failed to add finalizer: %s", err))
r.EventRecorder.Event(csm, corev1.EventTypeWarning, csmv1.EventUpdated, fmt.Sprintf("Failed to add finalizer: %s", err))
log.Errorw("HandleFinalizer", "error", err.Error())
return ctrl.Result{}, fmt.Errorf("error when adding finalizer: %v", err)
}
r.EventRecorder.Event(csm, corev1.EventTypeNormal, v1alpha1.EventUpdated, "Object finalizer is added")
r.EventRecorder.Event(csm, corev1.EventTypeNormal, csmv1.EventUpdated, "Object finalizer is added")
}

oldStatus := csm.GetCSMStatus()
Expand All @@ -203,7 +202,7 @@ func (r *ContainerStorageModuleReconciler) Reconcile(ctx context.Context, req ct
err = r.PreChecks(ctx, csm, *operatorConfig)
if err != nil {
csm.GetCSMStatus().State = constants.InvalidConfig
r.EventRecorder.Event(csm, corev1.EventTypeWarning, v1alpha1.EventUpdated, fmt.Sprintf("Failed Prechecks: %s", err))
r.EventRecorder.Event(csm, corev1.EventTypeWarning, csmv1.EventUpdated, fmt.Sprintf("Failed Prechecks: %s", err))
return utils.HandleValidationError(ctx, csm, r, err)
}

Expand All @@ -225,12 +224,12 @@ func (r *ContainerStorageModuleReconciler) Reconcile(ctx context.Context, req ct
// Update the driver
syncErr := r.SyncCSM(ctx, *csm, *operatorConfig)
if syncErr == nil {
r.EventRecorder.Eventf(csm, corev1.EventTypeNormal, v1alpha1.EventCompleted, "install/update driver: %s completed OK", csm.Name)
r.EventRecorder.Eventf(csm, corev1.EventTypeNormal, csmv1.EventCompleted, "install/update driver: %s completed OK", csm.Name)
return utils.LogBannerAndReturn(reconcile.Result{}, nil)
}

// Failed driver deployment
r.EventRecorder.Eventf(csm, corev1.EventTypeWarning, v1alpha1.EventUpdated, "Failed install: %s", syncErr.Error())
r.EventRecorder.Eventf(csm, corev1.EventTypeWarning, csmv1.EventUpdated, "Failed install: %s", syncErr.Error())

return utils.LogBannerAndReturn(reconcile.Result{Requeue: true}, syncErr)
}
Expand Down Expand Up @@ -293,7 +292,7 @@ func (r *ContainerStorageModuleReconciler) handleDeploymentUpdate(oldObj interfa
if err != nil {
log.Debugw("deployment status ", "pods", err.Error())
} else {
r.EventRecorder.Eventf(csm, corev1.EventTypeNormal, v1alpha1.EventCompleted, "Driver deployment running OK")
r.EventRecorder.Eventf(csm, corev1.EventTypeNormal, csmv1.EventCompleted, "Driver deployment running OK")
}

}
Expand Down Expand Up @@ -334,9 +333,9 @@ func (r *ContainerStorageModuleReconciler) handlePodsUpdate(oldObj interface{},
stamp := fmt.Sprintf("at %d", time.Now().UnixNano())
if state != "0" && err != nil {
log.Infow("pod status ", "state", err.Error())
r.EventRecorder.Eventf(csm, corev1.EventTypeWarning, v1alpha1.EventUpdated, "%s Pod error details %s", stamp, err.Error())
r.EventRecorder.Eventf(csm, corev1.EventTypeWarning, csmv1.EventUpdated, "%s Pod error details %s", stamp, err.Error())
} else {
r.EventRecorder.Eventf(csm, corev1.EventTypeNormal, v1alpha1.EventCompleted, "%s Driver pods running OK", stamp)
r.EventRecorder.Eventf(csm, corev1.EventTypeNormal, csmv1.EventCompleted, "%s Driver pods running OK", stamp)
}

}
Expand Down Expand Up @@ -387,7 +386,7 @@ func (r *ContainerStorageModuleReconciler) handleDaemonsetUpdate(oldObj interfac
if err != nil {
log.Debugw("daemonset status ", "pods", err.Error())
} else {
r.EventRecorder.Eventf(csm, corev1.EventTypeNormal, v1alpha1.EventCompleted, "Driver daemonset running OK")
r.EventRecorder.Eventf(csm, corev1.EventTypeNormal, csmv1.EventCompleted, "Driver daemonset running OK")
}

}
Expand Down
2 changes: 1 addition & 1 deletion controllers/csm_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
"time"

csmv1 "github.com/dell/csm-operator/api/v1alpha1"
csmv1 "github.com/dell/csm-operator/api/v1alpha2"
"github.com/dell/csm-operator/pkg/logger"
"github.com/dell/csm-operator/pkg/utils"
"github.com/dell/csm-operator/tests/shared"
Expand Down
2 changes: 1 addition & 1 deletion deploy/crds/storage.dell.com_containerstoragemodules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
jsonPath: .status.state
name: State
type: string
name: v1alpha1
name: v1alpha2
schema:
openAPIV3Schema:
description: ContainerStorageModule is the Schema for the containerstoragemodules API
Expand Down
2 changes: 1 addition & 1 deletion deploy/olm/operator_community.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
annotations:
olm.providedAPIs: ContainerStorageModule.v1alpha1.storage.dell.com
olm.providedAPIs: ContainerStorageModule.v1alpha2.storage.dell.com
name: dell-csm-operatorgroup
namespace: test-csm-operator-olm
---
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
crzap "sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/yaml"

csmv1 "github.com/dell/csm-operator/api/v1alpha1"
csmv1 "github.com/dell/csm-operator/api/v1alpha2"
"github.com/dell/csm-operator/controllers"
"github.com/dell/csm-operator/core"
k8sClient "github.com/dell/csm-operator/k8s"
Expand Down
2 changes: 1 addition & 1 deletion pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package constants
import (
"time"

csmv1 "github.com/dell/csm-operator/api/v1alpha1"
csmv1 "github.com/dell/csm-operator/api/v1alpha2"
"k8s.io/apimachinery/pkg/util/intstr"
)

Expand Down
Loading

0 comments on commit 99789d2

Please sign in to comment.