Skip to content

Commit

Permalink
feat: choose controller image version during generation of manifests (#…
Browse files Browse the repository at this point in the history
…627)

## Description

Choose controller image version during generation of manifests. 

```bash
┌─[cmwylie19@Cases-MacBook-Pro] - [~/pepr/pepr-test-module] - [2024-03-07 12:43:40]
└─[0] <git:(main✈) > npx ts-node ../src/cli.ts  build -v "99.99.99"   

  dist/pepr-static-test.js            3.6kb  100.0%
   ├ capabilities/hello-pepr.ts       2.8kb   77.4%
   ├ package.json                     667b    18.0%
   └ pepr.ts                           46b     1.2%

  dist/pepr-static-test.js.LEGAL.txt    0b   100.0%

Registered Pepr Capability "hello-pepr"
Module static-test has capability: hello-pepr
Module static-test has capability: hello-pepr
Module static-test has capability: hello-pepr
Module static-test has capability: hello-pepr
✅ K8s resource for the module saved to /Users/cmwylie19/pepr/pepr-test-module/dist/pepr-module-static-test.yaml
┌─[cmwylie19@Cases-MacBook-Pro] - [~/pepr/pepr-test-module] - [2024-03-07 12:43:51]
└─[0] <git:(main✈) > cat dist/pepr-module-static-test.yaml | egrep "image:"
          image: ghcr.io/defenseunicorns/pepr/controller:v99.99.99
          image: ghcr.io/defenseunicorns/pepr/controller:v99.99.99
```

Fixes for mandatory values that were marked as optional.

## Related Issue

Fixes #581 
<!-- or -->
Relates to #

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://github.com/defenseunicorns/pepr/blob/main/CONTRIBUTING.md#submitting-a-pull-request)
followed

---------

Signed-off-by: Case Wylie <cmwylie19@defenseunicorns.com>
  • Loading branch information
cmwylie19 committed Mar 8, 2024
1 parent 3d8db0e commit eeec4db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion docs/030_user-guide/010_pepr-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ Create a [zarf.yaml](https://zarf.dev) and K8s manifest for the current module.
- `--timeout [timeout]` - How long the API server should wait for a webhook to respond before treating the call as a failure
- `--rbac-mode [admin|scoped]` - Rbac Mode: admin, scoped (default: admin) (choices: "admin", "scoped", default: "admin")
- `-i, --custom-image [custom-image]` - Custom Image: Use custom image for Admission and Watcher Deployments.
- `--registry [GitHub, Iron Bank]`, - Container registry: Choose container registry for deployment manifests.
- `--registry [GitHub, Iron Bank]` - Container registry: Choose container registry for deployment manifests.
- `-v, --version <version>. Example: '0.27.3'` - The version of the Pepr image to use in the deployment manifests.

## `npx pepr kfc`
Execute a `kubernetes-fluent-client` command. This command is a wrapper around `kubernetes-fluent-client`.
Expand Down
15 changes: 12 additions & 3 deletions src/cli/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,23 @@ export default function (program: RootCmd) {
"Disables embedding of deployment files into output module. Useful when creating library modules intended solely for reuse/distribution via NPM.",
)
.option(
"-i, --custom-image [custom-image]",
"-i, --custom-image <custom-image>",
"Custom Image: Use custom image for Admission and Watch Deployments.",
)
.option(
"-r, --registry-info [<registry>/<username>]",
"Registry Info: Image registry and username. Note: You must be signed into the registry",
)
.option("-o, --output-dir [output directory]", "Define where to place build output")
.option("-o, --output-dir <output directory>", "Define where to place build output")
.option(
"--timeout [timeout]",
"--timeout <timeout>",
"How long the API server should wait for a webhook to respond before treating the call as a failure",
parseTimeout,
)
.option(
"-v, --version <version>. Example: '0.27.3'",
"The version of the Pepr image to use in the deployment manifests.",
)
.addOption(
new Option(
"--registry <GitHub|Iron Bank>",
Expand Down Expand Up @@ -105,6 +109,11 @@ export default function (program: RootCmd) {
return;
}

// set the image version if provided
if (opts.version) {
cfg.pepr.peprVersion = opts.version;
}

// Generate a secret for the module
const assets = new Assets(
{
Expand Down

0 comments on commit eeec4db

Please sign in to comment.