Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
Add helm symlink to host. (#378) (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
r0mant authored Apr 23, 2019
1 parent 743309f commit 6255351
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ RELEASE_OUT ?=
TELEPORT_TAG = 3.0.5
# TELEPORT_REPOTAG adapts TELEPORT_TAG to the teleport tagging scheme
TELEPORT_REPOTAG := v$(TELEPORT_TAG)
PLANET_TAG := 5.6.1-$(K8S_VER_SUFFIX)
PLANET_TAG := 5.6.2-$(K8S_VER_SUFFIX)
PLANET_BRANCH := $(PLANET_TAG)
K8S_APP_TAG := $(GRAVITY_TAG)
TELEKUBE_APP_TAG := $(GRAVITY_TAG)
Expand Down
8 changes: 8 additions & 0 deletions lib/defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,14 @@ const (
// HelmBin is the location of helm binary inside planet
HelmBin = "/usr/bin/helm"

// HelmScript is the location of the helm script, which the host's helm
// is symlinked to, inside the planet
HelmScript = "/usr/local/bin/helm"

// HelmBinAlternate is the alternative location of helm symlink on
// systems where /usr/bin is not writable
HelmBinAlternate = "/writable/bin/helm"

// PlanetBin is the default location of planet binary
PlanetBin = "/usr/bin/planet"

Expand Down
12 changes: 12 additions & 0 deletions tool/gravity/cli/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,11 +597,23 @@ func updateKubectl(planetPath string) (err error) {
for _, path := range []string{defaults.KubectlBin, defaults.KubectlBinAlternate} {
out, err = exec.Command("ln", "-sfT", kubectlPath, path).CombinedOutput()
if err == nil {
log.Infof("Updated kubectl symlink: %v -> %v.", path, kubectlPath)
break
}
log.Warnf("Failed to update kubectl symlink: %s (%v).", out, err)
}

// update helm symlink
helmPath := filepath.Join(planetPath, constants.PlanetRootfs, defaults.HelmScript)
for _, path := range []string{defaults.HelmBin, defaults.HelmBinAlternate} {
out, err = exec.Command("ln", "-sfT", helmPath, path).CombinedOutput()
if err == nil {
log.Infof("Updated helm symlink: %v -> %v.", path, helmPath)
break
}
log.Warnf("Failed to update helm symlink: %s (%v).", out, err)
}

// update kube config environment variable
kubeConfigPath := filepath.Join(planetPath, constants.PlanetRootfs, defaults.PlanetKubeConfigPath)
environment, err := utils.ReadEnv(defaults.EnvironmentPath)
Expand Down

0 comments on commit 6255351

Please sign in to comment.