Skip to content

Commit

Permalink
Merge pull request #90 from Altinity/release-0.2.3
Browse files Browse the repository at this point in the history
Release 0.2.3
  • Loading branch information
alex-zaitsev committed May 20, 2019
2 parents d000377 + 36e540d commit 382e380
Show file tree
Hide file tree
Showing 72 changed files with 1,550 additions and 481 deletions.
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM golang:1.11.5 as builder
# === Builder ===

FROM golang:1.11.5 AS builder

WORKDIR $GOPATH/src/github.com/altinity/clickhouse-operator

Expand All @@ -11,7 +13,9 @@ ADD pkg pkg
ADD cmd cmd
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /tmp/clickhouse-operator ./cmd/clickhouse-operator

FROM alpine:3.8
# === Runner ===

FROM alpine:3.8 AS runner
RUN apk update && apk add ca-certificates && rm -rf /var/cache/apk/*
WORKDIR /
COPY --from=builder /tmp/clickhouse-operator .
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ The ClickHouse Operator for Kubernetes currently provides the following:
* [ClickHouse Installation Custom Resource specification][crd_explained]

**Maintenance tasks**
* [Adding replication to an existing ClickHouse cluster][update_cluster_add_replication]
* Adding shards and replicas
* [Add replication to an existing ClickHouse cluster][update_cluster_add_replication]
* Add shards and replicas
* [Automatic schema creation][schema_migration]
* [Update ClickHouse version][update_clickhouse_version]
* [Update Operator version][update_operator]
Expand Down
40 changes: 39 additions & 1 deletion cmd/clickhouse-operator/app/clickhouse_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,52 @@ func createClientsets(config *kuberest.Config) (*kube.Clientset, *chopclientset.
return kubeClientset, chopClientset
}

func GetRuntimeParams() map[string]string {
res := make(map[string]string)
// This list of ENV VARS is specified in operator .yaml manifest, section "kind: Deployment"
vars := []string{
// spec.nodeName: ip-172-20-52-62.ec2.internal
"OPERATOR_POD_NODE_NAME",
// metadata.name: clickhouse-operator-6f87589dbb-ftcsf
"OPERATOR_POD_NAME",
// metadata.namespace: kube-system
"OPERATOR_POD_NAMESPACE",
// status.podIP: 100.96.3.2
"OPERATOR_POD_IP",
// spec.serviceAccount: clickhouse-operator
// spec.serviceAccountName: clickhouse-operator
"OPERATOR_POD_SERVICE_ACCOUNT",

"OPERATOR_CONTAINER_CPU_REQUEST",
"OPERATOR_CONTAINER_CPU_LIMIT",
"OPERATOR_CONTAINER_MEM_REQUEST",
"OPERATOR_CONTAINER_MEM_LIMIT",
}

for _, varName := range vars {
res[varName] = os.Getenv(varName)
}

return res
}

func LogRuntimeParams() {
runtimeParams := GetRuntimeParams()
for name, value := range runtimeParams {
glog.V(1).Infof("%s=%s\n", name, value)
}
}

// Run is an entry point of the application
func Run() {
if versionRequest {
fmt.Printf("%s\n", Version)
os.Exit(0)
}

glog.V(1).Infof("Starting clickhouse-operator versionRequest '%s'\n", Version)
glog.V(1).Infof("Starting clickhouse-operator version '%s'\n", Version)
LogRuntimeParams()

chopConfig, err := config.GetConfig(chopConfigFile)
if err != nil {
glog.Fatalf("Unable to build config file %v\n", err)
Expand Down
41 changes: 34 additions & 7 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ namespaces:
- info
- onemore

###########################################
################################################
##
## Additional Configuration Files Section
##
###########################################
################################################

# Path to folder where ClickHouse configuration files common for all instances within CHI are located.
chCommonConfigsPath: config.d
Expand All @@ -25,17 +25,44 @@ chUsersConfigsPath: users.d
# Manifests are applied in sorted alpha-numeric order
chiTemplatesPath: templates.d

###########################################
################################################
##
## Cluster Update Section
## Cluster Create/Update/Delete Objects Section
##
###########################################
################################################

# How many seconds to wait for created/updated StatefulSet to be Ready
statefulSetUpdateTimeout: 50

# How many seconds to wait between checks for created/updated StatefulSet status
statefulSetUpdatePollPeriod: 2

# What to do in case created/updated StatefulSet is not in Ready after `statefulSetUpdateTimeout` seconds
onStatefulSetUpdateFailureAction: abort
# What to do in case created StatefulSet is not in Ready after `statefulSetUpdateTimeout` seconds
# Possible options:
# 1. abort - do nothing, just break the process and wait for admin
# 2. delete - delete newly created problematic StatefulSet
onStatefulSetCreateFailureAction: delete

# What to do in case updated StatefulSet is not in Ready after `statefulSetUpdateTimeout` seconds
# Possible options:
# 1. abort - do nothing, just break the process and wait for admin
# 2. rollback - delete Pod and rollback StatefulSet to previous Generation.
# Pod would be recreated by StatefulSet based on rollback-ed configuration
onStatefulSetUpdateFailureAction: rollback

################################################
##
## ClickHouse Settings Section
##
################################################

# Default values for ClickHouse user configuration
# 1. user/profile - string
# 2. user/quota - string
# 3. user/networks/ip - multiple strings
# 4. user/password - string
chConfigUserDefaultProfile: default
chConfigUserDefaultQuota: default
chConfigUserDefaultNetworksIP:
- "::/0"
chConfigUserDefaultPassword: "default"
12 changes: 6 additions & 6 deletions dev/RnD/chopsim/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,24 +348,24 @@ func (chi *ClickHouseInstallation) createConfigMapObjects(data map[string]string
return cmList
}

// Returns list of services:
// Returns list of services:
// one service per pod with internal name, and one service for installation itself that should finally bind to:
// clickhouse-<installation_name>.<namespace>.svc.cluster.local
func (chi *ClickHouseInstallation) createServiceObjects(o *genOptions) serviceList {
svcList := make(serviceList, 0, len(o.ssNames)+1)
ports := []serviceSpecPort{
{
Name: "rpc",
Name: "http",
Port: 8123,
},
{
Name: "client",
Port: 9000,
},
{
Name: "interserver",
Port: 9009,
},
{
Name: "rest",
Port: 8123,
},
}
for ssName := range o.ssNames {
svcList = append(svcList, &service{
Expand Down
Loading

0 comments on commit 382e380

Please sign in to comment.