Added dragonfly-operator as an app-template.

This commit is contained in:
Joseph Hanson 2024-02-04 15:14:38 -06:00
parent 6563b35a74
commit 294a047628
7 changed files with 1998 additions and 0 deletions

View file

@ -0,0 +1,129 @@
---
# yaml-language-server: $schema=https://ks.hsn.dev/helm.toolkit.fluxcd.io/helmrelease_v2beta2.json
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: &app dragonfly-operator
spec:
interval: 30m
chart:
spec:
chart: app-template
version: 2.5.0
sourceRef:
kind: HelmRepository
name: bjw-s
namespace: flux-system
install:
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
retries: 3
uninstall:
keepHistory: false
values:
serviceAccount:
create: false
name: dragonfly-operator-controller-manager
controllers:
main:
containers:
rbac-proxy:
image:
repository: gcr.io/kubebuilder/kube-rbac-proxy
tag: v0.13.1
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
- "--logtostderr=true"
- "--v=0"
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities: { drop: ["ALL"] }
resources:
requests:
cpu: 5m
memory: 64Mi
limits:
cpu: 500m
memory: 128Mi
main:
image:
repository: docker.dragonflydb.io/dragonflydb/operator
tag: v1.1.0
args:
- "--health-probe-bind-address=:8081"
- "--metrics-bind-address=127.0.0.1:8080"
- "--leader-elect"
command:
- "/manager"
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities: { drop: ["ALL"] }
probes:
liveness:
enabled: true
custom: true
spec:
httpGet:
path: /healthz
port: &port 8081
initialDelaySeconds: 15
periodSeconds: 20
timeoutSeconds: 1
failureThreshold: 3
readiness:
enabled: true
custom: true
spec:
httpGet:
path: /readyz
port: *port
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 1
failureThreshold: 3
startup:
enabled: false
resources:
requests:
cpu: 10m
memory: 64Mi
limits:
cpu: 500m
memory: 128Mi
annotations:
reloader.stakater.com/auto: "true"
pod:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
- ppc64le
- s390x
- key: kubernetes.io/os
operator: In
values:
- linux
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app.kubernetes.io/name: *app
service:
main:
ports:
http:
port: *port

View file

@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: dragonfly-operator-system
resources:
- ./dragonfly-operator-crd.yaml
- ./rbac.yaml
- ./helmrelease.yaml

View file

@ -0,0 +1,230 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: dragonfly-operator
app.kubernetes.io/instance: controller-manager-sa
app.kubernetes.io/name: serviceaccount
app.kubernetes.io/part-of: dragonfly-operator
name: dragonfly-operator-controller-manager
namespace: dragonfly-operator-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
labels:
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: dragonfly-operator
app.kubernetes.io/instance: leader-election-role
app.kubernetes.io/name: role
app.kubernetes.io/part-of: dragonfly-operator
name: dragonfly-operator-leader-election-role
namespace: dragonfly-operator-system
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: dragonfly-operator-manager-role
rules:
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- apiGroups:
- ""
resources:
- pods
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- services
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- apps
resources:
- statefulsets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- dragonflydb.io
resources:
- dragonflies
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- dragonflydb.io
resources:
- dragonflies/finalizers
verbs:
- update
- apiGroups:
- dragonflydb.io
resources:
- dragonflies/status
verbs:
- get
- patch
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: dragonfly-operator
app.kubernetes.io/instance: metrics-reader
app.kubernetes.io/name: clusterrole
app.kubernetes.io/part-of: dragonfly-operator
name: dragonfly-operator-metrics-reader
rules:
- nonResourceURLs:
- /metrics
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: dragonfly-operator
app.kubernetes.io/instance: proxy-role
app.kubernetes.io/name: clusterrole
app.kubernetes.io/part-of: dragonfly-operator
name: dragonfly-operator-proxy-role
rules:
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: dragonfly-operator
app.kubernetes.io/instance: leader-election-rolebinding
app.kubernetes.io/name: rolebinding
app.kubernetes.io/part-of: dragonfly-operator
name: dragonfly-operator-leader-election-rolebinding
namespace: dragonfly-operator-system
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: dragonfly-operator-leader-election-role
subjects:
- kind: ServiceAccount
name: dragonfly-operator-controller-manager
namespace: dragonfly-operator-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: dragonfly-operator
app.kubernetes.io/instance: manager-rolebinding
app.kubernetes.io/name: clusterrolebinding
app.kubernetes.io/part-of: dragonfly-operator
name: dragonfly-operator-manager-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: dragonfly-operator-manager-role
subjects:
- kind: ServiceAccount
name: dragonfly-operator-controller-manager
namespace: dragonfly-operator-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: dragonfly-operator
app.kubernetes.io/instance: proxy-rolebinding
app.kubernetes.io/name: clusterrolebinding
app.kubernetes.io/part-of: dragonfly-operator
name: dragonfly-operator-proxy-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: dragonfly-operator-proxy-role
subjects:
- kind: ServiceAccount
name: dragonfly-operator-controller-manager
namespace: dragonfly-operator-system

View file

@ -0,0 +1,19 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/main/kustomization-kustomize-v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app dragonfly-operator
namespace: flux-system
spec:
targetNamespace: dragonfly-operator-system
commonMetadata:
labels:
app.kubernetes.io/name: *app
interval: 10m
path: "./kubernetes/apps/dragonfly-operator-system/dragonfly-operator/app"
prune: true
sourceRef:
kind: GitRepository
name: homelab
wait: true

View file

@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/kustomization.json
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
# Pre Flux-Kustomizations
- ./namespace.yaml
# Flux-Kustomizations
- ./dragonfly-operator/ks.yaml

View file

@ -0,0 +1,10 @@
---
apiVersion: v1
kind: Namespace
metadata:
labels:
app.kubernetes.io/instance: system
app.kubernetes.io/name: namespace
app.kubernetes.io/part-of: dragonfly-operator
control-plane: controller-manager
name: dragonfly-operator-system