Skip to content

Commit

Permalink
chore: improve the docs for k9s flag options (#2132)
Browse files Browse the repository at this point in the history
## Description

This fixes docs and help for the additional `k9s` flags allowed in #2095

## Related Issue

Fixes #N/A

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [X] 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/zarf/blob/main/CONTRIBUTING.md#developer-workflow)
followed
  • Loading branch information
Racer159 authored Nov 16, 2023
1 parent 548e9d2 commit 06c8e53
Show file tree
Hide file tree
Showing 21 changed files with 272 additions and 190 deletions.
30 changes: 15 additions & 15 deletions docs/2-the-zarf-cli/100-cli-commands/zarf_init.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@ zarf init [flags]

```
# Initializing without any optional components:
zarf init
# Initializing without any optional components:
$ zarf init
# Initializing w/ Zarfs internal git server:
zarf init --components=git-server
# Initializing w/ Zarfs internal git server:
$ zarf init --components=git-server
# Initializing w/ Zarfs internal git server and PLG stack:
zarf init --components=git-server,logging
# Initializing w/ Zarfs internal git server and PLG stack:
$ zarf init --components=git-server,logging
# Initializing w/ an internal registry but with a different nodeport:
zarf init --nodeport=30333
# Initializing w/ an internal registry but with a different nodeport:
$ zarf init --nodeport=30333
# Initializing w/ an external registry:
zarf init --registry-push-password={PASSWORD} --registry-push-username={USERNAME} --registry-url={URL}
# Initializing w/ an external registry:
$ zarf init --registry-push-password={PASSWORD} --registry-push-username={USERNAME} --registry-url={URL}
# Initializing w/ an external git server:
zarf init --git-push-password={PASSWORD} --git-push-username={USERNAME} --git-url={URL}
# Initializing w/ an external git server:
$ zarf init --git-push-password={PASSWORD} --git-push-username={USERNAME} --git-url={URL}
# Initializing w/ an external artifact server:
zarf init --artifact-push-password={PASSWORD} --artifact-push-username={USERNAME} --artifact-url={URL}
# Initializing w/ an external artifact server:
$ zarf init --artifact-push-password={PASSWORD} --artifact-push-username={USERNAME} --artifact-url={URL}
# NOTE: Not specifying a pull username/password will use the push user for pulling as well.
# NOTE: Not specifying a pull username/password will use the push user for pulling as well.
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,30 @@ image registries and git repositories within the target environment
zarf package mirror-resources [ PACKAGE_SOURCE ] [flags]
```

## Examples

```
# Mirror resources to internal Zarf resources
$ zarf package mirror-resources <your-package.tar.zst> \
--registry-url 127.0.0.1:31999 \
--registry-push-username zarf-push \
--registry-push-password <generated-registry-push-password> \
--git-url http://zarf-gitea-http.zarf.svc.cluster.local:3000 \
--git-push-username zarf-git-user \
--git-push-password <generated-git-push-password>
# Mirror resources to external resources
$ zarf package mirror-resources <your-package.tar.zst> \
--registry-url registry.enterprise.corp \
--registry-push-username <registry-push-username> \
--registry-push-password <registry-push-password> \
--git-url https://git.enterprise.corp \
--git-push-username <git-push-username> \
--git-push-password <git-push-password>
```

## Options

```
Expand Down
8 changes: 4 additions & 4 deletions docs/2-the-zarf-cli/100-cli-commands/zarf_package_publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ zarf package publish { PACKAGE_SOURCE | SKELETON DIRECTORY } REPOSITORY [flags]

```
# Publish a package to a remote registry
zarf package publish my-package.tar oci://my-registry.com/my-namespace
# Publish a package to a remote registry
$ zarf package publish my-package.tar oci://my-registry.com/my-namespace
# Publish a skeleton package to a remote registry
zarf package publish ./path/to/dir oci://my-registry.com/my-namespace
# Publish a skeleton package to a remote registry
$ zarf package publish ./path/to/dir oci://my-registry.com/my-namespace
```

Expand Down
2 changes: 1 addition & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_package_pull.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ zarf package pull PACKAGE_SOURCE [flags]
## Examples

```
zarf package pull oci://my-registry.com/my-namespace/my-package:0.0.1-arm64
$ zarf package pull oci://my-registry.com/my-namespace/my-package:0.0.1-arm64
```

## Options
Expand Down
20 changes: 10 additions & 10 deletions docs/2-the-zarf-cli/100-cli-commands/zarf_tools_get-creds.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ zarf tools get-creds [flags]

```
# Print all Zarf credentials:
zarf tools get-creds
# Get specific Zarf credentials:
zarf tools get-creds registry
zarf tools get-creds registry-readonly
zarf tools get-creds git
zarf tools get-creds git-readonly
zarf tools get-creds artifact
zarf tools get-creds logging
# Print all Zarf credentials:
$ zarf tools get-creds
# Get specific Zarf credentials:
$ zarf tools get-creds registry
$ zarf tools get-creds registry-readonly
$ zarf tools get-creds git
$ zarf tools get-creds git-readonly
$ zarf tools get-creds artifact
$ zarf tools get-creds logging
```

Expand Down
26 changes: 25 additions & 1 deletion docs/2-the-zarf-cli/100-cli-commands/zarf_tools_monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,31 @@ zarf tools monitor [flags]
## Options

```
-h, --help help for monitor
-A, --all-namespaces Launch K9s in all namespaces
--as string Username to impersonate for the operation
--as-group stringArray Group to impersonate for the operation
--certificate-authority string Path to a cert file for the certificate authority
--client-certificate string Path to a client certificate file for TLS
--client-key string Path to a client key file for TLS
--cluster string The name of the kubeconfig cluster to use
-c, --command string Overrides the default resource to load when the application launches
--context string The name of the kubeconfig context to use
--crumbsless Turn K9s crumbs off
--headless Turn K9s header off
-h, --help help for monitor
--insecure-skip-tls-verify If true, the server's caCertFile will not be checked for validity
--kubeconfig string Path to the kubeconfig file to use for CLI requests
--logFile string Specify the log file
-l, --logLevel string Specify a log level (info, warn, debug, trace, error)
--logoless Turn K9s logo off
-n, --namespace string If present, the namespace scope for this CLI request
--readonly Sets readOnly mode by overriding readOnly configuration setting
-r, --refresh int Specify the default refresh rate as an integer (sec) (default 2)
--request-timeout string The length of time to wait before giving up on a single server request
--screen-dump-dir string Sets a path to a dir for a screen dumps
--token string Bearer token for authentication to the API server
--user string The name of the kubeconfig user to use
--write Sets write mode by overriding the readOnly configuration setting
```

## SEE ALSO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ zarf tools registry catalog REGISTRY [flags]

```
# list the repos internal to Zarf
$ zarf tools registry catalog
# List the repos internal to Zarf
$ zarf tools registry catalog
# list the repos for reg.example.com
$ zarf tools registry catalog reg.example.com
# List the repos for reg.example.com
$ zarf tools registry catalog reg.example.com
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ zarf tools registry delete IMAGE [flags]

```
# delete an image digest from an internal repo in Zarf
# Delete an image digest from an internal repo in Zarf
$ zarf tools registry delete 127.0.0.1:31999/stefanprodan/podinfo@sha256:57a654ace69ec02ba8973093b6a786faa15640575fbf0dbb603db55aca2ccec8
# delete an image digest from a repo hosted at reg.example.com
# Delete an image digest from a repo hosted at reg.example.com
$ zarf tools registry delete reg.example.com/stefanprodan/podinfo@sha256:57a654ace69ec02ba8973093b6a786faa15640575fbf0dbb603db55aca2ccec8
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ zarf tools registry digest IMAGE [flags]

```
# return an image digest for an internal repo in Zarf
# Return an image digest for an internal repo in Zarf
$ zarf tools registry digest 127.0.0.1:31999/stefanprodan/podinfo:6.4.0
# return an image digest from a repo hosted at reg.example.com
# Return an image digest from a repo hosted at reg.example.com
$ zarf tools registry digest reg.example.com/stefanprodan/podinfo:6.4.0
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ zarf tools registry ls REPO [flags]

```
# list the tags for a repo internal to Zarf
$ zarf tools registry ls 127.0.0.1:31999/stefanprodan/podinfo
# List the tags for a repo internal to Zarf
$ zarf tools registry ls 127.0.0.1:31999/stefanprodan/podinfo
# list the tags for a repo hosted at reg.example.com
$ zarf tools registry ls reg.example.com/stefanprodan/podinfo
# List the tags for a repo hosted at reg.example.com
$ zarf tools registry ls reg.example.com/stefanprodan/podinfo
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ zarf tools registry pull IMAGE TARBALL [flags]

```
# pull an image from an internal repo in Zarf to a local tarball
$ zarf tools registry pull 127.0.0.1:31999/stefanprodan/podinfo:6.4.0 image.tar
# Pull an image from an internal repo in Zarf to a local tarball
$ zarf tools registry pull 127.0.0.1:31999/stefanprodan/podinfo:6.4.0 image.tar
# pull an image from a repo hosted at reg.example.com to a local tarball
$ zarf tools registry pull reg.example.com/stefanprodan/podinfo:6.4.0 image.tar
# Pull an image from a repo hosted at reg.example.com to a local tarball
$ zarf tools registry pull reg.example.com/stefanprodan/podinfo:6.4.0 image.tar
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ zarf tools registry push PATH IMAGE [flags]

```
# push an image into an internal repo in Zarf
$ zarf tools registry push image.tar 127.0.0.1:31999/stefanprodan/podinfo:6.4.0
# Push an image into an internal repo in Zarf
$ zarf tools registry push image.tar 127.0.0.1:31999/stefanprodan/podinfo:6.4.0
# push an image into an repo hosted at reg.example.com
$ zarf tools registry push image.tar reg.example.com/stefanprodan/podinfo:6.4.0
# Push an image into an repo hosted at reg.example.com
$ zarf tools registry push image.tar reg.example.com/stefanprodan/podinfo:6.4.0
```

Expand Down
48 changes: 24 additions & 24 deletions docs/2-the-zarf-cli/100-cli-commands/zarf_tools_update-creds.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ zarf tools update-creds [flags]

```
# Autogenerate all Zarf credentials at once:
zarf tools update-creds
# Autogenerate specific Zarf service credentials:
zarf tools update-creds registry
zarf tools update-creds git
zarf tools update-creds artifact
zarf tools update-creds agent
# Update all Zarf credentials w/external services at once:
zarf tools update-creds \
--registry-push-username={USERNAME} --registry-push-password={PASSWORD} \
--git-push-username={USERNAME} --git-push-password={PASSWORD} \
--artifact-push-username={USERNAME} --artifact-push-token={PASSWORD}
# NOTE: Any credentials omitted from flags without a service key specified will be autogenerated - URLs will only change if specified.
# Config options can also be set with the 'init' section of a Zarf config file.
# Update specific Zarf credentials w/external services:
zarf tools update-creds registry --registry-push-username={USERNAME} --registry-push-password={PASSWORD}
zarf tools update-creds git --git-push-username={USERNAME} --git-push-password={PASSWORD}
zarf tools update-creds artifact --artifact-push-username={USERNAME} --artifact-push-token={PASSWORD}
# NOTE: Not specifying a pull username/password will keep the previous pull username/password.
# Autogenerate all Zarf credentials at once:
$ zarf tools update-creds
# Autogenerate specific Zarf service credentials:
$ zarf tools update-creds registry
$ zarf tools update-creds git
$ zarf tools update-creds artifact
$ zarf tools update-creds agent
# Update all Zarf credentials w/external services at once:
$ zarf tools update-creds \
--registry-push-username={USERNAME} --registry-push-password={PASSWORD} \
--git-push-username={USERNAME} --git-push-password={PASSWORD} \
--artifact-push-username={USERNAME} --artifact-push-token={PASSWORD}
# NOTE: Any credentials omitted from flags without a service key specified will be autogenerated - URLs will only change if specified.
# Config options can also be set with the 'init' section of a Zarf config file.
# Update specific Zarf credentials w/external services:
$ zarf tools update-creds registry --registry-push-username={USERNAME} --registry-push-password={PASSWORD}
$ zarf tools update-creds git --git-push-username={USERNAME} --git-push-password={PASSWORD}
$ zarf tools update-creds artifact --artifact-push-username={USERNAME} --artifact-push-token={PASSWORD}
# NOTE: Not specifying a pull username/password will keep the previous pull username/password.
```

Expand Down
32 changes: 16 additions & 16 deletions docs/2-the-zarf-cli/100-cli-commands/zarf_tools_wait-for.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ zarf tools wait-for { KIND | PROTOCOL } { NAME | SELECTOR | URI } { CONDITION |

```
# Wait for Kubernetes resources:
zarf tools wait-for pod my-pod-name ready -n default # wait for pod my-pod-name in namespace default to be ready
zarf tools wait-for p cool-pod-name ready -n cool # wait for pod (using p alias) cool-pod-name in namespace cool to be ready
zarf tools wait-for deployment podinfo available -n podinfo # wait for deployment podinfo in namespace podinfo to be available
zarf tools wait-for pod app=podinfo ready -n podinfo # wait for pod with label app=podinfo in namespace podinfo to be ready
zarf tools wait-for svc zarf-docker-registry exists -n zarf # wait for service zarf-docker-registry in namespace zarf to exist
zarf tools wait-for svc zarf-docker-registry -n zarf # same as above, except exists is the default condition
zarf tools wait-for crd addons.k3s.cattle.io # wait for crd addons.k3s.cattle.io to exist
zarf tools wait-for sts test-sts '{.status.availableReplicas}'=23 # wait for statefulset test-sts to have 23 available replicas
# Wait for network endpoints:
zarf tools wait-for http localhost:8080 200 # wait for a 200 response from http://localhost:8080
zarf tools wait-for tcp localhost:8080 # wait for a connection to be established on localhost:8080
zarf tools wait-for https 1.1.1.1 200 # wait for a 200 response from https://1.1.1.1
zarf tools wait-for http google.com # wait for any 2xx response from http://google.com
zarf tools wait-for http google.com success # wait for any 2xx response from http://google.com
# Wait for Kubernetes resources:
$ zarf tools wait-for pod my-pod-name ready -n default # wait for pod my-pod-name in namespace default to be ready
$ zarf tools wait-for p cool-pod-name ready -n cool # wait for pod (using p alias) cool-pod-name in namespace cool to be ready
$ zarf tools wait-for deployment podinfo available -n podinfo # wait for deployment podinfo in namespace podinfo to be available
$ zarf tools wait-for pod app=podinfo ready -n podinfo # wait for pod with label app=podinfo in namespace podinfo to be ready
$ zarf tools wait-for svc zarf-docker-registry exists -n zarf # wait for service zarf-docker-registry in namespace zarf to exist
$ zarf tools wait-for svc zarf-docker-registry -n zarf # same as above, except exists is the default condition
$ zarf tools wait-for crd addons.k3s.cattle.io # wait for crd addons.k3s.cattle.io to exist
$ zarf tools wait-for sts test-sts '{.status.availableReplicas}'=23 # wait for statefulset test-sts to have 23 available replicas
# Wait for network endpoints:
$ zarf tools wait-for http localhost:8080 200 # wait for a 200 response from http://localhost:8080
$ zarf tools wait-for tcp localhost:8080 # wait for a connection to be established on localhost:8080
$ zarf tools wait-for https 1.1.1.1 200 # wait for a 200 response from https://1.1.1.1
$ zarf tools wait-for http google.com # wait for any 2xx response from http://google.com
$ zarf tools wait-for http google.com success # wait for any 2xx response from http://google.com
```

Expand Down
2 changes: 1 addition & 1 deletion packages/gitea/gitea-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ gitea:
security:
INSTALL_LOCK: true
service:
DISABLE_REGISTRATION: "###ZARF_VAR_GIT_SERVER_DISABLE_REGISTRATION###"
DISABLE_REGISTRATION: ###ZARF_VAR_GIT_SERVER_DISABLE_REGISTRATION###
repository:
ENABLE_PUSH_CREATE_USER: true
FORCE_PRIVATE: true
Expand Down
4 changes: 2 additions & 2 deletions packages/gitea/zarf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ variables:
- name: GIT_SERVER_REPLICA_COUNT
description: The number of git server replicas to deploy
default: "1"

- name: GIT_SERVER_DISABLE_REGISTRATION
description: Disables the ability to register new users
default: true
default: "true"

constants:
- name: GITEA_IMAGE
Expand Down
1 change: 1 addition & 0 deletions src/cmd/common/vendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var vendorCmds = []string{
"s",
"k9s",
"monitor",
"m",
"wait-for",
"wait",
"w",
Expand Down
8 changes: 8 additions & 0 deletions src/cmd/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ var generateCLIDocs = &cobra.Command{
}
}
}

if toolCmd.Use == "monitor" {
toolCmd.Flags().VisitAll(func(flag *pflag.Flag) {
if flag.Value.Type() == "string" {
flag.DefValue = ""
}
})
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/cmd/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ var packageMirrorCmd = &cobra.Command{
Aliases: []string{"mr"},
Short: lang.CmdPackageMirrorShort,
Long: lang.CmdPackageMirrorLong,
Example: lang.CmdPackageMirrorExample,
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
pkgConfig.PkgOpts.PackageSource = choosePackage(args)
Expand Down
Loading

0 comments on commit 06c8e53

Please sign in to comment.