-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f86cb14
Showing
125 changed files
with
11,759 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Build, format, analyze and test the Dart code. | ||
name: CI | ||
|
||
on: | ||
# Runs on pull requests and pushes targeting the default branch | ||
pull_request: | ||
push: | ||
branches: [main] | ||
paths-ignore: | ||
- "docs/**" | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages. | ||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
ci: | ||
name: Dart CI | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.draft == false | ||
steps: | ||
- name: Git Checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- name: Setup Dart | ||
uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d # v1.6.0 | ||
- name: Install dependencies | ||
run: dart pub get | ||
- name: Verify formatting | ||
run: dart format — output=none — set-exit-if-changed . | ||
- name: Analyze project source | ||
run: dart analyze | ||
- name: Run tests | ||
run: | | ||
dart pub global activate coverage | ||
dart pub global run coverage:test_with_coverage | ||
- name: Upload Coverage | ||
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 | ||
with: | ||
directory: ./coverage | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
- name: Verify Coverage | ||
uses: VeryGoodOpenSource/very_good_coverage@3b475421464c564c0714d92ce02742bd81fa9eda # v2.2.0 | ||
with: | ||
min_coverage: "100" | ||
- name: Verify Pub Score | ||
run: | | ||
dart pub global activate pana | ||
sudo apt-get install webp | ||
PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p") | ||
echo "score: $PANA_SCORE" | ||
IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0]; TOTAL=SCORE_ARR[1] | ||
if [ -z "$1" ]; then MINIMUM_SCORE=TOTAL; else MINIMUM_SCORE=$1; fi | ||
if (( $SCORE < $MINIMUM_SCORE )); then echo "minimum score $MINIMUM_SCORE was not met!"; exit 1; fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Miscellaneous | ||
*.class | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
|
||
# Visual Studio Code related | ||
.classpath | ||
.project | ||
.settings/ | ||
.vscode/* | ||
|
||
# Idea related | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# Files and directories created by pub. | ||
.dart_tool/ | ||
.packages | ||
|
||
# Conventional directory for build outputs. | ||
build/ | ||
|
||
# Omit committing pubspec.lock for library packages; see | ||
# https://dart.dev/guides/libraries/private-files#pubspeclock. | ||
pubspec.lock | ||
|
||
# Ignore pubspec_overrides.yaml as local package paths may be different for everyone | ||
pubspec_overrides.yaml | ||
|
||
# Test and Coverage generated outputs | ||
coverage/ | ||
|
||
# # Generated dart files | ||
# *.g.dart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
## [1.0.0] - [Jan 15, 2023] | ||
* [Initial] Kubeconfig utility |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Fatih Sever | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
[![Kubeconfig Logo][kubeconfig_logo]][kubeconfig_link] | ||
|
||
[![CI][ci_badge]][ci_link] | ||
[![Coverage][coverage_badge]][coverage_link] | ||
[![License: MIT][license_badge]][license_link] | ||
[![pub][pub_badge]][pub_link] | ||
[![npm][npm_badge]][npm_link] | ||
|
||
--- | ||
A library that simplifies the management of kubeconfig files. It offers a bunch of features, such as validating, merging, and converting kubeconfig files, to ensure that you have a consistent and optimized configuration for accessing multiple Kubernetes clusters. | ||
|
||
Developed with 💙 by [Fatih Sever][fatihsever_link] | ||
|
||
## Features ✨ | ||
- **Validate**: Check the syntax and structure of kubeconfig files for common errors or inconsistencies. | ||
- **Convert**: Convert between different formats (YAML to JSON or JSON to YAML). | ||
- **Merge**: Combine multiple kubeconfig files into a single file, preserving context and cluster information, and avoiding duplication. | ||
|
||
## Documentation 📝 | ||
Please visit the [official documentation][docs_link]. | ||
|
||
## Installation 💻 | ||
### From pub: | ||
For quick start, please include the following in pubspec.yaml | ||
```yaml | ||
dependencies: | ||
kubeconfig: 1.0.0+1 | ||
``` | ||
For more information, please visit the [pub.dev](https://pub.dev/packages/kubeconfig/install) | ||
### From npm: | ||
`kubeconfig` compiled to JavaScript, as an npm package. You can add it to your project using the command below. | ||
```bash | ||
npm install --save kubeconfig | ||
``` | ||
|
||
For more information, please visit the [npmjs.com](https://www.npmjs.com/package/kubeconfig) | ||
|
||
## Quick Start 🚀 | ||
|
||
Validating a kubeconfig file: | ||
|
||
### Dart: | ||
```dart | ||
import 'dart:io'; | ||
import 'package:kubeconfig/kubeconfig.dart'; | ||
void main() { | ||
final kubeconfigYaml = await File('kube/config.yaml').readAsString(); | ||
final kubeconfig = Kubeconfig.fromYaml(kubeconfigYaml); | ||
final validationResult = kubeconfig.validate(); | ||
} | ||
``` | ||
|
||
### JavaScript: | ||
```javascript | ||
import { readFileSync } from 'fs'; | ||
import { Kubeconfig } from './kubeconfig'; | ||
let kubeconfigYaml = readFileSync('kube/config.yaml'); | ||
let kubeconfig = Kubeconfig.fromYaml(kubeconfigYaml); | ||
let validationResult = kubeconfig.validate(); | ||
``` | ||
|
||
## Examples 📋 | ||
### Dart: | ||
- **Validate**: [example/dart/validate.dart](example/validate.dart) | ||
- **Convert**: [example/dart/convert.dart](example/convert.dart) | ||
- **Merge**: [example/dart/merge.dart](example/merge.dart) | ||
|
||
### Javascript: | ||
- **Validate**: [example/js/validate.js](example/validate.js) | ||
- **Convert**: [example/js/validate.js](example/validate.js) | ||
- **Merge**: [example/js/validate.js](example/validate.js) | ||
|
||
[kubeconfig_logo]: assets/logo.svg | ||
[kubeconfig_link]: https://fatihsever.github.io/kubeconfig-lib/ | ||
[ci_badge]: https://github.com/fatihsever/kubeconfig-lib/actions/workflows/ci.yml/badge.svg?branch=main | ||
[ci_link]: https://github.com/fatihsever/kubeconfig-lib/actions/workflows/ci.yml | ||
[coverage_badge]: https://codecov.io/github/fatihsever/kubeconfig-lib/badges/coverage.svg?branch=main | ||
[coverage_link]: https://codecov.io/github/fatihsever/kubeconfig-lib/badges?branch=master | ||
[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg | ||
[license_link]: https://opensource.org/licenses/MIT | ||
[pub_badge]: https://img.shields.io/pub/v/kubeconfig | ||
[pub_link]: https://pub.dev/packages/kubeconfig | ||
[npm_badge]: https://img.shields.io/npm/v/kubeconfig | ||
[npm_link]: https://www.npmjs.com/package/kubeconfig | ||
[fatihsever_link]: https://fatihsever.com/ | ||
[docs_link]: https://fatihsever.github.io/kubeconfig-lib/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include: package:very_good_analysis/analysis_options.5.0.0.yaml | ||
analyzer: | ||
exclude: | ||
- "**/*.g.dart" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.yarn/ | ||
.next/ | ||
node_modules/ | ||
dist/ | ||
|
||
# Logs | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
.pnp.* |
Oops, something went wrong.