Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create manifests that can be used in scripts for installing and uninstalling operator #19

Merged
merged 1 commit into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
FROM gcr.io/distroless/static:nonroot

ENV USER_UID=1001 \
USER_NAME=dell-csi-operator \
X_CSM_OPERATOR_CONFIG_DIR="/etc/config/csm-operator"
USER_NAME=dell-csm-operator \
X_CSM_OPERATOR_CONFIG_DIR="/etc/config/dell-csm-operator"
WORKDIR /
COPY --from=builder /workspace/manager .
COPY operatorconfig/ /etc/config/local/csm-operator
COPY operatorconfig/ /etc/config/local/dell-csm-operator
LABEL vendor="Dell Inc." \
name="csm-operator" \
name="dell-csm-operator" \
summary="Operator for installing Dell EMC CSM Modules" \
description="Common Operator for installing various Dell EMC Container Storage Modules" \
version="1.5.0" \
license="Dell CSI Operator Apache License"
version="0.1.0" \
license="Dell CSM Operator Apache License"

ENTRYPOINT ["/manager"]
USER ${USER_UID}
Expand Down
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,21 @@ docker-push: ## Push docker image with the manager.

##@ Deployment

install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
static-crd: manifests kustomize ## Copies CRDs to deploy folder.
$(KUSTOMIZE) build config/crd > deploy/crds/storage.dell.com_containerstoragemodules.yaml

static-manager: manifests kustomize ## Creates the operator manifests in deploy folder.
$(KUSTOMIZE) build config/install > deploy/operator.yaml

static-manifests: static-crd static-manager

install: static-crd ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl apply -f -

uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl delete -f -

deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
deploy: static-manager ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | kubectl apply -f -

Expand Down
6 changes: 3 additions & 3 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ layout:
plugins:
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
projectName: csm-operator
projectName: dell-csm-operator
repo: github.com/dell/csm-operator
resources:
- api:
Expand All @@ -14,6 +14,6 @@ resources:
domain: dell.com
group: storage
kind: ContainerStorageModule
path: github.com/dell/csm-operator/api/v1
version: v1
path: github.com/dell/csm-operator/api/v1alpha1
version: v1alpha1
version: "3"
4 changes: 2 additions & 2 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Adds namespace to all resources.
namespace: csm-operator
namespace: dell-csm-operator

# Value of this field is prepended to the
# names of all resources, e.g. a deployment named
# "wordpress" becomes "alices-wordpress".
# Note that it should also match with the prefix (text before '-') of the namespace
# field above.
namePrefix: csm-operator-
namePrefix: dell-csm-operator-

# Labels to add to all resources and selectors.
#commonLabels:
Expand Down
17 changes: 17 additions & 0 deletions config/install/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Adds namespace to all resources.
namespace: dell-csm-operator
namePrefix: dell-csm-operator-

# Labels to add to all resources and selectors.
#commonLabels:
# someName: someValue

bases:
- ../serviceaccount
- ../rbac
- ../manager

images:
- name: controller
newName: dellemc/dell-csm-operator
newTag: v0.1.0
2 changes: 1 addition & 1 deletion config/manifests/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# These resources constitute the fully configured set of manifests
# used to generate the 'manifests/' directory in a bundle.
resources:
- bases/csm-operator.clusterserviceversion.yaml
- bases/dell-csm-operator.clusterserviceversion.yaml
- ../default
- ../samples
- ../scorecard
Expand Down
2 changes: 1 addition & 1 deletion config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ rules:
- apiGroups:
- apps
resourceNames:
- dell-csi-operator-controller-manager
- dell-csm-operator-controller-manager
resources:
- deployments/finalizers
verbs:
Expand Down
2 changes: 1 addition & 1 deletion controllers/csm_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var configVersionKey = fmt.Sprintf("%s/%s", MetadataPrefix, "CSIDriverConfigVers
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=clusterroles/finalizers,verbs=get;list;watch;update;create;delete;patch
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=roles,verbs=get;list;watch;update;create;delete;patch
// +kubebuilder:rbac:groups="monitoring.coreos.com",resources=servicemonitors,verbs=get;create
// +kubebuilder:rbac:groups="apps",resources=deployments/finalizers,resourceNames=dell-csi-operator-controller-manager,verbs=update
// +kubebuilder:rbac:groups="apps",resources=deployments/finalizers,resourceNames=dell-csm-operator-controller-manager,verbs=update
// +kubebuilder:rbac:groups="storage.k8s.io",resources=csidrivers,verbs=get;list;watch;create;update;delete;patch
// +kubebuilder:rbac:groups="storage.k8s.io",resources=storageclasses,verbs=get;list;watch;create;update;delete
// +kubebuilder:rbac:groups="storage.k8s.io",resources=volumeattachments,verbs=get;list;watch;create;update;patch
Expand Down
Loading