diff --git a/README.md b/README.md
index 3d6137b..cf639dc 100644
--- a/README.md
+++ b/README.md
@@ -150,6 +150,7 @@ Installs a local Airbyte instance or updates an existing installation which was
| Name | Default | Description |
|---------------------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| --chart | "" | Path to chart. |
| --chart-version | latest | Which Airbyte helm-chart version to install. |
| --docker-email | "" | Docker email address to authenticate against `--docker-server`.
Can also be specified by the environment-variable `ABCTL_LOCAL_INSTALL_DOCKER_EMAIL`. |
| --docker-password | "" | Docker password to authenticate against `--docker-server`.
Can also be specified by the environment-variable `ABCTL_LOCAL_INSTALL_DOCKER_PASSWORD`. |
diff --git a/internal/cmd/local/docker/secret.go b/internal/cmd/local/docker/secret.go
index 5dcc86b..001b35e 100644
--- a/internal/cmd/local/docker/secret.go
+++ b/internal/cmd/local/docker/secret.go
@@ -23,8 +23,8 @@ import (
func Secret(server, user, pass, email string) ([]byte, error) {
// map of the server to the credentials
return json.Marshal(map[string]any{
- "auths": map[string]any {
- server: map[string]any {
+ "auths": map[string]any{
+ server: map[string]any{
"username": user,
"password": pass,
"email": email,
@@ -32,4 +32,4 @@ func Secret(server, user, pass, email string) ([]byte, error) {
},
},
})
-}
\ No newline at end of file
+}
diff --git a/internal/cmd/local/k8s/k8stest/k8stest.go b/internal/cmd/local/k8s/k8stest/k8stest.go
index 3f1d8e5..8b4e0e8 100644
--- a/internal/cmd/local/k8s/k8stest/k8stest.go
+++ b/internal/cmd/local/k8s/k8stest/k8stest.go
@@ -36,7 +36,7 @@ type MockClient struct {
FnEventsWatch func(ctx context.Context, namespace string) (watch.Interface, error)
FnLogsGet func(ctx context.Context, namespace string, name string) (string, error)
FnStreamPodLogs func(ctx context.Context, namespace, podName string, since time.Time) (io.ReadCloser, error)
- FnPodList func(ctx context.Context, namespace string) (*corev1.PodList, error)
+ FnPodList func(ctx context.Context, namespace string) (*corev1.PodList, error)
}
func (m *MockClient) DeploymentList(ctx context.Context, namespace string) (*v1.DeploymentList, error) {
diff --git a/internal/cmd/local/local/cmd.go b/internal/cmd/local/local/cmd.go
index 507dfaf..c76291c 100644
--- a/internal/cmd/local/local/cmd.go
+++ b/internal/cmd/local/local/cmd.go
@@ -21,17 +21,17 @@ import (
const (
airbyteBootloaderPodName = "airbyte-abctl-airbyte-bootloader"
- airbyteChartName = "airbyte/airbyte"
- airbyteChartRelease = "airbyte-abctl"
- airbyteIngress = "ingress-abctl"
- airbyteNamespace = "airbyte-abctl"
- airbyteRepoName = "airbyte"
- airbyteRepoURL = "https://airbytehq.github.io/helm-charts"
- nginxChartName = "nginx/ingress-nginx"
- nginxChartRelease = "ingress-nginx"
- nginxNamespace = "ingress-nginx"
- nginxRepoName = "nginx"
- nginxRepoURL = "https://kubernetes.github.io/ingress-nginx"
+ airbyteChartName = "airbyte/airbyte"
+ airbyteChartRelease = "airbyte-abctl"
+ airbyteIngress = "ingress-abctl"
+ airbyteNamespace = "airbyte-abctl"
+ airbyteRepoName = "airbyte"
+ airbyteRepoURL = "https://airbytehq.github.io/helm-charts"
+ nginxChartName = "nginx/ingress-nginx"
+ nginxChartRelease = "ingress-nginx"
+ nginxNamespace = "ingress-nginx"
+ nginxRepoName = "nginx"
+ nginxRepoURL = "https://kubernetes.github.io/ingress-nginx"
)
// dockerAuthSecretName is the name of the secret which holds the docker authentication information.
@@ -45,7 +45,7 @@ type HTTPClient interface {
type BrowserLauncher func(url string) error
// ChartLocator primarily for testing purposes.
-type ChartLocator func(repoName, repoUrl string) string
+type ChartLocator func(repoName, repoUrl, chartFlag string) string
// Command is the local command, responsible for installing, uninstalling, or other local actions.
type Command struct {
diff --git a/internal/cmd/local/local/install.go b/internal/cmd/local/local/install.go
index cfe8971..9b283aa 100644
--- a/internal/cmd/local/local/install.go
+++ b/internal/cmd/local/local/install.go
@@ -42,6 +42,7 @@ const (
)
type InstallOpts struct {
+ HelmChartFlag string
HelmChartVersion string
HelmValues map[string]any
Secrets []string
@@ -252,6 +253,7 @@ func (c *Command) Install(ctx context.Context, opts InstallOpts) error {
repoURL: airbyteRepoURL,
chartName: airbyteChartName,
chartRelease: airbyteChartRelease,
+ chartFlag: opts.HelmChartFlag,
chartVersion: opts.HelmChartVersion,
namespace: airbyteNamespace,
valuesYAML: valuesYAML,
@@ -524,6 +526,7 @@ type chartRequest struct {
repoURL string
chartName string
chartRelease string
+ chartFlag string
chartVersion string
namespace string
values []string
@@ -548,7 +551,7 @@ func (c *Command) handleChart(
c.spinner.UpdateText(fmt.Sprintf("Fetching %s Helm Chart with version", req.chartName))
- chartLoc := c.locateChart(req.chartName, req.chartVersion)
+ chartLoc := c.locateChart(req.chartName, req.chartVersion, req.chartFlag)
helmChart, _, err := c.helm.GetChart(chartLoc, &action.ChartPathOptions{Version: req.chartVersion})
if err != nil {
@@ -746,7 +749,7 @@ func determineHelmChartAction(helm helm.Client, chart *chart.Chart, releaseName
// values provided were potentially overridden by the valuesYML file.
func mergeValuesWithValuesYAML(values []string, userValues map[string]any) (string, error) {
a := maps.FromSlice(values)
-
+
maps.Merge(a, userValues)
res, err := maps.ToYAML(a)
diff --git a/internal/cmd/local/local/install_test.go b/internal/cmd/local/local/install_test.go
index 3668dfa..3b7d0f6 100644
--- a/internal/cmd/local/local/install_test.go
+++ b/internal/cmd/local/local/install_test.go
@@ -25,7 +25,7 @@ import (
const portTest = 9999
const testAirbyteChartLoc = "https://airbytehq.github.io/helm-charts/airbyte-1.2.3.tgz"
-func testChartLocator(chartName, chartVersion string) string {
+func testChartLocator(chartName, chartVersion, chartFlag string) string {
if chartName == airbyteChartName && chartVersion == "" {
return testAirbyteChartLoc
}
diff --git a/internal/cmd/local/local/locate.go b/internal/cmd/local/local/locate.go
index 2593a16..bca2b39 100644
--- a/internal/cmd/local/local/locate.go
+++ b/internal/cmd/local/local/locate.go
@@ -40,9 +40,14 @@ var defaultNewChartRepo newChartRepo = func(cfg *repo.Entry, getters getter.Prov
// This variable should only be modified for testing purposes.
var defaultLoadIndexFile loadIndexFile = repo.LoadIndexFile
-func locateLatestAirbyteChart(chartName, chartVersion string) string {
+func locateLatestAirbyteChart(chartName, chartVersion, chartFlag string) string {
pterm.Debug.Printf("getting helm chart %q with version %q\n", chartName, chartVersion)
+ // If the --chart flag was given, use that.
+ if chartFlag != "" {
+ return chartFlag
+ }
+
// Helm will consider a local directory path named "airbyte/airbyte" to be a chart repo,
// but it might not be, which causes errors like "Chart.yaml file is missing".
// This trips up plenty of people, see: https://github.com/helm/helm/issues/7862
diff --git a/internal/cmd/local/local/locate_test.go b/internal/cmd/local/local/locate_test.go
index 0f87461..9977483 100644
--- a/internal/cmd/local/local/locate_test.go
+++ b/internal/cmd/local/local/locate_test.go
@@ -9,6 +9,14 @@ import (
"helm.sh/helm/v3/pkg/repo"
)
+func TestLocateChartFlag(t *testing.T) {
+ expect := "chartFlagValue"
+ c := locateLatestAirbyteChart("airbyte", "", expect)
+ if c != expect {
+ t.Errorf("expected %q but got %q", expect, c)
+ }
+}
+
func TestLocate(t *testing.T) {
origNewChartRepo := defaultNewChartRepo
origLoadIndexFile := defaultLoadIndexFile
@@ -90,7 +98,7 @@ func TestLocate(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
defaultLoadIndexFile = mockLoadIndexFile(repo.IndexFile{Entries: tt.entries})
- act := locateLatestAirbyteChart(airbyteChartName, "")
+ act := locateLatestAirbyteChart(airbyteChartName, "", "")
if d := cmp.Diff(tt.exp, act); d != "" {
t.Errorf("mismatch (-want +got):\n%s", d)
}
diff --git a/internal/cmd/local/local/log_utils_test.go b/internal/cmd/local/local/log_utils_test.go
index aa0759f..6cc0e2c 100644
--- a/internal/cmd/local/local/log_utils_test.go
+++ b/internal/cmd/local/local/log_utils_test.go
@@ -27,7 +27,7 @@ func TestJavaLogScanner(t *testing.T) {
expectLogLine := func(level, msg string) {
s.Scan()
-
+
if s.line.level != level {
t.Errorf("expected level %q but got %q", level, s.line.level)
}
@@ -58,5 +58,3 @@ func TestLastErrorLog(t *testing.T) {
t.Errorf("expected %q but got %q", expect, l)
}
}
-
-
diff --git a/internal/cmd/local/local/status.go b/internal/cmd/local/local/status.go
index d14e4a5..7548d5d 100644
--- a/internal/cmd/local/local/status.go
+++ b/internal/cmd/local/local/status.go
@@ -29,4 +29,4 @@ func (c *Command) Status(_ context.Context) error {
pterm.Info.Println(fmt.Sprintf("Airbyte should be accessible via http://localhost:%d", c.portHTTP))
return nil
-}
\ No newline at end of file
+}
diff --git a/internal/cmd/local/local_install.go b/internal/cmd/local/local_install.go
index 2d69ae1..474f91f 100644
--- a/internal/cmd/local/local_install.go
+++ b/internal/cmd/local/local_install.go
@@ -14,7 +14,8 @@ import (
)
type InstallCmd struct {
- ChartVersion string `default:"latest" help:"Version to install."`
+ Chart string `help:"Path to chart." xor:"chartver"`
+ ChartVersion string `default:"latest" help:"Version to install." xor:"chartver"`
DockerEmail string `group:"docker" help:"Docker email." env:"ABCTL_LOCAL_INSTALL_DOCKER_EMAIL"`
DockerPassword string `group:"docker" help:"Docker password." env:"ABCTL_LOCAL_INSTALL_DOCKER_PASSWORD"`
DockerServer string `group:"docker" default:"https://index.docker.io/v1/" help:"Docker server." env:"ABCTL_LOCAL_INSTALL_DOCKER_SERVER"`
@@ -114,6 +115,7 @@ func (i *InstallCmd) Run(ctx context.Context, provider k8s.Provider, telClient t
}
opts := local.InstallOpts{
+ HelmChartFlag: i.Chart,
HelmChartVersion: i.ChartVersion,
HelmValues: helmValues,
Secrets: i.Secret,
diff --git a/main.go b/main.go
index 565186d..9db299a 100644
--- a/main.go
+++ b/main.go
@@ -27,7 +27,6 @@ func main() {
func run(ctx context.Context) error {
-
var root cmd.Cmd
parser, err := kong.New(
&root,