From 3e6b1da0879c6546318494af902522222916e09d Mon Sep 17 00:00:00 2001 From: Marko Petrovic <22802784+gitbluf@users.noreply.github.com> Date: Fri, 30 Jun 2023 07:56:13 +0200 Subject: [PATCH] Update quickstart to support arm hardware(ex: M1) (#4457) * Add: arch selection for mysql image Update chart values and templates for mysql deployment Signed-off-by: gitbluf * Update: MySql image selector function to be more descriptive Signed-off-by: gitbluf * Remove: mysql image set on piped installation Signed-off-by: gitbluf * Update method name Signed-off-by: gitbluf --------- Signed-off-by: gitbluf --- manifests/pipecd/templates/deployment.yaml | 2 +- manifests/pipecd/values.yaml | 3 ++- pkg/app/pipectl/cmd/quickstart/quickstart.go | 21 +++++++++++++++++--- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/manifests/pipecd/templates/deployment.yaml b/manifests/pipecd/templates/deployment.yaml index 7da175b60d..57680d7384 100644 --- a/manifests/pipecd/templates/deployment.yaml +++ b/manifests/pipecd/templates/deployment.yaml @@ -354,7 +354,7 @@ spec: {{- end }} containers: - name: mysql - image: mysql:{{ .Values.mysql.imageTag }} + image: {{ .Values.mysql.image }}:{{ .Values.mysql.imageTag }} imagePullPolicy: IfNotPresent env: - name: MYSQL_ROOT_PASSWORD diff --git a/manifests/pipecd/values.yaml b/manifests/pipecd/values.yaml index c8dc4ab6bb..12cb4a1912 100644 --- a/manifests/pipecd/values.yaml +++ b/manifests/pipecd/values.yaml @@ -69,7 +69,8 @@ cloudSQLProxy: resources: {} mysql: - imageTag: "8.0.23" + image: mysql + imageTag: 8.0.33 resources: {} port: 3306 diff --git a/pkg/app/pipectl/cmd/quickstart/quickstart.go b/pkg/app/pipectl/cmd/quickstart/quickstart.go index e9581b8bf8..f217951a71 100644 --- a/pkg/app/pipectl/cmd/quickstart/quickstart.go +++ b/pkg/app/pipectl/cmd/quickstart/quickstart.go @@ -149,6 +149,8 @@ func (c *command) installControlPlane(ctx context.Context, helm string, input cl "--create-namespace", "--values", fmt.Sprintf(helmQuickstartValueRemotePath, c.version), + "--set", + fmt.Sprintf("mysql.image=%s", selectMySQLImage()), } var stderr, stdout bytes.Buffer @@ -312,6 +314,19 @@ func openbrowser(url string) error { return err } +func selectMySQLImage() string { + var mysqlImage string + switch runtime.GOARCH { + case "amd64": + mysqlImage = "mysql" + case "arm64": + mysqlImage = "arm64v8/mysql" + default: + mysqlImage = "mysql" + } + return mysqlImage +} + func (c *command) uninstallAll(ctx context.Context, helm string, input cli.Input) error { input.Logger.Info("Uninstalling PipeCD components...") @@ -380,9 +395,9 @@ func (c *command) getKubectl() (string, error) { } // getHelm finds and returns helm executable binary in the following priority: -// 1. pre-installed in command specified toolsDir (default is $HOME/.pipectl/tools) -// 2. $PATH -// 3. install new helm to command specified toolsDir +// 1. pre-installed in command specified toolsDir (default is $HOME/.pipectl/tools) +// 2. $PATH +// 3. install new helm to command specified toolsDir func (c *command) getHelm(ctx context.Context) (string, error) { binName := "helm"