chartify icon indicating copy to clipboard operation
chartify copied to clipboard

Retrieve resource types from the cluster instead of hard coding them

Open InfoSec812 opened this issue 5 years ago • 1 comments
trafficstars

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 avatar Jul 15 '20 13:07 InfoSec812

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"
]

InfoSec812 avatar Jul 15 '20 13:07 InfoSec812