k8s-ruby 0.17.1 → 0.18.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4fa98756521985595b9431153e2835ac7b52d85997610f0d6e8e5236e51f1de5
4
- data.tar.gz: 3f024921180350a153995ef782f924e390e8cd6aacfe7be753a703d96426d34b
3
+ metadata.gz: a91490b13f752ae7062cf986b6ed7e3e0eaced0c81f0ed8df1072b34a0fe0b68
4
+ data.tar.gz: 16b22333dda9aee3d1a8d149b6e1a5e4f2639c2aab39f7983b3a7d765da9cc36
5
5
  SHA512:
6
- metadata.gz: d2d9a64c1a8410796b0c14d7074746f52ca59ee5cf42be952b87258c42666031d226b3e1e52901a53e29b07f730ba2ba054d7d79a319f6ba8b2c04d5f4ef5435
7
- data.tar.gz: 71fdbba2af07f589984e01f6985d3954e17a7433e8aa032b63a87019ff22e7883745618343d9fdf2ad21ed29deb18d3951c3e6dc0de40373a2a90b97cc61abf2
6
+ metadata.gz: f3bba4862aa466faf91e25d4a47d32752fd3dbcae6331c8c5b396e10d311fe0676f37db14be2422028d73bc17bc36eb811dbb3cf51823fcc962b28c0247e5a1f
7
+ data.tar.gz: 4a123b134179c155a4494b3ebd788200f171b8698bc488377293b867451589db482eba2a1ee5897908bd207fb537c7b0644389af764279ef0ddcb8c1485c3a7d
@@ -0,0 +1,178 @@
1
+ # stub to call common GitHub Action (GA) as part of Continuous Integration (CI) Pull Request process checks for main branch
2
+ # inputs are described in the chef/common-github-actions/<GA.yml> with same name as this stub
3
+ #
4
+ # secrets are inherited from the calling workflow, typically SONAR_TOKEN, SONAR_HOST_URL, GH_TOKEN, AKEYLESS_JWT_ID, POLARIS_SERVER_URL and POLARIS_ACCESS_TOKEN
5
+
6
+ name: CI Pull Request on Main Branch
7
+
8
+ on:
9
+ pull_request:
10
+ branches: [ main, release/** ]
11
+ push:
12
+ branches: [ main, release/** ]
13
+
14
+ workflow_dispatch:
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ env:
20
+ STUB_VERSION: "1.0.8"
21
+
22
+ jobs:
23
+ echo_version:
24
+ name: 'Echo stub version'
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - name: echo version of stub and inputs
28
+ run: |
29
+ echo "CI main pull request stub version $STUB_VERSION"
30
+
31
+ detect-custom-metadata:
32
+ name: 'Detect custom properties'
33
+ runs-on: ubuntu-latest
34
+ outputs:
35
+ primaryApplication: ${{ steps.set-custom-metadata.outputs.primaryApplication }}
36
+ appBuildLanguage: ${{ steps.set-custom-metadata.outputs.applicationBuildLanguage }}
37
+ appBuildProfile: ${{ steps.set-custom-metadata.outputs.applicationBuildProfile }}
38
+ versionFromFile: ${{ steps.set-version-from-file.outputs.versionFromFile }}
39
+ steps:
40
+ - name: 'Checkout repository'
41
+ uses: actions/checkout@v4
42
+
43
+ - name: 'Detect version from file'
44
+ id: set-version-from-file
45
+ shell: bash
46
+ run: |
47
+ if [[ -f "VERSION" ]]; then
48
+ version=$(head -1 VERSION)
49
+ echo "VERSION_FROM_FILE=${version}" >> $GITHUB_ENV
50
+ echo "versionFromFile=${version}" >> $GITHUB_OUTPUT
51
+ elif [[ -f "go.mod" ]]; then
52
+ version=$(grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+' go.mod | head -1)
53
+ echo "VERSION_FROM_FILE=${version}" >> $GITHUB_ENV
54
+ echo "versionFromFile=${version}" >> $GITHUB_OUTPUT
55
+ else
56
+ echo "VERSION_FROM_FILE not found, defaulting to empty"
57
+ echo "versionFromFile=" >> $GITHUB_OUTPUT
58
+ fi
59
+ # do not do echo "::set-output name=versionFromFile::$version" any more per https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
60
+
61
+ - name: 'Detect app, language, and build profile environment variables from repository custom properties'
62
+ id: set-custom-metadata
63
+ # GH API returns something like [{"property_name":"GABuildLanguage","value":"go"},{"property_name":"GABuildProfile","value":"cli"},{"property_name":"primaryApplication","value":"chef-360"}]'
64
+ run: |
65
+ response=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/${{ github.repository }}/properties/values)
66
+
67
+ primaryApplication=$(echo "$response" | jq -r '.[] | select(.property_name=="primaryApplication") | .value')
68
+ GABuildLanguage=$(echo "$response" | jq -r '.[] | select(.property_name=="GABuildLanguage") | .value')
69
+ GABuildProfile=$(echo "$response" | jq -r '.[] | select(.property_name=="GABuildProfile") | .value')
70
+
71
+ echo "PRIMARY_APPLICATION=$primaryApplication" >> $GITHUB_ENV
72
+ echo "GA_BUILD_LANGUAGE=$GABuildLanguage" >> $GITHUB_ENV
73
+ echo "GA_BUILD_PROFILE=$GABuildProfile" >> $GITHUB_ENV
74
+
75
+ # If workflow_dispatch, use inputs (left), if other trigger, use default env (right)
76
+ echo "primaryApplication=${primaryApplication}" >> $GITHUB_OUTPUT
77
+ echo "applicationBuildLanguage=${GABuildLanguage}" >> $GITHUB_OUTPUT
78
+ echo "applicationBuildProfile=${GABuildProfile}" >> $GITHUB_OUTPUT
79
+ continue-on-error: true
80
+ env:
81
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82
+
83
+ call-ci-main-pr-check-pipeline:
84
+ uses: chef/common-github-actions/.github/workflows/ci-main-pull-request.yml@main
85
+ # needs: [detect-custom-metadata, detect-version-from-file]
86
+ needs: [detect-custom-metadata]
87
+ secrets: inherit
88
+ permissions:
89
+ id-token: write
90
+ contents: read
91
+
92
+ with:
93
+ application: ${{ needs.detect-custom-metadata.outputs.primaryApplication }}
94
+ visibility: ${{ github.event.repository.visibility }} # private, public, or internal
95
+ # go-private-modules: GOPRIVATE for Go private modules, default is 'github.com/progress-platform-services/*
96
+
97
+ # if version specified, it takes precedence; can be a semver like 1.0.2-xyz or a tag like "latest"
98
+ version: ${{ needs.detect-custom-metadata.outputs.versionFromFile || '1.0.0' }}
99
+ detect-version-source-type: 'file' # options include "none" (do not detect), "file", "github-tag" or "github-release"
100
+ detect-version-source-parameter: '' # use for file name
101
+ language: ${{ needs.detect-custom-metadata.outputs.appBuildLanguage }} # Go, Ruby, Rust, JavaScript, TypeScript, Python, Java, C#, PHP, other - used for build and SonarQube language setting
102
+
103
+ # complexity-checks, linting, trufflehog and trivy
104
+ perform-complexity-checks: true
105
+ # scc-output-filename: 'scc-output.txt'
106
+ perform-language-linting: true # Perform language-specific linting and pre-compilation checks
107
+ perform-trufflehog-scan: true
108
+ perform-trivy-scan: true
109
+
110
+ # perform application build and unit testing, will use custom repository properties when implemented for chef-primary-application, chef-build-profile, and chef-build-language
111
+ build: true
112
+ build-profile: ${{ needs.detect-custom-metadata.outputs.appBuildProfile }}
113
+ unit-tests: false
114
+ unit-test-output-path: "path/to/file.out"
115
+ unit-test-command-override: ""
116
+
117
+ # BlackDuck SAST (Polaris) require a build or binary present in repo to do SAST testing
118
+ # requires these secrets: POLARIS_SERVER_URL, POLARIS_ACCESS_TOKEN
119
+ perform-blackduck-polaris: false
120
+ polaris-application-name: "Chef-Agents" # one of these: Chef-Agents, Chef-Automate, Chef-Chef360, Chef-Habitat, Chef-Infrastructure-Server, Chef-Shared-Services, Chef-Other, Chef-Non-Product
121
+ polaris-project-name: ${{ github.event.repository.name }} # arch-sample-cli
122
+ polaris-working-directory: '.' # Working directory for the scan, defaults to . but usually lang-dependent like ./src
123
+ polaris-coverity-build-command: 'go build -o bin/chef-cli.exe' # Coverity build command, typically done in build stage by language or here as param 1-liner like "mvn clean install"
124
+ polaris-coverity-clean-command: 'go clean' # Coverity clean command, typically done before build stage by language or here as param 1-liner like "mvn clean"
125
+ polaris-detect-search-depth: '5' # Detect search depth, blank but can be set to "3" to search up to 3 levels of subdirectories for code to scan'
126
+ polaris-assessment-mode: 'SAST' # Assessment mode (SAST, CI or SOURCE_UPLOAD)
127
+ wait-for-scan: true
128
+ # polaris-detect-args: '' # Additional Detect arguments, can supply extra arguments like "--detect.diagnostic=true"
129
+ # coverity_build_command: "go build"
130
+ # coverity_clean_command: "go clean"
131
+ # polaris-config-path: '' # Path to Detect configuration file, typically a file supplied at root level like ./detect-config.yml
132
+ # polaris-coverity-config-path: '' # Path to Coverity configuration file, typically a file supplied at root level like ./coverity.yml
133
+ # polaris-coverity-args: '' # Additional Coverity arguments,can supply extra arguments like "--config-override capture.build.build-command=make
134
+
135
+ # perform SonarQube scan, with or without unit test coverage data
136
+ # requires secrets SONAR_TOKEN and SONAR_HOST_URL (progress.sonar.com)
137
+ perform-sonarqube-scan: true
138
+ # perform-sonar-build: true
139
+ # build-profile: 'default'
140
+ # report-unit-test-coverage: true
141
+ perform-docker-scan: false # scan Dockerfile and built images with Docker Scout or Trivy; see repo custom properties matching "container"
142
+
143
+ # report to central developer dashboard
144
+ report-to-atlassian-dashboard: false
145
+ quality-product-name: 'Chef-Agents' # product name for quality reporting, like Chef360, Courier, Inspec
146
+ # quality-product-name: ${{ github.event.repository.name }} # like 'Chef-360' - the product name for quality reporting, like Chef360, Courier, Inspec
147
+ # quality-sonar-app-name: 'YourSonarAppName'
148
+ # quality-testing-type: 'Integration' like Unit, Integration, e2e, api, Performance, Security
149
+ # quality-service-name: 'YourServiceOrRepoName'
150
+ # quality-junit-report: 'path/to/junit/report''
151
+
152
+ # perform Habitat-based and native packaging, publish to package repositories
153
+ package-binaries: false # Package binaries (e.g., RPM, DEB, MSI, dpkg + signing + SHA)
154
+ habitat-build: false # Create Habitat packages
155
+ publish-habitat-packages: false # Publish Habitat packages to Builder
156
+ publish-habitat-hab_package: false # Chef Habitat package to install (e.g., core/nginx)
157
+ publish-habitat-hab_version: "1.0.0" # Chef Habitat package version (optional)
158
+ publish-habitat-hab_release: "20240101010101" # Chef Habitat package release (optional)
159
+ publish-habitat-hab_channel: "stable" # Chef Habitat package channel (e.g., stable, base, base-2025); default is stable
160
+ publish-habitat-hab_auth_token: "" # Chef Habitat Builder authentication token (uses secret if not provided)
161
+ publish-habitat-runner_os: "ubuntu-latest" # OS runner for Habitat package publishing job, can also be windows-latest
162
+ habitat-grype-scan: false # Scan built Habitat packages with Grype for vulnerabilities
163
+ publish-packages: false # Publish packages (e.g., container from Dockerfile to ECR, go-releaser binary to releases page, omnibus to artifactory, gems, choco, homebrew, other app stores)
164
+
165
+ # generate and export Software Bill of Materials (SBOM) in various formats
166
+ generate-sbom: true
167
+ export-github-sbom: true # SPDX JSON artifact on job instance
168
+ generate-msft-sbom: false
169
+ license_scout: false # Run license scout for license compliance (uses .license_scout.yml)
170
+
171
+ # perform Blackduck software composition analysis (SCA) for 3rd party CVEs, licensing, and operational risk
172
+ perform-blackduck-sca-scan: true # combined with generate sbom & generate github-sbom, also needs version above
173
+ blackduck-project-group-name: 'Chef-Agents' # typically one of (Chef), Chef-Agents, Chef-Automate, Chef-Chef360, Chef-Habitat, Chef-Infrastructure-Server, Chef-Shared-Services, Chef-Non-Product'
174
+ blackduck-project-name: ${{ github.event.repository.name }} # BlackDuck project name, typically the repository name
175
+
176
+ # udf1: 'default' # user defined flag 1
177
+ # udf2: 'default' # user defined flag 2
178
+ # udf3: 'default' # user defined flag 3
@@ -7,27 +7,6 @@ on:
7
7
  pull_request:
8
8
 
9
9
  jobs:
10
- build-2-6:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: actions/checkout@v4
14
- - run: docker compose build rspec-2.6
15
- - run: docker compose run rspec-2.6
16
-
17
- build-2-7:
18
- runs-on: ubuntu-latest
19
- steps:
20
- - uses: actions/checkout@v4
21
- - run: docker compose build rspec-2.7
22
- - run: docker compose run rspec-2.7
23
-
24
- build-3-0:
25
- runs-on: ubuntu-latest
26
- steps:
27
- - uses: actions/checkout@v4
28
- - run: docker compose build rspec-3.0
29
- - run: docker compose run rspec-3.0
30
-
31
10
  build-3-1:
32
11
  runs-on: ubuntu-latest
33
12
  steps:
data/.gitignore CHANGED
@@ -10,7 +10,6 @@
10
10
  .ruby-version
11
11
  .tool-versions
12
12
  /.byebug_history
13
- Gemfile.lock
14
13
 
15
14
  # rspec failure tracking
16
15
  .rspec_status
data/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- ARG BASE_IMAGE=ruby:2.7
1
+ ARG BASE_IMAGE=ruby:3.1
2
2
  FROM ${BASE_IMAGE}
3
3
 
4
4
  RUN gem install bundler:2.3.5
@@ -9,7 +9,6 @@ COPY Gemfile *.gemspec ./
9
9
  COPY lib/k8s/ruby/version.rb ./lib/k8s/ruby/
10
10
 
11
11
  RUN bundle install
12
- RUN bundle update --bundler
13
12
 
14
13
  COPY . .
15
14
  ENTRYPOINT ["/app/entrypoint.sh"]
data/README.md CHANGED
@@ -226,15 +226,6 @@ client.api('v1').resource('pods', namespace: 'default').watch(labelSelector: {'r
226
226
  end
227
227
  ```
228
228
 
229
-
230
- ### Exec into running containers
231
- > **WARNING:** This feature is currently supported only on Linux based platforms. Windows platforms are NOT supported.
232
-
233
- #### This opens a new shell in the `test-pod` container
234
- ```ruby
235
- client.api('v1').resource('pods', namespace: 'default').exec(name: 'test-pod', container: 'shell', command: '/bin/sh')
236
- ```
237
-
238
229
  ## Contributing
239
230
 
240
231
  Bug reports and pull requests are welcome on GitHub at [k8s-ruby/k8s-ruby](https://github.com/k8s-ruby/k8s-ruby).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.17.1
1
+ 0.18.0
data/docker-compose.yaml CHANGED
@@ -1,25 +1,4 @@
1
1
  services:
2
- rspec-2.6:
3
- build:
4
- context: .
5
- args:
6
- BASE_IMAGE: ruby:2.6
7
- volumes:
8
- - .:/app
9
- rspec-2.7:
10
- build:
11
- context: .
12
- args:
13
- BASE_IMAGE: ruby:2.7
14
- volumes:
15
- - .:/app
16
- rspec-3.0:
17
- build:
18
- context: .
19
- args:
20
- BASE_IMAGE: ruby:3.0
21
- volumes:
22
- - .:/app
23
2
  rspec-3.1:
24
3
  build:
25
4
  context: .
data/k8s-ruby.gemspec CHANGED
@@ -21,9 +21,9 @@ Gem::Specification.new do |spec|
21
21
  spec.bindir = "bin"
22
22
  spec.executables = []
23
23
  spec.require_paths = ["lib"]
24
- spec.required_ruby_version = ">= 2.4"
24
+ spec.required_ruby_version = ">= 3.1"
25
25
 
26
- spec.add_runtime_dependency "excon", "~> 0.71"
26
+ spec.add_runtime_dependency "excon", "~> 1.5"
27
27
  spec.add_runtime_dependency "dry-struct"
28
28
  spec.add_runtime_dependency "dry-types"
29
29
  spec.add_runtime_dependency "dry-configurable"
@@ -33,10 +33,8 @@ Gem::Specification.new do |spec|
33
33
  spec.add_runtime_dependency "yajl-ruby", "~> 1.4"
34
34
  spec.add_runtime_dependency "yaml-safe_load_stream3"
35
35
  spec.add_runtime_dependency "base64"
36
- spec.add_runtime_dependency "eventmachine", "~> 1.2"
37
- spec.add_runtime_dependency "faye-websocket", "~> 0.11"
38
- spec.add_runtime_dependency "ruby-termios", "~> 1.1" unless Gem::Platform.local.os =~ /mingw|mswin|windows/
39
- spec.add_development_dependency "bundler", ">= 1.17", "< 3.0"
36
+
37
+ spec.add_development_dependency "bundler", ">= 1.17"
40
38
  spec.add_development_dependency "rake", ">= 12.3.3"
41
39
  spec.add_development_dependency "rspec", "~> 3.7"
42
40
  spec.add_development_dependency "webmock", "~> 3.6"
@@ -1,12 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "resource_client/exec" unless Gem::Platform.local.os =~ /mingw|mswin|windows/
4
-
5
3
  module K8s
6
4
  # Per-APIResource type client.
7
5
  #
8
6
  # Used to get/list/update/patch/delete specific types of resources, optionally in some specific namespace.
9
- #
10
7
  class ResourceClient
11
8
  # Common helpers used in both class/instance methods
12
9
  module Utils
@@ -39,11 +36,6 @@ module K8s
39
36
  include Utils
40
37
  extend Utils
41
38
 
42
- # Don't support Exec for windows since
43
- # it depends on ruby-termios which is not supported for Windows platforms
44
- # @!parse include K8s::ResourceClient::Exec
45
- include Exec if defined?(Exec)
46
-
47
39
  # Pipeline list requests for multiple resource types.
48
40
  #
49
41
  # Returns flattened array with mixed resource kinds.
@@ -3,6 +3,6 @@
3
3
  module K8s
4
4
  class Ruby
5
5
  # Updated on releases using semver.
6
- VERSION = "0.17.1"
6
+ VERSION = "0.18.0"
7
7
  end
8
8
  end
data/lib/k8s/transport.rb CHANGED
@@ -183,6 +183,7 @@ module K8s
183
183
  persistent: true,
184
184
  middlewares: EXCON_MIDDLEWARES,
185
185
  headers: REQUEST_HEADERS,
186
+ include_default_port: !@options[:omit_default_port],
186
187
  **@options
187
188
  )
188
189
  end
@@ -388,50 +389,5 @@ module K8s
388
389
  **options
389
390
  )
390
391
  end
391
-
392
- # Returns a websocket connection using part of the current transport configuration.
393
- # Will use same host and port returned by #server.
394
- # @param resource_path [String]
395
- # @param query [Hash]
396
- # @return [Faye::WebSocket::Client]
397
- def build_ws_conn(resource_path, query = {})
398
- private_key_file = nil
399
- cert_chain_file = nil
400
-
401
- on_open_callbacks = []
402
-
403
- if options[:client_cert] && options[:client_key]
404
- private_key_file = options[:client_key]
405
- cert_chain_file = options[:client_cert]
406
- elsif options[:client_cert_data] && options[:client_key_data]
407
- temp_file_path_from_data = lambda do |data|
408
- temp_file = Tempfile.new
409
- temp_file.write(data)
410
- temp_file.close
411
- on_open_callbacks << -> { temp_file.unlink }
412
- temp_file.path
413
- end
414
- private_key_file = temp_file_path_from_data.call(options[:client_key_data])
415
- cert_chain_file = temp_file_path_from_data.call(options[:client_cert_data])
416
- end
417
-
418
- url = server.gsub("http", "ws") +
419
- resource_path +
420
- Excon::Utils.query_string(query: query)
421
-
422
- ws = Faye::WebSocket::Client.new(
423
- url,
424
- [],
425
- headers: request_options[:headers],
426
- tls: {
427
- verify_peer: !!options[:ssl_verify_peer],
428
- private_key_file: private_key_file,
429
- cert_chain_file: cert_chain_file
430
- }
431
- )
432
-
433
- ws.on(:open) { on_open_callbacks.each(&:call) }
434
- ws
435
- end
436
392
  end
437
393
  end
@@ -0,0 +1,43 @@
1
+ # SonarQube configuration file
2
+ #
3
+ # Sample Ruby Sonar file - https://docs.sonarsource.com/sonarqube-server/10.6/analyzing-source-code/languages/ruby/
4
+ # properties defined in https://docs.sonarsource.com/sonarqube-server/latest/analyzing-source-code/analysis-parameters/
5
+ #
6
+ # view this repo in sonar: <ADD your URL like https://sonar.progress.com/dashboard?id=chef_inspec_k8s-ruby_d9e48289-6759-4a67-ba37-d2df5736629f>
7
+ # Required metadata
8
+ sonar.projectKey=inspec_k8s-ruby_d9e48289-6759-4a67-ba37-d2df5736629f
9
+ # project name is 3 parts: "Chef" + "<area/product>" + "<repo>" with underscores between
10
+ # <area/product> choices: Chef-Agents | Chef-Automate | Chef360 | Chef-Habitat | Chef-Infra-Server | Chef-Shared-Services
11
+ # example project name: chef/chef-vault repo would be Chef_Chef-Infra-Client_chef-vault
12
+ sonar.projectName=Chef_InSpec_k8s-ruby
13
+ # sonar.projectVersion=1.0
14
+ # sonar.projectDescription=
15
+
16
+ # Language - https://docs.sonarsource.com/sonarqube-server/latest/analyzing-source-code/languages/overview/ go, ruby, rust
17
+ sonar.language=ruby
18
+ sonar.sources=lib
19
+ # sonar.sources=lib <-- for Ruby, match this with the /spec directory for tests & SARIF output directory for test results/rcov
20
+ # sonar.exclusions=**/*_test.go, **/*.js, **/*.sql, **/*.yml, **/*.yaml; may exclude **/vendor/** for Ruby
21
+
22
+ # Unit tests
23
+ sonar.tests=spec
24
+ # was spec/**/*.rb
25
+ # sonar.test.inclusions=**/*_test.go **/*Test.java
26
+ # Coverage report
27
+ sonar.ruby.coverage.framework=RSpec
28
+ sonar.ruby.coverage.reportPaths=coverage/coverage.json
29
+ # ^^^ comma-delimited paths to Rubocop reports, SimpleCov, or RSpec plugin reports (coverage/coverage.json <-- default output for simpleCov)
30
+
31
+ # sonar.ruby.rubocop.reportPaths=./rubocop-report.json -- import Ruby Rubocop
32
+ # sonar.dependencyCheck.htmlReportPath=./dependency-check-report.html -- import OWASP dependency check report
33
+ # sonar.externalIssuesReportPaths Comma-delimited list of paths to generic issue reports.
34
+ # sonar.sarifReportPaths Comma-delimited list of paths to SARIF issue reports.
35
+
36
+ # Additional settings
37
+ # sonar.qualitygate.wait=false
38
+ # sonar.qualitygate.timeout=300
39
+
40
+ # skip C-language processor
41
+ sonar.c.file.suffixes=-
42
+ sonar.cpp.file.suffixes=-
43
+ sonar.objc.file.suffixes=-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: k8s-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.1
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rdx.net
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-04-04 00:00:00.000000000 Z
12
+ date: 2026-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: excon
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '0.71'
20
+ version: '1.5'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '0.71'
27
+ version: '1.5'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: dry-struct
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -157,48 +157,6 @@ dependencies:
157
157
  - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
- - !ruby/object:Gem::Dependency
161
- name: eventmachine
162
- requirement: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: '1.2'
167
- type: :runtime
168
- prerelease: false
169
- version_requirements: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - "~>"
172
- - !ruby/object:Gem::Version
173
- version: '1.2'
174
- - !ruby/object:Gem::Dependency
175
- name: faye-websocket
176
- requirement: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - "~>"
179
- - !ruby/object:Gem::Version
180
- version: '0.11'
181
- type: :runtime
182
- prerelease: false
183
- version_requirements: !ruby/object:Gem::Requirement
184
- requirements:
185
- - - "~>"
186
- - !ruby/object:Gem::Version
187
- version: '0.11'
188
- - !ruby/object:Gem::Dependency
189
- name: ruby-termios
190
- requirement: !ruby/object:Gem::Requirement
191
- requirements:
192
- - - "~>"
193
- - !ruby/object:Gem::Version
194
- version: '1.1'
195
- type: :runtime
196
- prerelease: false
197
- version_requirements: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - "~>"
200
- - !ruby/object:Gem::Version
201
- version: '1.1'
202
160
  - !ruby/object:Gem::Dependency
203
161
  name: bundler
204
162
  requirement: !ruby/object:Gem::Requirement
@@ -206,9 +164,6 @@ dependencies:
206
164
  - - ">="
207
165
  - !ruby/object:Gem::Version
208
166
  version: '1.17'
209
- - - "<"
210
- - !ruby/object:Gem::Version
211
- version: '3.0'
212
167
  type: :development
213
168
  prerelease: false
214
169
  version_requirements: !ruby/object:Gem::Requirement
@@ -216,9 +171,6 @@ dependencies:
216
171
  - - ">="
217
172
  - !ruby/object:Gem::Version
218
173
  version: '1.17'
219
- - - "<"
220
- - !ruby/object:Gem::Version
221
- version: '3.0'
222
174
  - !ruby/object:Gem::Dependency
223
175
  name: rake
224
176
  requirement: !ruby/object:Gem::Requirement
@@ -298,6 +250,7 @@ extra_rdoc_files: []
298
250
  files:
299
251
  - ".expeditor/config.yml"
300
252
  - ".expeditor/update_version.sh"
253
+ - ".github/workflows/ci-main-pull-request-stub-1.0.8.yml"
301
254
  - ".github/workflows/tests.yml"
302
255
  - ".gitignore"
303
256
  - ".rspec"
@@ -329,11 +282,11 @@ files:
329
282
  - lib/k8s/logging.rb
330
283
  - lib/k8s/resource.rb
331
284
  - lib/k8s/resource_client.rb
332
- - lib/k8s/resource_client/exec.rb
333
285
  - lib/k8s/ruby/version.rb
334
286
  - lib/k8s/stack.rb
335
287
  - lib/k8s/transport.rb
336
288
  - lib/k8s/util.rb
289
+ - sonar-project.properties
337
290
  homepage: https://github.com/k8s-ruby/k8s-ruby
338
291
  licenses:
339
292
  - Apache-2.0
@@ -346,14 +299,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
346
299
  requirements:
347
300
  - - ">="
348
301
  - !ruby/object:Gem::Version
349
- version: '2.4'
302
+ version: '3.1'
350
303
  required_rubygems_version: !ruby/object:Gem::Requirement
351
304
  requirements:
352
305
  - - ">="
353
306
  - !ruby/object:Gem::Version
354
307
  version: '0'
355
308
  requirements: []
356
- rubygems_version: 3.2.3
309
+ rubygems_version: 3.3.27
357
310
  signing_key:
358
311
  specification_version: 4
359
312
  summary: Kubernetes client library for Ruby
@@ -1,110 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module K8s
4
- class ResourceClient
5
- module Exec
6
- def self.included(base)
7
- base.include(InstanceMethods)
8
- base.include(Logging)
9
- end
10
-
11
- module InstanceMethods
12
- require "eventmachine"
13
- require "faye/websocket"
14
- require "termios"
15
- require "tempfile"
16
-
17
- # Executes arbitrary commands in a container.
18
- #
19
- # @param name [String] name of the pod
20
- # @param namespace [String]
21
- # @param container [String] name of the container to execute the command in
22
- # @param command [Array<String>|String] command to execute. It accepts a single string or an array of strings if multiple arguments are needed.
23
- # @param stdin [Boolean] whether to stream stdin to the container
24
- # @param stdout [Boolean] whether to stream stdout from the container
25
- # @param tty [Boolean] whether to allocate a tty for the container
26
- # @yield [String] Optional block to yield the output of the command
27
- # @return [String, nil] output of the command. It returns nil if a block is given or tty is true.
28
- #
29
- # @example
30
- # client.api('v1').resource('pods', namespace: 'default').exec(
31
- # name: 'test-pod',
32
- # container: 'shell',
33
- # command: '/bin/sh'
34
- # )
35
- # @example Open a shell:
36
- # exec(name: 'my-pod', container: 'my-container', command: '/bin/sh')
37
- # @example Execute single command:
38
- # exec(name: 'my-pod', container: 'my-container', command: 'date')
39
- # @example Pass multiple arguments:
40
- # exec(name: 'my-pod', container: 'my-container', command: ['ls', '-la'])
41
- # @example Yield the output of the command:
42
- # exec(
43
- # name: "test-pod",
44
- # container: "shell",
45
- # command: [ "watch", "date" ],
46
- # ) do |out|
47
- # puts "local time #{Time.now}"
48
- # puts "server time #{out}"
49
- # end
50
- def exec(name:, namespace: @namespace, command:, container:, stdin: true, stdout: true, tty: true)
51
- query = {
52
- command: [command].flatten,
53
- container: container,
54
- stdin: !!stdin,
55
- stdout: !!stdout,
56
- tty: !!tty
57
- }
58
-
59
- exec_path = path(name, namespace: namespace, subresource: "exec")
60
- output = StringIO.new
61
-
62
- EM.run do
63
- ws = @transport.build_ws_conn(exec_path, query)
64
-
65
- ws.on :message do |event|
66
- out = event.data.pack("C*")
67
-
68
- if block_given?
69
- yield(out)
70
- elsif tty
71
- print out
72
- else
73
- output.write(out)
74
- end
75
- end
76
-
77
- ws.on :error do |event|
78
- logger.error(event.message)
79
- end
80
-
81
- term_attributes_original = Termios.tcgetattr($stdin)
82
- if tty
83
- term_attributes = term_attributes_original.dup
84
- term_attributes.lflag &= ~Termios::ECHO
85
- term_attributes.lflag &= ~Termios::ICANON
86
- Termios.tcsetattr($stdin, Termios::TCSANOW, term_attributes)
87
-
88
- EM.open_keyboard(Module.new do
89
- define_method(:receive_data) do |input|
90
- input = [0] + input.unpack("C*")
91
- ws.send(input)
92
- end
93
- end)
94
- end
95
-
96
- ws.on :close do
97
- Termios.tcsetattr($stdin, Termios::TCSANOW, term_attributes_original)
98
- EM.stop
99
- end
100
- end
101
-
102
- return if tty
103
-
104
- output.rewind
105
- output.read
106
- end
107
- end
108
- end
109
- end
110
- end