moonspot/kubernetes 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

moonspot/kubernetes

最新稳定版本:v1.29.0

Composer 安装命令:

composer require moonspot/kubernetes

包简介

Library of classes for composing Kubernetes objects

README 文档

README

This library builds, imports, and exports Kubernetes objects. The classes are all built using the Swagger files in the kubernetes/kubernetes repository.

The original purpose for building this library was for writing applications that interact with Kubernetes objects. It is not the intention that this library be used to build configuration management repositories. The PHP code for managing objects would likely be more verbose and complex than simply writing the needed YAML.

Version Compatibility

The versions of this library follow the major/minor release versions of the official Kubernetes releases. Only versions from 1.21 forward are supported.

Example

$configmap = \Moonspot\Kubernetes\Kubernetes::new('ConfigMap');

$configmap->metadata->name = 'MyConfigMap';
$configmap->metadata->labels = [
    "app-name" => 'MyApp'
];
$configmap->data = [
    'config.ini' => "some_setting = 1\nsome_setting = 2\n"
];

echo $configmap->toYaml();

Result:

---
apiVersion: v1
data:
  config.ini: |
    some_setting = 1
    some_setting = 2
kind: ConfigMap
metadata:
  labels:
    app-name: MyApp
  name: MyConfigMap
...

Importing

The factory method of the Kubernetes class will auto-detect the kind of object and create it.

$configmap = \Moonspot\Kubernetes\Kubernetes::factory(file_get_contents('./configmap.yaml'));

echo $configmap->metadata->name . "\n";

Result:

MyConfigMap

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-11-01