mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-25 17:12:50 +00:00
Signed-off-by: joyceliu <joyceliu@yunify.com> Co-authored-by: joyceliu <joyceliu@yunify.com>
151 lines
5.2 KiB
YAML
151 lines
5.2 KiB
YAML
---
|
|
#Sample storage classes for OpenEBS Local PV
|
|
apiVersion: storage.k8s.io/v1
|
|
kind: StorageClass
|
|
metadata:
|
|
name: local
|
|
annotations:
|
|
storageclass.kubesphere.io/supported-access-modes: '["ReadWriteOnce"]'
|
|
storageclass.beta.kubernetes.io/is-default-class: "{{ if .sc.local.default }}true{{ else }}false{{ end }}"
|
|
openebs.io/cas-type: local
|
|
cas.openebs.io/config: |
|
|
- name: StorageType
|
|
value: "hostpath"
|
|
- name: BasePath
|
|
value: "{{ .sc.local.path }}"
|
|
provisioner: openebs.io/local
|
|
volumeBindingMode: WaitForFirstConsumer
|
|
reclaimPolicy: Delete
|
|
---
|
|
# Create Maya Service Account
|
|
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: openebs-maya-operator
|
|
namespace: kube-system
|
|
---
|
|
# Define Role that allows operations on K8s pods/deployments
|
|
kind: ClusterRole
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
metadata:
|
|
name: openebs-maya-operator
|
|
rules:
|
|
- apiGroups: ["*"]
|
|
resources: ["nodes", "nodes/proxy"]
|
|
verbs: ["*"]
|
|
- apiGroups: ["*"]
|
|
resources: ["namespaces", "services", "pods", "pods/exec", "deployments", "deployments/finalizers", "replicationcontrollers", "replicasets", "events", "endpoints", "configmaps", "secrets", "jobs", "cronjobs"]
|
|
verbs: ["*"]
|
|
- apiGroups: ["*"]
|
|
resources: ["statefulsets", "daemonsets"]
|
|
verbs: ["*"]
|
|
- apiGroups: ["*"]
|
|
resources: ["resourcequotas", "limitranges"]
|
|
verbs: ["list", "watch"]
|
|
- apiGroups: ["*"]
|
|
resources: ["ingresses", "horizontalpodautoscalers", "verticalpodautoscalers", "poddisruptionbudgets", "certificatesigningrequests"]
|
|
verbs: ["list", "watch"]
|
|
- apiGroups: ["*"]
|
|
resources: ["storageclasses", "persistentvolumeclaims", "persistentvolumes"]
|
|
verbs: ["*"]
|
|
- apiGroups: ["apiextensions.k8s.io"]
|
|
resources: ["customresourcedefinitions"]
|
|
verbs: [ "get", "list", "create", "update", "delete", "patch"]
|
|
- apiGroups: ["openebs.io"]
|
|
resources: [ "*"]
|
|
verbs: ["*"]
|
|
- nonResourceURLs: ["/metrics"]
|
|
verbs: ["get"]
|
|
---
|
|
# Bind the Service Account with the Role Privileges.
|
|
# TODO: Check if default account also needs to be there
|
|
kind: ClusterRoleBinding
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
metadata:
|
|
name: openebs-maya-operator
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: openebs-maya-operator
|
|
namespace: kube-system
|
|
roleRef:
|
|
kind: ClusterRole
|
|
name: openebs-maya-operator
|
|
apiGroup: rbac.authorization.k8s.io
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: openebs-localpv-provisioner
|
|
namespace: kube-system
|
|
labels:
|
|
name: openebs-localpv-provisioner
|
|
openebs.io/component-name: openebs-localpv-provisioner
|
|
openebs.io/version: 3.3.0
|
|
spec:
|
|
selector:
|
|
matchLabels:
|
|
name: openebs-localpv-provisioner
|
|
openebs.io/component-name: openebs-localpv-provisioner
|
|
replicas: 1
|
|
strategy:
|
|
type: Recreate
|
|
template:
|
|
metadata:
|
|
labels:
|
|
name: openebs-localpv-provisioner
|
|
openebs.io/component-name: openebs-localpv-provisioner
|
|
openebs.io/version: 3.3.0
|
|
spec:
|
|
serviceAccountName: openebs-maya-operator
|
|
containers:
|
|
- name: openebs-provisioner-hostpath
|
|
imagePullPolicy: IfNotPresent
|
|
image: {{ .sc.local.provisioner_image }}
|
|
env:
|
|
# OPENEBS_IO_K8S_MASTER enables openebs provisioner to connect to K8s
|
|
# based on this address. This is ignored if empty.
|
|
# This is supported for openebs provisioner version 0.5.2 onwards
|
|
#- name: OPENEBS_IO_K8S_MASTER
|
|
# value: "http://10.128.0.12:8080"
|
|
# OPENEBS_IO_KUBE_CONFIG enables openebs provisioner to connect to K8s
|
|
# based on this config. This is ignored if empty.
|
|
# This is supported for openebs provisioner version 0.5.2 onwards
|
|
#- name: OPENEBS_IO_KUBE_CONFIG
|
|
# value: "/home/ubuntu/.kube/config"
|
|
- name: NODE_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: spec.nodeName
|
|
- name: OPENEBS_NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
# OPENEBS_SERVICE_ACCOUNT provides the service account of this pod as
|
|
# environment variable
|
|
- name: OPENEBS_SERVICE_ACCOUNT
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: spec.serviceAccountName
|
|
- name: OPENEBS_IO_ENABLE_ANALYTICS
|
|
value: "true"
|
|
- name: OPENEBS_IO_INSTALLER_TYPE
|
|
value: "openebs-operator-lite"
|
|
- name: OPENEBS_IO_HELPER_IMAGE
|
|
value: "{{ .sc.local.linux_utils_image }}"
|
|
# LEADER_ELECTION_ENABLED is used to enable/disable leader election. By default
|
|
# leader election is enabled.
|
|
#- name: LEADER_ELECTION_ENABLED
|
|
# value: "true"
|
|
# OPENEBS_IO_IMAGE_PULL_SECRETS environment variable is used to pass the image pull secrets
|
|
# to the helper pod launched by local-pv hostpath provisioner
|
|
#- name: OPENEBS_IO_IMAGE_PULL_SECRETS
|
|
# value: ""
|
|
livenessProbe:
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- test $(pgrep -c "^provisioner-loc.*") = 1
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 60
|