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

sync pump cluster in new pump_member_manager #1269

Merged
merged 6 commits into from
Dec 3, 2019
Merged
Show file tree
Hide file tree
Changes from 5 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
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rules:
- events
verbs: ["*"]
- apiGroups: [""]
resources: ["endpoints"]
resources: ["endpoints","configmaps"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To operate configmaps of pump

verbs: ["create", "get", "list", "watch", "update"]
- apiGroups: ["batch"]
resources: ["jobs"]
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module github.com/pingcap/tidb-operator
go 1.13

require (
github.com/BurntSushi/toml v0.3.1
github.com/MakeNowJust/heredoc v0.0.0-20171113091838-e9091a26100e // indirect
github.com/Microsoft/go-winio v0.4.12 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
Expand Down Expand Up @@ -41,6 +42,7 @@ require (
github.com/juju/loggo v0.0.0-20180524022052-584905176618 // indirect
github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073 // indirect
github.com/mholt/archiver v3.1.1+incompatible
github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb
github.com/nwaples/rardecode v1.0.0 // indirect
github.com/onsi/ginkgo v1.10.3
github.com/onsi/gomega v1.5.0
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lN
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb h1:e+l77LJOEqXTIQihQJVkA6ZxPOUmfPM5e4H7rcpgtSk=
github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/monoculum/formam v0.0.0-20180901015400-4e68be1d79ba/go.mod h1:RKgILGEJq24YyJ2ban8EO0RUVSJlF1pGsEvoLEACr/Q=
github.com/morikuni/aec v0.0.0-20170113033406-39771216ff4c h1:nXxl5PrvVm2L/wCy8dQu6DMTwH4oIuGN8GJDAlqDdVE=
Expand All @@ -538,7 +539,9 @@ github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d h1:7PxY7LVfSZm7P
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mvdan/xurls v1.1.0/go.mod h1:tQlNn3BED8bE/15hnSL2HLkDeLWpNPAwtw7wkEq44oU=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/naoina/go-stringutil v0.1.0 h1:rCUeRUHjBjGTSHl0VC00jUPLz8/F9dDzYI70Hzifhks=
github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0=
github.com/naoina/toml v0.1.1 h1:PT/lllxVVN0gzzSqSlHEmP8MJB4MY2U7STGxiouV4X8=
github.com/naoina/toml v0.1.1/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E=
github.com/nicksnyder/go-i18n v1.10.0/go.mod h1:HrK7VCrbOvQoUAQ7Vpy7i87N7JZZZ7R2xBGjv0j365Q=
github.com/nwaples/rardecode v1.0.0 h1:r7vGuS5akxOnR4JQSkko62RJ1ReCMXxQRPtxsiFMBOs=
Expand Down
5 changes: 5 additions & 0 deletions manifests/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,11 @@ spec:
pump:
description: PumpSpec contains details of Pump members
properties:
configUpdateStrategy:
description: ConfigUpdateStrategy determines how to apply the configuration
change, change this field without actually changing the configuration
will not trigger rolling-update
type: string
replicas:
format: int32
type: integer
Expand Down
2 changes: 1 addition & 1 deletion manifests/webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ spec:
- -v=4
# TODO webhook is not bundled with tidb-operator yet and tested in
# e2e only, make it configurable in helm chart
- -features=AdvancedStatefulSet=true
# - -features=AdvancedStatefulSet=true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disable asts temporarily, a new [Serial] tag will address this #1257

tennix marked this conversation as resolved.
Show resolved Hide resolved
volumeMounts:
- name: webhook-certs
mountPath: /etc/webhook/certs
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/pingcap/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions pkg/apis/pingcap/v1alpha1/tidbcluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type ComponentAccessor interface {
Tolerations() []corev1.Toleration
PodSecurityContext() *corev1.PodSecurityContext
SchedulerName() string
DnsPolicy() corev1.DNSPolicy
}

type componentAccessorImpl struct {
Expand Down Expand Up @@ -135,6 +136,14 @@ func (a *componentAccessorImpl) Tolerations() []corev1.Toleration {
return tols
}

func (a *componentAccessorImpl) DnsPolicy() corev1.DNSPolicy {
dnsPolicy := corev1.DNSClusterFirst // same as kubernetes default
if a.HostNetwork() {
dnsPolicy = corev1.DNSClusterFirstWithHostNet
}
return dnsPolicy
}

// BaseTiDBSpec returns the base spec of TiDB servers
func (tc *TidbCluster) BaseTiDBSpec() ComponentAccessor {
return &componentAccessorImpl{&tc.Spec, &tc.Spec.TiDB.ComponentSpec}
Expand Down
28 changes: 23 additions & 5 deletions pkg/apis/pingcap/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
package v1alpha1

import (
"github.com/pingcap/tidb-operator/pkg/util/json"
"github.com/pingcap/tidb-operator/pkg/util/config"
apps "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -58,6 +58,17 @@ const (
UpgradePhase MemberPhase = "Upgrade"
)

// ConfigUpdateStrategy represents the strategy to update configuration
type ConfigUpdateStrategy string

const (
// ConfigUpdateStrategyInPlace update the configmap without changing the name
ConfigUpdateStrategyInPlace ConfigUpdateStrategy = "InPlace"
// ConfigUpdateStrategyRollingUpdate generate different configmap on configuration update and
// try to rolling-update the pod controller (e.g. statefulset) to apply updates.
ConfigUpdateStrategyRollingUpdate ConfigUpdateStrategy = "RollingUpdate"
)

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

Expand Down Expand Up @@ -173,7 +184,7 @@ type PDSpec struct {

// +k8s:openapi-gen=false
// TODO: add schema
Config map[string]json.JsonObject `json:"config,omitempty"`
config.GenericConfig `json:",inline"`
}

// +k8s:openapi-gen=true
Expand All @@ -192,7 +203,7 @@ type TiKVSpec struct {

// +k8s:openapi-gen=false
// TODO: add schema
Config map[string]json.JsonObject `json:"config,omitempty"`
config.GenericConfig `json:",inline"`
}

// +k8s:openapi-gen=true
Expand All @@ -218,7 +229,7 @@ type TiDBSpec struct {

// +k8s:openapi-gen=false
// TODO: add schema
Config map[string]json.JsonObject `json:"config,omitempty"`
config.GenericConfig `json:",inline"`
}

// +k8s:openapi-gen=true
Expand All @@ -232,9 +243,16 @@ type PumpSpec struct {
StorageClassName string `json:"storageClassName,omitempty"`
Replicas int32 `json:"replicas"`

// ConfigUpdateStrategy determines how to apply the configuration change,
// change this field without actually changing the configuration will not trigger rolling-update
ConfigUpdateStrategy ConfigUpdateStrategy `json:"configUpdateStrategy,omitempty"`
// +k8s:openapi-gen=false
// TODO: add schema
Config map[string]json.JsonObject `json:"config,omitempty"`
config.GenericConfig `json:",inline"`

// +k8s:openapi-gen=false
// For backward compatibility with helm chart
SetTimeZone *bool `json:"setTimeZone,omitempty"`
}

// +k8s:openapi-gen=true
Expand Down
52 changes: 8 additions & 44 deletions pkg/apis/pingcap/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading