Skip to content

Commit

Permalink
Merge pull request #99 from jsuchome/fixes-core-depl
Browse files Browse the repository at this point in the history
Fixes for core service deployment
  • Loading branch information
Jiří Suchomel committed May 20, 2021
2 parents a3deab7 + 06e02e0 commit e52f332
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
13 changes: 10 additions & 3 deletions deployments/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (core Core) createCoreCredsSecret(c *kubernetes.Cluster) error {
}

// Create fuseml-core deployment pointing to provided gitea server URL
func (core *Core) createCoreDeployment(giteaURL string) error {
func (core *Core) createCoreDeployment(giteaURL, tektonURL string) error {

yamlPathOnDisk, err := helpers.ExtractFile(coreDeploymentYamlPath)
if err != nil {
Expand All @@ -204,13 +204,16 @@ func (core *Core) createCoreDeployment(giteaURL string) error {
re := regexp.MustCompile(`__GITEA_URL__`)
renderedFileContents := re.ReplaceAllString(string(fileContents), giteaURL)

re = regexp.MustCompile(`__TEKTON_DASHBOARD_URL__`)
renderedFileContents = re.ReplaceAllString(string(renderedFileContents), tektonURL)

tmpFilePath, err := helpers.CreateTmpFile(string(renderedFileContents))
if err != nil {
return err
}
defer os.Remove(tmpFilePath)

out, err := helpers.Kubectl(fmt.Sprintf("apply -n %s --filename %s", coreDeploymentNamespace, tmpFilePath))
out, err := helpers.Kubectl(fmt.Sprintf("apply --filename %s", tmpFilePath))

if err != nil {
return errors.Wrap(err, fmt.Sprintf("kubectl apply failed:\n%s", out))
Expand Down Expand Up @@ -251,7 +254,11 @@ func (core Core) apply(c *kubernetes.Cluster, ui *ui.UI, options kubernetes.Inst
if !exists {
giteaURL = "http://gitea." + domain
}
if err := core.createCoreDeployment(giteaURL); err != nil {
tektonURL, exists := os.LookupEnv("TEKTON_DASHBOARD_URL")
if !exists {
tektonURL = "http://tekton." + domain
}
if err := core.createCoreDeployment(giteaURL, tektonURL); err != nil {
return errors.Wrap(err, fmt.Sprintf("Installing %s failed", coreDeploymentYamlPath))
}

Expand Down
2 changes: 2 additions & 0 deletions embedded-files/fuseml-core-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ spec:
name: fuseml-core-gitea
- name: GITEA_URL
value: __GITEA_URL__
- name: TEKTON_DASHBOARD_URL
value: __TEKTON_DASHBOARD_URL__
ports:
- containerPort: 80
---
Expand Down
2 changes: 1 addition & 1 deletion paas/install_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ func (c *InstallClient) Install(cmd *cobra.Command, options *kubernetes.Installa
&deployments.Workloads{Timeout: DefaultTimeoutSec},
&deployments.MLflow{Timeout: DefaultTimeoutSec},
&deployments.Gitea{Timeout: DefaultTimeoutSec},
&deployments.Core{Timeout: DefaultTimeoutSec},
&deployments.Registry{Timeout: DefaultTimeoutSec},
&deployments.Tekton{Timeout: DefaultTimeoutSec},
&deployments.Core{Timeout: DefaultTimeoutSec},
} {
details.Info("deploy", "Deployment", deployment.ID())

Expand Down

0 comments on commit e52f332

Please sign in to comment.