-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
47 changed files
with
794 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package constants | ||
|
||
const ( | ||
CodeAborted uint8 = 137 | ||
CodeInputError uint8 = 155 | ||
CodeInternal uint8 = 190 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package constants | ||
|
||
const ( | ||
InitStepName = "tktw-init" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package constants | ||
|
||
import "path/filepath" | ||
|
||
const ( | ||
InternalPath = "/.tktw" | ||
TerminationLogPath = "/dev/termination-log" | ||
) | ||
|
||
var ( | ||
InternalBinPath = filepath.Join(InternalPath, "bin") | ||
InitPath = filepath.Join(InternalPath, "init") | ||
ToolkitPath = filepath.Join(InternalPath, "toolkit") | ||
StatePath = filepath.Join(InternalPath, "state") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package data | ||
|
||
import ( | ||
"context" | ||
"sync" | ||
|
||
"github.com/kubeshop/testkube/cmd/testworkflow-init/constants" | ||
"github.com/kubeshop/testkube/cmd/testworkflow-init/output" | ||
agentclient "github.com/kubeshop/testkube/pkg/agent/client" | ||
"github.com/kubeshop/testkube/pkg/cloud" | ||
"github.com/kubeshop/testkube/pkg/credentials" | ||
"github.com/kubeshop/testkube/pkg/log" | ||
) | ||
|
||
var ( | ||
cloudMu sync.Mutex | ||
cloudClient cloud.TestKubeCloudAPIClient | ||
) | ||
|
||
func CloudClient() cloud.TestKubeCloudAPIClient { | ||
cloudMu.Lock() | ||
defer cloudMu.Unlock() | ||
|
||
if cloudClient == nil { | ||
cfg := GetState().InternalConfig.Worker.Connection | ||
logger := log.NewSilent() | ||
grpcConn, err := agentclient.NewGRPCConnection(context.Background(), cfg.TlsInsecure, cfg.SkipVerify, cfg.Url, "", "", "", logger) | ||
if err != nil { | ||
output.ExitErrorf(constants.CodeInternal, "failed to connect with the Control Plane: %s", err.Error()) | ||
} | ||
cloudClient = cloud.NewTestKubeCloudAPIClient(grpcConn) | ||
} | ||
return cloudClient | ||
} | ||
|
||
func Credentials() credentials.CredentialRepository { | ||
cfg := GetState().InternalConfig | ||
return credentials.NewCredentialRepository(CloudClient(), cfg.Worker.Connection.ApiKey, cfg.Execution.Id) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.