Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrmr33 committed Sep 20, 2023
1 parent 55670bc commit ce024c1
Show file tree
Hide file tree
Showing 12 changed files with 225 additions and 192 deletions.
22 changes: 0 additions & 22 deletions charts/ocean-kubernetes-controller/temp/NOTES.txt

This file was deleted.

32 changes: 0 additions & 32 deletions charts/ocean-kubernetes-controller/temp/hpa.yaml

This file was deleted.

61 changes: 0 additions & 61 deletions charts/ocean-kubernetes-controller/temp/ingress.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions charts/ocean-kubernetes-controller/temp/service.yaml

This file was deleted.

120 changes: 120 additions & 0 deletions charts/ocean-kubernetes-controller/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "ocean-kubernetes-controller.fullname" . }}
labels:
{{- include "ocean-kubernetes-controller.labels" . | nindent 4 }}
rules:
# ---------------------------------------------------------------------------
# feature: ocean/readonly
# ---------------------------------------------------------------------------
- apiGroups: [ "" ]
resources: [ "pods", "nodes", "services", "namespaces", "replicationcontrollers", "limitranges", "events", "persistentvolumes", "persistentvolumeclaims" ]
verbs: [ "get", "list", "watch" ]
- apiGroups: [ "apps" ]
resources: [ "deployments", "daemonsets", "statefulsets", "replicasets" ]
verbs: [ "get", "list", "watch" ]
- apiGroups: [ "storage.k8s.io" ]
resources: [ "storageclasses" ]
verbs: [ "get", "list", "watch" ]
- apiGroups: [ "batch" ]
resources: [ "jobs", "cronjobs" ]
verbs: [ "get", "list", "watch" ]
- apiGroups: [ "policy" ]
resources: [ "poddisruptionbudgets" ]
verbs: [ "get", "list", "watch" ]
- apiGroups: [ "metrics.k8s.io" ]
resources: [ "pods" ]
verbs: [ "get", "list", "watch" ]
- apiGroups: [ "autoscaling" ]
resources: [ "horizontalpodautoscalers" ]
verbs: [ "get", "list", "watch" ]
- apiGroups: [ "apiextensions.k8s.io" ]
resources: [ "customresourcedefinitions" ]
verbs: [ "get", "list", "watch" ]
- apiGroups: [ "node.k8s.io" ]
resources: [ "runtimeclasses" ]
verbs: [ "get", "list", "watch" ]
- nonResourceURLs: [ "/version/", "/version" ]
verbs: [ "get" ]
# ---------------------------------------------------------------------------
# feature: ocean/draining
# ---------------------------------------------------------------------------
- apiGroups: [""]
resources: ["nodes"]
verbs: ["patch", "update"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["delete"]
- apiGroups: [""]
resources: ["pods/eviction"]
verbs: ["create"]
# ---------------------------------------------------------------------------
# feature: ocean/cleanup
# ---------------------------------------------------------------------------
- apiGroups: [""]
resources: ["nodes"]
verbs: ["delete"]
# ---------------------------------------------------------------------------
# feature: ocean/csr-approval
# ---------------------------------------------------------------------------
- apiGroups: ["certificates.k8s.io"]
resources: ["certificatesigningrequests"]
verbs: ["get", "list", "delete", "create"]
- apiGroups: ["certificates.k8s.io"]
resources: ["certificatesigningrequests/approval"]
verbs: ["patch", "update"]
- apiGroups: ["certificates.k8s.io"]
resources: ["signers"]
resourceNames: ["kubernetes.io/kubelet-serving", "kubernetes.io/kube-apiserver-client-kubelet"]
verbs: ["approve"]
# ---------------------------------------------------------------------------
# feature: ocean/auto-update
# ---------------------------------------------------------------------------
- apiGroups: ["rbac.authorization.k8s.io"]
resources: ["clusterroles"]
resourceNames: ["spotinst-kubernetes-cluster-controller"]
verbs: ["patch", "update", "escalate"]
- apiGroups: ["apps"]
resources: ["deployments"]
resourceNames: ["spotinst-kubernetes-cluster-controller"]
verbs: ["patch", "update"]
# ---------------------------------------------------------------------------
# feature: ocean/apply
# ---------------------------------------------------------------------------
- apiGroups: ["apps"]
resources: ["deployments", "daemonsets"]
verbs: ["get", "list", "patch", "update", "create", "delete"]
- apiGroups: ["extensions"]
resources: ["daemonsets"]
verbs: ["get", "list", "patch", "update", "create", "delete"]
- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "patch", "update", "create", "delete"]
- apiGroups: ["batch"]
resources: ["jobs"]
verbs: ["get", "list", "patch", "update", "create", "delete"]
# ---------------------------------------------------------------------------
# feature: wave
# ---------------------------------------------------------------------------
- apiGroups: ["sparkoperator.k8s.io"]
resources: ["sparkapplications", "scheduledsparkapplications"]
verbs: ["get", "list", "patch", "update", "create", "delete"]
- apiGroups: ["wave.spot.io"]
resources: ["sparkapplications", "wavecomponents", "waveenvironments"]
verbs: ["get", "list"]
- apiGroups: ["bigdata.spot.io"]
resources: ["bigdataenvironments"]
verbs: ["get", "list", "patch", "update", "create", "delete"]
# ---------------------------------------------------------------------------
# feature: controller/leader-election (high-availability)
# ---------------------------------------------------------------------------
- apiGroups: [ "coordination.k8s.io" ]
resources: [ "leases" ]
verbs: [ "get","list","patch","update","create","delete" ]
# ---------------------------------------------------------------------------
# feature: controller/report-events
# ---------------------------------------------------------------------------
- apiGroups: [ "" ]
resources: [ "events" ]
verbs: [ "create" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "ocean-kubernetes-controller.fullname" . }}
labels:
{{- include "ocean-kubernetes-controller.labels" . | nindent 4 }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "ocean-kubernetes-controller.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ include "ocean-kubernetes-controller.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
14 changes: 14 additions & 0 deletions charts/ocean-kubernetes-controller/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.configMap.create }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "ocean-kubernetes-controller.configMapName" . }}
labels:
{{- include "ocean-kubernetes-controller.labels" . | nindent 4 }}
data:
spotinst.cluster-identifier: {{ required "`spotinst.clusterIdentifier` must be specified" .Values.spotinst.clusterIdentifier }}
base-url: {{ default "" .Values.spotinst.baseUrl | quote }}
proxy-url: {{ default "" .Values.spotinst.proxyUrl | quote }}
disable-auto-update: {{ default "false" .Values.spotinst.disableAutoUpdate | quote }}
enable-csr-approval: {{ default "false" .Values.spotinst.enableCsrApproval | quote }}
{{- end }}
44 changes: 43 additions & 1 deletion charts/ocean-kubernetes-controller/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,57 @@ spec:
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if kindIs "invalid" .Values.affinity }}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: NotIn
values:
- windows
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
preference:
matchExpressions:
- key: node-role.kubernetes.io/master
operator: Exists
{{- else }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
{{- end }}
{{- if kindIs "invalid" .Values.tolerations }}
tolerations:
- key: node.kubernetes.io/not-ready
effect: NoExecute
operator: Exists
tolerationSeconds: 150
- key: node.kubernetes.io/unreachable
effect: NoExecute
operator: Exists
tolerationSeconds: 150
- key: node-role.kubernetes.io/master
operator: Exists
- key: node-role.kubernetes.io/control-plane
operator: Exists
{{- else }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- if kindIs "invalid" .Values.topologySpreadConstraints }}
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
labelSelector:
{{- include "ocean-kubernetes-controller.selectorLabels" . | nindent 6 }}
{{- else }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/ocean-kubernetes-controller/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if and .Values.secret.create }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "ocean-kubernetes-controller.secretName" . }}
labels:
{{- include "ocean-kubernetes-controller.labels" . | nindent 4 }}
type: Opaque
data:
token: {{ required "`spotinst.token` must be specified" .Values.spotinst.token | quote | b64enc }}
account: {{ required "`spotinst.account` must be specified" .Values.spotinst.account | quote | b64enc }}
{{- end }}

This file was deleted.

Loading

0 comments on commit ce024c1

Please sign in to comment.