-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore!: removing the loadEnvVars func (#503)
* chore: Deploy timeout-handler before traefik and minio * chore: removing the loadEnvVars func * chore: rename TestScope field (#504) * chore: docs updated * chore: bump go and k8s version to fix the DOS Vulnerability (#506) * chore: rename TestScope field * chore: bump k8s version to fix the DOS Vulnerability * chore: bumped go version to fix it * chore!: remove Executor from knuu (#508) * chore: rename TestScope field * chore: bump k8s version to fix the DOS Vulnerability * chore: bumped go version to fix it * chore: deprecate Executor * fix: rename the deprecated NewExecutor * chore: refactor e2e system tests to new knuu obj (#520) * chore: refactor system e2e tests to new knuu obj * fix: added missing commit before start * fix: added missing commit before start * fix: added missing commit before start * chore: code cleanup * chore: some more cleanup * fix: a typo in err var
- Loading branch information
1 parent
057c341
commit 2da9172
Showing
36 changed files
with
661 additions
and
1,003 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,59 +1,58 @@ | ||
package instance | ||
package e2e | ||
|
||
import ( | ||
"context" | ||
|
||
"k8s.io/apimachinery/pkg/api/resource" | ||
|
||
"github.com/celestiaorg/knuu/pkg/system" | ||
"github.com/celestiaorg/knuu/pkg/instance" | ||
"github.com/celestiaorg/knuu/pkg/knuu" | ||
) | ||
|
||
const ( | ||
executorDefaultImage = "docker.io/nicolaka/netshoot:latest" | ||
executorName = "executor" | ||
sleepCommand = "sleep" | ||
infinityArg = "infinity" | ||
) | ||
|
||
type Executor struct { | ||
Kn *knuu.Knuu | ||
} | ||
|
||
var ( | ||
executorMemoryLimit = resource.MustParse("100Mi") | ||
executorCpuLimit = resource.MustParse("100m") | ||
) | ||
|
||
type Executor struct { | ||
*Instance | ||
} | ||
|
||
func NewExecutor(ctx context.Context, sysDeps system.SystemDependencies) (*Executor, error) { | ||
i, err := New(executorName, sysDeps) | ||
func (e *Executor) NewInstance(ctx context.Context, name string) (*instance.Instance, error) { | ||
i, err := e.Kn.NewInstance(name) | ||
if err != nil { | ||
return nil, ErrCreatingInstance.Wrap(err) | ||
return nil, err | ||
} | ||
|
||
if err := i.SetImage(ctx, executorDefaultImage); err != nil { | ||
return nil, ErrSettingImage.Wrap(err) | ||
return nil, err | ||
} | ||
|
||
if err := i.Commit(); err != nil { | ||
return nil, ErrCommittingInstance.Wrap(err) | ||
return nil, err | ||
} | ||
|
||
if err := i.SetArgs(sleepCommand, infinityArg); err != nil { | ||
return nil, ErrSettingArgs.Wrap(err) | ||
return nil, err | ||
} | ||
|
||
if err := i.SetMemory(executorMemoryLimit, executorMemoryLimit); err != nil { | ||
return nil, ErrSettingMemory.Wrap(err) | ||
return nil, err | ||
} | ||
|
||
if err := i.SetCPU(executorCpuLimit); err != nil { | ||
return nil, ErrSettingCPU.Wrap(err) | ||
return nil, err | ||
} | ||
i.instanceType = ExecutorInstance | ||
|
||
if err := i.Start(ctx); err != nil { | ||
return nil, ErrStartingInstance.Wrap(err) | ||
return nil, err | ||
} | ||
|
||
return &Executor{Instance: i}, nil | ||
return i, nil | ||
} |
Oops, something went wrong.