-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(k8s): allow pulling base images when building in cluster
We now use the configured `imagePullSecrets` on the `kubernetes` provider to authenticate the cluster Docker daemon or Kaniko pods, so that you can pull base images from private repositories. This PR includes new integration tests and some helpers that were needed to facilitate those. Closes #1236
- Loading branch information
Showing
39 changed files
with
1,517 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env ts-node | ||
|
||
/** | ||
* Helper script for encrypting files and storing them in the repository. Uses Google Cloud KMS (which devs should | ||
* have access to anyway) to encrypt the data, such that it's safe to commit the file to git. | ||
* | ||
* Usage example: `echo "my data" | ./bin/encrypt-file.ts filename.txt` | ||
*/ | ||
|
||
import kms from "@google-cloud/kms" | ||
import { writeFile } from "fs-extra" | ||
import { resolve } from "path" | ||
|
||
const projectId = "garden-dev-200012" | ||
const keyRingId = "dev" | ||
const cryptoKeyId = "dev" | ||
const locationId = "global" | ||
|
||
async function encrypt(filename: string, plaintext: Buffer) { | ||
const client = new kms.KeyManagementServiceClient() | ||
|
||
const name = client.cryptoKeyPath( | ||
projectId, | ||
locationId, | ||
keyRingId, | ||
cryptoKeyId | ||
) | ||
|
||
const [result] = await client.encrypt({ name, plaintext }) | ||
|
||
const outputPath = resolve(__dirname, "..", "secrets", filename) | ||
await writeFile(outputPath, result.ciphertext) | ||
|
||
console.log( | ||
`Encrypted input, result saved to ${outputPath}` | ||
) | ||
} | ||
|
||
const args = process.argv.slice(2) | ||
const filename = args[0] | ||
|
||
if (require.main === module) { | ||
process.stdin.resume() | ||
|
||
let data = Buffer.from("") | ||
|
||
process.stdin.on("data", (chunk) => { | ||
data = Buffer.concat([data, chunk]) | ||
}) | ||
|
||
process.stdin.on("end", function() { | ||
encrypt(filename, data).catch((err) => { | ||
console.error(err) | ||
process.exit(1) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.