kube_cluster 0.4.2 → 0.4.4
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/.github/workflows/test.yaml +22 -0
- data/Gemfile.lock +3 -3
- data/kube_cluster.gemspec +1 -1
- data/lib/kube/cluster/manifest.rb +25 -0
- data/lib/kube/cluster/version.rb +1 -1
- data/lib/kube/helm/repo.rb +31 -22
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 34f6c89109b79b6be8137a3997de13bb5b0fce1c1d6b4993c62a9b8c742b0124
|
|
4
|
+
data.tar.gz: 2788eef6b86900c2e0abcb4a7d41630667da5509d6f8c3a29258e5e833aaf0e0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb9f12348b47e796dfd1d96cdc44200b600b062beee943d4343292f5546e5bd3d4bfa744b99df1eae3c6d5838530d0f4f796eae11746ac05154d0a488677efc7
|
|
7
|
+
data.tar.gz: be495978b1494e1dd84343de7e1aca23056c3d1b2cba811d42cb8c7a7ce9f5b70d96fae1c055ad26e73c767cfcad4bb68be50e6b043e677fddef738166cbf320
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on: [push, pull_request]
|
|
4
|
+
|
|
5
|
+
concurrency:
|
|
6
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
7
|
+
cancel-in-progress: true
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- uses: ruby/setup-ruby@v1
|
|
16
|
+
with:
|
|
17
|
+
ruby-version: "3.3"
|
|
18
|
+
bundler-cache: true
|
|
19
|
+
|
|
20
|
+
- run: sudo apt-get install -y ripgrep
|
|
21
|
+
|
|
22
|
+
- run: bundle exec scampi
|
data/Gemfile.lock
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
kube_cluster (0.4.
|
|
4
|
+
kube_cluster (0.4.4)
|
|
5
5
|
kube_kubectl (~> 2.0.9)
|
|
6
|
-
kube_schema (~> 1.4.
|
|
6
|
+
kube_schema (~> 1.4.3)
|
|
7
7
|
scampi (~> 0.1)
|
|
8
8
|
|
|
9
9
|
GEM
|
|
@@ -38,7 +38,7 @@ GEM
|
|
|
38
38
|
rubyshell (~> 1.5)
|
|
39
39
|
shellwords (~> 0.2.2)
|
|
40
40
|
string_builder (~> 1.2.2)
|
|
41
|
-
kube_schema (1.4.
|
|
41
|
+
kube_schema (1.4.3)
|
|
42
42
|
json_schemer (~> 2.5.0)
|
|
43
43
|
rubyshell (~> 1.5.0)
|
|
44
44
|
language_server-protocol (3.17.0.5)
|
data/kube_cluster.gemspec
CHANGED
|
@@ -33,6 +33,6 @@ Gem::Specification.new do |spec|
|
|
|
33
33
|
spec.add_development_dependency "rake", "~> 13.0"
|
|
34
34
|
spec.add_development_dependency "rubocop", "~> 1.21"
|
|
35
35
|
|
|
36
|
-
spec.add_dependency "kube_schema", "~> 1.4.
|
|
36
|
+
spec.add_dependency "kube_schema", "~> 1.4.3"
|
|
37
37
|
spec.add_dependency "kube_kubectl", "~> 2.0.9"
|
|
38
38
|
end
|
|
@@ -23,6 +23,31 @@ module Kube
|
|
|
23
23
|
#
|
|
24
24
|
class Manifest < Kube::Schema::Manifest
|
|
25
25
|
attr_reader :resources
|
|
26
|
+
|
|
27
|
+
# Override << to automatically upgrade Kube::Schema::Resource
|
|
28
|
+
# instances into Kube::Cluster::Resource instances. This ensures
|
|
29
|
+
# resources parsed via Kube::Schema::Manifest (e.g. from Helm
|
|
30
|
+
# charts or downloaded YAML) gain cluster-level methods like
|
|
31
|
+
# cluster_scoped?, pod_bearing?, and rebuild when composed into
|
|
32
|
+
# a cluster manifest.
|
|
33
|
+
def <<(item)
|
|
34
|
+
case item
|
|
35
|
+
when Kube::Cluster::Resource
|
|
36
|
+
@resources << item
|
|
37
|
+
when Kube::Schema::Resource
|
|
38
|
+
@resources << Kube::Cluster[item.kind].new(item.to_h)
|
|
39
|
+
when Kube::Schema::Manifest
|
|
40
|
+
item.each { |r| self << r }
|
|
41
|
+
when Array
|
|
42
|
+
item.each { |r| self << r }
|
|
43
|
+
else
|
|
44
|
+
raise ArgumentError,
|
|
45
|
+
"Expected a Kube::Schema::Resource or Manifest, got #{item.class}. " \
|
|
46
|
+
"Use Kube::Schema.parse(hash) to convert hashes."
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
self
|
|
50
|
+
end
|
|
26
51
|
end
|
|
27
52
|
end
|
|
28
53
|
end
|
data/lib/kube/cluster/version.rb
CHANGED
data/lib/kube/helm/repo.rb
CHANGED
|
@@ -46,13 +46,13 @@ module Kube
|
|
|
46
46
|
#
|
|
47
47
|
# @return [self]
|
|
48
48
|
def add
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
tap do
|
|
50
|
+
if endpoint.requires_add?
|
|
51
|
+
helm.run(
|
|
52
|
+
helm.call { repo.add.(@name).(endpoint.url) }.to_s
|
|
53
|
+
)
|
|
54
|
+
end
|
|
54
55
|
end
|
|
55
|
-
self
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
# Update the local chart index for this repo.
|
|
@@ -60,12 +60,13 @@ module Kube
|
|
|
60
60
|
#
|
|
61
61
|
# @return [self]
|
|
62
62
|
def update
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
tap do
|
|
64
|
+
if endpoint.requires_add?
|
|
65
|
+
helm.run(
|
|
66
|
+
helm.call { repo.update.(@name) }.to_s
|
|
67
|
+
)
|
|
68
|
+
end
|
|
67
69
|
end
|
|
68
|
-
self
|
|
69
70
|
end
|
|
70
71
|
|
|
71
72
|
# Remove this repo from the local Helm client.
|
|
@@ -73,12 +74,13 @@ module Kube
|
|
|
73
74
|
#
|
|
74
75
|
# @return [self]
|
|
75
76
|
def remove
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
tap do
|
|
78
|
+
if endpoint.requires_add?
|
|
79
|
+
helm.run(
|
|
80
|
+
helm.call { repo.remove.(@name) }.to_s
|
|
81
|
+
)
|
|
82
|
+
end
|
|
80
83
|
end
|
|
81
|
-
self
|
|
82
84
|
end
|
|
83
85
|
|
|
84
86
|
# Fetch a chart from this repo.
|
|
@@ -96,12 +98,19 @@ module Kube
|
|
|
96
98
|
|
|
97
99
|
ref = endpoint.chart_ref(chart_name, repo_name: @name)
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
helm.run(
|
|
102
|
+
helm.call {
|
|
103
|
+
if version
|
|
104
|
+
show.chart.(ref).version(version)
|
|
105
|
+
else
|
|
106
|
+
show.chart.(ref)
|
|
107
|
+
end
|
|
108
|
+
}.to_s
|
|
109
|
+
).then do |yaml_output|
|
|
110
|
+
(YAML.safe_load(yaml_output, permitted_classes: [Symbol]) || {}).then do |data|
|
|
111
|
+
Chart.new(data, ref: ref, cluster: @cluster)
|
|
112
|
+
end
|
|
113
|
+
end
|
|
105
114
|
end
|
|
106
115
|
|
|
107
116
|
# Is this an OCI-backed repo?
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kube_cluster
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nathan K
|
|
@@ -57,14 +57,14 @@ dependencies:
|
|
|
57
57
|
requirements:
|
|
58
58
|
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 1.4.
|
|
60
|
+
version: 1.4.3
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 1.4.
|
|
67
|
+
version: 1.4.3
|
|
68
68
|
- !ruby/object:Gem::Dependency
|
|
69
69
|
name: kube_kubectl
|
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -92,6 +92,7 @@ files:
|
|
|
92
92
|
- ".envrc"
|
|
93
93
|
- ".github/workflows/release.yml"
|
|
94
94
|
- ".github/workflows/tag-gem-version-bump.yml"
|
|
95
|
+
- ".github/workflows/test.yaml"
|
|
95
96
|
- ".gitignore"
|
|
96
97
|
- ".rubocop.yml"
|
|
97
98
|
- Gemfile
|