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

Extend tidbcluster v1alpha1 to support configuration and pump #1193

Merged
merged 20 commits into from
Nov 26, 2019

Conversation

aylei
Copy link
Contributor

@aylei aylei commented Nov 19, 2019

What problem does this PR solve?

This PR extends the TidbCluster v1alpha1 type to support the management of component configuration, service and pump.

Support cluster-level setting for components.

There is no logic change introduced.

Next step: controllers, as stated in #1121

close #1182
close #1159

Does this PR introduce a user-facing change?:

Support cluster-level setting for components 

Signed-off-by: Aylei <[email protected]>

// +k8s:openapi-gen=false
// TODO: add schema
Config map[string]json.JsonObject `json:"config,omitempty"`
Copy link
Contributor Author

@aylei aylei Nov 19, 2019

Choose a reason for hiding this comment

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

Configuration schema and validation requires kernel-side support, I leave these as future works and the first edition of controller-side configuration management will blindly mashal the config object to toml.

@aylei
Copy link
Contributor Author

aylei commented Nov 20, 2019

/run-e2e-in-kind

Signed-off-by: Aylei <[email protected]>
@weekface
Copy link
Contributor

Is it compatible with 1.0.x? How do these 1.0.x users upgrade?

}
image = fmt.Sprintf("%s:%s", baseImage, version)
}
return image
Copy link
Contributor

Choose a reason for hiding this comment

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

image requires a tag and baseImage cannot have a tag? Why define two images in componentSpec?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

version is used as tag, effectively

For backward compatibility, we keep the image field.

@aylei
Copy link
Contributor Author

aylei commented Nov 20, 2019

Is it compatible with 1.0.x? How do these 1.0.x users upgrade?

Yes, no actions required as stated in the design doc. If use specify new specs added in this PR, for example, .spec.tidb.service, the control-loop will try to adopt the orphaned objects created by helm first.

TiDB TiDBSpec `json:"tidb,omitempty"`
TiKV TiKVSpec `json:"tikv,omitempty"`
// +k8s:openapi-gen=false
TiKVPromGateway TiKVPromGatewaySpec `json:"tikvPromGateway,omitempty"`
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 field is not used anymore, removing this is backward compatible as long as the validation code do not reject this field

if baseImage != "" {
version := a.ComponentSpec.Version
if version == "" {
version = a.ClusterSpec.Version
Copy link
Contributor Author

Choose a reason for hiding this comment

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

validation constraints will guarantee either .spec.version or .spec..version is not-empty if baseImage is present

pkg/apis/pingcap/v1alpha1/tidbcluster.go Outdated Show resolved Hide resolved
pkg/apis/pingcap/v1alpha1/types.go Outdated Show resolved Hide resolved
Timezone string `json:"timezone,omitempty"`

// Whether enable PVC reclaim for orphan PVC left by statefulset scale-in
EnablePVReclaim bool `json:"enablePVReclaim,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Not related to this PR, this variable name is confusing. Maybe better to rename it as AutoReclaimPV.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suggest PVCReclaimPolicy with enum value Deferred and Immediate if we are going to do the renaming

pkg/apis/pingcap/v1alpha1/types.go Show resolved Hide resolved
pkg/util/util.go Outdated Show resolved Hide resolved
@aylei
Copy link
Contributor Author

aylei commented Nov 21, 2019

/run-e2e-in-kind

@aylei aylei requested a review from LinuxGit November 21, 2019 03:15
@@ -90,19 +91,64 @@ type TidbClusterList struct {
// +k8s:openapi-gen=true
// TidbClusterSpec describes the attributes that a user creates on a tidb cluster
type TidbClusterSpec struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modification of .status will be introduced along with the controller logic

@aylei
Copy link
Contributor Author

aylei commented Nov 21, 2019

/run-e2e-in-kind

1 similar comment
@aylei
Copy link
Contributor Author

aylei commented Nov 21, 2019

/run-e2e-in-kind

@aylei
Copy link
Contributor Author

aylei commented Nov 23, 2019

/run-e2e-in-kind

@aylei
Copy link
Contributor Author

aylei commented Nov 23, 2019

@tennix
After I remove the .spec.tidb.storageClassNamefield, I find that this field has been existing from the very beginning and there is a unit test for it.

We can remove this field and adjust the UT because it is not used anywhere, but I suggest we leaving it as is because TiDB MAY use persistent volume according to the RFC pingcap/tidb#13481, which introduce a built-in logging aggregation mechanism that requires local persistent (for a short time) log storage.

@aylei aylei dismissed stale reviews from weekface and tennix via d109f36 November 23, 2019 08:39
@aylei
Copy link
Contributor Author

aylei commented Nov 23, 2019

/run-e2e-in-kind

@aylei
Copy link
Contributor Author

aylei commented Nov 23, 2019

@tennix @weekface PTAL again

Copy link
Contributor

@DanielZhangQD DanielZhangQD left a comment

Choose a reason for hiding this comment

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

LGTM

tennix
tennix previously approved these changes Nov 25, 2019
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

@tennix
Copy link
Member

tennix commented Nov 25, 2019

@tennix
After I remove the .spec.tidb.storageClassNamefield, I find that this field has been existing from the very beginning and there is a unit test for it.

We can remove this field and adjust the UT because it is not used anywhere, but I suggest we leaving it as is because TiDB MAY use persistent volume according to the RFC pingcap/tidb#13481, which introduce a built-in logging aggregation mechanism that requires local persistent (for a short time) log storage.

OK, sounds good to me.

@weekface
Copy link
Contributor

the conflicts should be resolved

@aylei
Copy link
Contributor Author

aylei commented Nov 25, 2019

@weekface conflicts addressed, PTAL

@tennix @DanielZhangQD PTAL again

&
/run-e2e-in-kind

pp := a.ComponentSpec.ImagePullPolicy
if pp == nil {
pp = &a.ClusterSpec.ImagePullPolicy
}
Copy link
Contributor

Choose a reason for hiding this comment

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

ClusterSpec.ImagePullPolicy must not be empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there will be a defaulting through mutating-webhook and validation to ensure clusterSpec.ImagePullPolicy and component.ImagePullPolicy is not both empty.

Copy link
Contributor Author

@aylei aylei Nov 25, 2019

Choose a reason for hiding this comment

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

And it's not an issue if clusterSpec.ImagePullPolicy is empty, we just write empty pull policy in PodSpec and use the default of kubernetes

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

@aylei
Copy link
Contributor Author

aylei commented Nov 25, 2019

/run-e2e-in-kind

@aylei aylei requested a review from onlymellb November 26, 2019 05:42
Copy link
Contributor

@DanielZhangQD DanielZhangQD 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 Nov 26, 2019

/run-e2e-in-kind

@aylei aylei merged commit f67ed33 into pingcap:master Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants