From d59e15e5239328680146472a363feffc264f804f Mon Sep 17 00:00:00 2001 From: Michi Mutsuzaki Date: Wed, 15 Jun 2022 17:25:38 -0700 Subject: [PATCH] hubble port-forward: Don't generate Helm manifests Get hubble-relay service port from Kubernetes APIs instead of relying on Helm charts. This way the port-forward command works regardless of how Cilium was installed. Signed-off-by: Michi Mutsuzaki --- hubble/hubble.go | 1 + hubble/relay.go | 15 +-------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/hubble/hubble.go b/hubble/hubble.go index 7e8ace61fb..7faef5005d 100644 --- a/hubble/hubble.go +++ b/hubble/hubble.go @@ -62,6 +62,7 @@ type k8sHubbleImplementation interface { ListCiliumEndpoints(ctx context.Context, namespace string, opts metav1.ListOptions) (*ciliumv2.CiliumEndpointList, error) GetServerVersion() (*semver.Version, error) GetHelmState(ctx context.Context, namespace string, secretName string) (*helm.State, error) + GetService(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*corev1.Service, error) } type K8sHubble struct { diff --git a/hubble/relay.go b/hubble/relay.go index a4cc5db96c..458d1322cc 100644 --- a/hubble/relay.go +++ b/hubble/relay.go @@ -252,24 +252,11 @@ func (k *K8sHubble) generateRelayCertificate(name string) (corev1.Secret, error) } func (k *K8sHubble) PortForwardCommand(ctx context.Context) error { - helmState, err := k.client.GetHelmState(ctx, k.params.Namespace, k.params.HelmValuesSecretName) + relaySvc, err := k.client.GetService(ctx, k.params.Namespace, "hubble-relay", metav1.GetOptions{}) if err != nil { return err } - // Generate the manifests has if hubble was being enabled so that we can - // retrieve all UI and Relay's resource names. - k.params.UI = true - k.params.Relay = true - err = k.generateManifestsEnable(ctx, false, helmState.Values) - if err != nil { - return err - } - - relaySvc, err := k.generateRelayService() - if err != nil { - return err - } args := []string{ "port-forward", "-n", k.params.Namespace,