vmware-archive / kubecfg

A tool for managing complex enterprise Kubernetes environments as code.
Apache License 2.0
728 stars 62 forks source link

Import all paths passed on the command line via the VM #308

Open tinyzimmer opened 3 years ago

tinyzimmer commented 3 years ago

This is regarding our discussion in Slack. It felt like an easy, low hanging fruit, type thing to make possible real quick.

Could potentially use more test cases. However, locally I was able to utilize it like so:

# Existing behavior
./kubecfg show ./example.jsonnet
# ...
#
# Some remote file
./kubecfg show https://raw.githubusercontent.com/bitnami/kube-prod-runtime/master/manifests/components/nginx-ingress.jsonnet
# ...
# ...
# Apply some remote file
./kubecfg update https://raw.githubusercontent.com/bitnami/kube-prod-runtime/master/manifests/components/nginx-ingress.jsonnet
INFO  Validating deployments kubeprod.nginx-ingress-controller
INFO  validate object "apps/v1, Kind=Deployment"
INFO  Validating clusterroles nginx-ingress-controller
INFO  validate object "rbac.authorization.k8s.io/v1beta1, Kind=ClusterRole"
INFO  Validating roles kubeprod.nginx-ingress-controller
INFO  validate object "rbac.authorization.k8s.io/v1beta1, Kind=Role"
INFO  Validating services kubeprod.nginx-ingress
INFO  validate object "/v1, Kind=Service"
INFO  Validating configmaps kubeprod.tcp-services-67c1890
INFO  validate object "/v1, Kind=ConfigMap"
INFO  Validating configmaps kubeprod.udp-services-67c1890
INFO  validate object "/v1, Kind=ConfigMap"
INFO  Validating configmaps kubeprod.nginx-ingress-0ff949c
INFO  validate object "/v1, Kind=ConfigMap"
INFO  Validating horizontalpodautoscalers kubeprod.nginx-ingress-controller
INFO  validate object "autoscaling/v1, Kind=HorizontalPodAutoscaler"
INFO  Validating clusterrolebindings nginx-ingress-controller
INFO  validate object "rbac.authorization.k8s.io/v1beta1, Kind=ClusterRoleBinding"
INFO  Validating rolebindings kubeprod.nginx-ingress-controller
INFO  validate object "rbac.authorization.k8s.io/v1beta1, Kind=RoleBinding"
INFO  Validating poddisruptionbudgets kubeprod.nginx-ingress-controller
INFO  validate object "policy/v1beta1, Kind=PodDisruptionBudget"
INFO  Validating serviceaccounts kubeprod.nginx-ingress-controller
INFO  validate object "/v1, Kind=ServiceAccount"
INFO  Fetching schemas for 12 resources
W0603 12:33:15.306538  560040 warnings.go:67] rbac.authorization.k8s.io/v1beta1 ClusterRole is deprecated in v1.17+, unavailable in v1.22+; use rbac.authorization.k8s.io/v1 ClusterRole
INFO  Creating clusterroles nginx-ingress-controller
W0603 12:33:15.312277  560040 warnings.go:67] rbac.authorization.k8s.io/v1beta1 ClusterRole is deprecated in v1.17+, unavailable in v1.22+; use rbac.authorization.k8s.io/v1 ClusterRole
W0603 12:33:15.401767  560040 warnings.go:67] rbac.authorization.k8s.io/v1beta1 ClusterRoleBinding is deprecated in v1.17+, unavailable in v1.22+; use rbac.authorization.k8s.io/v1 ClusterRoleBinding
INFO  Creating clusterrolebindings nginx-ingress-controller
W0603 12:33:15.406635  560040 warnings.go:67] rbac.authorization.k8s.io/v1beta1 ClusterRoleBinding is deprecated in v1.17+, unavailable in v1.22+; use rbac.authorization.k8s.io/v1 ClusterRoleBinding
INFO  Creating services kubeprod.nginx-ingress
INFO  Creating configmaps kubeprod.nginx-ingress-0ff949c
INFO  Creating horizontalpodautoscalers kubeprod.nginx-ingress-controller
W0603 12:33:15.507259  560040 warnings.go:67] policy/v1beta1 PodDisruptionBudget is deprecated in v1.21+, unavailable in v1.25+; use policy/v1 PodDisruptionBudget
INFO  Creating poddisruptionbudgets kubeprod.nginx-ingress-controller
W0603 12:33:15.708563  560040 warnings.go:67] policy/v1beta1 PodDisruptionBudget is deprecated in v1.21+, unavailable in v1.25+; use policy/v1 PodDisruptionBudget
W0603 12:33:15.907006  560040 warnings.go:67] rbac.authorization.k8s.io/v1beta1 Role is deprecated in v1.17+, unavailable in v1.22+; use rbac.authorization.k8s.io/v1 Role
INFO  Creating roles kubeprod.nginx-ingress-controller
W0603 12:33:16.108283  560040 warnings.go:67] rbac.authorization.k8s.io/v1beta1 Role is deprecated in v1.17+, unavailable in v1.22+; use rbac.authorization.k8s.io/v1 Role
W0603 12:33:16.307254  560040 warnings.go:67] rbac.authorization.k8s.io/v1beta1 RoleBinding is deprecated in v1.17+, unavailable in v1.22+; use rbac.authorization.k8s.io/v1 RoleBinding
INFO  Creating rolebindings kubeprod.nginx-ingress-controller
W0603 12:33:16.508205  560040 warnings.go:67] rbac.authorization.k8s.io/v1beta1 RoleBinding is deprecated in v1.17+, unavailable in v1.22+; use rbac.authorization.k8s.io/v1 RoleBinding
INFO  Creating serviceaccounts kubeprod.nginx-ingress-controller
INFO  Creating configmaps kubeprod.tcp-services-67c1890
INFO  Creating configmaps kubeprod.udp-services-67c1890
INFO  Creating deployments kubeprod.nginx-ingress-controller
tinyzimmer commented 3 years ago

This PR is almost an identical copy of this at this point

tinyzimmer commented 3 years ago

Any blockers on getting this merged? I'd love to use it as an example for this new jsonnet-controller project, so that in the readme I can just say kubecfg update https://github.com...