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

Release/1.16 #200

Closed
wants to merge 52 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
71e7f7f
feat: cron job template field (#132) (#133)
vsukhin May 3, 2023
b1213c7
feat: deprecate args (#130)
vsukhin May 3, 2023
4224945
fix: upload variables file (#135)
vLia May 4, 2023
3306a20
add tests for develop branch (#136)
ypoplavs May 5, 2023
861c0ac
add check fir release branch (#137)
ypoplavs May 8, 2023
ffa9d74
comment out the automatic merge of release branch for now
ypoplavs May 10, 2023
8f9bb9d
fix release branch naming
ypoplavs May 10, 2023
bbb6fc0
fix typo
ypoplavs May 10, 2023
0222b15
fix path for goreleaser file
ypoplavs May 16, 2023
2f1e170
rename release branch (#142)
ypoplavs May 16, 2023
355e4bf
ci: parametrize alpine (#144)
ypoplavs May 25, 2023
b8c8300
fix: ttl for trigger condition (#143)
vsukhin May 25, 2023
4168152
ci: rename gh token var (#145)
ypoplavs May 25, 2023
5087440
fix: add missing var for alpine image for arm64 arch
ypoplavs May 26, 2023
1e9a3cf
fix: remove empty username and token (#147)
vsukhin May 26, 2023
e3870b0
ci: add docker registry description (#146)
ypoplavs May 26, 2023
86b5aba
ci: add workflow dispatch (#149)
ypoplavs May 31, 2023
eed35fe
fix: support external secrets for tests (#148)
vsukhin Jun 2, 2023
afea426
feat: webhook templlate and headers (#152)
vsukhin Jun 7, 2023
033b048
fix: secret check (#153)
vsukhin Jun 9, 2023
48fd2fa
feat: provide known condition types (#155)
vsukhin Jun 13, 2023
95faaa7
feat: parallel testsuite (#109)
vsukhin Jun 15, 2023
a2224e7
fix: remove run secrets as well (#139)
nicufk Jun 21, 2023
30d80e4
feat: postrun script (#156)
vsukhin Jun 22, 2023
89ba17b
ci: remove release branch creation in helm-charts repo (#157)
ypoplavs Jun 27, 2023
e416a8c
feat: probe conditions (#158)
vsukhin Jul 3, 2023
8815bd8
fix: don't remove non Testkube secrets (#160)
vsukhin Jul 6, 2023
bc8cd9f
feat: remove outdated description (#164)
vsukhin Jul 17, 2023
edf3c1d
fix: image registry (#166)
vsukhin Aug 7, 2023
071c677
feat: basic test execution crd (#165)
vsukhin Aug 11, 2023
9570ed2
fix: use go 1.21 (#169)
vsukhin Aug 16, 2023
870da6e
fix: context typo (#171)
vsukhin Aug 24, 2023
199e57e
feat: artifact bucket (#170)
vsukhin Aug 24, 2023
8fda604
feat: test field (#172)
vsukhin Aug 24, 2023
5c2e383
feat: template crd (#173)
vsukhin Sep 5, 2023
e93d866
feat: adjust uri descrription (#174)
vsukhin Sep 7, 2023
4d087b2
feat: trigger concurrency policy (#175)
vsukhin Sep 18, 2023
fe2d1f9
Added slaves field in executor CRD to add slaves configuration (#177)
hiteshwani Sep 26, 2023
785d106
feat: update operator to use latest kubebuilder layout (#178)
dejanzele Sep 27, 2023
688b0e1
fix invalid reference (#179)
dejanzele Sep 27, 2023
5fc2021
fix mocks (#180)
dejanzele Sep 27, 2023
457bf71
fix: make test fields optional (#181)
dejanzele Sep 27, 2023
aa5afde
feat: execute post run script before scraping field (#183)
vsukhin Oct 5, 2023
3ec1179
feat: regex field (#186)
vsukhin Oct 20, 2023
62a7951
fix: visibility for secrets (#187)
vsukhin Oct 20, 2023
11468a1
fix: back merge (#191)
vsukhin Oct 25, 2023
f61e073
feat: data dir as working dir (#192)
vsukhin Nov 2, 2023
c66d03d
feat: pass artifacts testsuite (#193)
vsukhin Nov 8, 2023
1f48caf
fix: correct downloading tools with Go 1.16+ (#195)
rangoo94 Nov 10, 2023
0a5b5ef
chore: rename default secret label (#196)
fivenp Nov 14, 2023
803ccbc
feat: support argo cd sync (#197)
vsukhin Nov 15, 2023
520ed73
Merge branch 'main' into release/1.16
vsukhin Nov 21, 2023
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
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,9 @@ define go-get-tool
@[ -f $(1) ] || { \
set -e ;\
TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
rm -rf $$TMP_DIR ;\
GOPATH="$$TMP_DIR" GOBIN="$$TMP_DIR/bin" go install $(2) ;\
cp -r "$$TMP_DIR/bin" "$(PROJECT_DIR)" ;\
chmod -R 777 "$$TMP_DIR" ; rm -rf "$$TMP_DIR" ;\
}
endef
44 changes: 44 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,50 @@ resources:
kind: Template
path: github.com/kubeshop/testkube-operator/api/template/v1
version: v1
- api:
crdVersion: v1
namespaced: true
domain: testkube.io
group: tests
kind: Test
path: github.com/kubeshop/testkube-operator/api/tests/v2
version: v2
- api:
crdVersion: v1
namespaced: true
controller: true
domain: testkube.io
group: tests
kind: TestSuite
path: github.com/kubeshop/testkube-operator/api/testsuite/v3
version: v3
- api:
crdVersion: v1
namespaced: true
controller: true
domain: testkube.io
group: tests
kind: TestExecution
path: github.com/kubeshop/testkube-operator/api/testexecution/v1
version: v1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: testkube.io
group: tests
kind: TestSuiteExecution
path: github.com/kubeshop/testkube-operator/api/testsuiteexecution/v1
version: v1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: testkube.io
group: tests
kind: Template
path: github.com/kubeshop/testkube-operator/api/template/v1
version: v1
- api:
crdVersion: v1
namespaced: true
Expand Down
3 changes: 3 additions & 0 deletions api/executor/v1/executor_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ type ExecutorSpec struct {

// Slaves data to run test in distributed environment
Slaves *SlavesMeta `json:"slaves,omitempty"`

// use data dir as working dir for executor
UseDataDirAsWorkingDir bool `json:"useDataDirAsWorkingDir,omitempty"`
}

type SlavesMeta struct {
Expand Down
19 changes: 11 additions & 8 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ package main
import (
"encoding/base64"
"flag"
testtriggersv1 "github.com/kubeshop/testkube-operator/api/testtriggers/v1"
"os"

testtriggersv1 "github.com/kubeshop/testkube-operator/api/testtriggers/v1"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
Expand Down Expand Up @@ -75,6 +76,7 @@ type config struct {
Fullname string
TemplateCronjob string `split_words:"true"`
Registry string
UseArgocdSync bool `split_words:"true"`
}

func init() {
Expand Down Expand Up @@ -128,7 +130,6 @@ func main() {
}

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{

Scheme: scheme,
Metrics: metricsserver.Options{BindAddress: metricsAddr},
HealthProbeBindAddress: probeAddr,
Expand All @@ -155,17 +156,19 @@ func main() {
os.Exit(1)
}
if err = (&testscontrollers.TestReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
CronJobClient: cronjob.NewClient(mgr.GetClient(), httpConfig.Fullname, httpConfig.Port, templateCronjob, httpConfig.Registry),
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
CronJobClient: cronjob.NewClient(mgr.GetClient(), httpConfig.Fullname, httpConfig.Port,
templateCronjob, httpConfig.Registry, httpConfig.UseArgocdSync),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Test")
os.Exit(1)
}
if err = (&testsuitecontrollers.TestSuiteReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
CronJobClient: cronjob.NewClient(mgr.GetClient(), httpConfig.Fullname, httpConfig.Port, templateCronjob, httpConfig.Registry),
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
CronJobClient: cronjob.NewClient(mgr.GetClient(), httpConfig.Fullname, httpConfig.Port,
templateCronjob, httpConfig.Registry, httpConfig.UseArgocdSync),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "TestSuite")
os.Exit(1)
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/executor.testkube.io_executors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ spec:
uri:
description: URI for rest based executors
type: string
useDataDirAsWorkingDir:
description: use data dir as working dir for executor
type: boolean
type: object
status:
description: ExecutorStatus defines the observed state of Executor
Expand Down
8 changes: 5 additions & 3 deletions internal/controller/tests/test_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ func (r *TestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.

options := cronjob.CronJobOptions{
Schedule: test.Spec.Schedule,
Resource: cronjob.TestResourceURI,
Resource: testsv3.Resource,
Version: testsv3.Version,
ResourceURI: cronjob.TestResourceURI,
Data: string(data),
Labels: test.Labels,
CronJobTemplate: jobTemplate,
Expand All @@ -128,7 +130,7 @@ func (r *TestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
if err != nil {
if errors.IsNotFound(err) {
if err = r.CronJobClient.Create(ctx, test.Name,
cronjob.GetMetadataName(test.Name, cronjob.TestResourceURI), req.NamespacedName.Namespace, options); err != nil {
cronjob.GetMetadataName(test.Name, cronjob.TestResourceURI), req.NamespacedName.Namespace, string(test.UID), options); err != nil {
return ctrl.Result{}, err
}
}
Expand All @@ -138,7 +140,7 @@ func (r *TestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.

// Update CronJob if it was created before provided Test schedule
if err = r.CronJobClient.Update(ctx, cronJob, test.Name,
cronjob.GetMetadataName(test.Name, cronjob.TestResourceURI), req.NamespacedName.Namespace, options); err != nil {
cronjob.GetMetadataName(test.Name, cronjob.TestResourceURI), req.NamespacedName.Namespace, string(test.UID), options); err != nil {
return ctrl.Result{}, err
}

Expand Down
8 changes: 5 additions & 3 deletions internal/controller/testsuite/testsuite_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ func (r *TestSuiteReconciler) Reconcile(ctx context.Context, req ctrl.Request) (

options := cronjob.CronJobOptions{
Schedule: testSuite.Spec.Schedule,
Resource: cronjob.TestSuiteResourceURI,
Resource: testsuitev3.Resource,
Version: testsuitev3.Version,
ResourceURI: cronjob.TestSuiteResourceURI,
Data: string(data),
Labels: testSuite.Labels,
CronJobTemplate: jobTemplate,
Expand All @@ -129,7 +131,7 @@ func (r *TestSuiteReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
if err != nil {
if errors.IsNotFound(err) {
if err = r.CronJobClient.Create(ctx, testSuite.Name,
cronjob.GetMetadataName(testSuite.Name, cronjob.TestSuiteResourceURI), req.NamespacedName.Namespace, options); err != nil {
cronjob.GetMetadataName(testSuite.Name, cronjob.TestSuiteResourceURI), req.NamespacedName.Namespace, string(testSuite.UID), options); err != nil {
return ctrl.Result{}, err
}
}
Expand All @@ -139,7 +141,7 @@ func (r *TestSuiteReconciler) Reconcile(ctx context.Context, req ctrl.Request) (

// Update CronJob if it was created before provided Test schedule
if err = r.CronJobClient.Update(ctx, cronJob, testSuite.Name,
cronjob.GetMetadataName(testSuite.Name, cronjob.TestSuiteResourceURI), req.NamespacedName.Namespace, options); err != nil {
cronjob.GetMetadataName(testSuite.Name, cronjob.TestSuiteResourceURI), req.NamespacedName.Namespace, string(testSuite.UID), options); err != nil {
return ctrl.Result{}, err
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/client/tests/v3/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const (
var testSecretDefaultLabels = map[string]string{
"testkube": testkubeTestSecretLabel,
"testkubeSecretType": "variables",
"visibility": "testkube",
"createdBy": "testkube",
}

//go:generate mockgen -source=./test.go -destination=./mock_tests.go -package=tests "github.com/kubeshop/testkube-operator/pkg/client/tests/v3" Interface
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/testsuites/v3/testsuites.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const (
var testsuiteSecretDefaultLabels = map[string]string{
"testkube": testkubeTestsuiteSecretLabel,
"testkubeSecretType": "variables",
"visibility": "testkube",
"createdBy": "testkube",
}

//go:generate mockgen -destination=./mock_testsuites.go -package=v3 "github.com/kubeshop/testkube-operator/pkg/client/testsuites/v3" Interface
Expand Down
23 changes: 20 additions & 3 deletions pkg/cronjob/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ type Client struct {
servicePort int
cronJobTemplate string
registry string
argoCDSync bool
}

type CronJobOptions struct {
Schedule string
Resource string
Version string
ResourceURI string
Data string
Labels map[string]string
CronJobTemplate string
Expand All @@ -49,21 +52,27 @@ type templateParameters struct {
ServicePort int
Schedule string
Resource string
Version string
ResourceURI string
CronJobTemplate string
CronJobTemplateExtensions string
Data string
Labels map[string]string
Registry string
ArgoCDSync bool
UID string
}

// NewClient is a method to create new cron job client
func NewClient(cli client.Client, serviceName string, servicePort int, cronJobTemplate, registry string) *Client {
func NewClient(cli client.Client, serviceName string, servicePort int, cronJobTemplate, registry string,
argoCDSync bool) *Client {
return &Client{
Client: cli,
serviceName: serviceName,
servicePort: servicePort,
cronJobTemplate: cronJobTemplate,
registry: registry,
argoCDSync: argoCDSync,
}
}

Expand All @@ -78,7 +87,7 @@ func (c *Client) Get(ctx context.Context, name, namespace string) (*batchv1.Cron
}

// Create is a method to create a cron job
func (c *Client) Create(ctx context.Context, id, name, namespace string, options CronJobOptions) error {
func (c *Client) Create(ctx context.Context, id, name, namespace, uid string, options CronJobOptions) error {
template := c.cronJobTemplate
if options.CronJobTemplate != "" {
template = options.CronJobTemplate
Expand All @@ -92,11 +101,15 @@ func (c *Client) Create(ctx context.Context, id, name, namespace string, options
ServicePort: c.servicePort,
Schedule: options.Schedule,
Resource: options.Resource,
Version: options.Version,
ResourceURI: options.ResourceURI,
CronJobTemplate: template,
CronJobTemplateExtensions: options.CronJobTemplateExtensions,
Data: options.Data,
Labels: options.Labels,
Registry: c.registry,
ArgoCDSync: c.argoCDSync,
UID: uid,
}

cronJobSpec, err := NewCronJobSpec(parameters)
Expand All @@ -112,7 +125,7 @@ func (c *Client) Create(ctx context.Context, id, name, namespace string, options
}

// Update is a method to update an existing cron job
func (c *Client) Update(ctx context.Context, cronJob *batchv1.CronJob, id, name, namespace string, options CronJobOptions) error {
func (c *Client) Update(ctx context.Context, cronJob *batchv1.CronJob, id, name, namespace, uid string, options CronJobOptions) error {
template := c.cronJobTemplate
if options.CronJobTemplate != "" {
template = options.CronJobTemplate
Expand All @@ -126,11 +139,15 @@ func (c *Client) Update(ctx context.Context, cronJob *batchv1.CronJob, id, name,
ServicePort: c.servicePort,
Schedule: options.Schedule,
Resource: options.Resource,
Version: options.Version,
ResourceURI: options.ResourceURI,
CronJobTemplate: template,
CronJobTemplateExtensions: options.CronJobTemplateExtensions,
Data: options.Data,
Labels: options.Labels,
Registry: c.registry,
ArgoCDSync: c.argoCDSync,
UID: uid,
}

cronJobSpec, err := NewCronJobSpec(parameters)
Expand Down
2 changes: 1 addition & 1 deletion pkg/secret/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func NewSpec(id, namespace, label string, labels, stringData map[string]string)
ObjectMeta: metav1.ObjectMeta{
Name: id,
Namespace: namespace,
Labels: map[string]string{"testkube": label, "visibility": "testkube"},
Labels: map[string]string{"testkube": label, "createdBy": "testkube"},
},
Type: v1.SecretTypeOpaque,
StringData: stringData,
Expand Down
Loading