Skip to content

Commit

Permalink
Remove redundant config value
Browse files Browse the repository at this point in the history
  • Loading branch information
deadlycoconuts committed Sep 23, 2024
1 parent cb3c892 commit a63f15f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
8 changes: 4 additions & 4 deletions api/cmd/api/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ func initImageBuilder(cfg *config.Config) (webserviceBuilder imagebuilder.ImageB
}

var artifactService artifact.Service
if cfg.ImageBuilderConfig.ArtifactServiceType == "gcs" {
if cfg.MlflowConfig.ArtifactServiceType == "gcs" {
artifactService, err = artifact.NewGcsArtifactClient()
} else if cfg.ImageBuilderConfig.ArtifactServiceType == "s3" {
} else if cfg.MlflowConfig.ArtifactServiceType == "s3" {
artifactService, err = artifact.NewS3ArtifactClient()
} else if cfg.ImageBuilderConfig.ArtifactServiceType == "nop" {
} else if cfg.MlflowConfig.ArtifactServiceType == "nop" {
artifactService = artifact.NewNopArtifactClient()
} else {
log.Panicf("invalid artifact service type %s", cfg.ImageBuilderConfig.ArtifactServiceType)
log.Panicf("invalid artifact service type %s", cfg.MlflowConfig.ArtifactServiceType)
}

if cfg.ImageBuilderConfig.KanikoPushRegistryType != "gcs" &&
Expand Down
7 changes: 3 additions & 4 deletions api/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,14 @@ type ClusterConfig struct {
type ImageBuilderConfig struct {
ClusterName string `validate:"required"`
GcpProject string
ArtifactServiceType string `validate:"required"`
BaseImage BaseImageConfig `validate:"required"`
PredictionJobBaseImage BaseImageConfig `validate:"required"`
BuildNamespace string `validate:"required" default:"mlp"`
DockerRegistry string `validate:"required"`
BuildTimeout string `validate:"required" default:"10m"`
KanikoImage string `validate:"required" default:"gcr.io/kaniko-project/executor:v1.6.0"`
KanikoServiceAccount string
KanikoPushRegistryType string `validate:"required" default:"docker"`
KanikoPushRegistryType string `validate:"required,oneof=docker gcr" default:"docker"`
KanikoDockerCredentialSecretName string
KanikoAdditionalArgs []string
DefaultResources ResourceRequestsLimits `validate:"required"`
Expand Down Expand Up @@ -455,8 +454,8 @@ type JaegerConfig struct {
}

type MlflowConfig struct {
TrackingURL string `validate:"required"`
ArtifactServiceType string `validate:"required"`
TrackingURL string `validate:"required_if=ArtifactServiceType gcs ArtifactServiceType s3"`
ArtifactServiceType string `validate:"required,oneof=nop gcs s3"`
}

func (cfg *Config) Validate() error {
Expand Down
5 changes: 2 additions & 3 deletions api/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,8 @@ func TestLoad(t *testing.T) {
EnvironmentConfigs: []*EnvironmentConfig{},
},
ImageBuilderConfig: ImageBuilderConfig{
ClusterName: "test-cluster",
GcpProject: "test-project",
ArtifactServiceType: "gcs",
ClusterName: "test-cluster",
GcpProject: "test-project",
BaseImage: BaseImageConfig{
ImageName: "ghcr.io/caraml-dev/merlin/merlin-pyfunc-base:0.0.0",
DockerfilePath: "pyfunc-server/docker/Dockerfile",
Expand Down

0 comments on commit a63f15f

Please sign in to comment.