Files
oc-monitord/tools/interface.go
T

37 lines
1.2 KiB
Go
Raw Normal View History

2025-02-14 12:00:29 +01:00
package tools
import (
"errors"
"io"
2026-05-27 16:09:45 +02:00
wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/watch"
2025-02-14 12:00:29 +01:00
)
type Tool interface {
2025-02-17 16:54:25 +01:00
CreateArgoWorkflow(path string, ns string) (string, error)
CreateAccessSecret(user string, password string, storageId string, namespace string) (string, error)
2026-05-27 16:09:45 +02:00
// CreateSourceSecret creates an ephemeral K8s Secret holding a pre-signed URL
// for a private source resource. The secret is labelled with the execution ID
// so it can be bulk-cleaned up after workflow completion.
CreateSourceSecret(secretName, presignedURL, executionID, namespace string) error
GetArgoWatch(executionId string, wfName string) (watch.Interface, error)
2026-05-27 16:09:45 +02:00
GetArgoWorkflow(ns string, wfName string) (*wfv1.Workflow, error)
GetPodLogger(ns string, wfName string, podName string) (io.ReadCloser, error)
GetS3Secret(storageId string, namespace string) *v1.Secret
2025-02-14 12:00:29 +01:00
}
var _service = map[string]func() (Tool, error){
"kubernetes": NewKubernetesTool,
}
func NewService(name string) (Tool, error) {
2026-03-25 11:13:12 +01:00
return NewKubernetesTool()
2025-02-14 12:00:29 +01:00
service, ok := _service[name]
if !ok {
return nil, errors.New("service not found")
}
return service()
}