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

Commit

Permalink
Merge pull request #40 from ritmas/fix/node-selector
Browse files Browse the repository at this point in the history
Introduced nodeSelector support, code readability
  • Loading branch information
hiddeco authored Dec 23, 2020
2 parents 9ffb11e + 84421f1 commit 4ae4a73
Show file tree
Hide file tree
Showing 17 changed files with 217 additions and 211 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $ kubectl apply -f https://raw.githubusercontent.com/hiddeco/cronjobber/master/d
> database until this issue has been resolved.
Cronjobber embeds a default timezone database in its binary, this database is
however not updated regulary. To help your overcome this issue there is an
however not updated regularly. To help your overcome this issue there is an
[`cronjobber-updatetz`](https://quay.io/repository/hiddeco/cronjobber-updatetz)
image available that can be used as a sidecar.

Expand Down Expand Up @@ -66,12 +66,12 @@ spec:
template:
spec:
containers:
- name: hello
image: busybox
args:
- /bin/sh
- -c
- date; echo "Hello, World!"
- name: hello
image: busybox
args:
- /bin/sh
- -c
- date; echo "Hello, World!"
restartPolicy: OnFailure
```
Expand Down
4 changes: 2 additions & 2 deletions chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v1
name: cronjobber
home: https://github.com/hiddeco/cronjobber
version: 0.1.0
version: 0.1.1
appVersion: 0.3.0
description: Cronjobber is the cronjob controller from Kubernetes patched with time zone support.
maintainers:
- name: CyberHippo
- name: CyberHippo
17 changes: 17 additions & 0 deletions chart/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: {{ .Values.name }}
labels:
name: {{ .Values.name }}
rules:
- apiGroups: ['cronjobber.hidde.co']
resources: ['*']
verbs: ['*']
- apiGroups: ['batch']
resources: ['jobs']
verbs: ['*']
- apiGroups: ['']
resources: ['events']
verbs: ['create', 'patch', 'update']
15 changes: 15 additions & 0 deletions chart/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: {{ .Values.name }}
labels:
name: {{ .Values.name }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ .Values.name }}
subjects:
- kind: ServiceAccount
name: {{ .Values.name }}
namespace: {{ .Values.namespace }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ kind: CustomResourceDefinition
metadata:
name: tzcronjobs.cronjobber.hidde.co
spec:
group: cronjobber.hidde.co
version: v1alpha1
names:
plural: tzcronjobs
singular: tzcronjob
kind: TZCronJob
listKind: TZCronJobList
shortNames:
group: cronjobber.hidde.co
version: v1alpha1
names:
plural: tzcronjobs
singular: tzcronjob
kind: TZCronJob
listKind: TZCronJobList
shortNames:
- tzc
scope: Namespaced
subresources:
status: {}
additionalPrinterColumns:
scope: Namespaced
subresources:
status: {}
additionalPrinterColumns:
- name: Schedule
type: string
description: The schedule defining the interval a TZCronJob is run
Expand All @@ -31,4 +31,4 @@ spec:
JSONPath: .status.lastScheduleTime
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
JSONPath: .metadata.creationTimestamp
100 changes: 52 additions & 48 deletions chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,57 +21,61 @@ spec:
fsGroup: 2 #daemon
{{- if .Values.sidecar.enabled }}
volumes:
- name: timezonedb
emptyDir: {}
- name: timezonedb
emptyDir: {}
{{- end }}
{{- if .Values.sidecar.enabled }}
initContainers:
- name: init-updatetz
image: {{ printf "%s:%s" .Values.sidecar.image.repository .Values.sidecar.image.tag | quote }}
securityContext:
{{ toYaml .Values.sidecar.securityContext | indent 10 }}
resources:
limits:
cpu: {{ .Values.sidecar.resources.requests.cpu }}
memory: {{ .Values.sidecar.resources.requests.memory }}
volumeMounts:
- name: timezonedb
mountPath: /tmp/zoneinfo
readOnly: false
env:
- name: INIT_CONTAINER
value: "true"
- name: REFRESH_INTERVAL
value: "3s"
- name: init-updatetz
image: {{ printf "%s:%s" .Values.sidecar.image.repository .Values.sidecar.image.tag | quote }}
securityContext:
{{ toYaml .Values.sidecar.securityContext | indent 12 }}
resources:
limits:
cpu: {{ .Values.sidecar.resources.requests.cpu }}
memory: {{ .Values.sidecar.resources.requests.memory }}
volumeMounts:
- name: timezonedb
mountPath: /tmp/zoneinfo
readOnly: false
env:
- name: INIT_CONTAINER
value: "true"
- name: REFRESH_INTERVAL
value: "3s"
{{- end }}
containers:
- name: {{ .Values.name }}
image: {{ printf "%s:%s" .Values.image.repository .Values.image.tag | quote }}
resources:
requests:
cpu: {{ .Values.resources.requests.cpu }}
memory: {{ .Values.resources.requests.memory }}
args:
- --log-level=info
{{- if .Values.sidecar.enabled }}
volumeMounts:
- name: timezonedb
mountPath: /usr/share/zoneinfo
readOnly: true
{{- end }}
- name: {{ .Values.name }}
image: {{ printf "%s:%s" .Values.image.repository .Values.image.tag | quote }}
resources:
requests:
cpu: {{ .Values.resources.requests.cpu }}
memory: {{ .Values.resources.requests.memory }}
args:
- --log-level=info
{{- if .Values.sidecar.enabled }}
volumeMounts:
- name: timezonedb
mountPath: /usr/share/zoneinfo
readOnly: true
{{- end }}
{{- if .Values.sidecar.enabled }}
- name: updatetz
image: {{ printf "%s:%s" .Values.sidecar.image.repository .Values.sidecar.image.tag | quote }}
# NB: the security context configuration below may not work
# out of the box on OpenShift
securityContext:
{{ toYaml .Values.sidecar.securityContext | indent 10 }}
resources:
limits:
cpu: {{ .Values.sidecar.resources.requests.cpu }}
memory: {{ .Values.sidecar.resources.requests.memory }}
volumeMounts:
- name: timezonedb
mountPath: /tmp/zoneinfo
readOnly: false
{{- end }}
- name: updatetz
image: {{ printf "%s:%s" .Values.sidecar.image.repository .Values.sidecar.image.tag | quote }}
# NB: the security context configuration below may not work
# out of the box on OpenShift
securityContext:
{{ toYaml .Values.sidecar.securityContext | indent 12 }}
resources:
limits:
cpu: {{ .Values.sidecar.resources.requests.cpu }}
memory: {{ .Values.sidecar.resources.requests.memory }}
volumeMounts:
- name: timezonedb
mountPath: /tmp/zoneinfo
readOnly: false
{{- end }}
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
42 changes: 0 additions & 42 deletions chart/templates/rbac.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions chart/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.name }}
namespace: {{ .Values.namespace }}
labels:
name: {{ .Values.name }}
3 changes: 2 additions & 1 deletion chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ sidecar:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
- ALL
nodeSelector: {}
26 changes: 13 additions & 13 deletions deploy/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ kind: CustomResourceDefinition
metadata:
name: tzcronjobs.cronjobber.hidde.co
spec:
group: cronjobber.hidde.co
version: v1alpha1
names:
plural: tzcronjobs
singular: tzcronjob
kind: TZCronJob
listKind: TZCronJobList
shortNames:
group: cronjobber.hidde.co
version: v1alpha1
names:
plural: tzcronjobs
singular: tzcronjob
kind: TZCronJob
listKind: TZCronJobList
shortNames:
- tzc
scope: Namespaced
subresources:
status: {}
additionalPrinterColumns:
scope: Namespaced
subresources:
status: {}
additionalPrinterColumns:
- name: Schedule
type: string
description: The schedule defining the interval a TZCronJob is run
Expand All @@ -31,4 +31,4 @@ spec:
JSONPath: .status.lastScheduleTime
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
JSONPath: .metadata.creationTimestamp
Loading

0 comments on commit 4ae4a73

Please sign in to comment.