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

Conversation

aylei
Copy link
Contributor

@aylei aylei commented Dec 2, 2019

Signed-off-by: Aylei rayingecho@gmail.com

close #1191

Note:

Check List

Tests

  • Unit test
  • E2E test

Code changes

  • Has Helm charts change
  • Has Go code change

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Does this PR introduce a user-facing change?:

Custom resource `TidbCluster` is extended to support managing Pump cluster. 

@weekface @tennix @cofyc @Yisaer @AstroProfundis PTAL

Signed-off-by: Aylei <rayingecho@gmail.com>
@aylei
Copy link
Contributor Author

aylei commented Dec 2, 2019

/run-e2e-test

@@ -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

@@ -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

}

// syncStatefulSet syncs the pump statefulset
// TODO: sync statefulset status of pump to tidbcluster
Copy link
Contributor Author

Choose a reason for hiding this comment

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


oldCmTemp, err := pmm.cmLister.ConfigMaps(newCm.Namespace).Get(newCm.Name)
if errors.IsNotFound(err) {
// TODO: garbage collection for pump 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.

}
if spec.HostNetwork() {
// For backward compatibility, set HOSTNAME to POD_NAME in hostNetwork mode
envs = append(envs, corev1.EnvVar{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This can avoid rolling-update when user upgrade from helm chart, but I'm not sure if there is any side-effect, @cofyc PTAL

Copy link
Contributor

@cofyc cofyc Dec 3, 2019

Choose a reason for hiding this comment

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

you don't do this because this is a new sts to deploy (no need to keep back-compatibility like pd/tikv sts)

you can always use POD_NAME for both pod network and host network mode because sts member address is always <pod-name>.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See the comment below, we have to consider the helm chart.

Copy link
Contributor Author

@aylei aylei Dec 3, 2019

Choose a reason for hiding this comment

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

Actually I prefer to use POD_NAME, which is more accurate and has no hidden tricks, but we have to document that adopt pump via TidbCluster CR will trigger an rolling-update, this a trade-off, both looks not good but acceptable to me.

/cc @weekface @tennix how do you think?

Copy link
Member

Choose a reason for hiding this comment

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

What about adding a feature gate for adopting helm managed resources?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No gate is needed, if user leave the .spec.pump as nil, the helm resource will not be adopted. The real concern is that whether user has the ability to adopt pump cluster and do not trigger rolling-update. If not, abandon helm for existing cluster will require extra effort.

Copy link
Contributor

Choose a reason for hiding this comment

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

adapt old pump clusters and do not trigger rolling-update when update tidb-operator is reasonable for the user.

Copy link
Contributor

Choose a reason for hiding this comment

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

adapt old pump clusters and do not trigger rolling-update when update tidb-operator is reasonable for the user.

Copy link
Member

Choose a reason for hiding this comment

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

So users can allow the adoption when they need to update pump clusters? If so, then it's reasonable and we can document about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, if both approaches make sense, I pretend to keep it as is to avoid additional code change (mainly in e2e, there is a case to verify the sts do not get rolling-update after adoption, which need to be re-written if we choose to change the podTemplate in this PR), further improvement on the PodTemplate of pump could be made through other enhancement issues.

func getPumpStartScript(tc *v1alpha1.TidbCluster) (string, error) {
buff := new(bytes.Buffer)
// Keep the logic same as helm chart, but pump has not supported tls yet (no cert mounted)
// TODO: support tls
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TLS of pump is not actually supported in tidb-cluster helm chart, nor in controller. We may document this limitation first @AstroProfundis PTAL

@aylei
Copy link
Contributor Author

aylei commented Dec 2, 2019

/run-e2e-in-kind

@aylei
Copy link
Contributor Author

aylei commented Dec 2, 2019

/run-e2e-test

/pump \
-pd-urls={{ .Scheme }}://{{ .ClusterName }}-pd:2379 \
-L={{ .LogLevel }} \
-advertise-addr=` + "`" + `echo ${HOSTNAME}` + "`" + `.{{ .ClusterName }}-pump:8250 \
Copy link
Contributor

Choose a reason for hiding this comment

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

this is strange, does this work? -advertise-addr={{.PodName}}.{{ .ClusterName }}-pump:8250
we don't need to pass HOSTNAME environment for sts pod, because the pod address is predictable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use the HOSTNAME environment deliberately to keep backward compatibility with the helm chart, otherwise the pump statefulset will get rolling-update if we set the new env var POD_NAME.

tests/actions.go Show resolved Hide resolved
pkg/manager/member/utils.go Outdated Show resolved Hide resolved
manifests/webhook.yaml Show resolved Hide resolved
pkg/apis/pingcap/v1alpha1/types.go Outdated Show resolved Hide resolved
aylei and others added 2 commits December 3, 2019 11:31
Co-Authored-By: Tennix <tennix@users.noreply.github.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
@aylei
Copy link
Contributor Author

aylei commented Dec 3, 2019

/run-e2e-test

@aylei aylei requested review from cofyc and tennix December 3, 2019 04:05
@aylei
Copy link
Contributor Author

aylei commented Dec 3, 2019

In order to not blocking the development of #1192 #1264 #1263 , I will separate the configmapControlInterface to another PR.

Copy link
Member

@tennix tennix left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@weekface weekface left a comment

Choose a reason for hiding this comment

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

lgtm

@aylei
Copy link
Contributor Author

aylei commented Dec 3, 2019

/run-e2e-test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sync Pump in controllers
4 participants