kubepack / chartify

📈 Generate Helm Charts from Kubernetes objects
Apache License 2.0
227 stars 25 forks source link

Retrieve resource types from the cluster instead of hard coding them #45

Open InfoSec812 opened 4 years ago

InfoSec812 commented 4 years ago

As a developer who works across a number of different Kubernetes cluster from a number of different vendors, and as a developer using Operators in K8s; I would like to have a way to convert existing resources of types not currently defined in this application.

For example, if using the Strimzi Operator for deploying Kafka clusters, I would want to be able to extract, templatize, and convert to a chart the Custom Resource Definitions for Strimzi.

https://github.com/kubepack/chartify/blob/9322a89ea562f775dc7b1d39c45178711b35cb91/pkg/kube_objects.go#L20

InfoSec812 commented 4 years ago

For example, on an OpenShift 4.2 cluster...

curl -s -H "Authorization: Bearer <REDACTED>" "https://cluster.example.com/openapi/v2" | jq '.definitions | keys'

[
  "com.coreos.monitoring.v1.Alertmanager",
  "com.coreos.monitoring.v1.AlertmanagerList",
  "com.coreos.monitoring.v1.PodMonitor",
  "com.coreos.monitoring.v1.PodMonitorList",
  "com.coreos.monitoring.v1.Prometheus",
  "com.coreos.monitoring.v1.PrometheusList",
  "com.coreos.monitoring.v1.PrometheusRule",
  "com.coreos.monitoring.v1.PrometheusRuleList",
  "com.coreos.monitoring.v1.ServiceMonitor",
  "com.coreos.monitoring.v1.ServiceMonitorList",
  "com.coreos.operators.v1.CatalogSourceConfig",
  "com.coreos.operators.v1.CatalogSourceConfigList",
  "com.coreos.operators.v1.OperatorGroup",
  "com.coreos.operators.v1.OperatorGroupList",
//.. SNIP ..//
  "org.integreatly.v1alpha1.Grafana",
  "org.integreatly.v1alpha1.GrafanaDashboard",
  "org.integreatly.v1alpha1.GrafanaDashboardList",
  "org.integreatly.v1alpha1.GrafanaDataSource",
  "org.integreatly.v1alpha1.GrafanaDataSourceList",
  "org.integreatly.v1alpha1.GrafanaList"
]