Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #674 from avalluri/operator-deploy
Browse files Browse the repository at this point in the history
deploy: Move operator deployment files to ${REPO_ROOT}/deploy
  • Loading branch information
avalluri authored Jun 8, 2020
2 parents 9e0abab + 193671d commit 2f4e721
Show file tree
Hide file tree
Showing 8 changed files with 180 additions and 17 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,14 @@ KUSTOMIZE_OUTPUT += deploy/common/pmem-storageclass-cache.yaml
KUSTOMIZATION_deploy/common/pmem-storageclass-cache.yaml = deploy/kustomize/storageclass-cache
KUSTOMIZE_OUTPUT += deploy/common/pmem-storageclass-late-binding.yaml
KUSTOMIZATION_deploy/common/pmem-storageclass-late-binding.yaml = deploy/kustomize/storageclass-late-binding
KUSTOMIZE_OUTPUT += deploy/operator/pmem-csi-operator.yaml
KUSTOMIZATION_deploy/operator/pmem-csi-operator.yaml = deploy/kustomize/operator
kustomize: _work/go-bindata clean_kustomize_output $(KUSTOMIZE_OUTPUT)
$< -o deploy/bindata_generated.go -pkg deploy deploy/kubernetes-*/*/pmem-csi.yaml

$(KUSTOMIZE_OUTPUT): _work/kustomize $(KUSTOMIZE_INPUT)
$< build --load_restrictor none $(KUSTOMIZATION_$@) >$@
if echo "$@" | grep -q '/pmem-csi-'; then \
if echo "$@" | grep '/pmem-csi-' | grep -qv '\-operator'; then \
dir=$$(echo "$@" | tr - / | sed -e 's;kubernetes/;kubernetes-;' -e 's/.yaml//' -e 's;/pmem/csi/;/;') && \
mkdir -p $$dir && \
cp $@ $$dir/pmem-csi.yaml && \
Expand Down
16 changes: 8 additions & 8 deletions deploy/bindata_generated.go

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

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: pmem-csi.intel.com/v1alpha1
kind: Deployment
metadata:
name: example-deployment
name: pmem-csi.intel.com
spec:
pmemPercentage: 50
controllerResources:
Expand Down
4 changes: 4 additions & 0 deletions deploy/kustomize/operator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Operator

The common parts for a PMEM-CSI operator deployment. Additional layers
could be added to customize the base operator deployment.
2 changes: 2 additions & 0 deletions deploy/kustomize/operator/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
resources:
- operator.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
###
# TODOs:
# 1) At somepoint this file should move to REPO_ROOT/deploy/
###
apiVersion: v1
kind: ServiceAccount
metadata:
Expand Down
159 changes: 159 additions & 0 deletions deploy/operator/pmem-csi-operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: pmem-csi-operator
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
creationTimestamp: null
name: pmem-csi-operator
namespace: default
rules:
- apiGroups:
- ""
resources:
- configmaps
- services
- services/finalizers
- serviceaccounts
- endpoints
- events
- secrets
- pods
verbs:
- '*'
- apiGroups:
- apps
resources:
- daemonsets
- statefulsets
verbs:
- '*'
- apiGroups:
- apps
resourceNames:
- pmem-csi-operator
resources:
- deployments/finalizers
verbs:
- update
- apiGroups:
- rbac.authorization.k8s.io
resources:
- roles
- rolebindings
verbs:
- '*'
- apiGroups:
- ""
resources:
- pods
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: pmem-csi-operator
rules:
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterroles
- clusterrolebindings
verbs:
- '*'
- apiGroups:
- storage.k8s.io
resources:
- csidrivers
verbs:
- '*'
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- get
- create
- delete
- apiGroups:
- pmem-csi.intel.com
resources:
- deployments
- deployments/status
verbs:
- '*'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: pmem-csi-operator
namespace: default
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: pmem-csi-operator
subjects:
- kind: ServiceAccount
name: pmem-csi-operator
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: pmem-csi-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: pmem-csi-operator
subjects:
- kind: ServiceAccount
name: pmem-csi-operator
namespace: default
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pmem-csi-operator
namespace: default
spec:
replicas: 1
selector:
matchLabels:
name: pmem-csi-operator
template:
metadata:
labels:
app: pmem-csi-operator
name: pmem-csi-operator
pmem-csi.intel.com/webhook: ignore
spec:
containers:
- command:
- /usr/local/bin/pmem-csi-operator
env:
- name: WATCH_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: OPERATOR_NAME
value: pmem-csi-operator
image: intel/pmem-csi-driver:canary
imagePullPolicy: IfNotPresent
name: pmem-csi-operator
securityContext:
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp
name: tmp
serviceAccountName: pmem-csi-operator
volumes:
- emptyDir: {}
name: tmp
6 changes: 3 additions & 3 deletions test/start-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ source "${TEST_CONFIG:-${TEST_DIRECTORY}/test-config.sh}"
CLUSTER=${CLUSTER:-pmem-govm}
REPO_DIRECTORY="${REPO_DIRECTORY:-$(dirname "${TEST_DIRECTORY}")}"
CLUSTER_DIRECTORY="${CLUSTER_DIRECTORY:-${REPO_DIRECTORY}/_work/${CLUSTER}}"
DEPLOYMENT_DIRECTORY="${REPO_DIRECTORY}/operator/deploy"
DEPLOYMENT_DIRECTORY="${REPO_DIRECTORY}/deploy/operator"
SSH="${CLUSTER_DIRECTORY}/ssh.0"
KUBECTL="${SSH} kubectl" # Always use the kubectl installed in the cluster.

deploy="${DEPLOYMENT_DIRECTORY}/operator.yaml"
deploy="${DEPLOYMENT_DIRECTORY}/pmem-csi-operator.yaml"
echo "Deploying '${deploy}'..."

if [ -f "$deploy" ]; then
Expand Down Expand Up @@ -57,7 +57,7 @@ EOF

cat <<EOF
PMEM-CSI operator is running. To try out deploying the pmem-csi driver:
cat operator/examples/pmem-csi.intel.com_v1alpha1_deployment_cr.yaml | ${KUBECTL} create -f -
cat deploy/common/pmem-csi.intel.com_v1alpha1_deployment_cr.yaml | ${KUBECTL} create -f -
EOF
else
echo >&2 "'${deploy}' not a yaml file"
Expand Down

0 comments on commit 2f4e721

Please sign in to comment.