kuber_kit 1.2.7 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +4 -0
- data/lib/kuber_kit/container.rb +4 -0
- data/lib/kuber_kit/service_deployer/strategies/helm.rb +41 -0
- data/lib/kuber_kit/service_deployer/strategies/kubernetes.rb +8 -2
- data/lib/kuber_kit/shell/commands/helm_commands.rb +42 -0
- data/lib/kuber_kit/shell/commands/kubectl_commands.rb +3 -2
- data/lib/kuber_kit/version.rb +1 -1
- data/lib/kuber_kit.rb +2 -0
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6afb44a6d4d220f74b0254b1334eb8c1a54eaed3bb343ac701a88bc25f2afcaa
|
4
|
+
data.tar.gz: dde0f72facc6c08af028bc32ba2d024b1838e036836e94f2785695e43f948d96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 383427ada7a5ca0ecd9a6db9c6747ecdf830866d2a7ea890706b5201566fa8e4aa59b868b6b49c94ab3524c7f5d7f8e85a8ea137e9d8c973d825d8aef028f1dc
|
7
|
+
data.tar.gz: 66c2f065953353e283dc5986582e5d440b03c2e3e532dd70c717e91288aa15d99b872c1eb337b23dc9a4fd4873c72ded43dcd0fd5f630cf579ae76e01c652eeb
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.2.
|
1
|
+
3.2.2
|
data/CHANGELOG.md
CHANGED
data/lib/kuber_kit/container.rb
CHANGED
@@ -181,6 +181,10 @@ class KuberKit::Container
|
|
181
181
|
KuberKit::Shell::Commands::SystemCommands.new
|
182
182
|
end
|
183
183
|
|
184
|
+
register "shell.helm_commands" do
|
185
|
+
KuberKit::Shell::Commands::HelmCommands.new
|
186
|
+
end
|
187
|
+
|
184
188
|
register "shell.local_shell" do
|
185
189
|
KuberKit::Shell::LocalShell.new
|
186
190
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class KuberKit::ServiceDeployer::Strategies::Helm < KuberKit::ServiceDeployer::Strategies::Abstract
|
2
|
+
include KuberKit::Import[
|
3
|
+
"service_reader.reader",
|
4
|
+
"shell.helm_commands",
|
5
|
+
"shell.bash_commands",
|
6
|
+
"configs",
|
7
|
+
]
|
8
|
+
|
9
|
+
Contract KuberKit::Shell::AbstractShell, KuberKit::Core::Service => Any
|
10
|
+
def deploy(shell, service)
|
11
|
+
service_config = reader.read(shell, service)
|
12
|
+
chart_root_path = File.join(configs.service_config_dir, "#{service.name}_chart")
|
13
|
+
chart_templates_path = File.join(chart_root_path, "templates")
|
14
|
+
chart_config_path = File.join(chart_root_path, "Chart.yaml")
|
15
|
+
release_path = File.join(chart_templates_path, "release.yaml")
|
16
|
+
|
17
|
+
bash_commands.mkdir_p(shell, File.dirname(chart_root_path))
|
18
|
+
bash_commands.mkdir_p(shell, File.dirname(chart_templates_path))
|
19
|
+
|
20
|
+
shell.write(release_path, service_config)
|
21
|
+
shell.write(chart_config_path, chart_config_content(service.uri))
|
22
|
+
|
23
|
+
kubeconfig_path = KuberKit.current_configuration.kubeconfig_path
|
24
|
+
namespace = KuberKit.current_configuration.deployer_namespace
|
25
|
+
|
26
|
+
upgrade_result = helm_commands.upgrade(shell, chart_root_path, kubeconfig_path: kubeconfig_path, namespace: namespace)
|
27
|
+
|
28
|
+
upgrade_result
|
29
|
+
end
|
30
|
+
|
31
|
+
def chart_config_content(release_name)
|
32
|
+
query = <<-CHART
|
33
|
+
apiVersion: v2
|
34
|
+
name: #{release_name}
|
35
|
+
description: #{release_name}
|
36
|
+
type: application
|
37
|
+
version: 1.0.0
|
38
|
+
appVersion: "1.0.0"
|
39
|
+
CHART
|
40
|
+
end
|
41
|
+
end
|
@@ -10,7 +10,8 @@ class KuberKit::ServiceDeployer::Strategies::Kubernetes < KuberKit::ServiceDeplo
|
|
10
10
|
:resource_name,
|
11
11
|
:delete_if_exists,
|
12
12
|
:restart_if_exists,
|
13
|
-
:wait_for_rollout
|
13
|
+
:wait_for_rollout,
|
14
|
+
:apply_command
|
14
15
|
]
|
15
16
|
|
16
17
|
Contract KuberKit::Shell::AbstractShell, KuberKit::Core::Service => Any
|
@@ -40,7 +41,12 @@ class KuberKit::ServiceDeployer::Strategies::Kubernetes < KuberKit::ServiceDeplo
|
|
40
41
|
kubectl_commands.delete_resource(shell, resource_type, resource_name, kubeconfig_path: kubeconfig_path, namespace: namespace)
|
41
42
|
end
|
42
43
|
|
43
|
-
apply_result = kubectl_commands.apply_file(
|
44
|
+
apply_result = kubectl_commands.apply_file(
|
45
|
+
shell, config_path,
|
46
|
+
kubeconfig_path: kubeconfig_path,
|
47
|
+
namespace: namespace,
|
48
|
+
apply_command: strategy_options.fetch(:apply_command, "apply")
|
49
|
+
)
|
44
50
|
|
45
51
|
restart_enabled = strategy_options.fetch(:restart_if_exists, true)
|
46
52
|
wait_for_rollout = strategy_options.fetch(:wait_for_rollout, true)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class KuberKit::Shell::Commands::HelmCommands
|
2
|
+
Contract KuberKit::Shell::AbstractShell, Or[String, ArrayOf[String]], KeywordArgs[
|
3
|
+
kubeconfig_path: Maybe[Or[
|
4
|
+
String, KuberKit::Core::ArtifactPath
|
5
|
+
]],
|
6
|
+
namespace: Maybe[Or[Symbol, String]],
|
7
|
+
interactive: Optional[Bool],
|
8
|
+
] => Any
|
9
|
+
def helm_run(shell, command_list, kubeconfig_path: nil, namespace: nil, interactive: false)
|
10
|
+
command_parts = []
|
11
|
+
|
12
|
+
if kubeconfig_path.is_a?(KuberKit::Core::ArtifactPath)
|
13
|
+
kubeconfig_path = artifact_path_resolver.call(kubeconfig_path)
|
14
|
+
end
|
15
|
+
|
16
|
+
if kubeconfig_path
|
17
|
+
command_parts << "KUBECONFIG=#{kubeconfig_path}"
|
18
|
+
end
|
19
|
+
|
20
|
+
command_parts << "helm"
|
21
|
+
|
22
|
+
if namespace
|
23
|
+
command_parts << "-n #{namespace}"
|
24
|
+
end
|
25
|
+
|
26
|
+
command_parts += Array(command_list).compact
|
27
|
+
|
28
|
+
if interactive
|
29
|
+
shell.interactive!(command_parts.join(" "))
|
30
|
+
else
|
31
|
+
shell.exec!(command_parts.join(" "))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def install(shell, release_name, chart_path, kubeconfig_path: nil, namespace: nil)
|
36
|
+
helm_run(shell, "install #{release_name} #{chart_path}", kubeconfig_path: kubeconfig_path, namespace: namespace)
|
37
|
+
end
|
38
|
+
|
39
|
+
def upgrade(shell, release_name, chart_path, kubeconfig_path: nil, namespace: nil)
|
40
|
+
helm_run(shell, "upgrade #{release_name} #{chart_path} --install", kubeconfig_path: kubeconfig_path, namespace: namespace)
|
41
|
+
end
|
42
|
+
end
|
@@ -39,8 +39,9 @@ class KuberKit::Shell::Commands::KubectlCommands
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
def apply_file(shell, file_path, kubeconfig_path: nil, namespace: nil)
|
43
|
-
|
42
|
+
def apply_file(shell, file_path, kubeconfig_path: nil, namespace: nil, apply_command: nil)
|
43
|
+
apply_command ||= "apply"
|
44
|
+
kubectl_run(shell, "#{apply_command} -f #{file_path}", kubeconfig_path: kubeconfig_path, namespace: namespace)
|
44
45
|
end
|
45
46
|
|
46
47
|
def exec(shell, pod_name, command, args: nil, kubeconfig_path: nil, interactive: false, namespace: nil, entrypoint: nil)
|
data/lib/kuber_kit/version.rb
CHANGED
data/lib/kuber_kit.rb
CHANGED
@@ -104,6 +104,7 @@ module KuberKit
|
|
104
104
|
autoload :RsyncCommands, 'shell/commands/rsync_commands'
|
105
105
|
autoload :KubectlCommands, 'shell/commands/kubectl_commands'
|
106
106
|
autoload :SystemCommands, 'shell/commands/system_commands'
|
107
|
+
autoload :HelmCommands, 'shell/commands/helm_commands'
|
107
108
|
end
|
108
109
|
end
|
109
110
|
|
@@ -166,6 +167,7 @@ module KuberKit
|
|
166
167
|
autoload :Docker, 'service_deployer/strategies/docker'
|
167
168
|
autoload :DockerCompose, 'service_deployer/strategies/docker_compose'
|
168
169
|
autoload :Kubernetes, 'service_deployer/strategies/kubernetes'
|
170
|
+
autoload :Helm, 'service_deployer/strategies/helm'
|
169
171
|
end
|
170
172
|
end
|
171
173
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuber_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iskander Khaziev
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: contracts
|
@@ -343,6 +343,7 @@ files:
|
|
343
343
|
- lib/kuber_kit/service_deployer/strategies/abstract.rb
|
344
344
|
- lib/kuber_kit/service_deployer/strategies/docker.rb
|
345
345
|
- lib/kuber_kit/service_deployer/strategies/docker_compose.rb
|
346
|
+
- lib/kuber_kit/service_deployer/strategies/helm.rb
|
346
347
|
- lib/kuber_kit/service_deployer/strategies/kubernetes.rb
|
347
348
|
- lib/kuber_kit/service_deployer/strategy_detector.rb
|
348
349
|
- lib/kuber_kit/service_reader/action_handler.rb
|
@@ -353,6 +354,7 @@ files:
|
|
353
354
|
- lib/kuber_kit/shell/commands/docker_commands.rb
|
354
355
|
- lib/kuber_kit/shell/commands/docker_compose_commands.rb
|
355
356
|
- lib/kuber_kit/shell/commands/git_commands.rb
|
357
|
+
- lib/kuber_kit/shell/commands/helm_commands.rb
|
356
358
|
- lib/kuber_kit/shell/commands/kubectl_commands.rb
|
357
359
|
- lib/kuber_kit/shell/commands/rsync_commands.rb
|
358
360
|
- lib/kuber_kit/shell/commands/system_commands.rb
|
@@ -382,7 +384,7 @@ homepage: https://github.com/ArtStation/kuber_kit
|
|
382
384
|
licenses:
|
383
385
|
- MIT
|
384
386
|
metadata: {}
|
385
|
-
post_install_message:
|
387
|
+
post_install_message:
|
386
388
|
rdoc_options: []
|
387
389
|
require_paths:
|
388
390
|
- lib
|
@@ -397,8 +399,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
397
399
|
- !ruby/object:Gem::Version
|
398
400
|
version: '0'
|
399
401
|
requirements: []
|
400
|
-
rubygems_version: 3.4.
|
401
|
-
signing_key:
|
402
|
+
rubygems_version: 3.4.10
|
403
|
+
signing_key:
|
402
404
|
specification_version: 4
|
403
405
|
summary: Docker Containers Build & Deployment
|
404
406
|
test_files: []
|