mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-06-23 06:48:47 +00:00
Move the 8899
integer and string literals into a const
named DefaultApiServerPort
in shared
(#367)
This commit is contained in:
parent
9d179c7227
commit
167b17dfd2
@ -12,12 +12,14 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/up9inc/mizu/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
longRetriesCount = 100
|
longRetriesCount = 100
|
||||||
shortRetriesCount = 10
|
shortRetriesCount = 10
|
||||||
defaultApiServerPort = 8899
|
defaultApiServerPort = shared.DefaultApiServerPort
|
||||||
defaultNamespaceName = "mizu-tests"
|
defaultNamespaceName = "mizu-tests"
|
||||||
defaultServiceName = "httpbin"
|
defaultServiceName = "httpbin"
|
||||||
defaultEntriesCount = 50
|
defaultEntriesCount = 50
|
||||||
|
@ -2,6 +2,7 @@ package utils
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
@ -11,6 +12,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/up9inc/mizu/shared"
|
||||||
"github.com/up9inc/mizu/shared/logger"
|
"github.com/up9inc/mizu/shared/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -37,7 +39,7 @@ func StartServer(app *gin.Engine) {
|
|||||||
|
|
||||||
// Run server.
|
// Run server.
|
||||||
logger.Log.Infof("Starting the server...")
|
logger.Log.Infof("Starting the server...")
|
||||||
if err := app.Run(":8899"); err != nil {
|
if err := app.Run(fmt.Sprintf(":%d", shared.DefaultApiServerPort)); err != nil {
|
||||||
logger.Log.Errorf("Server is not running! Reason: %v", err)
|
logger.Log.Errorf("Server is not running! Reason: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ func (provider *Provider) CreateMizuApiServerPod(ctx context.Context, opts *ApiS
|
|||||||
command = append(command, "--namespace", opts.Namespace)
|
command = append(command, "--namespace", opts.Namespace)
|
||||||
}
|
}
|
||||||
|
|
||||||
port := intstr.FromInt(8899)
|
port := intstr.FromInt(shared.DefaultApiServerPort)
|
||||||
|
|
||||||
pod := &core.Pod{
|
pod := &core.Pod{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
@ -281,7 +281,7 @@ func (provider *Provider) CreateService(ctx context.Context, namespace string, s
|
|||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
},
|
},
|
||||||
Spec: core.ServiceSpec{
|
Spec: core.ServiceSpec{
|
||||||
Ports: []core.ServicePort{{TargetPort: intstr.FromInt(8899), Port: 80}},
|
Ports: []core.ServicePort{{TargetPort: intstr.FromInt(shared.DefaultApiServerPort), Port: 80}},
|
||||||
Type: core.ServiceTypeClusterIP,
|
Type: core.ServiceTypeClusterIP,
|
||||||
Selector: map[string]string{"app": appLabelValue},
|
Selector: map[string]string{"app": appLabelValue},
|
||||||
},
|
},
|
||||||
|
@ -10,4 +10,5 @@ const (
|
|||||||
RulePolicyPath = "/app/enforce-policy/"
|
RulePolicyPath = "/app/enforce-policy/"
|
||||||
RulePolicyFileName = "enforce-policy.yaml"
|
RulePolicyFileName = "enforce-policy.yaml"
|
||||||
GoGCEnvVar = "GOGC"
|
GoGCEnvVar = "GOGC"
|
||||||
|
DefaultApiServerPort = 8899
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user