Skip to content

Commit

Permalink
chore: removes SetImageParamsMap from ComponentInterface (opendatahub…
Browse files Browse the repository at this point in the history
…-io#897)

As it's not used by any component, acting as a simple pass-return loop.

This makes the API contract a bit cleaner.
  • Loading branch information
bartoszmajsak authored Mar 7, 2024
1 parent 927340a commit d10a764
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 20 deletions.
3 changes: 1 addition & 2 deletions components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ can be found [here](https://github.com/opendatahub-io/opendatahub-operator/tree/
Cleanup(cli client.Client, DSCISpec *dsci.DSCInitializationSpec) error
GetComponentName() string
GetManagementState() operatorv1.ManagementState
SetImageParamsMap(imageMap map[string]string) map[string]string
OverrideManifests(platform string) error
UpdatePrometheusConfig(cli client.Client, enable bool, component string) error
WaitForDeploymentAvailable(ctx context.Context, r *rest.Config, c string, n string, i int, t int) error
}
```
### Add reconcile and Events
Expand Down
2 changes: 1 addition & 1 deletion components/codeflare/codeflare.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (c *CodeFlare) ReconcileComponent(ctx context.Context, cli client.Client, r

// Update image parameters only when we do not have customized manifests set
if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (c.DevFlags == nil || len(c.DevFlags.Manifests) == 0) {
if err := deploy.ApplyParams(ParamsPath, c.SetImageParamsMap(imageParamMap), true); err != nil {
if err := deploy.ApplyParams(ParamsPath, imageParamMap, true); err != nil {
return err
}
}
Expand Down
5 changes: 0 additions & 5 deletions components/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ func (c *Component) Cleanup(_ client.Client, _ *dsciv1.DSCInitializationSpec) er
return nil
}

func (c *Component) SetImageParamsMap(imageMap map[string]string) map[string]string {
return imageMap
}

// DevFlags defines list of fields that can be used by developers to test customizations. This is not recommended
// to be used in production environment.
// +kubebuilder:object:generate=true
Expand Down Expand Up @@ -84,7 +80,6 @@ type ComponentInterface interface {
Cleanup(cli client.Client, DSCISpec *dsciv1.DSCInitializationSpec) error
GetComponentName() string
GetManagementState() operatorv1.ManagementState
SetImageParamsMap(imageMap map[string]string) map[string]string
OverrideManifests(platform string) error
UpdatePrometheusConfig(cli client.Client, enable bool, component string) error
}
Expand Down
2 changes: 1 addition & 1 deletion components/dashboard/dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (d *Dashboard) ReconcileComponent(ctx context.Context,

// 3. Update image parameters
if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (d.DevFlags == nil || len(d.DevFlags.Manifests) == 0) {
if err := deploy.ApplyParams(PathSupported, d.SetImageParamsMap(imageParamMap), false); err != nil {
if err := deploy.ApplyParams(PathSupported, imageParamMap, false); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/datasciencepipelines/datasciencepipelines.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (d *DataSciencePipelines) ReconcileComponent(ctx context.Context,
// skip check if the dependent operator has beeninstalled, this is done in dashboard
// Update image parameters only when we do not have customized manifests set
if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (d.DevFlags == nil || len(d.DevFlags.Manifests) == 0) {
if err := deploy.ApplyParams(Path, d.SetImageParamsMap(imageParamMap), false); err != nil {
if err := deploy.ApplyParams(Path, imageParamMap, false); err != nil {
return err
}
}
Expand Down
4 changes: 2 additions & 2 deletions components/kserve/kserve.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (k *Kserve) ReconcileComponent(ctx context.Context, cli client.Client, resC

// Update image parameters only when we do not have customized manifests set
if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (k.DevFlags == nil || len(k.DevFlags.Manifests) == 0) {
if err := deploy.ApplyParams(Path, k.SetImageParamsMap(imageParamMap), false); err != nil {
if err := deploy.ApplyParams(Path, imageParamMap, false); err != nil {
return err
}
}
Expand All @@ -151,7 +151,7 @@ func (k *Kserve) ReconcileComponent(ctx context.Context, cli client.Client, resC
}
// Update image parameters for odh-model-controller
if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (k.DevFlags == nil || len(k.DevFlags.Manifests) == 0) {
if err := deploy.ApplyParams(DependentPath, k.SetImageParamsMap(dependentParamMap), false); err != nil {
if err := deploy.ApplyParams(DependentPath, dependentParamMap, false); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/kueue/kueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (r *Kueue) ReconcileComponent(ctx context.Context, cli client.Client, resCo
}
}
if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (r.DevFlags == nil || len(r.DevFlags.Manifests) == 0) {
if err := deploy.ApplyParams(Path, r.SetImageParamsMap(imageParamMap), true); err != nil {
if err := deploy.ApplyParams(Path, imageParamMap, true); err != nil {
return err
}
}
Expand Down
4 changes: 2 additions & 2 deletions components/modelmeshserving/modelmeshserving.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (m *ModelMeshServing) ReconcileComponent(ctx context.Context,
}
// Update image parameters
if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (m.DevFlags == nil || len(m.DevFlags.Manifests) == 0) {
if err := deploy.ApplyParams(Path, m.SetImageParamsMap(imageParamMap), false); err != nil {
if err := deploy.ApplyParams(Path, imageParamMap, false); err != nil {
return err
}
}
Expand All @@ -135,7 +135,7 @@ func (m *ModelMeshServing) ReconcileComponent(ctx context.Context,
}
// Update image parameters for odh-model-controller
if dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "" {
if err := deploy.ApplyParams(DependentPath, m.SetImageParamsMap(dependentImageParamMap), false); err != nil {
if err := deploy.ApplyParams(DependentPath, dependentImageParamMap, false); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/modelregistry/modelregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (m *ModelRegistry) ReconcileComponent(_ context.Context, cli client.Client,

// Update image parameters only when we do not have customized manifests set
if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (m.DevFlags == nil || len(m.DevFlags.Manifests) == 0) {
if err := deploy.ApplyParams(Path, m.SetImageParamsMap(imageParamMap), false); err != nil {
if err := deploy.ApplyParams(Path, imageParamMap, false); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/ray/ray.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (r *Ray) ReconcileComponent(ctx context.Context, cli client.Client, resConf
}
}
if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (r.DevFlags == nil || len(r.DevFlags.Manifests) == 0) {
if err := deploy.ApplyParams(RayPath, r.SetImageParamsMap(imageParamMap), true); err != nil {
if err := deploy.ApplyParams(RayPath, imageParamMap, true); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion components/trustyai/trustyai.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (t *TrustyAI) ReconcileComponent(ctx context.Context, cli client.Client, re
}
}
if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (t.DevFlags == nil || len(t.DevFlags.Manifests) == 0) {
if err := deploy.ApplyParams(Path, t.SetImageParamsMap(imageParamMap), false); err != nil {
if err := deploy.ApplyParams(Path, imageParamMap, false); err != nil {
return err
}
}
Expand Down
4 changes: 2 additions & 2 deletions components/workbenches/workbenches.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ func (w *Workbenches) ReconcileComponent(ctx context.Context, cli client.Client,
if (dscispec.DevFlags == nil || dscispec.DevFlags.ManifestsUri == "") && (w.DevFlags == nil || len(w.DevFlags.Manifests) == 0) {
if platform == deploy.ManagedRhods || platform == deploy.SelfManagedRhods {
// for kf-notebook-controller image
if err := deploy.ApplyParams(notebookControllerPath, w.SetImageParamsMap(imageParamMap), false); err != nil {
if err := deploy.ApplyParams(notebookControllerPath, imageParamMap, false); err != nil {
return err
}
// for odh-notebook-controller image
if err := deploy.ApplyParams(kfnotebookControllerPath, w.SetImageParamsMap(imageParamMap), false); err != nil {
if err := deploy.ApplyParams(kfnotebookControllerPath, imageParamMap, false); err != nil {
return err
}
}
Expand Down

0 comments on commit d10a764

Please sign in to comment.