forked from celery/Celery-Kubernetes-Operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deployment support to operator - Dockerfile, rbac and deployment …
…yaml
- Loading branch information
Showing
5 changed files
with
156 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM python:3.8 | ||
|
||
WORKDIR /usr/src/ | ||
|
||
COPY requirements.txt ./ | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
COPY . . | ||
|
||
CMD kopf run handlers.py --verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: celery-operator | ||
name: celery-operator | ||
namespace: default | ||
spec: | ||
minReadySeconds: 5 | ||
progressDeadlineSeconds: 600 | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: celery-operator | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 20% | ||
maxUnavailable: 0% | ||
type: RollingUpdate | ||
template: | ||
metadata: | ||
creationTimestamp: null | ||
labels: | ||
app: celery-operator | ||
spec: | ||
serviceAccountName: celery-account | ||
containers: | ||
- name: celery-operator | ||
image: celery-operator | ||
imagePullPolicy: Never | ||
resources: | ||
requests: | ||
cpu: "100m" | ||
memory: "64Mi" | ||
limits: | ||
cpu: "200m" | ||
memory: "128Mi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
namespace: default | ||
name: celery-account | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
kind: ClusterRole | ||
metadata: | ||
name: celery-role-cluster | ||
rules: | ||
|
||
# Framework: knowing which other operators are running (i.e. peering). | ||
- apiGroups: [zalando.org] | ||
resources: [clusterkopfpeerings] | ||
verbs: [list, watch, patch, get] | ||
- apiGroups: [apiextensions.k8s.io] | ||
resources: [customresourcedefinitions] | ||
verbs: [list, get] | ||
|
||
# Application: read-only access for watching cluster-wide. | ||
- apiGroups: [celeryproject.org] | ||
resources: [celery] | ||
verbs: [list, watch] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
kind: Role | ||
metadata: | ||
namespace: default | ||
name: celery-role-namespaced | ||
rules: | ||
|
||
# Framework: knowing which other operators are running (i.e. peering). | ||
- apiGroups: [zalando.org] | ||
resources: [kopfpeerings] | ||
verbs: [list, watch, patch, get] | ||
|
||
# Framework: posting the events about the handlers progress/errors. | ||
- apiGroups: [events.k8s.io] | ||
resources: [events] | ||
verbs: [create] | ||
- apiGroups: [""] | ||
resources: [events] | ||
verbs: [create] | ||
|
||
# Application: watching & handling for the custom resource we declare. | ||
- apiGroups: [celeryproject.org] | ||
resources: [celery] | ||
verbs: [list, watch, patch] | ||
|
||
# Application: other resources it produces and manipulates. | ||
# Here, we create Jobs+PVCs+Pods, but we do not patch/update/delete them ever. | ||
- apiGroups: [batch, extensions] | ||
resources: [jobs] | ||
verbs: [create] | ||
- apiGroups: [""] | ||
resources: [pods, services] | ||
verbs: ['*'] | ||
- apiGroups: ["apps"] | ||
resources: [deployments, replicasets] | ||
verbs: ['*'] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: celery-rolebinding-cluster | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: celery-role-cluster | ||
subjects: | ||
- kind: ServiceAccount | ||
name: celery-account | ||
namespace: default | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1beta1 | ||
kind: RoleBinding | ||
metadata: | ||
namespace: default | ||
name: celery-rolebinding-namespaced | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: celery-role-namespaced | ||
subjects: | ||
- kind: ServiceAccount | ||
name: celery-account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters