Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade orielodb addon to v1.0 API #1300

Merged
merged 5 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ KubeBlocks add-ons.
| oceanbase-ce | oceanbase-ce-4.3.0 | OceanBase has served over 400 customers across the globe and has been supporting all mission critical systems in Alipay. | Powerfooi shanshanying |
| opensearch | opensearch-2.7.0<br>opensearch-dashboard-2.7.0 | Open source distributed and RESTful search engine. | iziang |
| orchestrator | orchestrator-3.2.6 | Orchestrator is a MySQL high availability and replication management tool, runs as a service and provides command line access, HTTP API and Web interface. | kubeJocker |
| orioledb | orioledb-14.7.2-beta1 | OrioleDB is a new storage engine for PostgreSQL, bringing a modern approach to database capacity, capabilities and performance to the world's most-loved database platform. | 1aal |
| orioledb | orioledb-14.7.2 | OrioleDB is a new storage engine for PostgreSQL, bringing a modern approach to database capacity, capabilities and performance to the world's most-loved database platform. | 1aal |
| polardbx | polardbx-v2.3 | PolarDB-X is a cloud native distributed SQL Database designed for high concurrency, massive storage, complex querying scenarios. | Vettal Wu |
| postgresql | postgresql-12.14.0<br>postgresql-12.14.1<br>postgresql-12.15.0<br>postgresql-14.7.2<br>postgresql-14.8.0<br>postgresql-15.7.0<br>postgresql-16.4.0 | A PostgreSQL (with Patroni HA) cluster definition Helm chart for Kubernetes | ldming |
| pulsar | pulsar-bookies-recovery-2.11.2<br>pulsar-bookies-recovery-3.0.2<br>pulsar-bookkeeper-2.11.2<br>pulsar-bookkeeper-3.0.2<br>pulsar-broker-2.11.2<br>pulsar-broker-3.0.2<br>pulsar-proxy-2.11.2<br>pulsar-proxy-3.0.2<br>pulsar-zookeeper-2.11.2<br>pulsar-zookeeper-3.0.2 | Apache Pulsar is an open-source, distributed messaging and streaming platform built for the cloud. | caiq1nyu |
Expand Down
7 changes: 2 additions & 5 deletions addons-cluster/orioledb/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,5 @@ type: application
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0-alpha.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "14.7.2-beta1"

appVersion: "14.7.2"
55 changes: 54 additions & 1 deletion addons-cluster/orioledb/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,57 @@ replicas: 1
{{- else if eq .Values.mode "replication" }}
replicas: {{ max .Values.replicas 2 }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Define orioledb ComponentSpec with ComponentDefinition.
*/}}
{{- define "orioledb-cluster.componentSpec" }}
clusterDef: orioledb
topology: replication
componentSpecs:
- name: {{ include "orioledb-cluster.component-name" . }}
serviceVersion: {{ .Values.version }}
labels:
{{- include "orioledb-cluster.patroni-scope-label" . | indent 8 }}
{{- include "kblib.componentMonitor" . | indent 6 }}
{{- include "orioledb-cluster.replicaCount" . | indent 6 }}
{{- include "kblib.componentResources" . | indent 6 }}
{{- include "kblib.componentStorages" . | indent 6 }}
{{- if .Values.etcd.enabled }}
serviceRefs:
{{ include "orioledb-cluster.serviceRef" . | indent 6 }}
{{- end }}
{{- end }}

{{- define "orioledb-cluster.serviceRef" }}
- name: etcd
namespace: {{ .Release.Namespace }}
{{- if eq .Values.etcd.meta.mode "incluster" }}
clusterServiceSelector:
cluster: {{ .Values.etcd.meta.serviceRef.cluster.name }}
service:
component: {{ .Values.etcd.meta.serviceRef.cluster.component }}
service: {{ .Values.etcd.meta.serviceRef.cluster.service }}
port: {{ .Values.etcd.meta.serviceRef.cluster.port }}
credential:
component: {{ .Values.etcd.meta.serviceRef.cluster.component }}
name: {{ .Values.etcd.meta.serviceRef.cluster.credential }}
{{- else }}
serviceDescriptor: {{ .Values.etcd.meta.serviceRef.serviceDescriptor }}
{{- end }}
{{- end -}}

{{/*
Define orioledb componentName
*/}}
{{- define "orioledb-cluster.component-name" -}}
orioledb
{{- end }}

{{/*
Define patroni scope label which postgresql cluster depends on, the named pattern is `apps.kubeblocks.postgres.patroni/scope: <clusterName>-<componentName>`
*/}}
{{- define "orioledb-cluster.patroni-scope-label" }}
apps.kubeblocks.postgres.patroni/scope: {{ include "kblib.clusterName" . }}-{{ include "orioledb-cluster.component-name" . }}
{{- end -}}
22 changes: 9 additions & 13 deletions addons-cluster/orioledb/templates/cluster.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
{{- include "kblib.clusterCommon" . }}
componentSpecs:
- name: orioledb
componentDef: orioledb
serviceRefs:
- name: etcdService
cluster: {{ .Values.etcd.cluster | default "etcd" }}
namespace: {{ .Values.etcd.namespace | default "default" }}
{{- include "kblib.componentMonitor" . | indent 6 }}
{{- include "orioledb-cluster.replicaCount" . | indent 6 }}
serviceAccountName: {{ include "kblib.serviceAccountName" . }}
{{- include "kblib.componentResources" . | indent 6 }}
{{- include "kblib.componentStorages" . | indent 6 }}
apiVersion: apps.kubeblocks.io/v1
kind: Cluster
metadata:
name: {{ include "kblib.clusterName" . }}
namespace: {{ .Release.Namespace }}
labels: {{ include "kblib.clusterLabels" . | nindent 4 }}
spec:
terminationPolicy: {{ .Values.terminationPolicy }}
{{- include "orioledb-cluster.componentSpec" . }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if and .Values.etcd.enabled (eq .Values.etcd.meta.mode "serviceref") }}
apiVersion: apps.kubeblocks.io/v1
kind: ServiceDescriptor
metadata:
name: orioledb-etcd-descriptor
namespace: {{ .Release.Namespace }}
spec:
serviceKind: etcd
serviceVersion: 3.5.6
endpoint:
value: "etcd-cluster-etcd.default.svc.cluster.local:2379" # etcd service endpoint
{{- end }}
1 change: 0 additions & 1 deletion addons-cluster/orioledb/templates/rbac.yaml

This file was deleted.

18 changes: 1 addition & 17 deletions addons-cluster/orioledb/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"properties": {
"version": {
"type": "string",
"default": "orioledb-beta1"
"default": "14.7.2"
},
"mode": {
"type": "string",
Expand Down Expand Up @@ -58,22 +58,6 @@
"title": "Storage Class Name",
"description": "Storage class name of the data volume",
"type": "string"
},
"etcd": {
"type": "object",
"title": "The patroni dependency etcd Schema",
"properties": {
"cluster": {
"type": "string",
"default": "etcd",
"description": "The patroni dependency etcd cluster name"
},
"namespace": {
"type": "string",
"default": "default",
"description": "The patroni dependency etcd cluster namespace"
}
}
}
}
}
30 changes: 21 additions & 9 deletions addons-cluster/orioledb/values.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Default values for OrioleDB (with Patroni HA).
# Default values for Orioledb (with Patroni HA).
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

## @param version OrioleDB cluster version
## @param terminationPolicy define Cluster termination policy. One of DoNotTerminate, Halt, Delete, WipeOut.
##
version: orioledb-beta1
terminationPolicy: Delete

## @param mode OrioleDB cluster topology mode, standalone, replication
## @param version, mapping cluster.spec.componentSpec[].serviceVersion which defined in ComponentVersion
##
mode: standalone
version: 14.7.2

## @param mode orioledb cluster topology mode, standalone, replication
##
mode: replication

## @param replicas specify cluster replicas
##
Expand All @@ -33,8 +37,16 @@ requests:
##
storage: 20

## @param patroni etcd cluster name, if not set will use the cluster name "etcd"
## and the cluster must exist,
etcd:
cluster: "etcd"
namespace: "default"
enabled: false
meta:
mode: serviceref # optional: incluster, serviceref
serviceRef:
namespace:
cluster:
name:
component:
service:
port:
credential:
serviceDescriptor: orioledb-etcd-descriptor # example: orioledb-etcd-descriptor
15 changes: 9 additions & 6 deletions addons/orioledb/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ type: application
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0-alpha.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "14.7.2-beta1"
appVersion: "14.7.2"

maintainers:
- name: 1aal
url: https://github.com/apecloud/kubeblocks/

# Add a dependency to the kubeblocks definition library chart
dependencies:
- name: kblib
version: 0.1.0
repository: file://../kblib
alias: extra

annotations:
addon.kubeblocks.io/kubeblocks-version: ">=0.9.0"
addon.kubeblocks.io/kubeblocks-version: ">=1.0.0"
addon.kubeblocks.io/model: "RDBMS"
addon.kubeblocks.io/provider: "community"
18 changes: 0 additions & 18 deletions addons/orioledb/config/etcd-serve-config.tpl

This file was deleted.

4 changes: 4 additions & 0 deletions addons/orioledb/config/patroni-parameter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- ttl
- loop_wait
- retry_timeouts
- maximum_lag_on_failover
27 changes: 27 additions & 0 deletions addons/orioledb/config/patroni-reload.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- $restartParams := $.Files.Get "bootstrap.yaml" | fromYamlArray }}
{{- $patroniParamsContent := $.Files.Get "patroni_parameter.yaml" }}
{{- $patroniParams := fromYamlArray (default "" $patroniParamsContent) }}
{{- $command := "reload" }}
{{- $postgresql := dict }}
{{- $patroni := dict }}
{{- range $pk, $val := $.arg0 }}
{{- if has $pk $patroniParams }}
{{- set $patroni $pk ($val | trimAll "'") }}
{{- else }}
{{- /* trim single quotes for value in the pg config file */}}
{{- set $postgresql $pk ($val | trimAll "'") }}
{{- end }}
{{- if has $pk $restartParams }}
{{- $command = "restart" }}
{{- end }}
{{- end }}

{{- $params := merge $patroni (dict "postgresql" (dict "parameters" $postgresql)) }}
{{- $err := execSql (toJson $params) "config" }}
{{- if $err }}
{{- failed $err }}
{{- end }}
{{- $err := execSql "" $command }}
{{- if $err }}
{{- failed $err }}
{{- end }}
6 changes: 6 additions & 0 deletions addons/orioledb/config/patroni-yaml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ttl: 30
loop_wait: 10
retry_timeout: 10
maximum_lag_on_failover: 1048576
max_timelines_history: 0
check_timeline: true
78 changes: 78 additions & 0 deletions addons/orioledb/config/restart-parameter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#parameters:
- archive_mode
- autovacuum_freeze_max_age
- autovacuum_max_workers
- autovacuum_multixact_freeze_max_age
- bg_mon.history_buckets
- bonjour
- bonjour_name
- cluster_name
- config_file
- cron.database_name
- cron.enable_superuser_jobs
- cron.host
- cron.log_run
- cron.log_statement
- cron.max_running_jobs
- cron.timezone
- cron.use_background_workers
- data_directory
- data_sync_retry
- dynamic_shared_memory_type
- event_source
- external_pid_file
- hba_file
- hot_standby
- huge_pages
- huge_page_size
- ident_file
- ignore_invalid_pages
- jit_provider
- listen_addresses
- logging_collector
- max_connections
- max_files_per_process
- max_locks_per_transaction
- max_logical_replication_workers
- max_pred_locks_per_transaction
- max_prepared_transactions
- max_replication_slots
- max_wal_senders
- max_worker_processes
- min_dynamic_shared_memory
- old_snapshot_threshold
- pglogical.batch_inserts
- pglogical.synchronous_commit
- pglogical.use_spi
- pg_prewarm.autoprewarm
- pg_stat_statements.max
- port
- postgis.gdal_enabled_drivers
- recovery_init_sync_method
- recovery_target
- recovery_target_action
- recovery_target_inclusive
- recovery_target_lsn
- recovery_target_name
- recovery_target_time
- recovery_target_timeline
- recovery_target_xid
- session_preload_libraries
- shared_buffers
- shared_memory_type
- shared_preload_libraries
- superuser_reserved_connections
- timescaledb.bgw_launcher_poll_time
- timescaledb.max_background_workers
- track_activity_query_size
- track_commit_timestamp
- unix_socket_directories
- unix_socket_group
- unix_socket_permissions
- wal_buffers
- wal_compression
- wal_decode_buffer_size
- wal_level
- wal_log_hints
- wal_keep_segments
- wal_keep_size
Loading
Loading