Skip to content

Commit

Permalink
Merge pull request #147 from red-hat-storage/main
Browse files Browse the repository at this point in the history
Bug 2276056: [release-4.16] Syncing latest changes from main
  • Loading branch information
openshift-merge-bot[bot] authored Apr 22, 2024
2 parents 4f45d99 + 29394b2 commit 35fae4c
Show file tree
Hide file tree
Showing 280 changed files with 10,849 additions and 22,179 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
bin/
testbin/

catalog
catalog.Dockerfile

# Created by https://www.toptal.com/developers/gitignore/api/go,vim,visualstudiocode,git
# Edit at https://www.toptal.com/developers/gitignore?templates=go,vim,visualstudiocode,git

Expand Down Expand Up @@ -74,6 +77,9 @@ tags
# Local History for Visual Studio Code
.history/

### IntelliJ ###
.idea

# Built Visual Studio Code Extensions
*.vsix

Expand Down
3 changes: 0 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ run:
linters:
disable-all: true
enable:
- deadcode
- errcheck
- gosimple
- ineffassign
- staticcheck
- structcheck
- unused
- varcheck
- revive
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ COPY controllers/ controllers/
COPY config/ config/
COPY pkg/ pkg/
COPY service/ service/
# Run tests and linting
RUN make go-test

# Build
RUN make go-build
Expand Down
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ include hack/make-project-vars.mk
include hack/make-tools.mk
include hack/make-bundle-vars.mk


# 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.
Expand Down Expand Up @@ -55,15 +54,15 @@ vet: ## Run go vet against code.
go vet ./...

lint: ## Run golangci-lint against code.
docker run --rm -v $(PROJECT_DIR):/app:Z -w /app $(GO_LINT_IMG) golangci-lint run ./...
$(IMAGE_BUILD_CMD) run --rm -v $(PROJECT_DIR):/app -w /app $(GO_LINT_IMG) golangci-lint run ./...

godeps-update: ## Run go mod tidy & vendor
go mod tidy && go mod vendor

test-setup: godeps-update generate fmt vet ## Run setup targets for tests
test-setup: godeps-update generate fmt vet envtest ## Run setup targets for tests

go-test: ## Run go test against code.
./hack/go-test.sh
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(BIN_DIR) -p path)" go test -coverprofile cover.out `go list ./... | grep -v "e2e"`

test: test-setup go-test ## Run go unit tests.

Expand All @@ -82,11 +81,11 @@ go-build: ## Run go build against code.
run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go

container-build: test-setup ## Build container image with the manager.
docker build -t ${IMG} .
container-build: test ## Build container image with the manager.
$(IMAGE_BUILD_CMD) build --platform="linux/amd64" -t ${IMG} .

container-push: ## Push container image with the manager.
docker push ${IMG}
$(IMAGE_BUILD_CMD) push ${IMG}

##@ Deployment

Expand Down Expand Up @@ -117,7 +116,8 @@ bundle: manifests kustomize operator-sdk yq ## Generate bundle manifests and met
rm -rf ./bundle
$(OPERATOR_SDK) generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
cd config/console && $(KUSTOMIZE) edit set image ocs-client-operator-console=$(OCS_CLIENT_CONSOLE_IMG)
cd config/console && $(KUSTOMIZE) edit set image ocs-client-operator-console=$(OCS_CLIENT_CONSOLE_IMG) && \
$(KUSTOMIZE) edit set nameprefix $(OPERATOR_NAMEPREFIX)
cd config/default && \
$(KUSTOMIZE) edit set image kube-rbac-proxy=$(RBAC_PROXY_IMG) && \
$(KUSTOMIZE) edit set namespace $(OPERATOR_NAMESPACE) && \
Expand All @@ -128,27 +128,27 @@ bundle: manifests kustomize operator-sdk yq ## Generate bundle manifests and met
--patch '[{"op": "replace", "path": "/spec/replaces", "value": "$(REPLACES)"}]'
$(KUSTOMIZE) build $(MANIFEST_PATH) | sed "s|STATUS_REPORTER_IMAGE_VALUE|$(IMG)|g" | awk '{print}'| \
$(OPERATOR_SDK) generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS) --extra-service-accounts="$$($(KUSTOMIZE) build $(MANIFEST_PATH) | $(YQ) 'select(.kind == "ServiceAccount") | .metadata.name' -N | paste -sd "," -)"
sed -i "s|packageName:.*|packageName: ${CSI_ADDONS_PACKAGE_NAME}|g" "config/metadata/dependencies.yaml"
sed -i "s|version:.*|version: "${CSI_ADDONS_PACKAGE_VERSION}"|g" "config/metadata/dependencies.yaml"
yq -i '.dependencies[0].value.packageName = "'${CSI_ADDONS_PACKAGE_NAME}'"' config/metadata/dependencies.yaml
yq -i '.dependencies[0].value.version = "'${CSI_ADDONS_PACKAGE_VERSION}'"' config/metadata/dependencies.yaml
cp config/metadata/* bundle/metadata/
$(OPERATOR_SDK) bundle validate ./bundle

.PHONY: bundle-build
bundle-build: bundle ## Build the bundle image.
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
$(IMAGE_BUILD_CMD) build --platform="linux/amd64" -f bundle.Dockerfile -t $(BUNDLE_IMG) .

.PHONY: bundle-push
bundle-push: ## Push the bundle image.
docker push $(BUNDLE_IMG)
$(IMAGE_BUILD_CMD) push $(BUNDLE_IMG)

# Build a catalog image by adding bundle images to an empty catalog using the operator package manager tool, 'opm'.
# This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see:
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
.PHONY: catalog-build
catalog-build: opm ## Build a catalog image.
$(OPM) index add --permissive --container-tool docker --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
./hack/build-catalog.sh

# Push the catalog image.
.PHONY: catalog-push
catalog-push: ## Push a catalog image.
docker push $(CATALOG_IMG)
$(IMAGE_BUILD_CMD) push $(CATALOG_IMG)
8 changes: 0 additions & 8 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ resources:
kind: StorageClient
path: github.com/red-hat-storage/ocs-client-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
domain: openshift.io
group: ocs
kind: StorageClassClaim
path: github.com/red-hat-storage/ocs-client-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
Expand Down
18 changes: 6 additions & 12 deletions api/v1alpha1/storageclaim_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,21 @@ type StorageClaimStatus struct {
Phase storageClaimState `json:"phase,omitempty"`
}

type StorageClientNamespacedName struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
}

// StorageClaimSpec defines the desired state of StorageClaim
type StorageClaimSpec struct {
//+kubebuilder:validation:Enum=block;sharedfile
Type string `json:"type"`
EncryptionMethod string `json:"encryptionMethod,omitempty"`
StorageProfile string `json:"storageProfile,omitempty"`
StorageClient *StorageClientNamespacedName `json:"storageClient"`
//+kubebuilder:validation:XValidation:rule="self.lowerAscii()=='block'||self.lowerAscii()=='sharedfile'",message="value should be either 'sharedfile' or 'block'"
Type string `json:"type"`
EncryptionMethod string `json:"encryptionMethod,omitempty"`
StorageProfile string `json:"storageProfile,omitempty"`
StorageClient string `json:"storageClient"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
//+kubebuilder:printcolumn:name="StorageType",type="string",JSONPath=".spec.type"
//+kubebuilder:printcolumn:name="StorageProfile",type="string",JSONPath=".spec.storageProfile"
//+kubebuilder:printcolumn:name="StorageClientName",type="string",JSONPath=".spec.storageClient.name"
//+kubebuilder:printcolumn:name="StorageClientNamespace",type="string",JSONPath=".spec.storageClient.namespace"
//+kubebuilder:printcolumn:name="StorageClientName",type="string",JSONPath=".spec.storageClient"
//+kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase"

// StorageClaim is the Schema for the storageclaims API
Expand Down
89 changes: 0 additions & 89 deletions api/v1alpha1/storageclassclaim_types.go

This file was deleted.

1 change: 1 addition & 0 deletions api/v1alpha1/storageclient_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type StorageClientStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
//+kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase"
//+kubebuilder:printcolumn:name="consumer",type="string",JSONPath=".status.id"

Expand Down
Loading

0 comments on commit 35fae4c

Please sign in to comment.