Skip to content

Commit

Permalink
Dumpy release v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
larryTheSlap committed Jul 21, 2024
1 parent f58fc7a commit 4fed3d9
Show file tree
Hide file tree
Showing 35 changed files with 1,379 additions and 1,380 deletions.
18 changes: 9 additions & 9 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[submodule "test/bats"]
path = test/bats
url = https://github.com/bats-core/bats-core.git
[submodule "test/test_helper/bats-support"]
path = test/test_helper/bats-support
url = https://github.com/bats-core/bats-support.git
[submodule "test/test_helper/bats-assert"]
path = test/test_helper/bats-assert
url = https://github.com/bats-core/bats-assert.git
[submodule "test/bats"]
path = test/bats
url = https://github.com/bats-core/bats-core.git
[submodule "test/test_helper/bats-support"]
path = test/test_helper/bats-support
url = https://github.com/bats-core/bats-support.git
[submodule "test/test_helper/bats-assert"]
path = test/test_helper/bats-assert
url = https://github.com/bats-core/bats-assert.git
72 changes: 36 additions & 36 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
version: 2

before:
hooks:
- go mod tidy
- go generate ./...

builds:
- main: ./cmd
binary: kubectl-dumpy
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
version: 2

before:
hooks:
- go mod tidy
- go generate ./...

builds:
- main: ./cmd
binary: kubectl-dumpy
env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- format: tar.gz
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: windows
format: zip

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
120 changes: 60 additions & 60 deletions .krew.yaml
Original file line number Diff line number Diff line change
@@ -1,60 +1,60 @@
apiVersion: krew.googlecontainertools.github.com/v1alpha2
kind: Plugin
metadata:
name: dumpy
spec:
homepage: https://github.com/larryTheSlap/dumpy
shortDescription: Performs tcpdump captures on containers
version: v0.1.0
description: |
This plugin make capturing network traffic easy on containers for different kubernetes resources (deployments, replicasets, pods...),
it does that by running tcpdump on targeted containers.
platforms:
- selector:
matchLabels:
os: darwin
arch: amd64
uri: https://github.com/larryTheSlap/dumpy/releases/download/v0.1.0/dumpy_Darwin_x86_64.tar.gz
sha256: 31078d9a59944f3716342de8316c7c367f6018b367275b890476b2a280179a20
bin: kubectl-dumpy
files:
- from: kubectl-dumpy
to: .
- from: LICENSE
to: .
- selector:
matchLabels:
os: darwin
arch: arm64
uri: https://github.com/larryTheSlap/dumpy/releases/download/v0.1.0/dumpy_Darwin_arm64.tar.gz
sha256: fd1bac124761f81718b212f087ff4d144fc9b3a524eaa7364e38f1afb01e0f6b
bin: kubectl-dumpy
files:
- from: kubectl-dumpy
to: .
- from: LICENSE
to: .
- selector:
matchLabels:
os: linux
arch: amd64
uri: https://github.com/larryTheSlap/dumpy/releases/download/v0.1.0/dumpy_Linux_x86_64.tar.gz
sha256: 2168bc6be117a2a6720e3f59e2fa0b3d66348ba17c79911c6ea3c4143035890e
bin: kubectl-dumpy
files:
- from: kubectl-dumpy
to: .
- from: LICENSE
to: .
- selector:
matchLabels:
os: windows
arch: amd64
uri: https://github.com/larryTheSlap/dumpy/releases/download/v0.1.0/dumpy_Windows_x86_64.zip
sha256: 30d4271e66f8033acd285e539e0a09e8dbcc2bc239194f6724f389d965d03d24
bin: kubectl-dumpy.exe
files:
- from: kubectl-dumpy.exe
to: .
- from: LICENSE
to: .
apiVersion: krew.googlecontainertools.github.com/v1alpha2
kind: Plugin
metadata:
name: dumpy
spec:
homepage: https://github.com/larryTheSlap/dumpy
shortDescription: Performs tcpdump captures on containers
version: v0.1.0
description: |
This plugin make capturing network traffic easy on containers for different kubernetes resources (deployments, replicasets, pods...),
it does that by running tcpdump on targeted containers.
platforms:
- selector:
matchLabels:
os: darwin
arch: amd64
uri: https://github.com/larryTheSlap/dumpy/releases/download/v0.1.0/dumpy_Darwin_x86_64.tar.gz
sha256: 31078d9a59944f3716342de8316c7c367f6018b367275b890476b2a280179a20
bin: kubectl-dumpy
files:
- from: kubectl-dumpy
to: .
- from: LICENSE
to: .
- selector:
matchLabels:
os: darwin
arch: arm64
uri: https://github.com/larryTheSlap/dumpy/releases/download/v0.1.0/dumpy_Darwin_arm64.tar.gz
sha256: fd1bac124761f81718b212f087ff4d144fc9b3a524eaa7364e38f1afb01e0f6b
bin: kubectl-dumpy
files:
- from: kubectl-dumpy
to: .
- from: LICENSE
to: .
- selector:
matchLabels:
os: linux
arch: amd64
uri: https://github.com/larryTheSlap/dumpy/releases/download/v0.1.0/dumpy_Linux_x86_64.tar.gz
sha256: 2168bc6be117a2a6720e3f59e2fa0b3d66348ba17c79911c6ea3c4143035890e
bin: kubectl-dumpy
files:
- from: kubectl-dumpy
to: .
- from: LICENSE
to: .
- selector:
matchLabels:
os: windows
arch: amd64
uri: https://github.com/larryTheSlap/dumpy/releases/download/v0.1.0/dumpy_Windows_x86_64.zip
sha256: 30d4271e66f8033acd285e539e0a09e8dbcc2bc239194f6724f389d965d03d24
bin: kubectl-dumpy.exe
files:
- from: kubectl-dumpy.exe
to: .
- from: LICENSE
to: .
112 changes: 56 additions & 56 deletions cmd/kubectl-dumpy.go
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
package main

import (
"os"

"dumpy/pkg/subcmd"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

var (
dumpyExample = `# capture all traffic from deployment foo-deploy with capture name mycap
kubectl dumpy capture deploy foo-deploy --name mycap
# get mycap capture details
kubectl dumpy get mycap
# export pcap files from mycap capture to target dir /tmp/dumps
kubectl dumpy export mycap /tmp/dumps
# restart capture mycap sniffers
kubectl dumpy restart mycap
# stop tpcdump capture on mycap sniffers
kubectl dumpy stop mycap
# delete capture mycap
kubectl dumpy delete mycap
`
)

func main() {
flags := pflag.NewFlagSet("kubectl-dumpy", pflag.ExitOnError)
pflag.CommandLine = flags
if err := dumpyCmd().Execute(); err != nil {
os.Exit(1)
}
}

func dumpyCmd() (cmd *cobra.Command) {

cmd = &cobra.Command{
Use: "dumpy [command]",
Short: "Perform network capture on containers running in a kubernetes cluster",
Example: dumpyExample,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
cmd.Usage()
return nil
},
}
cmd.AddCommand(subcmd.Dumpysubcmd_capture())
cmd.AddCommand(subcmd.Dumpysubcmd_export())
cmd.AddCommand(subcmd.Dumpysubcmd_stop())
cmd.AddCommand(subcmd.Dumpysubcmd_restart())
cmd.AddCommand(subcmd.Dumpysubcmd_delete())
cmd.AddCommand(subcmd.Dumpysubcmd_get())

return cmd
}
package main

import (
"os"

"dumpy/pkg/subcmd"

"github.com/spf13/cobra"
"github.com/spf13/pflag"
)

var (
dumpyExample = `# capture all traffic from deployment foo-deploy with capture name mycap
kubectl dumpy capture deploy foo-deploy --name mycap
# get mycap capture details
kubectl dumpy get mycap
# export pcap files from mycap capture to target dir /tmp/dumps
kubectl dumpy export mycap /tmp/dumps
# restart capture mycap sniffers
kubectl dumpy restart mycap
# stop tpcdump capture on mycap sniffers
kubectl dumpy stop mycap
# delete capture mycap
kubectl dumpy delete mycap
`
)

func main() {
flags := pflag.NewFlagSet("kubectl-dumpy", pflag.ExitOnError)
pflag.CommandLine = flags
if err := dumpyCmd().Execute(); err != nil {
os.Exit(1)
}
}

func dumpyCmd() (cmd *cobra.Command) {

cmd = &cobra.Command{
Use: "dumpy [command]",
Short: "Perform network capture on containers running in a kubernetes cluster",
Example: dumpyExample,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
cmd.Usage()
return nil
},
}
cmd.AddCommand(subcmd.Dumpysubcmd_capture())
cmd.AddCommand(subcmd.Dumpysubcmd_export())
cmd.AddCommand(subcmd.Dumpysubcmd_stop())
cmd.AddCommand(subcmd.Dumpysubcmd_restart())
cmd.AddCommand(subcmd.Dumpysubcmd_delete())
cmd.AddCommand(subcmd.Dumpysubcmd_get())

return cmd
}
Loading

0 comments on commit 4fed3d9

Please sign in to comment.