Skip to content
This repository was archived by the owner on Jun 29, 2023. It is now read-only.

Commit 96d4d4c

Browse files
Upgrade to KDT 3. (#41)
- Remove v1 to v2 upgrade codepath - Document how to upgrade from config v1 to v2 for posterity - Scrub some LiveRamp-specific artifact services Co-authored-by: Joshua Kwan <joshua.kwan@liveramp.com>
1 parent 5b2f01c commit 96d4d4c

File tree

5 files changed

+24
-68
lines changed

5 files changed

+24
-68
lines changed

documentation/upgrade_v1_to_v2.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
```

lib/kube_deploy_tools/deploy_config_file.rb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
require 'kube_deploy_tools/shellrunner'
1010

1111
DEPLOY_YAML = 'deploy.yaml'
12-
DEPLOY_YML_V1 = 'deploy.yml'
1312

1413
module KubeDeployTools
1514
# Read-only model for the deploy.yaml configuration file.
@@ -40,11 +39,6 @@ def initialize(filename)
4039
filename = DEPLOY_YAML
4140
config = YAML.load_file(filename)
4241
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
4842
end
4943

5044
# KDT should run in the directory containing the deploy config file.
@@ -56,7 +50,7 @@ def initialize(filename)
5650
if ! filename.nil?
5751
raise "Could not locate file: config file '#{filename}' in any directory"
5852
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"
6054
end
6155
end
6256
if changed_dir
@@ -75,6 +69,8 @@ def initialize(filename)
7569
case version
7670
when 2
7771
fetch_and_parse_version2_config!
72+
else
73+
raise "Unsupported version #{version}"
7874
end
7975
end
8076

spec/resources/deploy_v2.yaml

Lines changed: 0 additions & 37 deletions
This file was deleted.

spec/unit/deploy_config_file_spec.rb

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,29 +57,6 @@
5757
expect(config.artifacts).to include(include('name' => 'colo-service-prod'))
5858
expect(config.artifacts).to include(include('name' => 'us-east-1-prod'))
5959
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
8360
end
8461

8562
context 'deploy.yamls with library files' do

spec/unit/generate_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
prefix: local-registry
7171
- name: gcp
7272
driver: gcp
73-
prefix: ***REMOVED***
73+
prefix: gcr.io/my-org
7474
YAML
7575
manifest.close
7676
input_dir = Dir.mktmpdir

0 commit comments

Comments
 (0)