Apply configuration yaml file via API or SDK

Kirill :

I started a pod in kubernetes cluster which can call kubernetes api via go-sdk (like in this example: https://github.com/kubernetes/client-go/tree/master/examples/in-cluster-client-configuration). I want to listen some external events in this pod (e.g. GitHub web-hooks), fetch yaml configuration files from repository and apply them to this cluster.

Is it possible to call kubectl apply -f <config-file> via kubernetes API (or better via golang SDK)?

mdaniel :

As yaml directly: no, not that I'm aware of. But if you increase the kubectl verbosity (--v=100 or such), you'll see that the first thing kubectl does to your yaml file is convert it to json, and then POST that content to the API. So the spirit of the answer to your question is "yes."

This box/kube-applier project may interest you. While it does not appear to be webhook aware, I am sure they would welcome a PR teaching it to do that. Using their existing project also means you benefit from all the bugs they have already squashed, as well as their nifty prometheus metrics integration.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Netplan: how do I apply specific configuration YAML file

How to check connection to database via YAML configuration file in Python?

yaml file handlers configuration

Docker pass configuration to yaml file

Read YAML configuration file in Python

Gitlab-ci .yaml configuration for posting Postman tests via Jira Xray API

Using client-go to `kubectl apply` against the Kubernetes API directly with multiple types in a single YAML file

How to set custom access logging configuration for AWS API Gateway via java sdk?

Yaml: can we apply a prefix to a whole yaml file/document?

Installing SDK via ZIP file

Get the keyname from a YAML configuration file

Yaml configuration list of objects to properties file

Executable access to yaml configuration file using setuptools

How to specify external YAML configuration file for springboot

the best way to parse and validate YAML configuration file

Custom configuration file flink-conf.yaml

YAML Configuration File Parsing Error in CircleCI

Parse yaml file content to scss via ruby

How to load YAML file via yaml-cpp?

Set Spring boot yaml configuration list property via environment variables

Tell Ansible to iterate through a (network camera) configuration json file and update every value via a new api call

Ruby on Rails - AWS-SDK configuration file

Programatically apply a single resource from a multi resource Kubernetes YAML file

YAML file through http GET and gitlab api

pytest run markers via configuration file

How to validate values in a YAML configuration file while loading it?

kubernetes configmap set from-file in yaml configuration

mongodb 3.0.4 on ubuntu 14.04 LTS configuration file not yaml?

yaml configuration for add one more script file to google app engine