Skip to content

Commit

Permalink
make glooctl check work for kube gateways (#9621)
Browse files Browse the repository at this point in the history
* glooctl check

* cl

* codegen

* use const

* standardize casing

* standardize case

* update kubegateway check

* fix import

* scheme

* KUBE2E_TESTS not needed by setup-kind

* fix test

* Adding changelog file to new location

* Deleting changelog file from old location

* fix typo

* add additional check outputs

* exclude kube checks

* add docs to exclude

* ensure kube resources are not checked if not enabled

* add exclude options

* add todo

* update kubegatewayenabled check

* fix newline

* use constants

* return early

* update comment

* Update error

* address comments

* rename kube gateway

* update message

---------

Co-authored-by: soloio-bulldozer[bot] <48420018+soloio-bulldozer[bot]@users.noreply.github.com>
Co-authored-by: changelog-bot <changelog-bot>
Co-authored-by: David Jumani <[email protected]>
  • Loading branch information
3 people committed Jun 21, 2024
1 parent ec0e655 commit 09d8546
Show file tree
Hide file tree
Showing 22 changed files with 567 additions and 494 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ runs:
- name: Setup test env
shell: bash
env:
KUBE2E_TESTS: ${{ matrix.kube-e2e-test-type }}
CLUSTER_NAME: 'kind'
CLUSTER_NODE_VERSION: ${{ matrix.kube-version.node }}
IMAGE_VARIANT: ${{ matrix.image-variant }}
Expand Down
6 changes: 6 additions & 0 deletions changelog/v1.17.0-rc7/glooctl-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
changelog:
- type: FIX
issueLink: https://github.com/solo-io/solo-projects/issues/5741
resolvesIssue: false
description: >-
Update `glooctl check` to check for Kubernetes Gateway resources.
2 changes: 0 additions & 2 deletions ci/kind/setup-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ VERSION="${VERSION:-1.0.0-ci1}"
SKIP_DOCKER="${SKIP_DOCKER:-false}"
# Stop after creating the kind cluster
JUST_KIND="${JUST_KIND:-false}"
# Offer a default value for type of installation
KUBE2E_TESTS="${KUBE2E_TESTS:-gateway}" # If 'KUBE2E_TESTS' not set or null, use 'gateway'.
# Set the default image variant to standard
IMAGE_VARIANT="${IMAGE_VARIANT:-standard}"
# If true, run extra steps to set up k8s gateway api conformance test environment
Expand Down
67 changes: 36 additions & 31 deletions docs/content/guides/gloo_federation/federated_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,47 +183,52 @@ glooctl check
```

```shell
Checking deployments... OK
Checking pods... OK
Checking upstreams... OK
Checking upstream groups... OK
Checking auth configs... OK
Checking rate limit configs... OK
Checking Deployments... OK
Checking Pods... OK
Checking Upstreams... OK
Checking UpstreamGroups... OK
Checking AuthConfigs... OK
Checking RateLimitConfigs... OK
Checking VirtualHostOptions... OK
Checking RouteOptions... OK
Checking secrets... OK
Checking virtual services... OK
Checking gateways... OK
Checking proxies... OK
Checking rate limit server... OK
Checking Secrets... OK
Checking VirtualServices... OK
Checking Gateways... OK
Checking Proxies... OK
No problems detected.

Detected Gloo Federation!

Checking Gloo Instance remote-1-gloo-system...
Checking deployments... OK
Checking pods... OK
Checking settings... OK
Checking upstreams... OK
Checking upstream groups... OK
Checking auth configs... OK
Checking virtual services... OK
Checking route tables... OK
Checking gateways... OK
Checking proxies... OK
Checking Deployments... OK
Checking Pods... OK
Checking Settings... OK
Checking Upstreams... OK
Checking UpstreamGroups... OK
Checking AuthConfigs... OK
Checking RateLimitConfigs... OK
Checking VirtualServices... OK
Checking RouteRables... OK
Checking Gateways... OK
Checking MatchableHttpGateways... OK
Checking MatchableTcpGateways... OK
Checking Proxies... OK


Checking Gloo Instance remote-2-gloo-system...
Checking deployments... OK
Checking pods... OK
Checking settings... OK
Checking upstreams... OK
Checking upstream groups... OK
Checking auth configs... OK
Checking virtual services... OK
Checking route tables... OK
Checking gateways... OK
Checking proxies... OK
Checking Deployments... OK
Checking Pods... OK
Checking Settings... OK
Checking Upstreams... OK
Checking UpstreamGroups... OK
Checking AuthConfigs... OK
Checking RateLimitConfigs... OK
Checking VirtualServices... OK
Checking RouteRables... OK
Checking Gateways... OK
Checking MatchableHttpGateways... OK
Checking MatchableTcpGateways... OK
Checking Proxies... OK
```

Note that it is best to have `gloo-edge` installed on this admin cluster. To do so, if needed, you can use the following values and command.
Expand Down
20 changes: 10 additions & 10 deletions docs/content/operations/debugging_gloo/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@ glooctl check

Example output for a healthy setup:
```
Checking deployments... OK
Checking pods... OK
Checking upstreams... OK
Checking upstream groups... OK
Checking auth configs... OK
Checking rate limit configs... OK
Checking Deployments... OK
Checking Pods... OK
Checking Upstreams... OK
Checking UpstreamGroups... OK
Checking AuthConfigs... OK
Checking RateLimitConfigs... OK
Checking VirtualHostOptions... OK
Checking RouteOptions... OK
Checking secrets... OK
Checking virtual services... OK
Checking gateways... OK
Checking proxies... OK
Checking Secrets... OK
Checking VirtualServices... OK
Checking Gateways... OK
Checking Proxies... OK
No problems detected.
```

Expand Down
16 changes: 8 additions & 8 deletions docs/content/operations/upgrading/upgrade_steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ Upgrade your Gloo Edge installation. The following example upgrade commands assu
```
Example output:
```bash
Checking deployments... OK
Checking pods... OK
Checking upstreams... OK
Checking upstream groups... OK
Checking secrets... OK
Checking virtual services... OK
Checking gateways... OK
Checking proxies... OK
Checking Deployments... OK
Checking Pods... OK
Checking Upstreams... OK
Checking UpstreamGroups... OK
Checking Secrets... OK
Checking VirtualServices... OK
Checking Gateways... OK
Checking Proxies... OK
No problems detected.
```

Expand Down
2 changes: 1 addition & 1 deletion docs/content/reference/cli/glooctl_check.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ glooctl check [flags]
### Options

```
-x, --exclude strings check to exclude: (deployments, pods, upstreams, upstreamgroup, auth-configs, rate-limit-configs, secrets, virtual-services, gateways, proxies, xds-metrics)
-x, --exclude strings check to exclude: (deployments, pods, upstreams, upstreamgroup, auth-configs, rate-limit-configs, virtual-host-options, route-options, secrets, virtual-services, gateways, proxies, xds-metrics, kube-gateway-classes, kube-gateways, kube-http-routes)
-h, --help help for check
-n, --namespace string namespace for reading or writing resources (default "gloo-system")
-o, --output OutputType output format: (json, table) (default table)
Expand Down
20 changes: 10 additions & 10 deletions docs/content/support/support-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ Get the Argo CD applications that define the installation of Gloo Edge by using
<br>Typically, the command output indicates any errors in the control plane components or associated resources, such as in the following example.

```
Checking deployments... 1 Errors!
Checking pods... 2 Errors!
Checking upstreams... OK
Checking upstream groups... OK
Checking auth configs... OK
Checking rate limit configs... OK
Checking Deployments... 1 Errors!
Checking Pods... 2 Errors!
Checking Upstreams... OK
Checking UpstreamGroups... OK
Checking AuthConfigs... OK
Checking RateLimitConfigs... OK
Checking VirtualHostOptions... OK
Checking RouteOptions... OK
Checking secrets... OK
Checking virtual services... OK
Checking gateways... OK
Checking proxies... Skipping due to an error in checking deployments
Checking Secrets... OK
Checking VirtualServices... OK
Checking Gateways... OK
Checking Proxies... Skipping due to an error in checking deployments
Skipping due to an error in checking deployments
Error: 5 errors occurred:
* Deployment gloo in namespace gloo-system is not available! Message: Deployment does not have minimum availability.
Expand Down
36 changes: 18 additions & 18 deletions projects/gloo/cli/pkg/cmd/check/gloo_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/golang/protobuf/jsonpb"
"github.com/solo-io/gloo/projects/gloo/cli/pkg/cmd/options"
"github.com/solo-io/gloo/projects/gloo/cli/pkg/constants"
"github.com/solo-io/gloo/projects/gloo/cli/pkg/helpers"
"github.com/solo-io/gloo/projects/gloo/cli/pkg/printers"
glooinstancev1 "github.com/solo-io/solo-apis/pkg/api/fed.solo.io/v1"
Expand All @@ -27,10 +28,10 @@ import (
func CheckMulticlusterResources(ctx context.Context, printer printers.P, opts *options.Options) {
// check if the gloo fed deployment exists
client := helpers.MustKubeClientWithKubecontext(opts.Top.KubeContext)
_, err := client.AppsV1().Deployments(opts.Metadata.GetNamespace()).Get(ctx, "gloo-fed", metav1.GetOptions{})
_, err := client.AppsV1().Deployments(opts.Metadata.GetNamespace()).Get(ctx, constants.GlooFedDeploymentName, metav1.GetOptions{})
if err != nil {
if apierrors.IsNotFound(err) {
printer.AppendMessage("Skipping Gloo Instance check -- Gloo Federation not detected")
printer.AppendMessage("\nSkipping Gloo Instance check -- Gloo Federation not detected.")
} else {
fmt.Printf("Warning: could not get Gloo Fed deployment: %v. Skipping Gloo Instance check.\n", err)
}
Expand All @@ -51,7 +52,7 @@ func CheckMulticlusterResources(ctx context.Context, printer printers.P, opts *o
glooInstanceList, err := instanceReader.listGlooInstances(ctx)
if err != nil {
if meta.IsNoMatchError(err) {
printer.AppendMessage("Skipping Gloo Instance check -- Gloo Federation not detected")
printer.AppendMessage("Skipping Gloo Instance check -- Gloo Federation not detected.")
return
}
fmt.Printf("Warning: could not list Gloo Instances: %v\n", err)
Expand All @@ -60,16 +61,19 @@ func CheckMulticlusterResources(ctx context.Context, printer printers.P, opts *o
printer.AppendMessage("\nDetected Gloo Federation!")
for _, glooInstance := range glooInstanceList.Items {
fmt.Printf("\nChecking Gloo Instance %s... ", glooInstance.GetName())
printGlooInstanceCheckSummary("deployments", glooInstance.Spec.GetCheck().GetDeployments())
printGlooInstanceCheckSummary("pods", glooInstance.Spec.GetCheck().GetPods())
printGlooInstanceCheckSummary("settings", glooInstance.Spec.GetCheck().GetSettings())
printGlooInstanceCheckSummary("upstreams", glooInstance.Spec.GetCheck().GetUpstreams())
printGlooInstanceCheckSummary("upstream groups", glooInstance.Spec.GetCheck().GetUpstreamGroups())
printGlooInstanceCheckSummary("auth configs", glooInstance.Spec.GetCheck().GetAuthConfigs())
printGlooInstanceCheckSummary("virtual services", glooInstance.Spec.GetCheck().GetVirtualServices())
printGlooInstanceCheckSummary("route tables", glooInstance.Spec.GetCheck().GetRouteTables())
printGlooInstanceCheckSummary("gateways", glooInstance.Spec.GetCheck().GetGateways())
printGlooInstanceCheckSummary("proxies", glooInstance.Spec.GetCheck().GetProxies())
printGlooInstanceCheckSummary("Deployments", glooInstance.Spec.GetCheck().GetDeployments())
printGlooInstanceCheckSummary("Pods", glooInstance.Spec.GetCheck().GetPods())
printGlooInstanceCheckSummary("Settings", glooInstance.Spec.GetCheck().GetSettings())
printGlooInstanceCheckSummary("Upstreams", glooInstance.Spec.GetCheck().GetUpstreams())
printGlooInstanceCheckSummary("UpstreamGroups", glooInstance.Spec.GetCheck().GetUpstreamGroups())
printGlooInstanceCheckSummary("AuthConfigs", glooInstance.Spec.GetCheck().GetAuthConfigs())
printGlooInstanceCheckSummary("RateLimitConfigs", glooInstance.Spec.GetCheck().GetRateLimitConfigs())
printGlooInstanceCheckSummary("VirtualServices", glooInstance.Spec.GetCheck().GetVirtualServices())
printGlooInstanceCheckSummary("RouteTables", glooInstance.Spec.GetCheck().GetRouteTables())
printGlooInstanceCheckSummary("Gateways", glooInstance.Spec.GetCheck().GetGateways())
printGlooInstanceCheckSummary("MatchableHttpGateways", glooInstance.Spec.GetCheck().GetMatchableHttpGateways())
printGlooInstanceCheckSummary("MatchableTcpGateways", glooInstance.Spec.GetCheck().GetMatchableTcpGateways())
printGlooInstanceCheckSummary("Proxies", glooInstance.Spec.GetCheck().GetProxies())
fmt.Printf("\n\n")
}
}
Expand Down Expand Up @@ -101,12 +105,8 @@ type unstructuredGlooInstanceReader struct {
}

func getUnstructuredGlooInstanceReader(cfg *rest.Config) (*unstructuredGlooInstanceReader, error) {
scheme := scheme.Scheme
if err := glooinstancev1.AddToScheme(scheme); err != nil {
return nil, err
}
client, err := client.New(cfg, client.Options{
Scheme: scheme,
Scheme: scheme.Scheme,
})
if err != nil {
return nil, err
Expand Down
Loading

0 comments on commit 09d8546

Please sign in to comment.