Skip to content

Commit a4027fc

Browse files
committed
Add ubi mode
Signed-off-by: Tamal Saha <[email protected]>
1 parent 6c6a3b8 commit a4027fc

File tree

529 files changed

+1738
-590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

529 files changed

+1738
-590
lines changed

apis/installer/v1alpha1/kubedb_catalog_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ type KubedbCatalogSpec struct {
5353
SkipDeprecated bool `json:"skipDeprecated"`
5454
EnableVersions map[string][]string `json:"enableVersions"`
5555
CustomVersions map[string]*runtime.RawExtension `json:"customVersions"`
56+
// +optional
57+
Distro DistroSpec `json:"distro"`
5658
}
5759

5860
type PSP struct {

apis/installer/v1alpha1/kubedb_kubestash_catalog_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ type KubedbKubestashCatalogSpec struct {
6262
Singlestore KubestashDatabaseSpec `json:"singlestore"`
6363
ZooKeeper KubestashDatabaseSpec `json:"zookeeper"`
6464
Kubedbverifier KubestashVerifierSpec `json:"kubedbverifier"`
65+
// +optional
66+
Distro DistroSpec `json:"distro"`
6567
}
6668

6769
// KubestashDatabaseSpec is the schema for DB values file

apis/installer/v1alpha1/types.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ type NetworkPolicySpec struct {
104104
Enabled bool `json:"enabled"`
105105
}
106106

107+
// +kubebuilder:validation:Enum=all;catalog;operator
108+
type UBIMode string
109+
107110
type DistroSpec struct {
108-
Openshift bool `json:"openshift"`
111+
Openshift bool `json:"openshift"`
112+
UBI UBIMode `json:"ubi"`
109113
}

apis/installer/v1alpha1/zz_generated.deepcopy.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

catalog/kubedb/fmt/main.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ const (
4949
distroOfficial = "Official"
5050
)
5151

52+
var ubiImageList = sets.NewString(
53+
"ghcr.io/kubedb/mariadb-archiver",
54+
"ghcr.io/kubedb/mysql-archiver",
55+
"ghcr.io/kubedb/postgres-archiver",
56+
)
57+
5258
type StashAddon struct {
5359
DBType string
5460
DBVersion string
@@ -537,6 +543,10 @@ func main() {
537543
}
538544
if ref.Tag != "" && ref.Tag != "latest" {
539545
newimg += ":" + ref.Tag
546+
i2 := fmt.Sprintf("%s/%s", ref.Registry, ref.Repository)
547+
if ubiImageList.Has(i2) {
548+
newimg += `{{ include "catalog.ubi" $ }}`
549+
}
540550
}
541551
err = unstructured.SetNestedField(objCopy.Object, newimg, fieldList...)
542552
if err != nil {

catalog/kubedb/fmt/templates/dbver.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{{ "{{ $featureGates := .Values.featureGates }}" }}
2+
{{ "{{ $ubi := .Values.distro.ubi }}" }}
23
{{ "{{- if .Values.global }}" }}
34
{{ " {{ $featureGates = mergeOverwrite dict .Values.featureGates .Values.global.featureGates }}" }}
5+
{{ " {{ $ubi = default .Values.distro.ubi .Values.global.distro.ubi }}" }}
46
{{ "{{- end }}" }}
57

6-
{{ "{{ if $featureGates."}}{{ .kind }}{{" }}" }}
8+
{{"{{ if and $featureGates."}}{{ .kind }}{{" (not (eq $ubi \"operator\")) }}"}}
79
{{- range $idx, $object := .objects }}
810
{{ if gt $idx 0 }}
911
---

catalog/kubedb/fmt/templates/psp.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{{ "{{ $featureGates := .Values.featureGates }}" }}
2+
{{ "{{ $ubi := .Values.distro.ubi }}" }}
23
{{ "{{- if .Values.global }}" }}
34
{{ " {{ $featureGates = mergeOverwrite dict .Values.featureGates .Values.global.featureGates }}" }}
5+
{{ " {{ $ubi = default .Values.distro.ubi .Values.global.distro.ubi }}" }}
46
{{ "{{- end }}" }}
57

6-
{{"{{ if and .Values.psp.enabled (.Capabilities.APIVersions.Has \"policy/v1beta1/PodSecurityPolicy\") $featureGates."}}{{ .kind }}{{" }}"}}
8+
{{"{{ if and .Values.psp.enabled (.Capabilities.APIVersions.Has \"policy/v1beta1/PodSecurityPolicy\") $featureGates."}}{{ .kind }}{{" (not (eq $ubi \"operator\")) }}"}}
79
apiVersion: {{ .object.apiVersion }}
810
kind: {{ .object.kind }}
911
metadata:

catalog/kubestash/fmt/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func main() {
213213
panic("unsupported registry for image " + img)
214214
}
215215
if found {
216-
newimg += ":" + tag
216+
newimg += ":" + tag + `{{ include "catalog.ubi" $ }}`
217217
}
218218
err = unstructured.SetNestedField(obj.UnstructuredContent(), newimg, "spec", "image")
219219
if err != nil {

charts/kubedb-autoscaler/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ The following table lists the configurable parameters of the `kubedb-autoscaler`
9090
| recommender.cpuHistogramDecayHalfLife | | <code>"5m0s"</code> |
9191
| maxConcurrentReconciles | The maximum number of concurrent reconciles which can be run | <code>0</code> |
9292
| distro.openshift | | <code>false</code> |
93+
| distro.ubi | | <code>""</code> |
9394

9495

9596
Specify each parameter using the `--set key=value[,key=value]` argument to `helm upgrade -i`. For example:

charts/kubedb-autoscaler/templates/_helpers.tpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ Returns the registry used for waitfor docker image
9494
{{- list .Values.registryFQDN .Values.waitfor.registry | compact | join "/" }}
9595
{{- end }}
9696

97+
{{/*
98+
Returns if ubi images are to be used
99+
*/}}
100+
{{- define "operator.ubi" -}}
101+
{{ ternary "-ubi" "" (list "operator" "all" | has .Values.distro.ubi) }}
102+
{{- end }}
103+
97104
{{- define "docker.imagePullSecrets" -}}
98105
{{- with .Values.imagePullSecrets -}}
99106
imagePullSecrets:

0 commit comments

Comments
 (0)