kubeconfig 1.0.0+1 kubeconfig: ^1.0.0+1 copied to clipboard
Kubeconfig utility library for Javascript and Dart. Validate, convert, or merge kubeconfig files.
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
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.
Installation 💻 #
From npm: #
kubeconfig
compiled to JavaScript, as an npm package. You can add it to your project using the command below.
npm install --save kubeconfig
For more information, please visit the npmjs.com
From pub: #
For quick start, please include the following in pubspec.yaml
dependencies:
kubeconfig: 1.0.0+1
For more information, please visit the pub.dev
Quick Start 🚀 #
Validating a kubeconfig file:
JavaScript: #
import { readFileSync } from 'fs';
import { Kubeconfig } from './kubeconfig';
let kubeconfigYaml = readFileSync('kube/config.yaml');
let kubeconfig = Kubeconfig.fromYaml(kubeconfigYaml);
let validationResult = kubeconfig.validate();
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();
}
Examples 📋 #
Javascript: #
- Validate: example/js/validate.js
- Convert: example/js/validate.js
- Merge: example/js/validate.js
Dart: #
- Validate: example/dart/validate.dart
- Convert: example/dart/convert.dart
- Merge: example/dart/merge.dart