Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sandbox/docker commands #5950

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions build/kind/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,10 @@ else
fi
log "Testkube is up and running."

# Step 9: Create Testkube k6 Test Workflow
log "Creating and running Testkube k6 Test Workflow..."
kubectl apply -f /examples/k6.yaml -n testkube

log "Testkube installation succeed!"
log "You can now use Testkube in your Kind Kubernetes cluster."
send_telenetry "docker_installation_succeed"
fi

# Step 10: Bring docker service back to foreground
# Step 9: Bring docker service back to foreground
fg %1
239 changes: 0 additions & 239 deletions build/kind/k6.yaml

This file was deleted.

1 change: 0 additions & 1 deletion build/kind/kind.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ RUN chmod +x /usr/local/bin/entrypoint.sh

# Step 7: Example K6 Test Workflow CRD and preload Kind images
COPY ./images /images
COPY k6.yaml /examples/k6.yaml

ARG segmentio_key
ENV SEGMENTIO_KEY=$segmentio_key
Expand Down
1 change: 1 addition & 0 deletions cmd/api-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ func main() {
envs,
features,
proContext,
cfg.TestkubeDockerImageVersion,
)
if err != nil {
exitOnError("Starting agent", err)
Expand Down
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ type Config struct {
TestkubeDefaultStorageClassName string `envconfig:"TESTKUBE_DEFAULT_STORAGE_CLASS_NAME" default:""`
GlobalWorkflowTemplateName string `envconfig:"TESTKUBE_GLOBAL_WORKFLOW_TEMPLATE_NAME" default:""`
EnableK8sEvents bool `envconfig:"ENABLE_K8S_EVENTS" default:"true"`
TestkubeDockerImageVersion string `envconfig:"TESTKUBE_DOCKER_IMAGE_VERSION" default:""`
TestkubeDockerImageVersion string `envconfig:"TESTKUBE_DOCKER_IMAGE_VERSION" default:"1.2.3"`

// DEPRECATED: Use TestkubeProAPIKey instead
TestkubeCloudAPIKey string `envconfig:"TESTKUBE_CLOUD_API_KEY" default:""`
Expand Down
27 changes: 16 additions & 11 deletions pkg/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@ import (
)

const (
timeout = 10 * time.Second
apiKeyMeta = "api-key"
clusterIDMeta = "cluster-id"
cloudMigrateMeta = "migrate"
orgIdMeta = "environment-id"
envIdMeta = "organization-id"
healthcheckCommand = "healthcheck"
timeout = 10 * time.Second
apiKeyMeta = "api-key"
clusterIDMeta = "cluster-id"
cloudMigrateMeta = "migrate"
orgIdMeta = "environment-id"
envIdMeta = "organization-id"
healthcheckCommand = "healthcheck"
dockerImageVersionMeta = "docker-image-version"
)

// buffer up to five messages per worker
Expand Down Expand Up @@ -150,10 +151,11 @@ type Agent struct {
receiveTimeout time.Duration
healthcheckInterval time.Duration

clusterID string
clusterName string
envs map[string]string
features featureflags.FeatureFlags
clusterID string
clusterName string
envs map[string]string
features featureflags.FeatureFlags
dockerImageVersion string

proContext config.ProContext
}
Expand All @@ -168,6 +170,7 @@ func NewAgent(logger *zap.SugaredLogger,
envs map[string]string,
features featureflags.FeatureFlags,
proContext config.ProContext,
dockerImageVersion string,
) (*Agent, error) {
return &Agent{
handler: handler,
Expand All @@ -194,6 +197,7 @@ func NewAgent(logger *zap.SugaredLogger,
envs: envs,
features: features,
proContext: proContext,
dockerImageVersion: dockerImageVersion,
}, nil
}

Expand Down Expand Up @@ -313,6 +317,7 @@ func (ag *Agent) runCommandLoop(ctx context.Context) error {
ctx = metadata.AppendToOutgoingContext(ctx, cloudMigrateMeta, ag.proContext.Migrate)
ctx = metadata.AppendToOutgoingContext(ctx, envIdMeta, ag.proContext.EnvID)
ctx = metadata.AppendToOutgoingContext(ctx, orgIdMeta, ag.proContext.OrgID)
ctx = metadata.AppendToOutgoingContext(ctx, dockerImageVersionMeta, ag.dockerImageVersion)

ag.logger.Infow("initiating streaming connection with control plane")
// creates a new Stream from the client side. ctx is used for the lifetime of the stream.
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func TestCommandExecution(t *testing.T) {

logger, _ := zap.NewDevelopment()
proContext := config.ProContext{APIKey: "api-key", WorkerCount: 5, LogStreamWorkerCount: 5, WorkflowNotificationsWorkerCount: 5}
agent, err := agent.NewAgent(logger.Sugar(), m, grpcClient, logStreamFunc, workflowNotificationsStreamFunc, "", "", nil, featureflags.FeatureFlags{}, proContext)
agent, err := agent.NewAgent(logger.Sugar(), m, grpcClient, logStreamFunc, workflowNotificationsStreamFunc, "", "", nil, featureflags.FeatureFlags{}, proContext, "")
if err != nil {
t.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestEventLoop(t *testing.T) {
var workflowNotificationsStreamFunc func(ctx context.Context, executionID string) (chan testkube.TestWorkflowExecutionNotification, error)

proContext := config.ProContext{APIKey: "api-key", WorkerCount: 5, LogStreamWorkerCount: 5, WorkflowNotificationsWorkerCount: 5}
agent, err := agent.NewAgent(logger.Sugar(), nil, grpcClient, logStreamFunc, workflowNotificationsStreamFunc, "", "", nil, featureflags.FeatureFlags{}, proContext)
agent, err := agent.NewAgent(logger.Sugar(), nil, grpcClient, logStreamFunc, workflowNotificationsStreamFunc, "", "", nil, featureflags.FeatureFlags{}, proContext, "")
assert.NoError(t, err)
go func() {
l, err := agent.Load()
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestLogStream(t *testing.T) {

logger, _ := zap.NewDevelopment()
proContext := config.ProContext{APIKey: "api-key", WorkerCount: 5, LogStreamWorkerCount: 5, WorkflowNotificationsWorkerCount: 5}
agent, err := agent.NewAgent(logger.Sugar(), m, grpcClient, logStreamFunc, workflowNotificationsStreamFunc, "", "", nil, featureflags.FeatureFlags{}, proContext)
agent, err := agent.NewAgent(logger.Sugar(), m, grpcClient, logStreamFunc, workflowNotificationsStreamFunc, "", "", nil, featureflags.FeatureFlags{}, proContext, "")
if err != nil {
t.Fatal(err)
}
Expand Down
Loading