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

[feature][disaggregated] Support configuration of username and password and multi secrets #312

Merged

Conversation

hechao-ustc
Copy link
Contributor

@hechao-ustc hechao-ustc commented Dec 16, 2024

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

  • Support configuration of username and password for disaggregated
  • Support multi secrets for disaggregated

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

})
}
} else {
defaultEnvs = append(defaultEnvs, []corev1.EnvVar{{
Copy link
Contributor

Choose a reason for hiding this comment

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

This behavior will trigger the restart of the DORIS cluster after upgrading the operator. It is dangerous for the online environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Currently, the doris cluster will only be restarted when ddc.Spec.AdminUser is configured.

@@ -729,6 +752,46 @@ func getMultiSecretVolumeAndVolumeMount(bSpec *v1.BaseSpec, componentType v1.Com
return volumes, volumeMounts
}

func GetMultiSecretVolumeAndVolumeMountWithCommonSpec(cSpec *dv1.CommonSpec, componentType dv1.DisaggregatedComponentType) ([]corev1.Volume, []corev1.VolumeMount) {
Copy link
Contributor

Choose a reason for hiding this comment

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

componentType is not a must parameter

Copy link
Contributor

Choose a reason for hiding this comment

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

if only log, the componentType can omit int parameters. log in message on the call function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's better to make judgment and print log in the GetMultiSecretVolumeAndVolumeMountWithCommonSpec here. Because there are three statefulsets in the disaggregated cluster, and each statefulset has two methods that call the GetMultiSecretVolumeAndVolumeMountWithCommonSpec, which results in numerous places that need to be modified.

Copy link
Contributor

@intelligentfu8 intelligentfu8 Dec 23, 2024

Choose a reason for hiding this comment

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

It does not need to output a log. common spec only in fe, be, cn, broker spec, so, if the common spec is not empty, the component type exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, componentType has been removed.

for _, secret := range secrets {
var s corev1.Secret
if getErr := d.K8sclient.Get(ctx, types.NamespacedName{Namespace: ddc.Namespace, Name: secret.SecretName}, &s); getErr != nil {
errMessage = errMessage + fmt.Sprintf("(name: %s, namespace: %s, err: %s), ", secret.SecretName, ddc.Namespace, getErr.Error())
Copy link
Contributor

Choose a reason for hiding this comment

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

No Import fmt package, code compilation error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

for _, secret := range cSpec.Secrets {
path := secret.MountPath
if secret.MountPath == "" {
path = defaultMountPath
Copy link
Contributor

Choose a reason for hiding this comment

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

path must be unique, You need to add the unique verification of the mounting path. If you do not pass, print it in an wrong log. like this config:

  feSpec:
    secrets:
    - secretName: secret1
    - secretName: secret2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the controller, it will be judged whether the path is unique or not.
image

@catpineapple
Copy link
Contributor

In the Docker entrypoint.sh script, the current method of getting PWD is only obtained in $Auth_path. By placing Name and PWD directly into ENV, it will be covered by resolve_password_from_secret.

DB_ADMIN_USER=${USER:-"root"}

DB_ADMIN_PASSWD=$PASSWD
AUTH_PATH="/etc/basic_auth"

resolve_password_from_secret()
{
    if [[ -f "$AUTH_PATH/password" ]]; then
        DB_ADMIN_PASSWD=`cat $AUTH_PATH/password`
    fi
    if [[ -f "$AUTH_PATH/username" ]]; then
        DB_ADMIN_USER=`cat $AUTH_PATH/username`
    fi
}

@intelligentfu8 intelligentfu8 merged commit a13e1ab into apache:master Dec 24, 2024
1 check passed
@catpineapple catpineapple mentioned this pull request Dec 24, 2024
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.

3 participants