๐
This file contains hidden or 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
import yargs from "yargs"; | |
import {hideBin} from "yargs/helpers"; | |
import {inspect} from 'node:util' | |
import {Command} from "commander"; | |
// Compare yargs and commander.js multiple CLI args array handling | |
// Run: | |
// | |
// node yargs-commander-compare.js --str "a string" --arr "array string 1" | |
// node yargs-commander-compare.js --str "a string" --str "another string" --arr "array string 1" --arr "array string 2" |
This file contains hidden or 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
import * as cdk from 'aws-cdk-lib'; | |
import { KiwiStack } from '../lib/stack'; | |
import { getSynthesizer } from '../lib/synthesizer'; | |
const app = new cdk.App(); | |
async function main() { | |
new KiwiStack(app, 'MyStack', { | |
// Use the current environment variables to figure out which account | |
// and region we want to deploy to |
This file contains hidden or 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
import simpleGit from 'simple-git'; | |
export async function getSynthesizer(synthProps?: cdk.DefaultStackSynthesizerProps) { | |
// Extract the current repository name | |
const remoteUrl = (await simpleGit().remote(['get-url', 'origin']))!.trim(); | |
const repository = /github.com[:/]([^/]+\/[^/]+)\.git/.exec(remoteUrl)![1]; | |
return new KiwiSynthesizer({ | |
...synthProps, | |
forcedTags: { |
This file contains hidden or 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
import * as cdk from 'aws-cdk-lib'; | |
export type KiwiSynthesizerProps = cdk.DefaultStackSynthesizerProps & { | |
forcedTags: Record; | |
}; | |
export class KiwiSynthesizer extends cdk.DefaultStackSynthesizer { | |
readonly forcedTags: KiwiSynthesizerProps['forcedTags']; | |
constructor(props: KiwiSynthesizerProps) { |
This file contains hidden or 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
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: restart-helper | |
labels: | |
app: restart-helper | |
spec: | |
replicas: 1 | |
template: | |
metadata: |
This file contains hidden or 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
apiVersion: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
name: restart-helper | |
spec: | |
rules: | |
- host: myhost.mydomain.com | |
http: | |
paths: | |
- path: / |
This file contains hidden or 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
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: restart-helper | |
spec: | |
selector: | |
app: restart-helper | |
ports: | |
- port: 7055 | |
name: http |
This file contains hidden or 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
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: restart-helper | |
--- | |
# Allows the service account to: | |
# | |
# - Get namespaces. | |
# - Get/patch our deployments and statefulsets, to allow the | |
# "restart rollout" command to work. |
This file contains hidden or 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
"/restart/:type/:name": | |
logOutput: true | |
logArgs: true | |
returnOutput: true | |
command: kubectl | |
args: | |
- rollout | |
- restart |
This file contains hidden or 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
"/restart/:type/:name": | |
logOutput: true | |
logArgs: true | |
returnOutput: true | |
command: kubectl | |
args: | |
- rollout | |
- restart |
NewerOlder