This repository was archived by the owner on Jun 29, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +24
-68
lines changed Expand file tree Collapse file tree 5 files changed +24
-68
lines changed Original file line number Diff line number Diff line change
1
+
2
+ # Upgrade KDT Config v1 to v2
3
+
4
+ To upgrade from KDT config v1 to v2, update your Gemfile to
5
+ source v2 of KDT.
6
+
7
+ ```
8
+ source 'https://***REMOVED***'
9
+
10
+ group :kdt do
11
+ gem 'kube_deploy_tools', '~> 2'
12
+ end
13
+ ```
14
+
15
+ Then, run the upgrade:
16
+
17
+ ```
18
+ bundle install
19
+ bundle exec kdt upgrade
20
+ ```
Original file line number Diff line number Diff line change 9
9
require 'kube_deploy_tools/shellrunner'
10
10
11
11
DEPLOY_YAML = 'deploy.yaml'
12
- DEPLOY_YML_V1 = 'deploy.yml'
13
12
14
13
module KubeDeployTools
15
14
# Read-only model for the deploy.yaml configuration file.
@@ -40,11 +39,6 @@ def initialize(filename)
40
39
filename = DEPLOY_YAML
41
40
config = YAML . load_file ( filename )
42
41
break
43
- elsif filename . nil? && File . exist? ( DEPLOY_YML_V1 )
44
- Logger . warn ( 'Found deprecated v1 deploy.yml. Please run `kdt upgrade` to v2 deploy.yaml' )
45
- filename = DEPLOY_YML_V1
46
- config = YAML . load_file ( filename )
47
- break
48
42
end
49
43
50
44
# KDT should run in the directory containing the deploy config file.
@@ -56,7 +50,7 @@ def initialize(filename)
56
50
if ! filename . nil?
57
51
raise "Could not locate file: config file '#{ filename } ' in any directory"
58
52
else
59
- raise "Could not locate file: config file '#{ DEPLOY_YAML } ' nor ' #{ DEPLOY_YML_V1 } ' in any directory"
53
+ raise "Could not locate file: config file '#{ DEPLOY_YAML } ' in any directory"
60
54
end
61
55
end
62
56
if changed_dir
@@ -75,6 +69,8 @@ def initialize(filename)
75
69
case version
76
70
when 2
77
71
fetch_and_parse_version2_config!
72
+ else
73
+ raise "Unsupported version #{ version } "
78
74
end
79
75
end
80
76
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 57
57
expect ( config . artifacts ) . to include ( include ( 'name' => 'colo-service-prod' ) )
58
58
expect ( config . artifacts ) . to include ( include ( 'name' => 'us-east-1-prod' ) )
59
59
end
60
-
61
- it 'outputs the same yaml when trying to upgrade to the current version' do
62
- # Convert fixture to yaml, then re-read it
63
- Tempfile . open ( "deploy.yaml from fixture" ) do |t |
64
- fixture = File . open ( DEPLOY_YAML ) { |f | f . read ( ) }
65
- t << fixture
66
- t . close
67
-
68
- # Test fixing a v2 yaml: it should do nothing
69
- before = KubeDeployTools ::DeployConfigFile . new ( t . path )
70
- before . upgrade!
71
-
72
- # Re-read fixed v1-as-v2 yaml
73
- after = KubeDeployTools ::DeployConfigFile . new ( t . path )
74
-
75
- actual = after
76
- expected = config
77
-
78
- expect ( actual . artifacts ) . to eq ( expected . artifacts )
79
- expect ( actual . flavors ) . to eq ( expected . flavors )
80
- expect ( actual . hooks ) . to match_array ( expected . hooks )
81
- end
82
- end
83
60
end
84
61
85
62
context 'deploy.yamls with library files' do
Original file line number Diff line number Diff line change 70
70
prefix: local-registry
71
71
- name: gcp
72
72
driver: gcp
73
- prefix: ***REMOVED***
73
+ prefix: gcr.io/my-org
74
74
YAML
75
75
manifest . close
76
76
input_dir = Dir . mktmpdir
You can’t perform that action at this time.
0 commit comments