Skip to content

Commit

Permalink
Ensure crd-manager runs first
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Jan 26, 2024
1 parent 6c15299 commit 640cfd4
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 4 deletions.
7 changes: 4 additions & 3 deletions apis/installer/v1alpha1/kubedb_crd_manager_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ type KubedbCrdManagerSpec struct {
Tolerations []core.Toleration `json:"tolerations"`
// If specified, the pod's scheduling constraints
// +optional
Affinity *core.Affinity `json:"affinity"`
ServiceAccount ServiceAccountSpec `json:"serviceAccount"`
FeatureGates map[string]bool `json:"featureGates"`
Affinity *core.Affinity `json:"affinity"`
ServiceAccount ServiceAccountSpec `json:"serviceAccount"`
FeatureGates map[string]bool `json:"featureGates"`
RemoveUnusedCRDs bool `json:"removeUnusedCRDs"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
1 change: 1 addition & 0 deletions charts/kubedb-crd-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ The following table lists the configurable parameters of the `kubedb-crd-manager
| featureGates.Singlestore | | <code>false</code> |
| featureGates.Solr | | <code>false</code> |
| featureGates.ZooKeeper | | <code>false</code> |
| removeUnusedCRDs | | <code>false</code> |


Specify each parameter using the `--set key=value[,key=value]` argument to `helm upgrade -i`. For example:
Expand Down
4 changes: 4 additions & 0 deletions charts/kubedb-crd-manager/templates/cluster-role-binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ metadata:
name: {{ include "kubedb-crd-manager.fullname" . }}
labels:
{{- include "kubedb-crd-manager.labels" . | nindent 4 }}
annotations:
"helm.sh/hook-weight": "2"
"helm.sh/hook": post-install,post-upgrade,post-rollback
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
4 changes: 4 additions & 0 deletions charts/kubedb-crd-manager/templates/cluster-role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ metadata:
name: {{ include "kubedb-crd-manager.fullname" . }}
labels:
{{- include "kubedb-crd-manager.labels" . | nindent 4 }}
annotations:
"helm.sh/hook-weight": "1"
"helm.sh/hook": post-install,post-upgrade,post-rollback
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed
rules:
- apiGroups:
- apiextensions.k8s.io
Expand Down
18 changes: 18 additions & 0 deletions charts/kubedb-crd-manager/templates/job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "kubedb-crd-manager.labels" . | nindent 4 }}
annotations:
"helm.sh/hook-weight": "3"
"helm.sh/hook": post-install,post-upgrade,post-rollback
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed
spec:
backoffLimit: 3
ttlSecondsAfterFinished: 300
Expand All @@ -24,6 +28,20 @@ spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
serviceAccountName: {{ include "kubedb-crd-manager.serviceAccountName" . }}
initContainers:
- name: init-{{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ include "image.registry" . }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.imagePullPolicy }}
args:
- run
- --v=3
{{- range $db, $enable := $featureGates }}
- --feature-gates={{ $db }}={{ $enable }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
Expand Down
5 changes: 4 additions & 1 deletion charts/kubedb-crd-manager/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ metadata:
name: {{ include "kubedb-crd-manager.serviceAccountName" . }}
labels:
{{- include "kubedb-crd-manager.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
"helm.sh/hook-weight": "0"
"helm.sh/hook": post-install,post-upgrade,post-rollback
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded,hook-failed
{{- with .Values.serviceAccount.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
Expand Down
3 changes: 3 additions & 0 deletions charts/kubedb-crd-manager/values.openapiv3_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,8 @@ properties:
type: object
registryFQDN:
type: string
removeUnusedCRDs:
type: boolean
resources:
description: ResourceRequirements describes the compute resource requirements.
properties:
Expand Down Expand Up @@ -1315,5 +1317,6 @@ required:
- featureGates
- image
- imagePullPolicy
- removeUnusedCRDs
- serviceAccount
type: object
2 changes: 2 additions & 0 deletions charts/kubedb-crd-manager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ featureGates:
Singlestore: false
Solr: false
ZooKeeper: false

removeUnusedCRDs: false
3 changes: 3 additions & 0 deletions charts/kubedb/values.openapiv3_schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2779,6 +2779,8 @@ properties:
type: object
registryFQDN:
type: string
removeUnusedCRDs:
type: boolean
resources:
description: ResourceRequirements describes the compute resource requirements.
properties:
Expand Down Expand Up @@ -3029,6 +3031,7 @@ properties:
- featureGates
- image
- imagePullPolicy
- removeUnusedCRDs
- serviceAccount
type: object
kubedb-kubestash-catalog:
Expand Down

0 comments on commit 640cfd4

Please sign in to comment.