Skip to content

Commit

Permalink
fix: wrong path when use devFlag + wrong default value + special name…
Browse files Browse the repository at this point in the history
… in (#1024)

trustyai

Signed-off-by: Wen Zhou <[email protected]>
  • Loading branch information
zdtsw authored May 30, 2024
1 parent df469bb commit d9e78b4
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
type: string
Expand Down Expand Up @@ -96,7 +96,7 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
type: string
Expand Down Expand Up @@ -140,7 +140,7 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
type: string
Expand Down Expand Up @@ -198,7 +198,7 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
type: string
Expand Down Expand Up @@ -301,7 +301,7 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
type: string
Expand Down Expand Up @@ -345,7 +345,7 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
type: string
Expand Down Expand Up @@ -388,7 +388,7 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
type: string
Expand Down Expand Up @@ -431,7 +431,7 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
type: string
Expand Down Expand Up @@ -474,7 +474,7 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
type: string
Expand Down Expand Up @@ -517,7 +517,7 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
type: string
Expand Down Expand Up @@ -560,7 +560,7 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
type: string
Expand Down
4 changes: 2 additions & 2 deletions components/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ type ManifestsConfig struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=1
URI string `json:"uri,omitempty"`

// contextDir is the relative path to the folder containing manifests in a repository
// contextDir is the relative path to the folder containing manifests in a repository, default value "manifests"
// +optional
// +kubebuilder:default:=""
// +kubebuilder:default:="manifests"
// +operator-sdk:csv:customresourcedefinitions:type=spec,order=2
ContextDir string `json:"contextDir,omitempty"`

Expand Down
2 changes: 1 addition & 1 deletion components/kueue/kueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (k *Kueue) OverrideManifests(_ string) error {
return err
}
// If overlay is defined, update paths
defaultKustomizePath := "openshift"
defaultKustomizePath := "rhoai"
if manifestConfig.SourcePath != "" {
defaultKustomizePath = manifestConfig.SourcePath
}
Expand Down
2 changes: 1 addition & 1 deletion components/trainingoperator/trainingoperator.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (r *TrainingOperator) OverrideManifests(_ string) error {
return err
}
// If overlay is defined, update paths
defaultKustomizePath := "openshift"
defaultKustomizePath := "rhoai"
if manifestConfig.SourcePath != "" {
defaultKustomizePath = manifestConfig.SourcePath
}
Expand Down
9 changes: 5 additions & 4 deletions components/trustyai/trustyai.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ import (
)

var (
ComponentName = "trustyai"
Path = deploy.DefaultManifestPath + "/" + "trustyai-service-operator/base"
ComponentName = "trustyai"
ComponentPathName = "trustyai-service-operator"
Path = deploy.DefaultManifestPath + "/" + ComponentPathName + "/base"
)

// Verifies that TrustyAI implements ComponentInterface.
Expand All @@ -36,15 +37,15 @@ func (t *TrustyAI) OverrideManifests(_ string) error {
// If devflags are set, update default manifests path
if len(t.DevFlags.Manifests) != 0 {
manifestConfig := t.DevFlags.Manifests[0]
if err := deploy.DownloadManifests(ComponentName, manifestConfig); err != nil {
if err := deploy.DownloadManifests(ComponentPathName, manifestConfig); err != nil {
return err
}
// If overlay is defined, update paths
defaultKustomizePath := "base"
if manifestConfig.SourcePath != "" {
defaultKustomizePath = manifestConfig.SourcePath
}
Path = filepath.Join(deploy.DefaultManifestPath, ComponentName, defaultKustomizePath)
Path = filepath.Join(deploy.DefaultManifestPath, ComponentPathName, defaultKustomizePath)
}
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
the folder containing manifests in a repository,
default value "manifests"
type: string
sourcePath:
default: ""
Expand Down Expand Up @@ -97,9 +98,10 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
the folder containing manifests in a repository,
default value "manifests"
type: string
sourcePath:
default: ""
Expand Down Expand Up @@ -141,9 +143,10 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
the folder containing manifests in a repository,
default value "manifests"
type: string
sourcePath:
default: ""
Expand Down Expand Up @@ -199,9 +202,10 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
the folder containing manifests in a repository,
default value "manifests"
type: string
sourcePath:
default: ""
Expand Down Expand Up @@ -302,9 +306,10 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
the folder containing manifests in a repository,
default value "manifests"
type: string
sourcePath:
default: ""
Expand Down Expand Up @@ -346,9 +351,10 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
the folder containing manifests in a repository,
default value "manifests"
type: string
sourcePath:
default: ""
Expand Down Expand Up @@ -389,9 +395,10 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
the folder containing manifests in a repository,
default value "manifests"
type: string
sourcePath:
default: ""
Expand Down Expand Up @@ -432,9 +439,10 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
the folder containing manifests in a repository,
default value "manifests"
type: string
sourcePath:
default: ""
Expand Down Expand Up @@ -475,9 +483,10 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
the folder containing manifests in a repository,
default value "manifests"
type: string
sourcePath:
default: ""
Expand Down Expand Up @@ -518,9 +527,10 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
the folder containing manifests in a repository,
default value "manifests"
type: string
sourcePath:
default: ""
Expand Down Expand Up @@ -561,9 +571,10 @@ spec:
items:
properties:
contextDir:
default: ""
default: manifests
description: contextDir is the relative path to
the folder containing manifests in a repository
the folder containing manifests in a repository,
default value "manifests"
type: string
sourcePath:
default: ""
Expand Down
2 changes: 1 addition & 1 deletion docs/api-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ _Appears in:_
| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `uri` _string_ | uri is the URI point to a git repo with tag/branch. e.g. https://github.com/org/repo/tarball/<tag/branch> | | |
| `contextDir` _string_ | contextDir is the relative path to the folder containing manifests in a repository | | |
| `contextDir` _string_ | contextDir is the relative path to the folder containing manifests in a repository, default value "manifests" | manifests | |
| `sourcePath` _string_ | sourcePath is the subpath within contextDir where kustomize builds start. Examples include any sub-folder or path: `base`, `overlays/dev`, `default`, `odh` etc. | | |


Expand Down

0 comments on commit d9e78b4

Please sign in to comment.