Skip to content

Commit

Permalink
[CN-945] Add SQL configuration in Hazelcast CR
Browse files Browse the repository at this point in the history
  • Loading branch information
dzeromski-hazelcast committed Aug 8, 2023
1 parent 8eccfb4 commit 295acfb
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
19 changes: 19 additions & 0 deletions api/v1alpha1/hazelcast_types.go
Expand Up @@ -163,6 +163,9 @@ type HazelcastSpec struct {
// This configuration from the ConfigMap might be overridden by the Hazelcast CR configuration.
// +optional
CustomConfigCmName string `json:"customConfigCmName,omitempty"`

// Hazelcast SQL configuration
SQL *SQL `json:"sql,omitempty"`
}

func (s *HazelcastSpec) GetLicenseKeySecretName() string {
Expand Down Expand Up @@ -1054,6 +1057,22 @@ type TLS struct {
MutualAuthentication MutualAuthentication `json:"mutualAuthentication,omitempty"`
}

type SQL struct {
// StatementTimeout defines the timeout in milliseconds that is applied
// to queries without an explicit timeout.
// +kubebuilder:default:=0
StatementTimeout int32 `json:"statementTimeout"`

// CatalogPersistence sets whether SQL Catalog persistence is enabled for the node.
// With SQL Catalog persistence enabled you can restart the whole cluster without
// losing schema definition objects (such as MAPPINGs, TYPEs, VIEWs and DATA CONNECTIONs).
// The feature is implemented on top of the Hot Restart feature of Hazelcast
// which persists the data to disk. If enabled, you have to also configure
// Hot Restart. Feature is disabled by default.
// +kubebuilder:default:=false
CatalogPersistence bool `json:"catalogPersistence"`
}

// HazelcastStatus defines the observed state of Hazelcast
type HazelcastStatus struct {
// Phase of the Hazelcast cluster
Expand Down
8 changes: 8 additions & 0 deletions controllers/hazelcast/hazelcast_resources.go
Expand Up @@ -933,6 +933,14 @@ func hazelcastBasicConfig(h *hazelcastv1alpha1.Hazelcast) config.Hazelcast {
Properties: NewSSLProperties(jksPath, password, "TLS", h.Spec.TLS.MutualAuthentication),
}
}

if h.Spec.SQL != nil {
cfg.SQL = config.SQL{
StatementTimeout: h.Spec.SQL.StatementTimeout,
CatalogPersistence: h.Spec.SQL.CatalogPersistence,
}
}

return cfg
}

Expand Down
6 changes: 6 additions & 0 deletions internal/config/hazelcast.go
Expand Up @@ -25,6 +25,7 @@ type Hazelcast struct {
AdvancedNetwork AdvancedNetwork `yaml:"advanced-network,omitempty"`
ManagementCenter ManagementCenterConfig `yaml:"management-center,omitempty"`
Serialization Serialization `yaml:"serialization,omitempty"`
SQL SQL `yaml:"sql,omitempty"`
}

type ManagementCenterConfig struct {
Expand Down Expand Up @@ -406,3 +407,8 @@ type ClassFactories struct {
FactoryId int32 `yaml:"factory-id"`
ClassName string `yaml:"class-name"`
}

type SQL struct {
StatementTimeout int32 `yaml:"statement-timeout-millis"`
CatalogPersistence bool `yaml:"catalog-persistence-enabled"`
}

0 comments on commit 295acfb

Please sign in to comment.