Skip to content

feat(deployment): add option to deploy mysql in KFP standalone #9855

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

Merged
merged 9 commits into from
Aug 21, 2023

Conversation

Linchin
Copy link
Contributor

@Linchin Linchin commented Aug 12, 2023

Description of your changes:

  • Update the manifests so users can choose to deploy KFP with MySQL or PostgreSQL
  • Note: the PostgreSQL will not work for now, due to backend support is not completed
  • Note: added a set of env vars for MySQL, and another set of env vars for PostgreSQL. Keeping the current env vars so the deployment doesn't break due to this PR. Will need to remove them after releasing and fully support the new SQL settings.

After merging this PR, users who deploy KFP standalone with MySQL will use the same commands as before:

export PIPELINE_VERSION=2.0.0
kubectl apply -k "github.com/kubeflow/pipelines/manifests/kustomize/cluster-scoped-resources?ref=$PIPELINE_VERSION"
kubectl wait --for condition=established --timeout=60s crd/applications.app.k8s.io
kubectl apply -k "github.com/kubeflow/pipelines/manifests/kustomize/env/dev?ref=$PIPELINE_VERSION"

With PostgreSQL, the command is slightly different:

export PIPELINE_VERSION=2.0.0
kubectl apply -k "github.com/kubeflow/pipelines/manifests/kustomize/cluster-scoped-resources?ref=$PIPELINE_VERSION"
kubectl wait --for condition=established --timeout=60s crd/applications.app.k8s.io
kubectl apply -k "github.com/kubeflow/pipelines/manifests/kustomize/env/dev/postgresql?ref=$PIPELINE_VERSION"

Using this method instead of letting user change their config in pipeline-install-config.yaml, because Kustomize does not allow conditional deployment (as far as I can find).

To-Do:

  • Verify that the manifests with MySQL deploys successfully
  • Update the documentation
  • (after release) remove the old environment variables in ml-pipeline-apiserver-deployment.yaml

Checklist:

@Linchin
Copy link
Contributor Author

Linchin commented Aug 14, 2023

part of #9813

@Linchin
Copy link
Contributor Author

Linchin commented Aug 16, 2023

/test kubeflow-pipeline-e2e-test

Comment on lines 16 to 17
dbHost: postgres
dbPort: "5432"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we avoid reusing the same variable name for both mysql config and postgresql config?

In the installs/generic/pipeline-install-config.yaml file, you defined mysqlHost, so we can use the same approach to name postgresqlConfigDbName or something similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for catching this. I should have added the postgres counterpart for the db config. The original parameters dbType and dbHost are kept for now because the v2 images these manifests use still call for them. They should be removed after we release the new images.

dbHost: mysql # relic to be removed after release
dbPort: "3306" # relic to be removed after release
dbType: mysql
mysqlHost: mysql
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: Do we want to name the new mysqlPort key to be something similar to the definition in

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I'm not sure understand. Did you mean to name it something like DBConfig.MySQLConfig.Port?

Copy link
Contributor

Choose a reason for hiding this comment

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

That is right, because it is a configmap, you can call it like dbconfig_mysqlconfig_port.

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'm not sure about this. The rest of the variable names are not consistent with their counterparts in config.json either. If we change all of them, this might lead to more backward compatibility issues.

secretKeyRef:
name: postgres-secret
key: username
optional: true
Copy link
Contributor

Choose a reason for hiding this comment

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

If postgresql is chosen as the driver DB, the flags here are not optional, but the mysql flags are optional.

Maybe consider using a patch to include postgresql flag in the platform-agnostic-postgresql overlay?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, I didn't think of this idea. I have changed the code so the mysql parameters are only required in default deployment, and postgres parameters are only required when postgres is used. I will commit after the local test passes.

@Linchin
Copy link
Contributor Author

Linchin commented Aug 17, 2023

/test kubeflow-pipeline-e2e-test

@google-oss-prow google-oss-prow bot added size/XL and removed size/L labels Aug 17, 2023
@Linchin Linchin requested a review from zijianjoy August 17, 2023 22:05
@Linchin
Copy link
Contributor Author

Linchin commented Aug 17, 2023

/test kubeflow-pipeline-e2e-test

@@ -11,7 +11,7 @@ data:
until the changes take effect. A quick way to restart all deployments in a
namespace: `kubectl rollout restart deployment -n <your-namespace>`.
appName: pipeline
appVersion: 2.0.0
appVersion: 2.0.1
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that we should still use 2.0.0 for the consistency across repo.

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 was changed due to version 2.0.1 was released yesterday, see #9899.

bases:
- ../metadata-writer
resources:
- ml-pipeline-apiserver-deployment.yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

Using patches in kustomization.yaml can make this file much simpler: https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/patches/

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
bases:
  - ../metadata-writer
  - ../
patches:
  - ml-pipeline-apiserver-deployment-patch.yaml

ml-pipeline-apiserver-deployment-patch.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ml-pipeline
spec:
  template:
    spec:
      containers:
        - name: DB_DRIVER_NAME
          valueFrom:
            configMapKeyRef:
              name: pipeline-install-config
              key: dbType
        # PostgreSQL Config
        - name: DBCONFIG_POSTGRESQLCONFIG_USER
          valueFrom:
            secretKeyRef:
              name: postgres-secret
              key: username
        - name: DBCONFIG_POSTGRESQLCONFIG_PASSWORD
          valueFrom:
            secretKeyRef:
              name: postgres-secret
              key: password
        - name: DBCONFIG_POSTGRESQLCONFIG_DBNAME
          valueFrom:
            configMapKeyRef:
              name: pipeline-install-config
              key: pipelineDb
        - name: DBCONFIG_POSTGRESQLCONFIG_HOST
          valueFrom:
            configMapKeyRef:
              name: pipeline-install-config
              key: postgresHost
        - name: DBCONFIG_POSTGRESQLCONFIG_PORT
          valueFrom:
            configMapKeyRef:
              name: pipeline-install-config
              key: postgresPort
        # end of PostgreSQL variables
        name: ml-pipeline-api-server

Copy link
Contributor Author

@Linchin Linchin Aug 18, 2023

Choose a reason for hiding this comment

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

They are still slightly different, because ml-pipeline-apiserver-deployment.yaml in the parent folder also includes some MySQL specific parameters, which are not needed in a PostgreSQL deployment.

Copy link
Contributor

@zijianjoy zijianjoy left a comment

Choose a reason for hiding this comment

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

/lgtm

Awesome work Lingqing! Pending for test to pass and remaining comments to address.

@google-oss-prow google-oss-prow bot added the lgtm label Aug 18, 2023
@zijianjoy
Copy link
Contributor

/lgtm
/approve

Thank you so much Lingqing!

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zijianjoy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit b086020 into kubeflow:master Aug 21, 2023
connor-mccarthy pushed a commit to connor-mccarthy/pipelines that referenced this pull request Aug 24, 2023
…low#9855)

* add option to deploy mysql

* fix deployment errors

* remove temp code in development

* keep mysql deployment path same as before

* change the generic folder

* manifest error

* revert default cache path

* address comments
stijntratsaertit pushed a commit to stijntratsaertit/kfp that referenced this pull request Feb 16, 2024
…low#9855)

* add option to deploy mysql

* fix deployment errors

* remove temp code in development

* keep mysql deployment path same as before

* change the generic folder

* manifest error

* revert default cache path

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

Successfully merging this pull request may close these issues.

3 participants