Skip to content

Commit

Permalink
Merge pull request #1383 from Altinity/0.23.4
Browse files Browse the repository at this point in the history
0.23.4
  • Loading branch information
sunsingerus authored Mar 31, 2024
2 parents 899b1a0 + 6c038ec commit 75d9899
Show file tree
Hide file tree
Showing 113 changed files with 9,145 additions and 3,776 deletions.
14 changes: 12 additions & 2 deletions cmd/operator/app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func Run() {

initClickHouse(ctx)
initClickHouseReconcilerMetricsExporter(ctx)
initKeeper(ctx)
keeperErr := initKeeper(ctx)

var wg sync.WaitGroup
wg.Add(3)
Expand All @@ -88,7 +88,17 @@ func Run() {
}()
go func() {
defer wg.Done()
runKeeper(ctx)
if keeperErr == nil {
log.Info("Starting keeper")
keeperErr = runKeeper(ctx)
if keeperErr == nil {
log.Info("Starting keeper OK")
} else {
log.Warning("Starting keeper FAILED with err: %v", keeperErr)
}
} else {
log.Warning("Starting keeper skipped due to failed initialization with err: %v", keeperErr)
}
}()

// Wait for completion
Expand Down
40 changes: 25 additions & 15 deletions cmd/operator/app/thread_keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ package app

import (
"context"
"os"

"github.com/go-logr/logr"

apps "k8s.io/api/apps/v1"
apiMachineryRuntime "k8s.io/apimachinery/pkg/runtime"
utilRuntime "k8s.io/apimachinery/pkg/util/runtime"
clientGoScheme "k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
ctrlRuntime "sigs.k8s.io/controller-runtime"
Expand All @@ -22,24 +20,28 @@ import (
controller "github.com/altinity/clickhouse-operator/pkg/controller/chk"
)

var scheme = apiMachineryRuntime.NewScheme()

func init() {
utilRuntime.Must(clientGoScheme.AddToScheme(scheme))
utilRuntime.Must(api.AddToScheme(scheme))
}

var (
scheme *apiMachineryRuntime.Scheme
manager ctrlRuntime.Manager
logger logr.Logger
)

func initKeeper(ctx context.Context) {
func initKeeper(ctx context.Context) error {
var err error

ctrl.SetLogger(zap.New(zap.UseDevMode(true)))

logger = ctrl.Log.WithName("keeper-runner")

var err error
scheme = apiMachineryRuntime.NewScheme()
if err = clientGoScheme.AddToScheme(scheme); err != nil {
logger.Error(err, "init keeper - unable to clientGoScheme.AddToScheme")
return err
}
if err = api.AddToScheme(scheme); err != nil {
logger.Error(err, "init keeper - unable to api.AddToScheme")
return err
}

manager, err = ctrlRuntime.NewManager(ctrlRuntime.GetConfigOrDie(), ctrlRuntime.Options{
Scheme: scheme,
Expand All @@ -48,7 +50,8 @@ func initKeeper(ctx context.Context) {
},
})
if err != nil {
os.Exit(1)
logger.Error(err, "init keeper - unable to ctrlRuntime.NewManager")
return err
}

err = ctrlRuntime.
Expand All @@ -62,12 +65,19 @@ func initKeeper(ctx context.Context) {
},
)
if err != nil {
os.Exit(1)
logger.Error(err, "init keeper - unable to ctrlRuntime.NewControllerManagedBy")
return err
}

// Initialization successful
return nil
}

func runKeeper(ctx context.Context) {
func runKeeper(ctx context.Context) error {
if err := manager.Start(ctx); err != nil {
os.Exit(1)
logger.Error(err, "run keeper - unable to manager.Start")
return err
}
// Run successful
return nil
}
15 changes: 13 additions & 2 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,22 +99,33 @@ clickhouse:
# ClickHouse is not willing to start in case incorrect/unknown settings are provided in config file.
- version: "*"
rules:
# see https://kb.altinity.com/altinity-kb-setup-and-maintenance/altinity-kb-server-config-files/#server-config-configxml-sections-which-dont-require-restart
# to be replaced with "select * from system.server_settings where changeable_without_restart = 'No'"

- settings/*: "yes"

# single values
- settings/access_control_path: "no"
- settings/dictionaries_config: "no"
- settings/logger: "no"
- settings/macros/*: "no"
- settings/max_server_memory_*: "no"
- settings/max_*_to_drop: "no"
- settings/max_concurrent_queries: "no"
- settings/models_config: "no"
- settings/user_defined_executable_functions_config: "no"

# structured XML
- settings/logger/*: "no"
- settings/macros/*: "no"
- settings/remote_servers/*: "no"
- settings/user_directories/*: "no"

- zookeeper/*: "yes"

- files/*.xml: "yes"
- files/config.d/*.xml: "yes"
- files/config.d/*dict*.xml: "no"

# exceptions in default profile
- profiles/default/background_*_pool_size: "yes"
- profiles/default/max_*_for_server: "yes"
- version: "21.*"
Expand Down
15 changes: 13 additions & 2 deletions deploy/builder/templates-config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,33 @@ clickhouse:
# ClickHouse is not willing to start in case incorrect/unknown settings are provided in config file.
- version: "*"
rules:
# see https://kb.altinity.com/altinity-kb-setup-and-maintenance/altinity-kb-server-config-files/#server-config-configxml-sections-which-dont-require-restart
# to be replaced with "select * from system.server_settings where changeable_without_restart = 'No'"

- settings/*: "yes"

# single values
- settings/access_control_path: "no"
- settings/dictionaries_config: "no"
- settings/logger: "no"
- settings/macros/*: "no"
- settings/max_server_memory_*: "no"
- settings/max_*_to_drop: "no"
- settings/max_concurrent_queries: "no"
- settings/models_config: "no"
- settings/user_defined_executable_functions_config: "no"

# structured XML
- settings/logger/*: "no"
- settings/macros/*: "no"
- settings/remote_servers/*: "no"
- settings/user_directories/*: "no"

- zookeeper/*: "yes"

- files/*.xml: "yes"
- files/config.d/*.xml: "yes"
- files/config.d/*dict*.xml: "no"

# exceptions in default profile
- profiles/default/background_*_pool_size: "yes"
- profiles/default/max_*_for_server: "yes"
- version: "21.*"
Expand Down
4 changes: 2 additions & 2 deletions deploy/helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ description: |-
kubectl apply -f https://github.com/Altinity/clickhouse-operator/raw/master/deploy/helm/crds/CustomResourceDefinition-clickhouseoperatorconfigurations.clickhouse.altinity.com.yaml
```
type: application
version: 0.23.3
appVersion: 0.23.3
version: 0.23.4
appVersion: 0.23.4
home: https://github.com/Altinity/clickhouse-operator
icon: https://logosandtypes.com/wp-content/uploads/2020/12/altinity.svg
maintainers:
Expand Down
3 changes: 2 additions & 1 deletion deploy/helm/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# altinity-clickhouse-operator

![Version: 0.23.3](https://img.shields.io/badge/Version-0.23.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.23.3](https://img.shields.io/badge/AppVersion-0.23.3-informational?style=flat-square)
![Version: 0.23.4](https://img.shields.io/badge/Version-0.23.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.23.4](https://img.shields.io/badge/AppVersion-0.23.4-informational?style=flat-square)

Helm chart to deploy [altinity-clickhouse-operator](https://github.com/Altinity/clickhouse-operator).

Expand Down Expand Up @@ -50,6 +50,7 @@ For upgrade please install CRDs separately:
| operator.image.tag | string | `""` | image tag (chart's appVersion value will be used if not set) |
| operator.resources | object | `{}` | custom resource configuration, look `kubectl explain pod.spec.containers.resources` for details |
| podAnnotations | object | `{"clickhouse-operator-metrics/port":"9999","clickhouse-operator-metrics/scrape":"true","prometheus.io/port":"8888","prometheus.io/scrape":"true"}` | annotations to add to the clickhouse-operator pod, look `kubectl explain pod.spec.annotations` for details |
| podLabels | object | `{}` | labels to add to the clickhouse-operator pod |
| podSecurityContext | object | `{}` | |
| rbac.create | bool | `true` | specifies whether cluster roles and cluster role bindings should be created |
| secret.create | bool | `true` | create a secret with operator credentials |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
# SINGULAR=clickhouseinstallation
# PLURAL=clickhouseinstallations
# SHORT=chi
# OPERATOR_VERSION=0.23.3
# OPERATOR_VERSION=0.23.4
#
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clickhouseinstallations.clickhouse.altinity.com
labels:
clickhouse.altinity.com/chop: 0.23.3
clickhouse.altinity.com/chop: 0.23.4
spec:
group: clickhouse.altinity.com
scope: Namespaced
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
# SINGULAR=clickhouseinstallationtemplate
# PLURAL=clickhouseinstallationtemplates
# SHORT=chit
# OPERATOR_VERSION=0.23.3
# OPERATOR_VERSION=0.23.4
#
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clickhouseinstallationtemplates.clickhouse.altinity.com
labels:
clickhouse.altinity.com/chop: 0.23.3
clickhouse.altinity.com/chop: 0.23.4
spec:
group: clickhouse.altinity.com
scope: Namespaced
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Template Parameters:
#
# OPERATOR_VERSION=0.23.3
# OPERATOR_VERSION=0.23.4
#
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: clickhousekeeperinstallations.clickhouse-keeper.altinity.com
labels:
clickhouse-keeper.altinity.com/chop: 0.23.3
clickhouse-keeper.altinity.com/chop: 0.23.4
spec:
group: clickhouse-keeper.altinity.com
scope: Namespaced
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ kind: CustomResourceDefinition
metadata:
name: clickhouseoperatorconfigurations.clickhouse.altinity.com
labels:
clickhouse.altinity.com/chop: 0.23.3
clickhouse.altinity.com/chop: 0.23.4
spec:
group: clickhouse.altinity.com
scope: Namespaced
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ helm.sh/chart: {{ include "altinity-clickhouse-operator.chart" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
{{- if .Values.podLabels }}
{{ toYaml .Values.podLabels }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#
# NAMESPACE=kube-system
# COMMENT=
# OPERATOR_IMAGE=altinity/clickhouse-operator:0.23.3
# OPERATOR_IMAGE=altinity/clickhouse-operator:0.23.4
# OPERATOR_IMAGE_PULL_POLICY=Always
# METRICS_EXPORTER_IMAGE=altinity/metrics-exporter:0.23.3
# METRICS_EXPORTER_IMAGE=altinity/metrics-exporter:0.23.4
# METRICS_EXPORTER_IMAGE_PULL_POLICY=Always
#
# Setup Deployment for clickhouse-operator
Expand All @@ -21,7 +21,7 @@ spec:
matchLabels: {{ include "altinity-clickhouse-operator.selectorLabels" . | nindent 6 }}
template:
metadata:
labels: {{ include "altinity-clickhouse-operator.selectorLabels" . | nindent 8 }}
labels: {{ include "altinity-clickhouse-operator.labels" . | nindent 8 }}
annotations:
{{ toYaml .Values.podAnnotations | nindent 8 }}
checksum/files: {{ include (print $.Template.BasePath "/generated/ConfigMap-etc-clickhouse-operator-files.yaml") . | sha256sum }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Template parameters available:
# NAMESPACE=kube-system
# COMMENT=
# OPERATOR_VERSION=0.23.3
# OPERATOR_VERSION=0.23.4
# CH_USERNAME_SECRET_PLAIN=clickhouse_operator
# CH_PASSWORD_SECRET_PLAIN=clickhouse_operator_password
#
Expand Down
14 changes: 12 additions & 2 deletions deploy/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ metrics:
# possible value format [{"name":"your-secret-name"}]
# look `kubectl explain pod.spec.imagePullSecrets` for details
imagePullSecrets: []
# podLabels -- labels to add to the clickhouse-operator pod
podLabels: {}
# podAnnotations -- annotations to add to the clickhouse-operator pod, look `kubectl explain pod.spec.annotations` for details
podAnnotations:
prometheus.io/port: '8888'
Expand Down Expand Up @@ -269,19 +271,27 @@ configs:
# ClickHouse is not willing to start in case incorrect/unknown settings are provided in config file.
- version: "*"
rules:
# see https://kb.altinity.com/altinity-kb-setup-and-maintenance/altinity-kb-server-config-files/#server-config-configxml-sections-which-dont-require-restart
# to be replaced with "select * from system.server_settings where changeable_without_restart = 'No'"
- settings/*: "yes"
# single values
- settings/access_control_path: "no"
- settings/dictionaries_config: "no"
- settings/logger: "no"
- settings/macros/*: "no"
- settings/max_server_memory_*: "no"
- settings/max_*_to_drop: "no"
- settings/max_concurrent_queries: "no"
- settings/models_config: "no"
- settings/user_defined_executable_functions_config: "no"
# structured XML
- settings/logger/*: "no"
- settings/macros/*: "no"
- settings/remote_servers/*: "no"
- settings/user_directories/*: "no"
- zookeeper/*: "yes"
- files/*.xml: "yes"
- files/config.d/*.xml: "yes"
- files/config.d/*dict*.xml: "no"
# exceptions in default profile
- profiles/default/background_*_pool_size: "yes"
- profiles/default/max_*_for_server: "yes"
- version: "21.*"
Expand Down
Loading

0 comments on commit 75d9899

Please sign in to comment.