-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create Kubernetes secret with certificate
- Loading branch information
Showing
32 changed files
with
314 additions
and
158 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
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
16 changes: 0 additions & 16 deletions
16
src/commands/configurations/prompts/google-cloud-project.ts
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
src/commands/configurations/prompts/google-cloud-redis-instance.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
src/commands/configurations/prompts/kubernetes-namespace.ts
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/commands/configurations/prompts/kubernetes-secret-key.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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,32 @@ | ||
import { bold, green, red } from 'chalk' | ||
import inquirer from 'inquirer' | ||
import autocomplete from 'inquirer-autocomplete-prompt' | ||
import { confirmationPrompt } from '../../lib/prompts/confirmation' | ||
import { googleCloudProjectPrompt } from '../../lib/prompts/google-cloud-project' | ||
import { googleCloudRedisInstancePrompt } from '../../lib/prompts/google-cloud-redis-instance' | ||
import { kubernetesContextPrompt } from '../../lib/prompts/kubernetes-context' | ||
import { kubernetesNamespacePrompt } from '../../lib/prompts/kubernetes-namespace' | ||
import { kubernetesSecretNamePrompt } from '../../lib/prompts/kubernetes-secret-name' | ||
import { saveSecret } from '../../lib/secrets' | ||
import { SecretCreateAnswers } from '../../lib/types' | ||
|
||
export const createSecret = async () => { | ||
inquirer.registerPrompt('autocomplete', autocomplete) | ||
|
||
const answers = await inquirer.prompt<SecretCreateAnswers>([ | ||
googleCloudProjectPrompt, | ||
googleCloudRedisInstancePrompt, | ||
kubernetesContextPrompt, | ||
kubernetesNamespacePrompt, | ||
kubernetesSecretNamePrompt, | ||
confirmationPrompt, | ||
]) | ||
|
||
if (answers.confirmation) { | ||
saveSecret(answers) | ||
|
||
console.log(green(`Created secret '${bold(answers.kubernetesSecretName)}'.`)) | ||
} else { | ||
console.log(red('You are excused.')) | ||
} | ||
} |
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,21 @@ | ||
import { Command } from 'commander' | ||
import { logError } from '../../lib/util/error' | ||
import { createSecret } from './create' | ||
|
||
export async function addSecretsCommands(program: Command) { | ||
const secrets = new Command('secrets') | ||
secrets.description('manage Kubernetes secrets for Redis certificates') | ||
|
||
secrets | ||
.command('create') | ||
.description('create Kubernetes secret containing Google Cloud Redis certificate') | ||
.action(async () => { | ||
try { | ||
await createSecret() | ||
} catch (error) { | ||
logError(error) | ||
} | ||
}) | ||
|
||
program.addCommand(secrets) | ||
} |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.