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

Fix KatibClient name in v1alpha2 #483

Merged
Merged
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
20 changes: 10 additions & 10 deletions pkg/util/v1alpha2/katibclient/katib_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client/config"
)

type katibClient struct {
type KatibClient struct {
client client.Client
}

func NewClient(options client.Options) (*katibClient, error) {
func NewClient(options client.Options) (*KatibClient, error) {
cfg, err := config.GetConfig()
if err != nil {
return nil, err
}
cl, err := client.New(cfg, options)
return &katibClient{
return &KatibClient{
client: cl,
}, nil
}

func (k *katibClient) GetExperimentList(namespace ...string) (*experimentv1alpha2.ExperimentList, error) {
func (k *KatibClient) GetExperimentList(namespace ...string) (*experimentv1alpha2.ExperimentList, error) {
ns := getNamespace(namespace...)
expList := &experimentv1alpha2.ExperimentList{}
listOpt := client.InNamespace(ns)
Expand All @@ -54,15 +54,15 @@ func (k *katibClient) GetExperimentList(namespace ...string) (*experimentv1alpha

}

func (k *katibClient) CreateExperiment(experiment *experimentv1alpha2.Experiment, namespace ...string) error {
func (k *KatibClient) CreateExperiment(experiment *experimentv1alpha2.Experiment, namespace ...string) error {

if err := k.client.Create(context.Background(), experiment); err != nil {
return err
}
return nil
}

func (k *katibClient) GetConfigMap(name string, namespace ...string) (map[string]string, error) {
func (k *KatibClient) GetConfigMap(name string, namespace ...string) (map[string]string, error) {
ns := getNamespace(namespace...)
configMap := &apiv1.ConfigMap{}
if err := k.client.Get(context.TODO(), types.NamespacedName{Name: name, Namespace: ns}, configMap); err != nil {
Expand All @@ -71,7 +71,7 @@ func (k *katibClient) GetConfigMap(name string, namespace ...string) (map[string
return configMap.Data, nil
}

func (k *katibClient) GetTrialTemplates(namespace ...string) (map[string]string, error) {
func (k *KatibClient) GetTrialTemplates(namespace ...string) (map[string]string, error) {

ns := getNamespace(namespace...)
trialTemplates := &apiv1.ConfigMap{}
Expand All @@ -83,7 +83,7 @@ func (k *katibClient) GetTrialTemplates(namespace ...string) (map[string]string,

}

func (k *katibClient) UpdateTrialTemplates(newTrialTemplates map[string]string, namespace ...string) error {
func (k *KatibClient) UpdateTrialTemplates(newTrialTemplates map[string]string, namespace ...string) error {
ns := getNamespace(namespace...)
trialTemplates := &apiv1.ConfigMap{}

Expand All @@ -98,7 +98,7 @@ func (k *katibClient) UpdateTrialTemplates(newTrialTemplates map[string]string,
return nil
}

func (k *katibClient) GetMetricsCollectorTemplates(namespace ...string) (map[string]string, error) {
func (k *KatibClient) GetMetricsCollectorTemplates(namespace ...string) (map[string]string, error) {

ns := getNamespace(namespace...)
metricsCollectorTemplates := &apiv1.ConfigMap{}
Expand All @@ -110,7 +110,7 @@ func (k *katibClient) GetMetricsCollectorTemplates(namespace ...string) (map[str

}

func (k *katibClient) UpdateMetricsCollectorTemplates(newMCTemplates map[string]string, namespace ...string) error {
func (k *KatibClient) UpdateMetricsCollectorTemplates(newMCTemplates map[string]string, namespace ...string) error {

ns := getNamespace(namespace...)
metricsCollectorTemplates := &apiv1.ConfigMap{}
Expand Down