From fe17482ae3742740beb663f8a9a05cadec99b6f8 Mon Sep 17 00:00:00 2001 From: Christopher Zell Date: Wed, 23 Nov 2022 14:34:30 +0100 Subject: [PATCH 1/5] refactor: move connect code to backend Introduce new package to move most code, which can be used by cli but also by workers. Refactored code such that it returns an error instead of panicing. --- go-chaos/backend/connection.go | 107 +++++++++++++++++++++++++++++++++ go-chaos/cmd/connect.go | 61 ++----------------- 2 files changed, 111 insertions(+), 57 deletions(-) create mode 100644 go-chaos/backend/connection.go diff --git a/go-chaos/backend/connection.go b/go-chaos/backend/connection.go new file mode 100644 index 000000000..de16a2479 --- /dev/null +++ b/go-chaos/backend/connection.go @@ -0,0 +1,107 @@ +// Copyright 2022 Camunda Services GmbH +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package backend + +import ( + "errors" + "fmt" + + "github.com/zeebe-io/zeebe-chaos/go-chaos/internal" + v1 "k8s.io/api/core/v1" +) + +func ConnectBrokers() error { + k8Client, err := internal.CreateK8Client() + if err != nil { + return err + } + + // No patch is need, since we expect that disconnect was executed before. + // If not all fine and the pods are already connected. + + // We run connect on all nodes, since roles can have been changed in between so it is easier to run the commands on all nodes. + + podNames, err := k8Client.GetBrokerPodNames() + if err != nil { + return err + } + + if len(podNames) <= 0 { + errorMsg := fmt.Sprintf("Expected to find brokers in current namespace %s, but found nothing", k8Client.GetCurrentNamespace()) + return errors.New(errorMsg) + } + + for _, pod := range podNames { + err = internal.MakeIpReachableForPod(k8Client, pod) + if err != nil { + internal.LogVerbose("Error on connection Broker: %s. Error: %s", pod, err.Error()) + } else { + internal.LogInfo("Connected %s again, removed unreachable routes.", pod) + } + } + return nil +} + + +func ConnectGateway() error { + k8Client, err := internal.CreateK8Client() + if err != nil { + return err + } + + // No patch is need, since we expect that disconnect was executed before. + // If not all fine and the pods are already connected. + + // We run connect on all nodes + brokerPods, err := k8Client.GetBrokerPods() + if err != nil { + return err + } + + if len(brokerPods.Items) <= 0 { + errorMsg := fmt.Sprintf("Expected to find broker(s) in current namespace %s, but found nothing", k8Client.GetCurrentNamespace()) + return errors.New(errorMsg) + } + + gatewayPod, err := getGatewayPod(k8Client) + if err != nil { + return err + } + + for _, brokerPod := range brokerPods.Items { + err = internal.MakeIpReachable(k8Client, gatewayPod.Name, brokerPod.Status.PodIP) + if err != nil { + internal.LogVerbose("Error on connection gateway: %s. Error: %s", gatewayPod.Name, err.Error()) + } else { + internal.LogInfo("Connected %s again with %s, removed unreachable routes.", gatewayPod.Name, brokerPod.Name) + } + } + return nil +} + + +func getGatewayPod(k8Client internal.K8Client) (*v1.Pod, error) { + pods, err := k8Client.GetGatewayPods() + if err != nil { + return nil, err + } + + if pods != nil && len(pods.Items) > 0 { + return &pods.Items[0], nil + } + + errorMsg := fmt.Sprintf("Expected to find standalone gateway, but found nothing.") + return nil, errors.New(errorMsg) +} \ No newline at end of file diff --git a/go-chaos/cmd/connect.go b/go-chaos/cmd/connect.go index 4660e16b5..851e47148 100644 --- a/go-chaos/cmd/connect.go +++ b/go-chaos/cmd/connect.go @@ -15,10 +15,8 @@ package cmd import ( - "fmt" - "github.com/spf13/cobra" - "github.com/zeebe-io/zeebe-chaos/go-chaos/internal" + "github.com/zeebe-io/zeebe-chaos/go-chaos/backend" ) func init() { @@ -38,34 +36,8 @@ var connectBrokers = &cobra.Command{ Short: "Connect Zeebe Brokers", Long: `Connect all Zeebe Brokers again, after they have been disconnected.`, Run: func(cmd *cobra.Command, args []string) { - internal.Verbosity = Verbose - k8Client, err := internal.CreateK8Client() - if err != nil { - panic(err) - } - - // No patch is need, since we expect that disconnect was executed before. - // If not all fine and the pods are already connected. - - // We run connect on all nodes, since roles can have been changed in between so it is easier to run the commands on all nodes. - - podNames, err := k8Client.GetBrokerPodNames() - if err != nil { - panic(err.Error()) - } - - if len(podNames) <= 0 { - panic(fmt.Sprintf("Expected to find brokers in current namespace %s, but found nothing", k8Client.GetCurrentNamespace())) - } - - for _, pod := range podNames { - err = internal.MakeIpReachableForPod(k8Client, pod) - if err != nil { - internal.LogVerbose("Error on connection Broker: %s. Error: %s", pod, err.Error()) - } else { - internal.LogInfo("Connected %s again, removed unreachable routes.", pod) - } - } + err := backend.ConnectBrokers() + ensureNoError(err) }, } @@ -74,32 +46,7 @@ var connectGateway = &cobra.Command{ Short: "Connect Zeebe Gateway", Long: `Connect all Zeebe Gateway again, after it has been disconnected.`, Run: func(cmd *cobra.Command, args []string) { - internal.Verbosity = Verbose - k8Client, err := internal.CreateK8Client() + err := backend.ConnectGateway() ensureNoError(err) - - // No patch is need, since we expect that disconnect was executed before. - // If not all fine and the pods are already connected. - - // We run connect on all nodes - brokerPods, err := k8Client.GetBrokerPods() - ensureNoError(err) - - if len(brokerPods.Items) <= 0 { - panic(fmt.Sprintf("Expected to find broker(s) in current namespace %s, but found nothing", k8Client.GetCurrentNamespace())) - } - - gatewayPod := getGatewayPod(k8Client) - - for _, brokerPod := range brokerPods.Items { - err = internal.MakeIpReachable(k8Client, gatewayPod.Name, brokerPod.Status.PodIP) - if err != nil { - if Verbose { - internal.LogVerbose("Error on connection gateway: %s. Error: %s", gatewayPod.Name, err.Error()) - } - } else { - internal.LogInfo("Connected %s again with %s, removed unreachable routes.", gatewayPod.Name, brokerPod.Name) - } - } }, } From e72a7cff2289ace324ae93567f8e6f0eb10eebd5 Mon Sep 17 00:00:00 2001 From: Christopher Zell Date: Thu, 24 Nov 2022 11:23:49 +0100 Subject: [PATCH 2/5] refactor: move disconnect code to backend --- go-chaos/backend/connection.go | 179 ++++++++++++++++++++++++++++++++- go-chaos/cmd/disconnect.go | 136 +++++-------------------- go-chaos/cmd/stress.go | 32 ++++++ 3 files changed, 231 insertions(+), 116 deletions(-) diff --git a/go-chaos/backend/connection.go b/go-chaos/backend/connection.go index de16a2479..98dfb3f1c 100644 --- a/go-chaos/backend/connection.go +++ b/go-chaos/backend/connection.go @@ -18,6 +18,7 @@ import ( "errors" "fmt" + "github.com/camunda/zeebe/clients/go/v8/pkg/zbc" "github.com/zeebe-io/zeebe-chaos/go-chaos/internal" v1 "k8s.io/api/core/v1" ) @@ -35,7 +36,7 @@ func ConnectBrokers() error { podNames, err := k8Client.GetBrokerPodNames() if err != nil { - return err + return err } if len(podNames) <= 0 { @@ -54,7 +55,6 @@ func ConnectBrokers() error { return nil } - func ConnectGateway() error { k8Client, err := internal.CreateK8Client() if err != nil { @@ -91,6 +91,147 @@ func ConnectGateway() error { return nil } +type Broker struct { + NodeId int + PartitionId int + Role string +} + +type DisconnectBrokerCfg struct { + Broker1Cfg Broker + Broker2Cfg Broker + OneDirection bool +} + +func DisconnectBroker(disconnectBrokerCfg DisconnectBrokerCfg) error { + k8Client, err := prepareBrokerDisconnect() + + zbClient, closeFn, err := ConnectToZeebeCluster(k8Client) + if err != nil { + return err + } + defer closeFn() + + broker1 := disconnectBrokerCfg.Broker1Cfg + broker1Pod, err := getBrokerPod(k8Client, zbClient, broker1.NodeId, broker1.PartitionId, broker1.Role) + if err != nil { + return err + } + + broker2 := disconnectBrokerCfg.Broker2Cfg + broker2Pod, err := getBrokerPod(k8Client, zbClient, broker2.NodeId, broker2.PartitionId, broker2.Role) + if err != nil { + return err + } + + if broker1Pod.Name == broker2Pod.Name { + internal.LogInfo("Expected to disconnect two DIFFERENT brokers %s and %s, but they are the same. Will do nothing.", broker1Pod.Name, broker2Pod.Name) + return nil + } + + return disconnectPods(k8Client, broker1Pod, broker2Pod, disconnectBrokerCfg.OneDirection) +} + +func ConnectToZeebeCluster(k8Client internal.K8Client) (zbc.Client, func(), error) { + port := 26500 + closeFn := k8Client.MustGatewayPortForward(port, port) + + zbClient, err := internal.CreateZeebeClient(port) + if err != nil { + return nil, closeFn, err + } + return zbClient, func() { + zbClient.Close() + closeFn() + }, nil +} + +type DisconnectGatewayCfg struct { + DisconnectToAll bool + OneDirection bool + BrokerCfg Broker +} + +func DisconnectGateway(disconnectGatewayCfg DisconnectGatewayCfg) error { + k8Client, zbClient, closeFn, err := prepareGatewayDisconnect() + if err != nil { + return err + } + defer closeFn() + + gatewayPod, err := getGatewayPod(k8Client) + + if disconnectGatewayCfg.DisconnectToAll { + pods, err := k8Client.GetBrokerPods() + if err != nil { + return err + } + + for _, brokerPod := range pods.Items { + err := disconnectPods(k8Client, gatewayPod, &brokerPod, disconnectGatewayCfg.OneDirection) + if err != nil { + return err + } + } + } else { + brokerCfg := disconnectGatewayCfg.BrokerCfg + broker2Pod, err := getBrokerPod(k8Client, zbClient, brokerCfg.NodeId, brokerCfg.PartitionId, brokerCfg.Role) + if err != nil { + return err + } + err = disconnectPods(k8Client, gatewayPod, broker2Pod, disconnectGatewayCfg.OneDirection) + if err != nil { + return err + } + } + return nil +} + +func prepareGatewayDisconnect() (internal.K8Client, zbc.Client, func(), error) { + k8Client, err := prepareBrokerDisconnect() + if err != nil { + return k8Client, nil, nil, err + } + + err = k8Client.ApplyNetworkPatchOnGateway() + if err != nil { + return internal.K8Client{}, nil, nil, err + } + + internal.LogVerbose("Patched deployment") + + err = k8Client.AwaitReadiness() + if err != nil { + return internal.K8Client{}, nil, nil, err + } + + zbClient, closeFn, err := ConnectToZeebeCluster(k8Client) + if err != nil { + return internal.K8Client{}, nil, nil, err + } + + return k8Client, zbClient, closeFn, nil +} + +func prepareBrokerDisconnect() (internal.K8Client, error) { + k8Client, err := internal.CreateK8Client() + if err != nil { + return internal.K8Client{}, err + } + + err = k8Client.PauseReconciliation() + if err != nil { + return internal.K8Client{}, err + } + + err = k8Client.ApplyNetworkPatch() + if err != nil { + return internal.K8Client{}, err + } + + internal.LogVerbose("Patched statefulset") + return k8Client, nil +} func getGatewayPod(k8Client internal.K8Client) (*v1.Pod, error) { pods, err := k8Client.GetGatewayPods() @@ -104,4 +245,36 @@ func getGatewayPod(k8Client internal.K8Client) (*v1.Pod, error) { errorMsg := fmt.Sprintf("Expected to find standalone gateway, but found nothing.") return nil, errors.New(errorMsg) -} \ No newline at end of file +} + +func getBrokerPod(k8Client internal.K8Client, zbClient zbc.Client, brokerNodeId int, brokerPartitionId int, brokerRole string) (*v1.Pod, error) { + var brokerPod *v1.Pod + var err error + if brokerNodeId >= 0 { + brokerPod, err = internal.GetBrokerPodForNodeId(k8Client, int32(brokerNodeId)) + internal.LogVerbose("Found Broker %s with node id %d.", brokerPod.Name, brokerNodeId) + } else { + brokerPod, err = internal.GetBrokerPodForPartitionAndRole(k8Client, zbClient, brokerPartitionId, brokerRole) + internal.LogVerbose("Found Broker %s as %s for partition %d.", brokerPod.Name, brokerRole, brokerPartitionId) + } + + return brokerPod, err +} + +func disconnectPods(k8Client internal.K8Client, firstPod *v1.Pod, secondPod *v1.Pod, oneDirection bool) error { + err := internal.MakeIpUnreachableForPod(k8Client, secondPod.Status.PodIP, firstPod.Name) + if err != nil { + return err + } + + internal.LogInfo("Disconnect %s from %s", firstPod.Name, secondPod.Name) + + if !oneDirection { + err = internal.MakeIpUnreachableForPod(k8Client, firstPod.Status.PodIP, secondPod.Name) + if err != nil { + return err + } + internal.LogInfo("Disconnect %s from %s", secondPod.Name, firstPod.Name) + } + return nil +} diff --git a/go-chaos/cmd/disconnect.go b/go-chaos/cmd/disconnect.go index 156b8c7e1..7b78afb96 100644 --- a/go-chaos/cmd/disconnect.go +++ b/go-chaos/cmd/disconnect.go @@ -15,13 +15,8 @@ package cmd import ( - "errors" - "fmt" - - "github.com/camunda/zeebe/clients/go/v8/pkg/zbc" "github.com/spf13/cobra" - "github.com/zeebe-io/zeebe-chaos/go-chaos/internal" - v1 "k8s.io/api/core/v1" + "github.com/zeebe-io/zeebe-chaos/go-chaos/backend" ) var ( @@ -74,122 +69,37 @@ var disconnectBrokers = &cobra.Command{ Short: "Disconnect Zeebe Brokers", Long: `Disconnect Zeebe Brokers with a given partition and role.`, Run: func(cmd *cobra.Command, args []string) { - internal.Verbosity = Verbose - k8Client, err := internal.CreateK8Client() - ensureNoError(err) - - err = k8Client.PauseReconciliation() + err := backend.DisconnectBroker(backend.DisconnectBrokerCfg{ + Broker1Cfg: backend.Broker{ + NodeId: broker1NodeId, + PartitionId: broker1PartitionId, + Role: broker1Role, + }, + Broker2Cfg: backend.Broker{ + NodeId: broker2NodeId, + PartitionId: broker2PartitionId, + Role: broker2Role, + }, + OneDirection: oneDirection, + }) ensureNoError(err) - - err = k8Client.ApplyNetworkPatch() - ensureNoError(err) - - internal.LogVerbose("Patched statefulset") - - port := 26500 - closeFn := k8Client.MustGatewayPortForward(port, port) - defer closeFn() - - zbClient, err := internal.CreateZeebeClient(port) - ensureNoError(err) - defer zbClient.Close() - - broker1Pod := getBrokerPod(k8Client, zbClient, broker1NodeId, broker1PartitionId, broker1Role) - broker2Pod := getBrokerPod(k8Client, zbClient, broker2NodeId, broker2PartitionId, broker2Role) - - if broker1Pod.Name == broker2Pod.Name { - internal.LogInfo("Expected to disconnect two DIFFERENT brokers %s and %s, but they are the same. Will do nothing.", broker1Pod.Name, broker2Pod.Name) - return - } - - disconnectPods(k8Client, broker1Pod, broker2Pod) }, } -func getBrokerPod(k8Client internal.K8Client, zbClient zbc.Client, brokerNodeId int, brokerPartitionId int, brokerRole string) *v1.Pod { - var brokerPod *v1.Pod - var err error - if brokerNodeId >= 0 { - brokerPod, err = internal.GetBrokerPodForNodeId(k8Client, int32(brokerNodeId)) - ensureNoError(err) - internal.LogVerbose("Found Broker %s with node id %d.", brokerPod.Name, brokerNodeId) - } else { - brokerPod, err = internal.GetBrokerPodForPartitionAndRole(k8Client, zbClient, brokerPartitionId, brokerRole) - ensureNoError(err) - internal.LogVerbose("Found Broker %s as %s for partition %d.", brokerPod.Name, role, brokerPartitionId) - } - - return brokerPod -} - -func getGatewayPod(k8Client internal.K8Client) *v1.Pod { - pods, err := k8Client.GetGatewayPods() - ensureNoError(err) - - if pods != nil && len(pods.Items) > 0 { - return &pods.Items[0] - } - - panic(errors.New(fmt.Sprintf("Expected to find standalone gateway, but found nothing."))) -} - var disconnectGateway = &cobra.Command{ Use: "gateway", Short: "Disconnect Zeebe Gateway", Long: `Disconnect Zeebe Gateway from Broker with a given partition and role.`, Run: func(cmd *cobra.Command, args []string) { - internal.Verbosity = Verbose - k8Client, err := internal.CreateK8Client() - ensureNoError(err) - - err = k8Client.PauseReconciliation() - ensureNoError(err) - - err = k8Client.ApplyNetworkPatch() - ensureNoError(err) - - internal.LogVerbose("Patched statefulset") - - err = k8Client.ApplyNetworkPatchOnGateway() - ensureNoError(err) - - internal.LogVerbose("Patched deployment") - - err = k8Client.AwaitReadiness() + err := backend.DisconnectGateway(backend.DisconnectGatewayCfg{ + OneDirection: oneDirection, + DisconnectToAll: disconnectToAll, + BrokerCfg: backend.Broker{ + Role: role, + PartitionId: partitionId, + NodeId: nodeId, + }, + }) ensureNoError(err) - - port := 26500 - closeFn := k8Client.MustGatewayPortForward(port, port) - defer closeFn() - - zbClient, err := internal.CreateZeebeClient(port) - ensureNoError(err) - defer zbClient.Close() - - gatewayPod := getGatewayPod(k8Client) - - if disconnectToAll { - pods, err := k8Client.GetBrokerPods() - ensureNoError(err) - - for _, brokerPod := range pods.Items { - disconnectPods(k8Client, gatewayPod, &brokerPod) - } - } else { - broker2Pod := getBrokerPod(k8Client, zbClient, nodeId, partitionId, role) - disconnectPods(k8Client, gatewayPod, broker2Pod) - } }, } - -func disconnectPods(k8Client internal.K8Client, firstPod *v1.Pod, secondPod *v1.Pod) { - err := internal.MakeIpUnreachableForPod(k8Client, secondPod.Status.PodIP, firstPod.Name) - ensureNoError(err) - internal.LogInfo("Disconnect %s from %s", firstPod.Name, secondPod.Name) - - if !oneDirection { - err = internal.MakeIpUnreachableForPod(k8Client, firstPod.Status.PodIP, secondPod.Name) - ensureNoError(err) - internal.LogInfo("Disconnect %s from %s", secondPod.Name, firstPod.Name) - } -} diff --git a/go-chaos/cmd/stress.go b/go-chaos/cmd/stress.go index 4e7675531..f599f43f8 100644 --- a/go-chaos/cmd/stress.go +++ b/go-chaos/cmd/stress.go @@ -15,8 +15,13 @@ package cmd import ( + "errors" + "fmt" + + "github.com/camunda/zeebe/clients/go/v8/pkg/zbc" "github.com/spf13/cobra" "github.com/zeebe-io/zeebe-chaos/go-chaos/internal" + v1 "k8s.io/api/core/v1" ) var ( @@ -94,3 +99,30 @@ var stressGateway = &cobra.Command{ ensureNoError(err) }, } + +func getBrokerPod(k8Client internal.K8Client, zbClient zbc.Client, brokerNodeId int, brokerPartitionId int, brokerRole string) *v1.Pod { + var brokerPod *v1.Pod + var err error + if brokerNodeId >= 0 { + brokerPod, err = internal.GetBrokerPodForNodeId(k8Client, int32(brokerNodeId)) + ensureNoError(err) + internal.LogVerbose("Found Broker %s with node id %d.", brokerPod.Name, brokerNodeId) + } else { + brokerPod, err = internal.GetBrokerPodForPartitionAndRole(k8Client, zbClient, brokerPartitionId, brokerRole) + ensureNoError(err) + internal.LogVerbose("Found Broker %s as %s for partition %d.", brokerPod.Name, role, brokerPartitionId) + } + + return brokerPod +} + +func getGatewayPod(k8Client internal.K8Client) *v1.Pod { + pods, err := k8Client.GetGatewayPods() + ensureNoError(err) + + if pods != nil && len(pods.Items) > 0 { + return &pods.Items[0] + } + + panic(errors.New(fmt.Sprintf("Expected to find standalone gateway, but found nothing."))) +} From 1c41e8b0085084ba73613007b0379f70e8eceb12 Mon Sep 17 00:00:00 2001 From: Christopher Zell Date: Thu, 24 Nov 2022 11:33:30 +0100 Subject: [PATCH 3/5] fix: return error on command --- go-chaos/cmd/disconnect.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/go-chaos/cmd/disconnect.go b/go-chaos/cmd/disconnect.go index 7b78afb96..704523229 100644 --- a/go-chaos/cmd/disconnect.go +++ b/go-chaos/cmd/disconnect.go @@ -68,8 +68,8 @@ var disconnectBrokers = &cobra.Command{ Use: "brokers", Short: "Disconnect Zeebe Brokers", Long: `Disconnect Zeebe Brokers with a given partition and role.`, - Run: func(cmd *cobra.Command, args []string) { - err := backend.DisconnectBroker(backend.DisconnectBrokerCfg{ + RunE: func(cmd *cobra.Command, args []string) error { + return backend.DisconnectBroker(backend.DisconnectBrokerCfg{ Broker1Cfg: backend.Broker{ NodeId: broker1NodeId, PartitionId: broker1PartitionId, @@ -82,7 +82,6 @@ var disconnectBrokers = &cobra.Command{ }, OneDirection: oneDirection, }) - ensureNoError(err) }, } From 86375a9fcb425abe3c9699e0611abb9bc750c468 Mon Sep 17 00:00:00 2001 From: Christopher Zell Date: Thu, 24 Nov 2022 14:31:13 +0100 Subject: [PATCH 4/5] refactor: panic on error --- go-chaos/cmd/disconnect.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/go-chaos/cmd/disconnect.go b/go-chaos/cmd/disconnect.go index 704523229..7b78afb96 100644 --- a/go-chaos/cmd/disconnect.go +++ b/go-chaos/cmd/disconnect.go @@ -68,8 +68,8 @@ var disconnectBrokers = &cobra.Command{ Use: "brokers", Short: "Disconnect Zeebe Brokers", Long: `Disconnect Zeebe Brokers with a given partition and role.`, - RunE: func(cmd *cobra.Command, args []string) error { - return backend.DisconnectBroker(backend.DisconnectBrokerCfg{ + Run: func(cmd *cobra.Command, args []string) { + err := backend.DisconnectBroker(backend.DisconnectBrokerCfg{ Broker1Cfg: backend.Broker{ NodeId: broker1NodeId, PartitionId: broker1PartitionId, @@ -82,6 +82,7 @@ var disconnectBrokers = &cobra.Command{ }, OneDirection: oneDirection, }) + ensureNoError(err) }, } From 55064783233be265412adc706a5d6178b6b49d35 Mon Sep 17 00:00:00 2001 From: Christopher Zell Date: Thu, 24 Nov 2022 14:41:55 +0100 Subject: [PATCH 5/5] ci: copy all --- go-chaos/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/go-chaos/Dockerfile b/go-chaos/Dockerfile index a1641ee34..23db27954 100644 --- a/go-chaos/Dockerfile +++ b/go-chaos/Dockerfile @@ -6,9 +6,7 @@ WORKDIR /app COPY --link go.mod go.sum . RUN go mod download -COPY --link cmd/ ./cmd -COPY --link internal ./internal -COPY --link main.go ./ +COPY --link . ./ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o zbchaos main.go FROM scratch