Skip to content

Commit

Permalink
updated docs, copy hello-world from kubefox, updated deps
Browse files Browse the repository at this point in the history
  • Loading branch information
xadhatter committed Dec 6, 2023
1 parent f861d14 commit c85dc53
Show file tree
Hide file tree
Showing 35 changed files with 115 additions and 126 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ package:
image:
$(REPO_ROOT)hack/scripts/image.sh

.PHONY: hello-world
hello-world:
$(REPO_ROOT)hack/scripts/hello-world.sh

.PHONY: docs
docs:
$(REPO_ROOT)hack/scripts/docs.sh
Expand Down
15 changes: 7 additions & 8 deletions cmd/build.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package cmd

import (
"strings"

"github.com/spf13/cobra"
"github.com/xigxog/fox/internal/repo"
)
Expand All @@ -11,18 +13,15 @@ var buildCmd = &cobra.Command{
PreRun: setup,
Run: runBuild,
Short: "Build and optionally push an OCI image of component",
Long: `
Long: strings.TrimSpace(`
The build command will use Docker to build the specified component. By default
components are built using a KubeFox defined Dockerfile. A custom Dockerfile can
be provided my placing it in the root directory of the component. Please note
that the build working directory is the root of the repository, not the
component directory.
Examples:
# Build and push OCI image for my-component.
fox build my-component --publish
`,
component directory.`),
Example: strings.TrimSpace(`
# Build and push OCI image for my-component.
fox build my-component --publish`),
}

func init() {
Expand Down
5 changes: 3 additions & 2 deletions cmd/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package cmd
import (
"os"
"path/filepath"
"strings"

"github.com/spf13/cobra"
"github.com/spf13/cobra/doc"
Expand All @@ -21,10 +22,10 @@ var docsCmd = &cobra.Command{
Use: "docs",
Run: generateDocs,
Short: "Generate docs for 🦊 Fox",
Long: `
Long: strings.TrimSpace(`
Run this command to automatically generate 🦊 Fox documentation. Output is
placed in the subdirectory docs of the working directory.
`,
`),
}

func init() {
Expand Down
5 changes: 3 additions & 2 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
_ "embed"
"strings"

"github.com/spf13/cobra"
"github.com/xigxog/fox/internal/repo"
Expand All @@ -13,11 +14,11 @@ var initCmd = &cobra.Command{
Args: cobra.NoArgs,
PreRun: setup,
Run: initRepo,
Long: `
Long: strings.TrimSpace(`
The init command creates the skelton of a KubeFox App and ensures a Git
repository is present. It will optionally create simple 'hello-world' app to get
you started.
`,
`),
}

func init() {
Expand Down
28 changes: 14 additions & 14 deletions cmd/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"strconv"
"strings"

"github.com/spf13/cobra"
"github.com/xigxog/fox/internal/log"
Expand All @@ -14,7 +15,7 @@ var proxyCmd = &cobra.Command{
PreRun: setup,
Run: runProxy,
Short: "Port forward local port to broker's HTTP server adapter",
Long: `
Long: strings.TrimSpace(`
The proxy command will inspect the Kubernetes cluster and find an available
broker to proxy a local port to. This port can then be used to make HTTP
requests to the broker's HTTP server adapter. This is especially useful during
Expand All @@ -24,19 +25,18 @@ The optional flags 'virtual-env' and 'app-deployment' can be set which will
automatically inject the values as context to requests sent through the proxy.
The context can still be overridden manually by setting the header or query
param on the original request.
Examples:
# Port forward local port 8080 and wait if no brokers are available.
fox proxy 8080 --wait 5m
# Port forward local port 8080 and inject 'my-env' and 'my-dep' context.
fox proxy 8080 --virtual-env my-env --app-deployment my-dep
http://127.0.0.1:8080/hello # uses my-env and my-deployment
http://127.0.0.1:8080/hello?kf-env=your-env # uses your-env and my-dep
http://127.0.0.1:8080/hello?kf-dep=your-dep # uses my-env and your-dep
`,
`),
Example: strings.TrimSpace(`
# Port forward local port 8080 and wait if no brokers are available.
fox proxy 8080 --wait 5m
# Port forward local port 8080 and inject 'my-env' and 'my-dep' context.
fox proxy 8080 --virtual-env my-env --app-deployment my-dep
http://127.0.0.1:8080/hello # uses my-env and my-deployment
http://127.0.0.1:8080/hello?kf-env=your-env # uses your-env and my-dep
http://127.0.0.1:8080/hello?kf-dep=your-dep # uses my-env and your-dep
`),
}

func init() {
Expand Down
23 changes: 12 additions & 11 deletions cmd/release.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package cmd

import (
"strings"

"github.com/spf13/cobra"
"github.com/xigxog/fox/internal/log"
"github.com/xigxog/fox/internal/repo"
Expand All @@ -12,7 +14,7 @@ var releaseCmd = &cobra.Command{
PreRun: setup,
Run: release,
Short: "Release specified AppDeployment and VirtualEnvironment",
Long: `
Long: strings.TrimSpace(`
The release command activates the routes of the components belonging to the
specified AppDeployment. This causes genesis events matching components' routes
to be automatically sent to the component with the specified environment being
Expand All @@ -22,16 +24,15 @@ The AppDeployment can be identified by its name, commit, short-commit (first 7
characters), version, Git tag, or Git branch. 🦊 Fox will inspect the Kubernetes
cluster to find a matching AppDeployment. If more than one AppDeployment is
found you will be prompted to select the desired AppDeployment.
Examples:
# Release the AppDeployment named 'main' using the 'dev' Virtual Environment.
fox release main --virtual-env dev
# Release the AppDeployment with version 'v1.2.3' using the 'prod'
# VirtualEnvironment, creating an VirtualEnvironmentSnapshot if needed.
fox release v1.2.3 --virtual-env prod --create-snapshot
`,
`),
Example: strings.TrimSpace(`
# Release the AppDeployment named 'main' using the 'dev' Virtual Environment.
fox release main --virtual-env dev
# Release the AppDeployment with version 'v1.2.3' using the 'prod'
# VirtualEnvironment, creating an VirtualEnvironmentSnapshot if needed.
fox release v1.2.3 --virtual-env prod --create-snapshot
`),
}

func init() {
Expand Down
7 changes: 4 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ var (
)

var rootCmd = &cobra.Command{
Use: "fox",
PersistentPreRun: initViper,
Short: "CLI for interacting with KubeFox",
Use: "fox",
DisableAutoGenTag: true,
PersistentPreRun: initViper,
Short: "CLI for interacting with KubeFox",
Long: `
🦊 Fox is a CLI for interacting with KubeFox. You can use it to build, deploy,
and release your KubeFox Apps.
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func runVer(cmd *cobra.Command, args []string) {
}

if modified {
log.Warn("binary built from source with uncommitted changes")
log.Verbose("binary built from source with uncommitted changes")
}
log.Marshal(map[string]any{
"version": version,
Expand Down
1 change: 0 additions & 1 deletion docs/fox.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ and release your KubeFox Apps.
* [fox release](fox_release.md) - Release specified AppDeployment and VirtualEnvironment
* [fox version](fox_version.md) - Show version information of 🦊 Fox

###### Auto generated by spf13/cobra on 4-Dec-2023
13 changes: 6 additions & 7 deletions docs/fox_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ Build and optionally push an OCI image of component

### Synopsis


The build command will use Docker to build the specified component. By default
components are built using a KubeFox defined Dockerfile. A custom Dockerfile can
be provided my placing it in the root directory of the component. Please note
that the build working directory is the root of the repository, not the
component directory.

Examples:

# Build and push OCI image for my-component.
fox build my-component --publish
```
fox build (NAME) [flags]
```

### Examples

```
fox build (NAME) [flags]
# Build and push OCI image for my-component.
fox build my-component --publish
```

### Options
Expand All @@ -45,4 +45,3 @@ fox build (NAME) [flags]

* [fox](fox.md) - CLI for interacting with KubeFox

###### Auto generated by spf13/cobra on 4-Dec-2023
1 change: 0 additions & 1 deletion docs/fox_completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ See each sub-command's help for details on how to use the generated script.
* [fox completion powershell](fox_completion_powershell.md) - Generate the autocompletion script for powershell
* [fox completion zsh](fox_completion_zsh.md) - Generate the autocompletion script for zsh

###### Auto generated by spf13/cobra on 4-Dec-2023
1 change: 0 additions & 1 deletion docs/fox_completion_bash.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ fox completion bash

* [fox completion](fox_completion.md) - Generate the autocompletion script for the specified shell

###### Auto generated by spf13/cobra on 4-Dec-2023
1 change: 0 additions & 1 deletion docs/fox_completion_fish.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@ fox completion fish [flags]

* [fox completion](fox_completion.md) - Generate the autocompletion script for the specified shell

###### Auto generated by spf13/cobra on 4-Dec-2023
1 change: 0 additions & 1 deletion docs/fox_completion_powershell.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ fox completion powershell [flags]

* [fox completion](fox_completion.md) - Generate the autocompletion script for the specified shell

###### Auto generated by spf13/cobra on 4-Dec-2023
1 change: 0 additions & 1 deletion docs/fox_completion_zsh.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ fox completion zsh [flags]

* [fox completion](fox_completion.md) - Generate the autocompletion script for the specified shell

###### Auto generated by spf13/cobra on 4-Dec-2023
1 change: 0 additions & 1 deletion docs/fox_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ Use the config subcommand to help setup your local environment.
* [fox config setup](fox_config_setup.md) - Run setup to configure 🦊 Fox
* [fox config show](fox_config_show.md) - Show the current configuration

###### Auto generated by spf13/cobra on 4-Dec-2023
1 change: 0 additions & 1 deletion docs/fox_config_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ fox config setup [flags]

* [fox config](fox_config.md) - Configure 🦊 Fox

###### Auto generated by spf13/cobra on 4-Dec-2023
1 change: 0 additions & 1 deletion docs/fox_config_show.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ fox config show [flags]

* [fox config](fox_config.md) - Configure 🦊 Fox

###### Auto generated by spf13/cobra on 4-Dec-2023
2 changes: 1 addition & 1 deletion docs/fox_deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fox deploy [NAME] [flags]
### Options

```
-t, --create-tag create Git tag using the AppDeployment version
--dry-run submit server-side request without persisting the resource
-h, --help help for deploy
-n, --namespace string namespace of KubeFox Platform
Expand All @@ -31,4 +32,3 @@ fox deploy [NAME] [flags]

* [fox](fox.md) - CLI for interacting with KubeFox

###### Auto generated by spf13/cobra on 4-Dec-2023
3 changes: 0 additions & 3 deletions docs/fox_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ Generate docs for 🦊 Fox

### Synopsis


Run this command to automatically generate 🦊 Fox documentation. Output is
placed in the subdirectory docs of the working directory.


```
fox docs [flags]
```
Expand All @@ -33,4 +31,3 @@ fox docs [flags]

* [fox](fox.md) - CLI for interacting with KubeFox

###### Auto generated by spf13/cobra on 4-Dec-2023
3 changes: 0 additions & 3 deletions docs/fox_init.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ Initialize a KubeFox App

### Synopsis


The init command creates the skelton of a KubeFox App and ensures a Git
repository is present. It will optionally create simple 'hello-world' app to get
you started.


```
fox init [flags]
```
Expand All @@ -35,4 +33,3 @@ fox init [flags]

* [fox](fox.md) - CLI for interacting with KubeFox

###### Auto generated by spf13/cobra on 4-Dec-2023
25 changes: 12 additions & 13 deletions docs/fox_proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Port forward local port to broker's HTTP server adapter

### Synopsis


The proxy command will inspect the Kubernetes cluster and find an available
broker to proxy a local port to. This port can then be used to make HTTP
requests to the broker's HTTP server adapter. This is especially useful during
Expand All @@ -15,21 +14,22 @@ automatically inject the values as context to requests sent through the proxy.
The context can still be overridden manually by setting the header or query
param on the original request.

Examples:
```
fox proxy (PORT) [flags]
```

# Port forward local port 8080 and wait if no brokers are available.
fox proxy 8080 --wait 5m
### Examples

# Port forward local port 8080 and inject 'my-env' and 'my-dep' context.
fox proxy 8080 --virtual-env my-env --app-deployment my-dep

http://127.0.0.1:8080/hello # uses my-env and my-deployment
http://127.0.0.1:8080/hello?kf-env=your-env # uses your-env and my-dep
http://127.0.0.1:8080/hello?kf-dep=your-dep # uses my-env and your-dep
```
# Port forward local port 8080 and wait if no brokers are available.
fox proxy 8080 --wait 5m
# Port forward local port 8080 and inject 'my-env' and 'my-dep' context.
fox proxy 8080 --virtual-env my-env --app-deployment my-dep
```
fox proxy (PORT) [flags]
http://127.0.0.1:8080/hello # uses my-env and my-deployment
http://127.0.0.1:8080/hello?kf-env=your-env # uses your-env and my-dep
http://127.0.0.1:8080/hello?kf-dep=your-dep # uses my-env and your-dep
```

### Options
Expand Down Expand Up @@ -58,4 +58,3 @@ fox proxy (PORT) [flags]

* [fox](fox.md) - CLI for interacting with KubeFox

###### Auto generated by spf13/cobra on 4-Dec-2023
1 change: 0 additions & 1 deletion docs/fox_publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@ fox publish [NAME] [flags]

* [fox](fox.md) - CLI for interacting with KubeFox

###### Auto generated by spf13/cobra on 4-Dec-2023
Loading

0 comments on commit c85dc53

Please sign in to comment.