Skip to content

Commit

Permalink
sync public repo
Browse files Browse the repository at this point in the history
Updating go.sum

Updated actions.yaml
  • Loading branch information
rajendraindukuri authored and rajendraindukuri committed Feb 18, 2022
1 parent a3ab388 commit 3b7c3d2
Show file tree
Hide file tree
Showing 95 changed files with 4,196 additions and 2,281 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ jobs:
uses: securego/gosec@master
with:
args: -exclude=G108,G402,G307 ./...
test:
name: Run Go unit tests and check package coverage
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Checkout dell-csi-operator
uses: actions/checkout@v2
with:
repository: 'dell/dell-csi-operator'
path: 'dell-csi-operator'
- name: Run unit tests and check package coverage
run: make unit-test
malware_security_scan:
name: Malware Scanner
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.16 as builder
FROM golang:1.17 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -25,7 +25,7 @@ FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
RUN microdnf install yum \
&& yum -y update-minimal --security --sec-severity=Important --sec-severity=Critical \
&& yum clean all \
&& microdnf remove yum \
&& rpm -e yum \
&& microdnf clean all

ENV USER_UID=1001 \
Expand Down
96 changes: 68 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:crdVersions={v1},trivialVersions=true,preserveUnknownFields=false"
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.22

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand All @@ -8,7 +8,49 @@ else
GOBIN=$(shell go env GOBIN)
endif

all: manager
# Setting SHELL to bash allows bash commands to be executed by recipes.
# This is a requirement for 'setup-envtest.sh' in the test target.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec

all: build

##@ General

# The help target prints out all targets with their descriptions organized
# beneath their categories. The categories are represented by '##@' and the
# target descriptions by '##'. The awk commands is responsible for reading the
# entire set of makefiles included in this invocation, looking for lines of the
# file as xyz: ## something, and then pretty-format the target and help. Then,
# if there's a line with ##@ something, that gets pretty-printed as a category.
# More info on the usage of ANSI control characters for terminal formatting:
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
# More info on the awk command:
# http://linuxcommand.org/lc3_adv_awk.php

help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

##@ Development

manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

fmt: ## Run go fmt against code.
go fmt ./...

vet: ## Run go vet against code.
go vet ./...

test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out

unit-test:
go clean -cache; cd ./test; go test -race -cover -coverprofile=coverage.out -coverpkg ../pkg/... ./. 2>&1 | tee test-result

#Generate semver.mk
gen-semver: generate
Expand All @@ -18,13 +60,6 @@ gen-semver: generate
version: gen-semver
make -f docker.mk version

# Run tests
test: generate fmt vet manifests
go test ./... -coverprofile cover.out

unit-test:
go clean -cache; cd ./test; go test -race -cover -coverprofile=coverage.out -coverpkg ../pkg/... ./. 2>&1 | tee test-result

# Build manager binary
manager: gen-semver fmt vet
go build -o bin/manager main.go
Expand Down Expand Up @@ -52,7 +87,7 @@ uninstall: static-crd

config-map:
tar -cf - driverconfig/* | gzip > deploy/config.tar.gz
kubectl create configmap dell-csi-operator-config --from-file deploy/config.tar.gz -o yaml --dry-run | kubectl apply -f -
kubectl create configmap dell-csi-operator-config --from-file deploy/config.tar.gz -o yaml --dry-run=client | kubectl apply -f -
rm -f deploy/config.tar.gz

remove-config-map:
Expand Down Expand Up @@ -84,22 +119,6 @@ remove-dev: kustomize
$(KUSTOMIZE) build config/dev | kubectl delete -f -
rm -f config/dev/config.tar.gz

# Generate manifests e.g. CRD, RBAC etc.
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases

# Run go fmt against code
fmt:
go fmt ./...

# Run go vet against code
vet:
go vet ./...

# Generate code
generate: controller-gen
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

# Build the docker image
docker-build: gen-semver
make -f docker.mk docker-build
Expand All @@ -116,12 +135,16 @@ docker-feature-push: gen-semver

CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.4.1)
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0)

KUSTOMIZE = $(shell pwd)/bin/kustomize
kustomize: ## Download kustomize locally if necessary.
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])

ENVTEST = $(shell pwd)/bin/setup-envtest
envtest: ## Download envtest-setup locally if necessary.
$(call go-get-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)

# go-get-tool will 'go get' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
Expand Down Expand Up @@ -172,3 +195,20 @@ check:
.PHONY: integ-test
integ-test: check gen-semver
(CGO_ENABLED=0 go test -v ./test/integration-tests/)

.PHONY: opm
OPM = ./bin/opm
opm: ## Download opm locally if necessary.
ifeq (,$(wildcard $(OPM)))
ifeq (,$(shell which opm 2>/dev/null))
@{ \
set -e ;\
mkdir -p $(dir $(OPM)) ;\
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.15.1/$${OS}-$${ARCH}-opm ;\
chmod +x $(OPM) ;\
}
else
OPM = $(shell which opm)
endif
endif
2 changes: 1 addition & 1 deletion bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=dell-csi-operator-certified
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.6.1+git
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.14.0+git
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ metadata:
"value": "/etc/fc-ports-filter"
}
],
"image": "dellemc/csi-powerstore:v2.1.0",
"image": "dellemc/csi-powerstore:v2.2.0",
"imagePullPolicy": "IfNotPresent"
},
"configVersion": "v2.1.0",
"configVersion": "v2.2.0",
"dnsPolicy": "ClusterFirstWithHostNet",
"forceUpdate": false,
"node": {
Expand Down Expand Up @@ -320,8 +320,7 @@ metadata:
certified: "true"
containerImage: dellemc/dell-csi-operator:v1.7.0
olm.properties: '[{"type": "olm.maxOpenShiftVersion", "value": "4.9"}]'
olm.skipRange: '>=1.5.0 <1.6.0'
operators.operatorframework.io/builder: operator-sdk-v1.6.1+git
operators.operatorframework.io/builder: operator-sdk-v1.14.0+git
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/dell/dell-csi-operator
support: Dell EMC
Expand Down Expand Up @@ -1876,4 +1875,5 @@ spec:
minKubeVersion: 1.20.0
provider:
name: Dell EMC
replaces: dell-csi-operator-certified.v1.6.0
version: 1.7.0

This file was deleted.

2 changes: 1 addition & 1 deletion bundle/manifests/storage.dell.com_csiisilons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
name: csiisilons.storage.dell.com
spec:
Expand Down
2 changes: 1 addition & 1 deletion bundle/manifests/storage.dell.com_csipowermaxes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
name: csipowermaxes.storage.dell.com
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
name: csipowermaxrevproxies.storage.dell.com
spec:
Expand Down
2 changes: 1 addition & 1 deletion bundle/manifests/storage.dell.com_csipowerstores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
name: csipowerstores.storage.dell.com
spec:
Expand Down
2 changes: 1 addition & 1 deletion bundle/manifests/storage.dell.com_csiunities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
name: csiunities.storage.dell.com
spec:
Expand Down
2 changes: 1 addition & 1 deletion bundle/manifests/storage.dell.com_csivxflexoses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.4.1
controller-gen.kubebuilder.io/version: v0.7.0
creationTimestamp: null
name: csivxflexoses.storage.dell.com
spec:
Expand Down
4 changes: 2 additions & 2 deletions bundle/metadata/annotations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ annotations:
operators.operatorframework.io.bundle.package.v1: dell-csi-operator-certified
operators.operatorframework.io.bundle.channels.v1: stable
operators.operatorframework.io.bundle.channel.default.v1: stable
operators.operatorframework.io.metrics.builder: operator-sdk-v1.6.1+git
operators.operatorframework.io.metrics.builder: operator-sdk-v1.14.0+git
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3

Expand All @@ -15,5 +15,5 @@ annotations:
operators.operatorframework.io.test.config.v1: tests/scorecard/

# Annotations to specify supported OCP versions.
com.redhat.openshift.versions: v4.8-v4.9
com.redhat.openshift.versions: v4.8

21 changes: 21 additions & 0 deletions bundle/tests/scorecard/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,59 @@ stages:
labels:
suite: basic
test: basic-check-spec-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-bundle-validation
image: quay.io/operator-framework/scorecard-test:v1.0.0
labels:
suite: olm
test: olm-bundle-validation-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-crds-have-validation
image: quay.io/operator-framework/scorecard-test:v1.0.0
labels:
suite: olm
test: olm-crds-have-validation-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-crds-have-resources
image: quay.io/operator-framework/scorecard-test:v1.0.0
labels:
suite: olm
test: olm-crds-have-resources-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-spec-descriptors
image: quay.io/operator-framework/scorecard-test:v1.0.0
labels:
suite: olm
test: olm-spec-descriptors-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-status-descriptors
image: quay.io/operator-framework/scorecard-test:v1.0.0
labels:
suite: olm
test: olm-status-descriptors-test
storage:
spec:
mountPath: {}
storage:
spec:
mountPath: {}
2 changes: 1 addition & 1 deletion check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ echo === Finished

echo === Linting...
(command -v golint >/dev/null 2>&1 \
|| GO111MODULE=off go get -insecure -u golang.org/x/lint/golint) \
|| GO111MODULE=on go install golang.org/x/lint/golint@latest) \
&& golint --set_exit_status ./pkg/config/... ./pkg/constants/... ./pkg/resources/... ./pkg/ctrlconfig/... ./pkg/utils/...
LINT_RETURN_CODE=$?
echo === Finished
Expand Down
2 changes: 1 addition & 1 deletion community.bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=dell-csi-operator
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.7.1
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.15.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3

Expand Down
Loading

0 comments on commit 3b7c3d2

Please sign in to comment.