Skip to content

Commit

Permalink
[cilium] add patch
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Pavlov <[email protected]>
  • Loading branch information
AndreyPavlovFlant committed Aug 19, 2024
1 parent 8357467 commit 9afcae7
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ vars:
echo "${ldflags[*]-}"
ciliumCLIVersion: v0.15.22
ciliumCLIVersion: "0.15.22"

cgoTags: "dfrunsecurity dfrunnetwork dfrunmount dfssh containers_image_openpgp osusergo exclude_graphdriver_devicemapper netgo no_devmapper static_build cni"
goTags: "dfrunsecurity dfrunnetwork dfrunmount dfssh containers_image_openpgp"

cgoDevLDFlags: "-linkmode external -extldflags=-static"
goDevLDFlags: ""

cgoReleaseLDFlags: "-linkmode external -extldflags=-static -s -w -X 'github.com/deckhouse/deckhouse-cli/cmd.Version={{ .version }}' -X 'github.com/cilium/cilium-cli/cli.Version={{ .ciliumCLIVersion }}' -X github.com/werf/werf/pkg/werf.Version={{ .version }} {{ .kubectlLDFlags }}"
goReleaseLDFlags: "-s -w -X 'github.com/deckhouse/deckhouse-cli/cmd.Version={{ .version }}' -X 'github.com/cilium/cilium-cli/cli.Version={{ .ciliumCLIVersion }}' -X github.com/werf/werf/pkg/werf.Version={{ .version }} {{ .kubectlLDFlags }}"
cgoReleaseLDFlags: "-linkmode external -extldflags=-static -s -w -X 'github.com/deckhouse/deckhouse-cli/cmd.Version={{ .version }}' -X 'github.com/cilium/cilium-cli/cli.Version=v{{ .ciliumCLIVersion }}' -X github.com/werf/werf/pkg/werf.Version={{ .version }} {{ .kubectlLDFlags }}"
goReleaseLDFlags: "-s -w -X 'github.com/deckhouse/deckhouse-cli/cmd.Version={{ .version }}' -X 'github.com/cilium/cilium-cli/cli.Version=v{{ .ciliumCLIVersion }}' -X github.com/werf/werf/pkg/werf.Version={{ .version }} {{ .kubectlLDFlags }}"

tasks:
_build:cgo:dev:
Expand Down Expand Up @@ -254,9 +254,8 @@ tasks:
desc: Clone cilium-cli
cmds:
- mkdir -p internal/cilium-cli
- git clone --depth 1 --branch v{{ .CILIUM_CLI_VERSION }} {{ .SOURCE_REPO }}/cilium/cilium-cli.git internal/cilium-cli
- git clone --depth 1 --branch v{{ .ciliumCLIVersion }} {{ .SOURCE_REPO }}/cilium/cilium-cli.git internal/cilium-cli
vars:
CILIUM_CLI_VERSION: "0.15.22"
SOURCE_REPO: "https://github.com"

_cilium:patch:
Expand All @@ -273,10 +272,15 @@ tasks:

_cilium:original-build:
desc: Build cilium-cli
dir: internal/cilium-cli
cmds:
- cd internal/cilium-cli
- make install

_cilium:clean:
desc: Clean cilium dir
cmds:
- rm -rf internal/cilium-cli

build-d8-w-cilium:
desc: Build and package all d8 binaries
cmds:
Expand Down
84 changes: 84 additions & 0 deletions patches/cilium-cli/003-removing-dangerous-commands.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
diff --git a/internal/cli/cmd/cmd.go b/internal/cli/cmd/cmd.go
index a04fccb7..8062bc6c 100644
--- a/internal/cli/cmd/cmd.go
+++ b/internal/cli/cmd/cmd.go
@@ -9,7 +9,6 @@ import (

"github.com/spf13/cobra"

- "github.com/cilium/cilium-cli/internal/utils"
"github.com/cilium/cilium-cli/k8s"
)

@@ -79,7 +78,6 @@ cilium connectivity test`,

cmd.AddCommand(
newCmdBgp(),
- newCmdClusterMesh(),
newCmdConfig(),
newCmdConnectivity(hooks),
newCmdContext(),
@@ -89,19 +87,6 @@ cilium connectivity test`,
newCmdSysdump(hooks),
newCmdVersion(),
)
- if utils.IsInHelmMode() {
- cmd.AddCommand(
- newCmdInstallWithHelm(),
- newCmdUninstallWithHelm(),
- newCmdUpgradeWithHelm(),
- )
- } else {
- cmd.AddCommand(
- newCmdInstall(),
- newCmdUninstall(),
- newCmdUpgrade(),
- )
- }

cmd.SetOut(os.Stdout)
cmd.SetErr(os.Stderr)
diff --git a/internal/cli/cmd/config.go b/internal/cli/cmd/config.go
index 0920554c..9808bef6 100644
--- a/internal/cli/cmd/config.go
+++ b/internal/cli/cmd/config.go
@@ -22,8 +22,6 @@ func newCmdConfig() *cobra.Command {

cmd.AddCommand(
newCmdConfigView(),
- newCmdConfigSet(),
- newCmdConfigDelete(),
)

return cmd
diff --git a/internal/cli/cmd/hubble.go b/internal/cli/cmd/hubble.go
index d9f228df..d13a6402 100644
--- a/internal/cli/cmd/hubble.go
+++ b/internal/cli/cmd/hubble.go
@@ -9,7 +9,6 @@ import (

"github.com/cilium/cilium-cli/defaults"
"github.com/cilium/cilium-cli/hubble"
- "github.com/cilium/cilium-cli/internal/utils"

"github.com/spf13/cobra"
)
@@ -25,17 +24,7 @@ func newCmdHubble() *cobra.Command {
newCmdPortForwardCommand(),
newCmdUI(),
)
- if utils.IsInHelmMode() {
- cmd.AddCommand(
- newCmdHubbleEnableWithHelm(),
- newCmdHubbleDisableWithHelm(),
- )
- } else {
- cmd.AddCommand(
- newCmdHubbleEnable(),
- newCmdHubbleDisable(),
- )
- }
+
return cmd
}

0 comments on commit 9afcae7

Please sign in to comment.