From b73e7717f3d903516124a4c4872c3c8c205ee406 Mon Sep 17 00:00:00 2001 From: Luke Kysow <1034429+lkysow@users.noreply.github.com> Date: Thu, 13 Jan 2022 18:56:42 -0800 Subject: [PATCH 1/3] Add - separated names for config entry crds For example allow both kubectl get ingressgateways and kubectl get ingress-gateways. When specified in .hcl or .json the config entries are dash-separated so this makes it consistent if someone uses a dash by mistake after reading our docs. --- control-plane/api/v1alpha1/exportedservices_types.go | 1 + control-plane/api/v1alpha1/ingressgateway_types.go | 1 + control-plane/api/v1alpha1/proxydefaults_types.go | 1 + control-plane/api/v1alpha1/servicedefaults_types.go | 1 + control-plane/api/v1alpha1/serviceintentions_types.go | 1 + control-plane/api/v1alpha1/serviceresolver_types.go | 1 + control-plane/api/v1alpha1/servicerouter_types.go | 1 + control-plane/api/v1alpha1/servicesplitter_types.go | 1 + control-plane/api/v1alpha1/terminatinggateway_types.go | 1 + .../config/crd/bases/consul.hashicorp.com_exportedservices.yaml | 2 ++ .../config/crd/bases/consul.hashicorp.com_ingressgateways.yaml | 2 ++ .../config/crd/bases/consul.hashicorp.com_proxydefaults.yaml | 2 ++ .../config/crd/bases/consul.hashicorp.com_servicedefaults.yaml | 2 ++ .../crd/bases/consul.hashicorp.com_serviceintentions.yaml | 2 ++ .../config/crd/bases/consul.hashicorp.com_serviceresolvers.yaml | 2 ++ .../config/crd/bases/consul.hashicorp.com_servicerouters.yaml | 2 ++ .../config/crd/bases/consul.hashicorp.com_servicesplitters.yaml | 2 ++ .../crd/bases/consul.hashicorp.com_terminatinggateways.yaml | 2 ++ 18 files changed, 27 insertions(+) diff --git a/control-plane/api/v1alpha1/exportedservices_types.go b/control-plane/api/v1alpha1/exportedservices_types.go index 5c1e337c2d..7d744c055d 100644 --- a/control-plane/api/v1alpha1/exportedservices_types.go +++ b/control-plane/api/v1alpha1/exportedservices_types.go @@ -29,6 +29,7 @@ func init() { // +kubebuilder:printcolumn:name="Synced",type="string",JSONPath=".status.conditions[?(@.type==\"Synced\")].status",description="The sync status of the resource with Consul" // +kubebuilder:printcolumn:name="Last Synced",type="date",JSONPath=".status.lastSyncedTime",description="The last successful synced time of the resource with Consul" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="The age of the resource" +// +kubebuilder:resource:shortName="exported-services" type ExportedServices struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/control-plane/api/v1alpha1/ingressgateway_types.go b/control-plane/api/v1alpha1/ingressgateway_types.go index 82e5026f8b..e5087e2885 100644 --- a/control-plane/api/v1alpha1/ingressgateway_types.go +++ b/control-plane/api/v1alpha1/ingressgateway_types.go @@ -32,6 +32,7 @@ func init() { // +kubebuilder:printcolumn:name="Synced",type="string",JSONPath=".status.conditions[?(@.type==\"Synced\")].status",description="The sync status of the resource with Consul" // +kubebuilder:printcolumn:name="Last Synced",type="date",JSONPath=".status.lastSyncedTime",description="The last successful synced time of the resource with Consul" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="The age of the resource" +// +kubebuilder:resource:shortName="ingress-gateway" type IngressGateway struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/control-plane/api/v1alpha1/proxydefaults_types.go b/control-plane/api/v1alpha1/proxydefaults_types.go index 7d52b32c12..1e38842d4b 100644 --- a/control-plane/api/v1alpha1/proxydefaults_types.go +++ b/control-plane/api/v1alpha1/proxydefaults_types.go @@ -31,6 +31,7 @@ func init() { // +kubebuilder:printcolumn:name="Synced",type="string",JSONPath=".status.conditions[?(@.type==\"Synced\")].status",description="The sync status of the resource with Consul" // +kubebuilder:printcolumn:name="Last Synced",type="date",JSONPath=".status.lastSyncedTime",description="The last successful synced time of the resource with Consul" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="The age of the resource" +// +kubebuilder:resource:shortName="proxy-defaults" type ProxyDefaults struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/control-plane/api/v1alpha1/servicedefaults_types.go b/control-plane/api/v1alpha1/servicedefaults_types.go index c2aa1ab61e..f5b0160397 100644 --- a/control-plane/api/v1alpha1/servicedefaults_types.go +++ b/control-plane/api/v1alpha1/servicedefaults_types.go @@ -29,6 +29,7 @@ func init() { // +kubebuilder:printcolumn:name="Synced",type="string",JSONPath=".status.conditions[?(@.type==\"Synced\")].status",description="The sync status of the resource with Consul" // +kubebuilder:printcolumn:name="Last Synced",type="date",JSONPath=".status.lastSyncedTime",description="The last successful synced time of the resource with Consul" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="The age of the resource" +// +kubebuilder:resource:shortName="service-defaults" type ServiceDefaults struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/control-plane/api/v1alpha1/serviceintentions_types.go b/control-plane/api/v1alpha1/serviceintentions_types.go index 80b66054f9..2a776e8209 100644 --- a/control-plane/api/v1alpha1/serviceintentions_types.go +++ b/control-plane/api/v1alpha1/serviceintentions_types.go @@ -29,6 +29,7 @@ func init() { // +kubebuilder:printcolumn:name="Synced",type="string",JSONPath=".status.conditions[?(@.type==\"Synced\")].status",description="The sync status of the resource with Consul" // +kubebuilder:printcolumn:name="Last Synced",type="date",JSONPath=".status.lastSyncedTime",description="The last successful synced time of the resource with Consul" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="The age of the resource" +// +kubebuilder:resource:shortName="service-intentions" type ServiceIntentions struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/control-plane/api/v1alpha1/serviceresolver_types.go b/control-plane/api/v1alpha1/serviceresolver_types.go index 8def0f2fa4..7ce67cb370 100644 --- a/control-plane/api/v1alpha1/serviceresolver_types.go +++ b/control-plane/api/v1alpha1/serviceresolver_types.go @@ -27,6 +27,7 @@ func init() { // +kubebuilder:printcolumn:name="Synced",type="string",JSONPath=".status.conditions[?(@.type==\"Synced\")].status",description="The sync status of the resource with Consul" // +kubebuilder:printcolumn:name="Last Synced",type="date",JSONPath=".status.lastSyncedTime",description="The last successful synced time of the resource with Consul" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="The age of the resource" +// +kubebuilder:resource:shortName="service-resolver" type ServiceResolver struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/control-plane/api/v1alpha1/servicerouter_types.go b/control-plane/api/v1alpha1/servicerouter_types.go index dbe9c15895..cc455a0853 100644 --- a/control-plane/api/v1alpha1/servicerouter_types.go +++ b/control-plane/api/v1alpha1/servicerouter_types.go @@ -30,6 +30,7 @@ const ( // +kubebuilder:printcolumn:name="Synced",type="string",JSONPath=".status.conditions[?(@.type==\"Synced\")].status",description="The sync status of the resource with Consul" // +kubebuilder:printcolumn:name="Last Synced",type="date",JSONPath=".status.lastSyncedTime",description="The last successful synced time of the resource with Consul" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="The age of the resource" +// +kubebuilder:resource:shortName="service-router" type ServiceRouter struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/control-plane/api/v1alpha1/servicesplitter_types.go b/control-plane/api/v1alpha1/servicesplitter_types.go index 900cc1c545..fb5ba74d7f 100644 --- a/control-plane/api/v1alpha1/servicesplitter_types.go +++ b/control-plane/api/v1alpha1/servicesplitter_types.go @@ -26,6 +26,7 @@ func init() { // +kubebuilder:printcolumn:name="Synced",type="string",JSONPath=".status.conditions[?(@.type==\"Synced\")].status",description="The sync status of the resource with Consul" // +kubebuilder:printcolumn:name="Last Synced",type="date",JSONPath=".status.lastSyncedTime",description="The last successful synced time of the resource with Consul" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="The age of the resource" +// +kubebuilder:resource:shortName="service-splitter" type ServiceSplitter struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/control-plane/api/v1alpha1/terminatinggateway_types.go b/control-plane/api/v1alpha1/terminatinggateway_types.go index 2973e58714..1236307b99 100644 --- a/control-plane/api/v1alpha1/terminatinggateway_types.go +++ b/control-plane/api/v1alpha1/terminatinggateway_types.go @@ -30,6 +30,7 @@ func init() { // +kubebuilder:printcolumn:name="Synced",type="string",JSONPath=".status.conditions[?(@.type==\"Synced\")].status",description="The sync status of the resource with Consul" // +kubebuilder:printcolumn:name="Last Synced",type="date",JSONPath=".status.lastSyncedTime",description="The last successful synced time of the resource with Consul" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="The age of the resource" +// +kubebuilder:resource:shortName="terminating-gateway" type TerminatingGateway struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/control-plane/config/crd/bases/consul.hashicorp.com_exportedservices.yaml b/control-plane/config/crd/bases/consul.hashicorp.com_exportedservices.yaml index 7c9b46192b..c8e10c6f09 100644 --- a/control-plane/config/crd/bases/consul.hashicorp.com_exportedservices.yaml +++ b/control-plane/config/crd/bases/consul.hashicorp.com_exportedservices.yaml @@ -13,6 +13,8 @@ spec: kind: ExportedServices listKind: ExportedServicesList plural: exportedservices + shortNames: + - exported-services singular: exportedservices scope: Namespaced versions: diff --git a/control-plane/config/crd/bases/consul.hashicorp.com_ingressgateways.yaml b/control-plane/config/crd/bases/consul.hashicorp.com_ingressgateways.yaml index ed2114aee9..13513ab65a 100644 --- a/control-plane/config/crd/bases/consul.hashicorp.com_ingressgateways.yaml +++ b/control-plane/config/crd/bases/consul.hashicorp.com_ingressgateways.yaml @@ -13,6 +13,8 @@ spec: kind: IngressGateway listKind: IngressGatewayList plural: ingressgateways + shortNames: + - ingress-gateway singular: ingressgateway scope: Namespaced versions: diff --git a/control-plane/config/crd/bases/consul.hashicorp.com_proxydefaults.yaml b/control-plane/config/crd/bases/consul.hashicorp.com_proxydefaults.yaml index f440d012c8..520fe95443 100644 --- a/control-plane/config/crd/bases/consul.hashicorp.com_proxydefaults.yaml +++ b/control-plane/config/crd/bases/consul.hashicorp.com_proxydefaults.yaml @@ -13,6 +13,8 @@ spec: kind: ProxyDefaults listKind: ProxyDefaultsList plural: proxydefaults + shortNames: + - proxy-defaults singular: proxydefaults scope: Namespaced versions: diff --git a/control-plane/config/crd/bases/consul.hashicorp.com_servicedefaults.yaml b/control-plane/config/crd/bases/consul.hashicorp.com_servicedefaults.yaml index 08da8480f1..b29905b01a 100644 --- a/control-plane/config/crd/bases/consul.hashicorp.com_servicedefaults.yaml +++ b/control-plane/config/crd/bases/consul.hashicorp.com_servicedefaults.yaml @@ -13,6 +13,8 @@ spec: kind: ServiceDefaults listKind: ServiceDefaultsList plural: servicedefaults + shortNames: + - service-defaults singular: servicedefaults scope: Namespaced versions: diff --git a/control-plane/config/crd/bases/consul.hashicorp.com_serviceintentions.yaml b/control-plane/config/crd/bases/consul.hashicorp.com_serviceintentions.yaml index d3420d1e77..1593fc86fd 100644 --- a/control-plane/config/crd/bases/consul.hashicorp.com_serviceintentions.yaml +++ b/control-plane/config/crd/bases/consul.hashicorp.com_serviceintentions.yaml @@ -13,6 +13,8 @@ spec: kind: ServiceIntentions listKind: ServiceIntentionsList plural: serviceintentions + shortNames: + - service-intentions singular: serviceintentions scope: Namespaced versions: diff --git a/control-plane/config/crd/bases/consul.hashicorp.com_serviceresolvers.yaml b/control-plane/config/crd/bases/consul.hashicorp.com_serviceresolvers.yaml index 87285e8563..c170465322 100644 --- a/control-plane/config/crd/bases/consul.hashicorp.com_serviceresolvers.yaml +++ b/control-plane/config/crd/bases/consul.hashicorp.com_serviceresolvers.yaml @@ -13,6 +13,8 @@ spec: kind: ServiceResolver listKind: ServiceResolverList plural: serviceresolvers + shortNames: + - service-resolver singular: serviceresolver scope: Namespaced versions: diff --git a/control-plane/config/crd/bases/consul.hashicorp.com_servicerouters.yaml b/control-plane/config/crd/bases/consul.hashicorp.com_servicerouters.yaml index ec74f9b63d..77707c0770 100644 --- a/control-plane/config/crd/bases/consul.hashicorp.com_servicerouters.yaml +++ b/control-plane/config/crd/bases/consul.hashicorp.com_servicerouters.yaml @@ -13,6 +13,8 @@ spec: kind: ServiceRouter listKind: ServiceRouterList plural: servicerouters + shortNames: + - service-router singular: servicerouter scope: Namespaced versions: diff --git a/control-plane/config/crd/bases/consul.hashicorp.com_servicesplitters.yaml b/control-plane/config/crd/bases/consul.hashicorp.com_servicesplitters.yaml index fbbac1010e..204179c000 100644 --- a/control-plane/config/crd/bases/consul.hashicorp.com_servicesplitters.yaml +++ b/control-plane/config/crd/bases/consul.hashicorp.com_servicesplitters.yaml @@ -13,6 +13,8 @@ spec: kind: ServiceSplitter listKind: ServiceSplitterList plural: servicesplitters + shortNames: + - service-splitter singular: servicesplitter scope: Namespaced versions: diff --git a/control-plane/config/crd/bases/consul.hashicorp.com_terminatinggateways.yaml b/control-plane/config/crd/bases/consul.hashicorp.com_terminatinggateways.yaml index ce87093245..716f22e4ef 100644 --- a/control-plane/config/crd/bases/consul.hashicorp.com_terminatinggateways.yaml +++ b/control-plane/config/crd/bases/consul.hashicorp.com_terminatinggateways.yaml @@ -13,6 +13,8 @@ spec: kind: TerminatingGateway listKind: TerminatingGatewayList plural: terminatinggateways + shortNames: + - terminating-gateway singular: terminatinggateway scope: Namespaced versions: From f6e89b7f0d3a768891dbb77b48a59eba897b10ca Mon Sep 17 00:00:00 2001 From: Luke Kysow <1034429+lkysow@users.noreply.github.com> Date: Thu, 13 Jan 2022 19:00:45 -0800 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd6b49bb55..0aed4f74e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ IMPROVEMENTS: * Helm * Allow customization of `terminationGracePeriodSeconds` on the ingress gateways. [[GH-947](https://github.com/hashicorp/consul-k8s/pull/947)] * Support `ui.dashboardURLTemplates.service` value for setting [dashboard URL templates](https://www.consul.io/docs/agent/options#ui_config_dashboard_url_templates_service). [[GH-937](https://github.com/hashicorp/consul-k8s/pull/937)] + * Allow using dash-separated names for config entries when using `kubectl`. [[GH-965](https://github.com/hashicorp/consul-k8s/pull/965)] BUG FIXES: * Helm From 6af8bab94cdff389f4f69fac4f05f09a12961055 Mon Sep 17 00:00:00 2001 From: Luke Kysow <1034429+lkysow@users.noreply.github.com> Date: Wed, 19 Jan 2022 14:09:17 -0800 Subject: [PATCH 3/3] Update CRDs --- charts/consul/templates/crd-exportedservices.yaml | 2 ++ charts/consul/templates/crd-ingressgateways.yaml | 2 ++ charts/consul/templates/crd-proxydefaults.yaml | 2 ++ charts/consul/templates/crd-servicedefaults.yaml | 2 ++ charts/consul/templates/crd-serviceintentions.yaml | 2 ++ charts/consul/templates/crd-serviceresolvers.yaml | 2 ++ charts/consul/templates/crd-servicerouters.yaml | 2 ++ charts/consul/templates/crd-servicesplitters.yaml | 2 ++ charts/consul/templates/crd-terminatinggateways.yaml | 2 ++ 9 files changed, 18 insertions(+) diff --git a/charts/consul/templates/crd-exportedservices.yaml b/charts/consul/templates/crd-exportedservices.yaml index 67f67e5704..9ddb7d3053 100644 --- a/charts/consul/templates/crd-exportedservices.yaml +++ b/charts/consul/templates/crd-exportedservices.yaml @@ -19,6 +19,8 @@ spec: kind: ExportedServices listKind: ExportedServicesList plural: exportedservices + shortNames: + - exported-services singular: exportedservices scope: Namespaced versions: diff --git a/charts/consul/templates/crd-ingressgateways.yaml b/charts/consul/templates/crd-ingressgateways.yaml index a9e2888ed7..f30e7f7a06 100644 --- a/charts/consul/templates/crd-ingressgateways.yaml +++ b/charts/consul/templates/crd-ingressgateways.yaml @@ -19,6 +19,8 @@ spec: kind: IngressGateway listKind: IngressGatewayList plural: ingressgateways + shortNames: + - ingress-gateway singular: ingressgateway scope: Namespaced versions: diff --git a/charts/consul/templates/crd-proxydefaults.yaml b/charts/consul/templates/crd-proxydefaults.yaml index d60160e260..6e21c89480 100644 --- a/charts/consul/templates/crd-proxydefaults.yaml +++ b/charts/consul/templates/crd-proxydefaults.yaml @@ -19,6 +19,8 @@ spec: kind: ProxyDefaults listKind: ProxyDefaultsList plural: proxydefaults + shortNames: + - proxy-defaults singular: proxydefaults scope: Namespaced versions: diff --git a/charts/consul/templates/crd-servicedefaults.yaml b/charts/consul/templates/crd-servicedefaults.yaml index 329a4d35bd..ab356836d2 100644 --- a/charts/consul/templates/crd-servicedefaults.yaml +++ b/charts/consul/templates/crd-servicedefaults.yaml @@ -19,6 +19,8 @@ spec: kind: ServiceDefaults listKind: ServiceDefaultsList plural: servicedefaults + shortNames: + - service-defaults singular: servicedefaults scope: Namespaced versions: diff --git a/charts/consul/templates/crd-serviceintentions.yaml b/charts/consul/templates/crd-serviceintentions.yaml index 7901083e3f..ffcd44ae5c 100644 --- a/charts/consul/templates/crd-serviceintentions.yaml +++ b/charts/consul/templates/crd-serviceintentions.yaml @@ -19,6 +19,8 @@ spec: kind: ServiceIntentions listKind: ServiceIntentionsList plural: serviceintentions + shortNames: + - service-intentions singular: serviceintentions scope: Namespaced versions: diff --git a/charts/consul/templates/crd-serviceresolvers.yaml b/charts/consul/templates/crd-serviceresolvers.yaml index 2bf85cbf0a..1023b9127f 100644 --- a/charts/consul/templates/crd-serviceresolvers.yaml +++ b/charts/consul/templates/crd-serviceresolvers.yaml @@ -19,6 +19,8 @@ spec: kind: ServiceResolver listKind: ServiceResolverList plural: serviceresolvers + shortNames: + - service-resolver singular: serviceresolver scope: Namespaced versions: diff --git a/charts/consul/templates/crd-servicerouters.yaml b/charts/consul/templates/crd-servicerouters.yaml index ac0f515b8e..15b15e7f6b 100644 --- a/charts/consul/templates/crd-servicerouters.yaml +++ b/charts/consul/templates/crd-servicerouters.yaml @@ -19,6 +19,8 @@ spec: kind: ServiceRouter listKind: ServiceRouterList plural: servicerouters + shortNames: + - service-router singular: servicerouter scope: Namespaced versions: diff --git a/charts/consul/templates/crd-servicesplitters.yaml b/charts/consul/templates/crd-servicesplitters.yaml index e91b16db6c..05b5548ce9 100644 --- a/charts/consul/templates/crd-servicesplitters.yaml +++ b/charts/consul/templates/crd-servicesplitters.yaml @@ -19,6 +19,8 @@ spec: kind: ServiceSplitter listKind: ServiceSplitterList plural: servicesplitters + shortNames: + - service-splitter singular: servicesplitter scope: Namespaced versions: diff --git a/charts/consul/templates/crd-terminatinggateways.yaml b/charts/consul/templates/crd-terminatinggateways.yaml index 518f03fe70..3db27d2bce 100644 --- a/charts/consul/templates/crd-terminatinggateways.yaml +++ b/charts/consul/templates/crd-terminatinggateways.yaml @@ -19,6 +19,8 @@ spec: kind: TerminatingGateway listKind: TerminatingGatewayList plural: terminatinggateways + shortNames: + - terminating-gateway singular: terminatinggateway scope: Namespaced versions: