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 Upgrade command #898

Closed
wants to merge 77 commits into from
Closed
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
92a5a4f
test
kschoche Oct 21, 2021
8171ec5
test
kschoche Oct 21, 2021
3ba20ec
change something
kschoche Oct 21, 2021
3a0f5a3
clean this up
kschoche Oct 21, 2021
08daf43
remove interface and make bootstrap part of Create
kschoche Oct 21, 2021
a7ad878
clean up the framework a bit
kschoche Oct 26, 2021
d0de8e6
Apply suggestions from code review
kschoche Oct 27, 2021
da47c6e
review comments
kschoche Oct 27, 2021
400fda6
fix lint
kschoche Oct 27, 2021
3808657
Merge branch 'vault-acceptance-base' into consul-vault-base
kschoche Oct 28, 2021
01e9974
Merge branch 'main' into consul-vault-base
kschoche Nov 1, 2021
80102a5
Bootstrap gossip encryption with Vault (#811)
kschoche Nov 12, 2021
9c515aa
Add configuration for the vault Connect CA provider (#872)
ishustava Nov 24, 2021
84f1a8e
Support Vault server running with TLS (#874)
ishustava Dec 1, 2021
13282c4
Made an initial try at the consul-k8s upgrade command. Running into i…
sadjamz Nov 15, 2021
a9260b3
Upgrade commit
sadjamz Nov 17, 2021
412117d
First pass at upgrade was successful.
sadjamz Nov 18, 2021
855a94f
notes from sync with Saad on what's left
ndhanushkodi Nov 23, 2021
bcfd881
Made an initial try at the consul-k8s upgrade command. Running into i…
sadjamz Nov 15, 2021
c01583e
Upgrade commit
sadjamz Nov 17, 2021
cdcccfd
First pass at upgrade was successful.
sadjamz Nov 18, 2021
eb68ee8
notes from sync with Saad on what's left
ndhanushkodi Nov 23, 2021
ed58f2f
Some basic cleanup
Dec 1, 2021
2666ff6
Remove TestDebugger
Dec 1, 2021
1a9dcf9
Remove validateLabels (unused)
Dec 2, 2021
fd8255d
Add the namespace and install flags
Dec 2, 2021
bf38f5b
Add flag test and remove install option
Dec 3, 2021
b6a91c2
Move presets into a config package
Dec 3, 2021
1fd8497
Add Changelog
Dec 3, 2021
e0f3b71
Fail if partitions enabled with federation (#892)
thisisnotashwin Dec 6, 2021
d08821b
Change error handling when scraping metrics (#551)
lkysow Dec 6, 2021
738d80e
Server TLS bootstrapping (#881)
kschoche Dec 7, 2021
5078a48
Merge branch 'main' into consul-vault-base
kschoche Dec 7, 2021
8107dd1
mod tidy
kschoche Dec 7, 2021
09f0ac2
fix merge error
kschoche Dec 7, 2021
ea85df1
add changelog entries
kschoche Dec 7, 2021
2e9da0d
cli: allow enterprise images to be named without the string "-ent" (#…
ndhanushkodi Dec 7, 2021
c1df868
Add support for ingressClassName
NiklasWagner Oct 12, 2021
adc71ca
Apply suggestions from code review
kschoche Dec 7, 2021
6c510cc
Reset ui ingress default to false
Dec 7, 2021
737b970
Test ingress UI with different Kube versions
Dec 7, 2021
5df0004
Apply suggestions from code review
kschoche Dec 7, 2021
5a728f4
Add Changelog entry for ingressClassName
Dec 7, 2021
053af17
Merge pull request #904 from hashicorp/consul-vault-base
kschoche Dec 7, 2021
aea9efe
Add docs about choosing storage class (#907)
lkysow Dec 7, 2021
6408674
Rename to exported services (#902)
thisisnotashwin Dec 8, 2021
ce6b2a7
Add support for tproxy for partitions test (#901)
thisisnotashwin Dec 8, 2021
e1badb2
Merge pull request #909 from hashicorp/ingress-class-name
Dec 8, 2021
b7f9331
Update service resolver/splitter/router with partitions (#908)
thisisnotashwin Dec 8, 2021
71a6bb6
Retry testing the merged metrics (#914)
lkysow Dec 8, 2021
4143aff
1.11.0 rc (#913)
thisisnotashwin Dec 8, 2021
f84fef0
Update version to 0.38.0 (#915)
thisisnotashwin Dec 8, 2021
dd1e1b0
Release v0.38.0
hc-github-team-consul-ecosystem Dec 8, 2021
aee48f0
Putting source back into Dev Mode
hc-github-team-consul-ecosystem Dec 8, 2021
45d065b
add psp support when its configured
kschoche Dec 9, 2021
363186b
go mod tidy vs 1.17
kschoche Dec 9, 2021
65a91a9
anony token
thisisnotashwin Dec 9, 2021
9c4bee4
Revert erronous commit
thisisnotashwin Dec 9, 2021
c4cafff
Merge pull request #917 from hashicorp/enable-psp-vault
kschoche Dec 10, 2021
e355006
Made an initial try at the consul-k8s upgrade command. Running into i…
sadjamz Nov 15, 2021
d575746
Upgrade commit
sadjamz Nov 17, 2021
8215641
First pass at upgrade was successful.
sadjamz Nov 18, 2021
8ce3d2c
notes from sync with Saad on what's left
ndhanushkodi Nov 23, 2021
ca14653
Made an initial try at the consul-k8s upgrade command. Running into i…
sadjamz Nov 15, 2021
3da54cd
Upgrade commit
sadjamz Nov 17, 2021
2920d3e
First pass at upgrade was successful.
sadjamz Nov 18, 2021
355be3c
notes from sync with Saad on what's left
ndhanushkodi Nov 23, 2021
56db257
Some basic cleanup
Dec 1, 2021
f5ccd78
Remove TestDebugger
Dec 1, 2021
61cf678
Remove validateLabels (unused)
Dec 2, 2021
7a409af
Add the namespace and install flags
Dec 2, 2021
1c660a6
Add flag test and remove install option
Dec 3, 2021
a0e2426
Move presets into a config package
Dec 3, 2021
ca1c6c0
Add Changelog
Dec 3, 2021
b770d3c
Merge branch 'cli-upgrade' of https://github.com/hashicorp/consul-k8s…
Dec 13, 2021
c05744f
Mark CHANGELOG update as BETA
Dec 13, 2021
e09f2e2
Remove namespace from upgrade
Dec 13, 2021
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
BREAKING CHANGES:
* Update minimum go version for project to 1.17 [[GH-878](https://github.com/hashicorp/consul-k8s/pull/878)]

FEATURES:
* CLI
* Add `upgrade` command to modify Consul installation on Kubernetes. [[GH-898](https://github.com/hashicorp/consul-k8s/pull/898)]
t-eckert marked this conversation as resolved.
Show resolved Hide resolved

IMPROVEMENTS:
* CLI
* Pre-check in the `install` command to verify the correct license secret exists when using an enterprise Consul image. [[GH-875](https://github.com/hashicorp/consul-k8s/pull/875)]
Expand Down
20 changes: 11 additions & 9 deletions cli/cmd/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ package install
import (
"errors"
"fmt"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"os"
"strings"
"sync"
"time"

k8serrors "k8s.io/apimachinery/pkg/api/errors"

consulChart "github.com/hashicorp/consul-k8s/charts"
"github.com/hashicorp/consul-k8s/cli/cmd/common"
"github.com/hashicorp/consul-k8s/cli/cmd/common/flag"
"github.com/hashicorp/consul-k8s/cli/cmd/common/terminal"
"github.com/hashicorp/consul-k8s/cli/config"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart/loader"
helmCLI "helm.sh/helm/v3/pkg/cli"
Expand Down Expand Up @@ -81,7 +83,7 @@ type Command struct {
func (c *Command) init() {
// Store all the possible preset values in 'presetList'. Printed in the help message.
var presetList []string
for name := range presets {
for name := range config.Presets {
presetList = append(presetList, name)
}

Expand Down Expand Up @@ -313,7 +315,7 @@ func (c *Command) Run(args []string) int {
// Without informing the user, default global.name to consul if it hasn't been set already. We don't allow setting
// the release name, and since that is hardcoded to "consul", setting global.name to "consul" makes it so resources
// aren't double prefixed with "consul-consul-...".
vals = mergeMaps(convert(globalNameConsul), vals)
vals = MergeMaps(config.Convert(config.GlobalNameConsul), vals)

// Dry Run should exit here, no need to actual locate/download the charts.
if c.flagDryRun {
Expand Down Expand Up @@ -454,15 +456,15 @@ func (c *Command) mergeValuesFlagsWithPrecedence(settings *helmCLI.EnvSettings)
}
if c.flagPreset != defaultPreset {
// Note the ordering of the function call, presets have lower precedence than set vals.
presetMap := presets[c.flagPreset].(map[string]interface{})
vals = mergeMaps(presetMap, vals)
presetMap := config.Presets[c.flagPreset].(map[string]interface{})
vals = MergeMaps(presetMap, vals)
}
return vals, err
}

// mergeMaps is a helper function used in Run. Merges two maps giving b precedent.
// MergeMaps is a helper function used in Run. Merges two maps giving b precedent.
// @source: https://github.com/helm/helm/blob/main/pkg/cli/values/options.go
func mergeMaps(a, b map[string]interface{}) map[string]interface{} {
func MergeMaps(a, b map[string]interface{}) map[string]interface{} {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored this out in another PR into a common package.

out := make(map[string]interface{}, len(a))
for k, v := range a {
out[k] = v
Expand All @@ -471,7 +473,7 @@ func mergeMaps(a, b map[string]interface{}) map[string]interface{} {
if v, ok := v.(map[string]interface{}); ok {
if bv, ok := out[k]; ok {
if bv, ok := bv.(map[string]interface{}); ok {
out[k] = mergeMaps(bv, v)
out[k] = MergeMaps(bv, v)
continue
}
}
Expand All @@ -492,7 +494,7 @@ func (c *Command) validateFlags(args []string) error {
if len(c.flagValueFiles) != 0 && c.flagPreset != defaultPreset {
return fmt.Errorf("Cannot set both -%s and -%s", flagNameConfigFile, flagNamePreset)
}
if _, ok := presets[c.flagPreset]; c.flagPreset != defaultPreset && !ok {
if _, ok := config.Presets[c.flagPreset]; c.flagPreset != defaultPreset && !ok {
return fmt.Errorf("'%s' is not a valid preset", c.flagPreset)
}
if !validLabel(c.flagNamespace) {
Expand Down
68 changes: 0 additions & 68 deletions cli/cmd/install/presets.go

This file was deleted.

Loading