Skip to content

Commit feca1ad

Browse files
Add metabase spec vars
1 parent 41561d3 commit feca1ad

File tree

8 files changed

+321
-11
lines changed

8 files changed

+321
-11
lines changed

api/v1/metabase_types.go

+27
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,32 @@ type MetabaseSpec struct {
2626
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
2727
// Important: Run "make" to regenerate code after modifying this file
2828

29+
// +kubebuilder:validation:Required
30+
Metabase MetabasePodSpec `json:"metabase"`
31+
2932
// +kubebuilder:validation:Required
3033
DB DBSpec `json:"db"`
3134
}
3235

36+
type MetabasePodSpec struct {
37+
// The image name to use for Metabase container.
38+
// +kubebuilder:default="metabase/metabase:latest"
39+
// +kubebuilder:validation:Optional
40+
Image string `json:"image,omitempty"`
41+
42+
// ImagePullPolicy is used to determine when Kubernetes will attempt to
43+
// pull (download) container images.
44+
// +kubebuilder:validation:Enum={Always,Never,IfNotPresent}
45+
// +kubebuilder:default="IfNotPresent"
46+
// +kubebuilder:validation:Optional
47+
ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
48+
49+
// Resources of the metabase container.
50+
// +kubebuilder:default={requests:{cpu: "1", memory: "2Gi"}, limits:{cpu: "1", memory: "2Gi"}}
51+
// +kubebuilder:validation:Optional
52+
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
53+
}
54+
3355
type DBSpec struct {
3456
// The image name to use for PostgreSQL containers.
3557
// +kubebuilder:default="postgres:latest"
@@ -49,6 +71,11 @@ type DBSpec struct {
4971
// +kubebuilder:validation:Optional
5072
Replicas *int32 `json:"replicas,omitempty"`
5173

74+
// Resources of the PostgreSQL container.
75+
// +kubebuilder:default={requests:{cpu: "100m", memory: "256Mi"}, limits:{cpu: "1", memory: "2Gi"}}
76+
// +kubebuilder:validation:Optional
77+
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
78+
5279
// +kubebuilder:validation:Required
5380
Volume VolumeSpec `json:"volume"`
5481
}

api/v1/zz_generated.deepcopy.go

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/operator/Chart.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ apiVersion: v2
22
name: metabase-operator
33
description: Helm chart to deploy [unagex-metabase-operator](https://github.com/unagex/metabase-operator)
44
type: application
5-
version: 0.0.3
6-
appVersion: 0.0.3
5+
version: 0.0.4
6+
appVersion: 0.0.4
77
home: https://github.com/unagex/metabase-operator

charts/operator/templates/crds/unagex.com_metabases.yaml

+129
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,62 @@ spec:
5555
format: int32
5656
minimum: 1
5757
type: integer
58+
resources:
59+
default:
60+
limits:
61+
cpu: "1"
62+
memory: 2Gi
63+
requests:
64+
cpu: 100m
65+
memory: 256Mi
66+
description: Resources of the PostgreSQL container.
67+
properties:
68+
claims:
69+
description: "Claims lists the names of resources, defined
70+
in spec.resourceClaims, that are used by this container.
71+
\n This is an alpha field and requires enabling the DynamicResourceAllocation
72+
feature gate. \n This field is immutable. It can only be
73+
set for containers."
74+
items:
75+
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
76+
properties:
77+
name:
78+
description: Name must match the name of one entry in
79+
pod.spec.resourceClaims of the Pod where this field
80+
is used. It makes that resource available inside a
81+
container.
82+
type: string
83+
required:
84+
- name
85+
type: object
86+
type: array
87+
x-kubernetes-list-map-keys:
88+
- name
89+
x-kubernetes-list-type: map
90+
limits:
91+
additionalProperties:
92+
anyOf:
93+
- type: integer
94+
- type: string
95+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
96+
x-kubernetes-int-or-string: true
97+
description: 'Limits describes the maximum amount of compute
98+
resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
99+
type: object
100+
requests:
101+
additionalProperties:
102+
anyOf:
103+
- type: integer
104+
- type: string
105+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
106+
x-kubernetes-int-or-string: true
107+
description: 'Requests describes the minimum amount of compute
108+
resources required. If Requests is omitted for a container,
109+
it defaults to Limits if that is explicitly specified, otherwise
110+
to an implementation-defined value. Requests cannot exceed
111+
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
112+
type: object
113+
type: object
58114
volume:
59115
properties:
60116
size:
@@ -70,8 +126,81 @@ spec:
70126
required:
71127
- volume
72128
type: object
129+
metabase:
130+
properties:
131+
image:
132+
default: metabase/metabase:latest
133+
description: The image name to use for Metabase container.
134+
type: string
135+
imagePullPolicy:
136+
default: IfNotPresent
137+
description: ImagePullPolicy is used to determine when Kubernetes
138+
will attempt to pull (download) container images.
139+
enum:
140+
- Always
141+
- Never
142+
- IfNotPresent
143+
type: string
144+
resources:
145+
default:
146+
limits:
147+
cpu: "1"
148+
memory: 2Gi
149+
requests:
150+
cpu: "1"
151+
memory: 2Gi
152+
description: Resources of the metabase container.
153+
properties:
154+
claims:
155+
description: "Claims lists the names of resources, defined
156+
in spec.resourceClaims, that are used by this container.
157+
\n This is an alpha field and requires enabling the DynamicResourceAllocation
158+
feature gate. \n This field is immutable. It can only be
159+
set for containers."
160+
items:
161+
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
162+
properties:
163+
name:
164+
description: Name must match the name of one entry in
165+
pod.spec.resourceClaims of the Pod where this field
166+
is used. It makes that resource available inside a
167+
container.
168+
type: string
169+
required:
170+
- name
171+
type: object
172+
type: array
173+
x-kubernetes-list-map-keys:
174+
- name
175+
x-kubernetes-list-type: map
176+
limits:
177+
additionalProperties:
178+
anyOf:
179+
- type: integer
180+
- type: string
181+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
182+
x-kubernetes-int-or-string: true
183+
description: 'Limits describes the maximum amount of compute
184+
resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
185+
type: object
186+
requests:
187+
additionalProperties:
188+
anyOf:
189+
- type: integer
190+
- type: string
191+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
192+
x-kubernetes-int-or-string: true
193+
description: 'Requests describes the minimum amount of compute
194+
resources required. If Requests is omitted for a container,
195+
it defaults to Limits if that is explicitly specified, otherwise
196+
to an implementation-defined value. Requests cannot exceed
197+
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
198+
type: object
199+
type: object
200+
type: object
73201
required:
74202
- db
203+
- metabase
75204
type: object
76205
status:
77206
description: MetabaseStatus defines the observed state of Metabase

config/crd/bases/unagex.com_metabases.yaml

+129
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,62 @@ spec:
5555
format: int32
5656
minimum: 1
5757
type: integer
58+
resources:
59+
default:
60+
limits:
61+
cpu: "1"
62+
memory: 2Gi
63+
requests:
64+
cpu: 100m
65+
memory: 256Mi
66+
description: Resources of the PostgreSQL container.
67+
properties:
68+
claims:
69+
description: "Claims lists the names of resources, defined
70+
in spec.resourceClaims, that are used by this container.
71+
\n This is an alpha field and requires enabling the DynamicResourceAllocation
72+
feature gate. \n This field is immutable. It can only be
73+
set for containers."
74+
items:
75+
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
76+
properties:
77+
name:
78+
description: Name must match the name of one entry in
79+
pod.spec.resourceClaims of the Pod where this field
80+
is used. It makes that resource available inside a
81+
container.
82+
type: string
83+
required:
84+
- name
85+
type: object
86+
type: array
87+
x-kubernetes-list-map-keys:
88+
- name
89+
x-kubernetes-list-type: map
90+
limits:
91+
additionalProperties:
92+
anyOf:
93+
- type: integer
94+
- type: string
95+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
96+
x-kubernetes-int-or-string: true
97+
description: 'Limits describes the maximum amount of compute
98+
resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
99+
type: object
100+
requests:
101+
additionalProperties:
102+
anyOf:
103+
- type: integer
104+
- type: string
105+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
106+
x-kubernetes-int-or-string: true
107+
description: 'Requests describes the minimum amount of compute
108+
resources required. If Requests is omitted for a container,
109+
it defaults to Limits if that is explicitly specified, otherwise
110+
to an implementation-defined value. Requests cannot exceed
111+
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
112+
type: object
113+
type: object
58114
volume:
59115
properties:
60116
size:
@@ -70,8 +126,81 @@ spec:
70126
required:
71127
- volume
72128
type: object
129+
metabase:
130+
properties:
131+
image:
132+
default: metabase/metabase:latest
133+
description: The image name to use for Metabase container.
134+
type: string
135+
imagePullPolicy:
136+
default: IfNotPresent
137+
description: ImagePullPolicy is used to determine when Kubernetes
138+
will attempt to pull (download) container images.
139+
enum:
140+
- Always
141+
- Never
142+
- IfNotPresent
143+
type: string
144+
resources:
145+
default:
146+
limits:
147+
cpu: "1"
148+
memory: 2Gi
149+
requests:
150+
cpu: "1"
151+
memory: 2Gi
152+
description: Resources of the metabase container.
153+
properties:
154+
claims:
155+
description: "Claims lists the names of resources, defined
156+
in spec.resourceClaims, that are used by this container.
157+
\n This is an alpha field and requires enabling the DynamicResourceAllocation
158+
feature gate. \n This field is immutable. It can only be
159+
set for containers."
160+
items:
161+
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
162+
properties:
163+
name:
164+
description: Name must match the name of one entry in
165+
pod.spec.resourceClaims of the Pod where this field
166+
is used. It makes that resource available inside a
167+
container.
168+
type: string
169+
required:
170+
- name
171+
type: object
172+
type: array
173+
x-kubernetes-list-map-keys:
174+
- name
175+
x-kubernetes-list-type: map
176+
limits:
177+
additionalProperties:
178+
anyOf:
179+
- type: integer
180+
- type: string
181+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
182+
x-kubernetes-int-or-string: true
183+
description: 'Limits describes the maximum amount of compute
184+
resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
185+
type: object
186+
requests:
187+
additionalProperties:
188+
anyOf:
189+
- type: integer
190+
- type: string
191+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
192+
x-kubernetes-int-or-string: true
193+
description: 'Requests describes the minimum amount of compute
194+
resources required. If Requests is omitted for a container,
195+
it defaults to Limits if that is explicitly specified, otherwise
196+
to an implementation-defined value. Requests cannot exceed
197+
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
198+
type: object
199+
type: object
200+
type: object
73201
required:
74202
- db
203+
- metabase
75204
type: object
76205
status:
77206
description: MetabaseStatus defines the observed state of Metabase

0 commit comments

Comments
 (0)