stax-helm 0.0.13 → 0.0.16
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/lib/stax/helm/ingress.rb +1 -1
- data/lib/stax/helm/kubectl.rb +5 -0
- data/lib/stax/helm/runcmd.rb +3 -1
- data/lib/stax/helm/service.rb +32 -0
- data/lib/stax/helm/version.rb +1 -1
- data/lib/stax/helm.rb +1 -0
- 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: 248e19bb79bd6595b16d9fad7ce67f0cc15174759b9f8f284939012fcb262747
|
4
|
+
data.tar.gz: 8388af58e1fa1ce1c219a6a703831a7367248db7399ae32e2d86b66ea511ad76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73227a072f5c02f3a04f8cf1c342588cde0d9d7cb04766fdf49b473e73b144538018c449e52bbb0cb49e5fd662fd0a281eef0662a9ab97d2c7036c5c037e20dc
|
7
|
+
data.tar.gz: 2b7a4437c9987371c10ce03e11dc61a412ab0da83bf8d83a1f4af7a691d2a8d5add2d985132e398139261bf922eee3af928f0062a94e8cb2d44149d5c155def4
|
data/lib/stax/helm/ingress.rb
CHANGED
@@ -10,7 +10,7 @@ module Stax
|
|
10
10
|
|
11
11
|
desc 'dns', 'list external-dns hostnames'
|
12
12
|
def dns
|
13
|
-
jsonpath = '{.items[].metadata.annotations.external-dns\.alpha\.kubernetes\.io/hostname}
|
13
|
+
jsonpath = '{range .items[*]}{.metadata.annotations.external-dns\.alpha\.kubernetes\.io/hostname}{"\n"}{end}'
|
14
14
|
kubectl_run(:get, :ingresses, "-o=jsonpath='#{jsonpath}'", '-l', helm_selector)
|
15
15
|
end
|
16
16
|
|
data/lib/stax/helm/kubectl.rb
CHANGED
@@ -22,6 +22,11 @@ module Stax
|
|
22
22
|
def helm_selector
|
23
23
|
"app.kubernetes.io/instance=#{helm_release_name}"
|
24
24
|
end
|
25
|
+
|
26
|
+
## override this to match a component in your helm release
|
27
|
+
def helm_component_selector(component)
|
28
|
+
"app.kubernetes.io/instance=#{helm_release_name},app.kubernetes.io/component=#{component}"
|
29
|
+
end
|
25
30
|
end
|
26
31
|
|
27
32
|
desc 'services', 'list services'
|
data/lib/stax/helm/runcmd.rb
CHANGED
@@ -39,7 +39,9 @@ module Stax
|
|
39
39
|
|
40
40
|
## name for Job to create based on container
|
41
41
|
def helm_run_job
|
42
|
-
"
|
42
|
+
suffix = "-run-#{SecureRandom.hex(4)}"
|
43
|
+
prefix = helm_release_name.slice(0,63-suffix.length).sub(/-+$/, '') # ensure total name is <=63 chars
|
44
|
+
prefix + suffix
|
43
45
|
end
|
44
46
|
|
45
47
|
## default command to run
|
@@ -0,0 +1,32 @@
|
|
1
|
+
## tasks to work on services
|
2
|
+
module Stax
|
3
|
+
module Helm
|
4
|
+
class Cmd < Base
|
5
|
+
|
6
|
+
no_commands do
|
7
|
+
def helm_services
|
8
|
+
jsonpath = '{.items[*].metadata.name}'
|
9
|
+
%x[kubectl get services -o=jsonpath='#{jsonpath}' -l #{helm_selector}].split
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'services', 'list services'
|
14
|
+
def services
|
15
|
+
kubectl_run(:get, :services, '-l', helm_selector)
|
16
|
+
end
|
17
|
+
|
18
|
+
map :svc => :services
|
19
|
+
|
20
|
+
desc 'port-forward', 'port forward a service'
|
21
|
+
method_option :component, aliases: '-c', type: :string, default: 'web', desc: 'component to forward'
|
22
|
+
method_option :ports, aliases: '-p', type: :array, default: nil, desc: 'local:remote ports'
|
23
|
+
def port_forward
|
24
|
+
svc = kubectl_json(:get, :svc, '-l', helm_component_selector(options[:component]))['items'].first
|
25
|
+
name = svc.dig('metadata', 'name')
|
26
|
+
ports = options.fetch(:ports, svc.dig('spec', 'ports').map { |p| p['port'] })
|
27
|
+
kubectl_run('port-forward', "service/#{name}", ports.join(' '))
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/stax/helm/version.rb
CHANGED
data/lib/stax/helm.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stax-helm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Lister
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- lib/stax/helm/kubectl.rb
|
91
91
|
- lib/stax/helm/pod.rb
|
92
92
|
- lib/stax/helm/runcmd.rb
|
93
|
+
- lib/stax/helm/service.rb
|
93
94
|
- lib/stax/helm/stern.rb
|
94
95
|
- lib/stax/helm/version.rb
|
95
96
|
- stax-helm.gemspec
|
@@ -112,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
113
|
- !ruby/object:Gem::Version
|
113
114
|
version: '0'
|
114
115
|
requirements: []
|
115
|
-
rubygems_version: 3.1.
|
116
|
+
rubygems_version: 3.1.6
|
116
117
|
signing_key:
|
117
118
|
specification_version: 4
|
118
119
|
summary: Control helm charts with stax.
|