Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cli flag to enable skipping dapr install #120

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/rust:1": {},
"ghcr.io/devcontainers/features/go:1": {},
"ghcr.io/devcontainers/features/node:1": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {},
"ghcr.io/devcontainers-extra/features/kind:1": {}
}
}
8 changes: 7 additions & 1 deletion cli/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ Usage examples:
clusterConfig.DaprSidecarVersion = sidecarVersion
saveConfig(clusterConfig)

var skipDaprInstall bool
if skipDaprInstall, err = cmd.Flags().GetBool("skip-dapr-install"); err != nil {
return err
}

if installer, err = service.MakeInstaller(namespace); err != nil {
return err
}
Expand All @@ -92,7 +97,7 @@ Usage examples:
output := output.NewTaskOutput()
defer output.Close()

if err := installer.Install(local, registry, version, output, namespace); err != nil {
if err := installer.Install(local, registry, version, output, namespace, skipDaprInstall); err != nil {
return err
}

Expand All @@ -106,5 +111,6 @@ Usage examples:
initCommand.Flags().StringP("namespace", "n", "drasi-system", "Kubernetes namespace to install Drasi into.")
initCommand.Flags().String("dapr-runtime-version", "1.10.0", "Dapr runtime version to install.")
initCommand.Flags().String("dapr-sidecar-version", "1.9.0", "Dapr sidecar (daprd) version to install.")
initCommand.Flags().Bool("skip-dapr-install", false, "Skip installing Dapr runtime and sidecar.")
return initCommand
}
20 changes: 12 additions & 8 deletions cli/service/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,22 @@ func MakeInstaller(namespace string) (*Installer, error) {
return &result, nil
}

func (t *Installer) Install(localMode bool, acr string, version string, output output.TaskOutput, namespace string) error {
daprInstalled, err := t.checkDaprInstallation(output)
if err != nil {
return err
}
if !daprInstalled {
if err = t.installDapr(output); err != nil {
func (t *Installer) Install(localMode bool, acr string, version string, output output.TaskOutput, namespace string, skipDaprInstall bool) error {

if !skipDaprInstall {
daprInstalled, err := t.checkDaprInstallation(output)
if err != nil {
return err
}
if !daprInstalled {
if err = t.installDapr(output); err != nil {
return err
}
}
}

if err = t.createConfig(localMode, acr, version); err != nil {
err := t.createConfig(localMode, acr, version)
if err != nil {
return err
}

Expand Down