diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4cff83697..2e6606e41 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,10 +31,12 @@ jobs: run: make npm-install - name: Run npm build run: make npm-build + - name: Tag helm chart image + run: | + sed -i 's/latest/${{ steps.get_version.outputs.VERSION }}/g' charts/vela-core/values.yaml + sed -i 's/0.1.0/${{ steps.get_version.outputs.VERSION }}/g' charts/vela-core/Chart.yaml - name: Run generate-source run: make generate-source - - name: Tag helm chart image - run: sed -i 's/latest/${{ steps.get_version.outputs.VERSION }}/g' charts/vela-core/values.yaml - name: Run cross-build run: make cross-build - name: Run compress binary diff --git a/charts/vela-core/templates/kubevela-controller.yaml b/charts/vela-core/templates/kubevela-controller.yaml index d7296ee63..78563cb5d 100644 --- a/charts/vela-core/templates/kubevela-controller.yaml +++ b/charts/vela-core/templates/kubevela-controller.yaml @@ -111,9 +111,11 @@ spec: - "--use-webhook=true" - "--webhook-port={{ .Values.webhookService.port }}" - "--webhook-cert-dir={{ .Values.certificate.mountPath }}" + {{ end }} - "--health-addr=:{{ .Values.healthCheck.port }}" + {{ if ne .Values.disableCaps "" }} - "--disable-caps={{ .Values.disableCaps }}" - {{ end }} + {{ end }} image: {{ .Values.image.repository }}:{{ .Values.image.tag }} imagePullPolicy: {{ quote .Values.image.pullPolicy }} resources: diff --git a/cmd/core/main.go b/cmd/core/main.go index 3aaa089c7..a66027274 100644 --- a/cmd/core/main.go +++ b/cmd/core/main.go @@ -12,6 +12,8 @@ import ( "syscall" "time" + "github.com/oam-dev/kubevela/version" + monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1" "github.com/crossplane/crossplane-runtime/pkg/logging" "github.com/go-logr/logr" @@ -40,7 +42,6 @@ import ( "github.com/oam-dev/kubevela/pkg/controller/utils" velawebhook "github.com/oam-dev/kubevela/pkg/webhook" oamwebhook "github.com/oam-dev/kubevela/pkg/webhook/core.oam.dev/v1alpha2" - "github.com/oam-dev/kubevela/version" ) const ( @@ -67,9 +68,6 @@ func init() { } func main() { - - setupLog.Info(fmt.Sprintf("KubeVela Version: %s, GIT Revision: %s.", version.VelaVersion, version.GitRevision)) - var metricsAddr, logFilePath, leaderElectionNamespace string var enableLeaderElection, logCompress bool var logRetainDate int @@ -117,6 +115,9 @@ func main() { o.DestWritter = w })) + setupLog.Info(fmt.Sprintf("KubeVela Version: %s, GIT Revision: %s.", version.VelaVersion, version.GitRevision)) + setupLog.Info(fmt.Sprintf("Disable Capabilities: %s.", disableCaps)) + // install dependency charts first k8sClient, err := client.New(ctrl.GetConfigOrDie(), client.Options{Scheme: scheme}) if err != nil { diff --git a/pkg/commands/system.go b/pkg/commands/system.go index b6375a756..9567fc5b8 100644 --- a/pkg/commands/system.go +++ b/pkg/commands/system.go @@ -125,9 +125,9 @@ func NewInstallCommand(c types.Args, chartContent string, ioStreams cmdutil.IOSt flag := cmd.Flags() flag.StringVarP(&i.chartPath, "vela-chart-path", "p", "", "path to vela core chart to override default chart") - flag.StringVarP(&i.chartArgs.imagePullPolicy, "image-pull-policy", "", "IfNotPresent", "vela core image pull policy, this will align to chart value image.pullPolicy") - flag.StringVarP(&i.chartArgs.imageRepo, "image-repo", "", "oamdev/vela-core", "vela core image repo, this will align to chart value image.repo") - flag.StringVarP(&i.chartArgs.imageTag, "image-tag", "", "latest", "vela core image repo, this will align to chart value image.tag") + flag.StringVarP(&i.chartArgs.imagePullPolicy, "image-pull-policy", "", "", "vela core image pull policy, this will align to chart value image.pullPolicy") + flag.StringVarP(&i.chartArgs.imageRepo, "image-repo", "", "", "vela core image repo, this will align to chart value image.repo") + flag.StringVarP(&i.chartArgs.imageTag, "image-tag", "", "", "vela core image repo, this will align to chart value image.tag") flag.StringVarP(&i.waitReady, "wait", "w", "0s", "wait until vela-core is ready to serve, default will not wait") return cmd @@ -213,12 +213,19 @@ func CheckCapabilityReady(ctx context.Context, c types.Args, timeout time.Durati func (i *initCmd) resolveValues() (map[string]interface{}, error) { finalValues := map[string]interface{}{} - valuesConfig := []string{ - // TODO(wonderflow) values here could give more arguments in command line - fmt.Sprintf("image.repository=%s", i.chartArgs.imageRepo), - fmt.Sprintf("image.tag=%s", i.chartArgs.imageTag), - fmt.Sprintf("image.pullPolicy=%s", i.chartArgs.imagePullPolicy), + var valuesConfig []string + // By default align values.yaml in chart + if i.chartArgs.imageRepo != "" { + valuesConfig = append(valuesConfig, fmt.Sprintf("image.repository=%s", i.chartArgs.imageRepo)) } + if i.chartArgs.imageTag != "" { + valuesConfig = append(valuesConfig, fmt.Sprintf("image.tag=%s", i.chartArgs.imageTag)) + } + if i.chartArgs.imagePullPolicy != "" { + valuesConfig = append(valuesConfig, fmt.Sprintf("image.pullPolicy=%s", i.chartArgs.imagePullPolicy)) + } + // TODO(wonderflow) values here could give more arguments in command line + for _, val := range valuesConfig { // parses Helm strvals line and merges into a map for the final overrides for values.yaml if err := strvals.ParseInto(val, finalValues); err != nil {