kuby-kube-db 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4948f767c31be6c14b6a9a31cf63e374afb3996cd37697576ac2c527ca27351
4
- data.tar.gz: 5992a1179de471e76d14d275c4c2de230b176b9f86b5c3b58ce48d02b9405c90
3
+ metadata.gz: 410cd6089e3ecf3de0324d3969ad8afa36a3787f962c664957fcad5d90629d58
4
+ data.tar.gz: ed650147e64258ebf60b350168ce9df7e389393134cf554c6d3893dcafafc26d
5
5
  SHA512:
6
- metadata.gz: e1d47996d8f5e155b64b7c26465869c35d26fad02c17b60d016346a92e0cc6035e8daeeb81df3bfb721f7a486bb2923ca6bddd6a1bcd81d4c9b0c3affec966a6
7
- data.tar.gz: 19aed56496c8c075a3a70c6ae753a0046139f2dcea859663326ac9d98d01e3e9dcf33169d47e6d8fdd3c92036a6328f473685eba9a1867d6be1807611e674321
6
+ metadata.gz: 05cd94f38afede349d7c63a08eac7d96435a924a5d912e97bad63e869660d71c9b87a84c1c7941c30eadb7107695c8c61342909b11f0d6560d4c6ee193a82181
7
+ data.tar.gz: e8b8a3a13b4023a2f237096e14773e60c3d0e75493c9dcaaad2bac3df383e4c2a1eee451e1076ea94cad477a9ac918eccd681ed470448762e7fcd9bccdcfbf07
@@ -1,3 +1,7 @@
1
+ ## 0.6.0
2
+ * Wait for API resources to become available.
3
+ - Krane queries k8s for API resources which causes kubectl to exit with a non-zero status code if KubeDB's operator isn't finished spinning up.
4
+
1
5
  ## 0.5.0
2
6
  * Conform to new plugin architecture.
3
7
  * Accept `environment` instead of `definition` instances.
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
12
12
 
13
13
  s.platform = Gem::Platform::RUBY
14
14
 
15
- s.add_dependency 'helm-cli', '~> 0.2'
15
+ s.add_dependency 'helm-cli', '~> 0.3'
16
16
  s.add_dependency 'kube-dsl', '~> 0.3'
17
17
 
18
18
  s.require_path = 'lib'
@@ -6,6 +6,7 @@ module Kuby
6
6
  module KubeDB
7
7
  class KubeDBError < StandardError; end
8
8
  class OperatorDeployError < KubeDBError; end
9
+ class APIResourcesError < KubeDBError; end
9
10
 
10
11
  class Plugin < ::Kuby::Plugin
11
12
  NAMESPACE = 'kube-system'.freeze
@@ -16,8 +17,8 @@ module Kuby
16
17
  CATALOG_RELEASE_NAME = 'kubedb-catalog'.freeze
17
18
  OPERATOR_CHART_NAME = 'appscode/kubedb'.freeze
18
19
  CATALOG_CHART_NAME = 'appscode/kubedb-catalog'.freeze
19
- OPERATOR_WAIT_INTERVAL = 5 # seconds
20
- OPERATOR_WAIT_MAX = 60 # seconds
20
+ WAIT_INTERVAL = 5 # seconds
21
+ WAIT_MAX = 120 # seconds
21
22
 
22
23
  OPERATOR_PARAMS = {
23
24
  'apiserver.enableValidatingWebhook' => 'true',
@@ -40,6 +41,10 @@ module Kuby
40
41
  Kuby.logger.info('Waiting for kubedb operator deployment')
41
42
  end
42
43
 
44
+ wait_for_api_resources do
45
+ Kuby.logger.info('Waiting for API resources to become available')
46
+ end
47
+
43
48
  Kuby.logger.info('Deploying kubedb catalog')
44
49
  catalog_deployed? ? upgrade_catalog : install_catalog
45
50
 
@@ -88,15 +93,35 @@ module Kuby
88
93
  loop do
89
94
  break if operator_ready?
90
95
 
91
- if time_elapsed >= OPERATOR_WAIT_MAX
96
+ if time_elapsed >= WAIT_MAX
92
97
  raise OperatorDeployError, 'timeout waiting for operator to start. '\
93
98
  "Waited #{time_elapsed}s."
94
99
  end
95
100
 
96
101
  yield
97
102
 
98
- sleep OPERATOR_WAIT_INTERVAL
99
- time_elapsed += OPERATOR_WAIT_INTERVAL
103
+ sleep WAIT_INTERVAL
104
+ time_elapsed += WAIT_INTERVAL
105
+ end
106
+ end
107
+
108
+ def wait_for_api_resources
109
+ time_elapsed = 0
110
+
111
+ loop do
112
+ begin
113
+ if time_elapsed >= WAIT_MAX
114
+ raise APIResourcesError, 'timeout waiting for API resources to '\
115
+ "become available. Waited #{time_elapsed}s."
116
+ end
117
+
118
+ kubernetes_cli.api_resources
119
+ break
120
+ rescue KubernetesCLI::KubernetesError
121
+ yield
122
+ sleep WAIT_INTERVAL
123
+ time_elapsed += WAIT_INTERVAL
124
+ end
100
125
  end
101
126
  end
102
127
 
@@ -168,7 +193,7 @@ module Kuby
168
193
  end
169
194
 
170
195
  def helm_cli
171
- @helm_cli ||= HelmCLI.new(provider.kubeconfig_path)
196
+ provider.helm_cli
172
197
  end
173
198
 
174
199
  def kubernetes_cli
@@ -1,6 +1,6 @@
1
1
  module Kuby
2
2
  module KubeDB
3
- VERSION = '0.5.0'.freeze
3
+ VERSION = '0.6.0'.freeze
4
4
  KUBEDB_VERSION = '0.12.0'.freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuby-kube-db
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Dutro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-30 00:00:00.000000000 Z
11
+ date: 2020-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: helm-cli
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.2'
19
+ version: '0.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.2'
26
+ version: '0.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: kube-dsl
29
29
  requirement: !ruby/object:Gem::Requirement