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

Add private host option for private networks support in hyperdrive #4932

Merged
merged 5 commits into from
Mar 28, 2024

Conversation

xortive
Copy link
Contributor

@xortive xortive commented Feb 6, 2024

What this PR solves / how to test

Support for configuring hyperdrives for databases that are inside a customer's private network
LDW CR-851053

Author has addressed the following

Copy link

changeset-bot bot commented Feb 6, 2024

🦋 Changeset detected

Latest commit: 4cd9083

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
wrangler Minor
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Feb 6, 2024

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8470404975/npm-package-wrangler-4932

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/prs/4932/npm-package-wrangler-4932

Or you can use npx with this latest build directly:

npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8470404975/npm-package-wrangler-4932 dev path/to/script.js
Additional artifacts:
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8470404975/npm-package-create-cloudflare-4932 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8470404975/npm-package-cloudflare-kv-asset-handler-4932
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8470404975/npm-package-miniflare-4932
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8470404975/npm-package-cloudflare-pages-shared-4932
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/8470404975/npm-package-cloudflare-vitest-pool-workers-4932

Note that these links will no longer work once the GitHub Actions artifact expires.


wrangler@3.39.0 includes the following runtime dependencies:

Package Constraint Resolved
miniflare workspace:* 3.20240320.0
workerd 1.20240320.1 1.20240320.1
workerd --version 1.20240320.1 2024-03-20

Please ensure constraints are pinned, and miniflare/workerd minor versions match.

Copy link

codecov bot commented Feb 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.32%. Comparing base (fbdca7d) to head (4cd9083).
Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4932      +/-   ##
==========================================
+ Coverage   72.20%   72.32%   +0.12%     
==========================================
  Files         322      323       +1     
  Lines       16666    16690      +24     
  Branches     4258     4264       +6     
==========================================
+ Hits        12033    12071      +38     
+ Misses       4633     4619      -14     
Files Coverage Δ
packages/wrangler/src/hyperdrive/client.ts 83.33% <ø> (ø)
packages/wrangler/src/hyperdrive/create.ts 78.78% <100.00%> (+0.66%) ⬆️
packages/wrangler/src/hyperdrive/update.ts 100.00% <ø> (ø)

... and 23 files with indirect coverage changes

Copy link

gitguardian bot commented Mar 21, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
- Generic Database Assignment 5f218bf packages/wrangler/src/tests/hyperdrive.test.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

@xortive xortive changed the title [DRAFT] Add private host option for private networks support in hyperdrive Add private host option for private networks support in hyperdrive Mar 25, 2024
@xortive xortive marked this pull request as ready for review March 25, 2024 18:47
@xortive xortive requested a review from a team as a code owner March 25, 2024 18:47
elithrar added a commit to cloudflare/cloudflare-docs that referenced this pull request Mar 27, 2024
@elithrar
Copy link
Contributor

Docs PR: cloudflare/cloudflare-docs#13654

@@ -116,6 +122,7 @@ export async function handler(
database: args.database,
user: args.originUser,
password: args.originPassword,
privateHost: args.privateHost,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
privateHost: args.privateHost,
private_host: args.privateHost,

@@ -91,6 +97,7 @@ export async function handler(
database: decodeURIComponent(url.pathname.replace("/", "")),
user: decodeURIComponent(url.username),
password: decodeURIComponent(url.password),
privateHost: args.privateHost ?? false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
privateHost: args.privateHost ?? false,
private_host: args.privateHost ?? false,

@@ -18,6 +18,7 @@ export type PublicOrigin = Origin & {
scheme?: string;
database?: string;
user?: string;
privateHost?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
privateHost?: boolean;
private_host?: boolean;

@@ -503,6 +567,7 @@ function mockHyperdriveRequest() {
port: 3211,
database: "mydb",
user: "dbuser",
privateHost: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
privateHost: false,
private_host: false,

@@ -473,6 +536,7 @@ function mockHyperdriveRequest() {
port: reqBody.origin.port,
database: reqBody.origin.database,
user: reqBody.origin.user,
privateHost: reqBody.origin.privateHost,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
privateHost: reqBody.origin.privateHost,
privateHost: reqBody.origin.private_host,

user: "test",
privateHost: false,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
privateHost: false,
private_host: false,

\\"user\\": \\"test\\"
\\"database\\": \\"database\\",
\\"user\\": \\"test\\",
\\"privateHost\\": false
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
\\"privateHost\\": false
\\"private_host\\": false

@@ -447,6 +509,7 @@ function mockHyperdriveRequest() {
database: reqBody.origin.database,
scheme: reqBody.origin.protocol,
user: reqBody.origin.user,
privateHost: reqBody.origin.privateHost,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
privateHost: reqBody.origin.privateHost,
private_host: reqBody.origin.private_host,

\\"user\\": \\"test\\"
\\"database\\": \\"database\\",
\\"user\\": \\"test\\",
\\"privateHost\\": false
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
\\"privateHost\\": false
\\"private_host\\": false

\\"user\\": \\"test\\"
\\"database\\": \\"database\\",
\\"user\\": \\"test\\",
\\"privateHost\\": false
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
\\"privateHost\\": false
\\"private_host\\": false

\\"port\\": 1234,
\\"database\\": \\"mydb\\",
\\"user\\": \\"newuser\\",
\\"privateHost\\": true
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
\\"privateHost\\": true
\\"private_host\\": true

\\"user\\": \\"test\\"
\\"database\\": \\"database\\",
\\"user\\": \\"test\\",
\\"privateHost\\": false
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
\\"privateHost\\": false
\\"private_host\\": false

@@ -309,7 +341,33 @@ describe("hyperdrive commands", () => {
\\"host\\": \\"example.com\\",
\\"port\\": 1234,
\\"database\\": \\"mydb\\",
\\"user\\": \\"newuser\\"
\\"user\\": \\"newuser\\",
\\"privateHost\\": false
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
\\"privateHost\\": false
\\"private_host\\": false

@@ -241,7 +271,8 @@ describe("hyperdrive commands", () => {
\\"host\\": \\"example.com\\",
\\"port\\": 5432,
\\"database\\": \\"/\\"weird/\\" dbname\\",
\\"user\\": \\"test\\"
\\"user\\": \\"test\\",
\\"privateHost\\": false
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
\\"privateHost\\": false
\\"private_host\\": false

@@ -217,7 +246,8 @@ describe("hyperdrive commands", () => {
\\"host\\": \\"example.com\\",
\\"port\\": 5432,
\\"database\\": \\"neondb\\",
\\"user\\": \\"test\\"
\\"user\\": \\"test\\",
\\"privateHost\\": false
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
\\"privateHost\\": false
\\"private_host\\": false

@@ -193,7 +221,8 @@ describe("hyperdrive commands", () => {
\\"host\\": \\"example.com\\",
\\"port\\": 5432,
\\"database\\": \\"neondb\\",
\\"user\\": \\"user:name\\"
\\"user\\": \\"user:name\\",
\\"privateHost\\": false
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
\\"privateHost\\": false
\\"private_host\\": false

\\"port\\": 12345,
\\"database\\": \\"database\\",
\\"user\\": \\"test\\",
\\"privateHost\\": true
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
\\"privateHost\\": true
\\"private_host\\": true

\\"user\\": \\"test\\"
\\"database\\": \\"database\\",
\\"user\\": \\"test\\",
\\"privateHost\\": false
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
\\"privateHost\\": false
\\"private_host\\": false

\\"user\\": \\"test\\"
\\"database\\": \\"database\\",
\\"user\\": \\"test\\",
\\"privateHost\\": false
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
\\"privateHost\\": false
\\"private_host\\": false

@mrbbot mrbbot added the ldw-exempt PRs marked with this label can be included in releases during LDW. label Mar 28, 2024
@mrbbot mrbbot merged commit dc0c1dc into cloudflare:main Mar 28, 2024
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ldw-exempt PRs marked with this label can be included in releases during LDW.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants