Skip to content

Commit

Permalink
sysdump: collect 'CiliumLocalRedirectPolicy' resources
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno M. Custódio <[email protected]>
  • Loading branch information
bmcustodio authored and tklauser committed Sep 22, 2021
1 parent 2382547 commit 1d30ccd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/k8s/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,3 +688,7 @@ func (c *Client) GetRunningCiliumVersion(ctx context.Context, namespace string)
func (c *Client) ListCiliumEgressNATPolicies(ctx context.Context, opts metav1.ListOptions) (*ciliumv2alpha1.CiliumEgressNATPolicyList, error) {
return c.CiliumClientset.CiliumV2alpha1().CiliumEgressNATPolicies().List(ctx, opts)
}

func (c *Client) ListCiliumLocalRedirectPolicies(ctx context.Context, namespace string, opts metav1.ListOptions) (*ciliumv2.CiliumLocalRedirectPolicyList, error) {
return c.CiliumClientset.CiliumV2().CiliumLocalRedirectPolicies(namespace).List(ctx, opts)
}
1 change: 1 addition & 0 deletions sysdump/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type KubernetesClient interface {
ListCiliumIdentities(ctx context.Context) (*ciliumv2.CiliumIdentityList, error)
ListCiliumEgressNATPolicies(ctx context.Context, opts metav1.ListOptions) (*ciliumv2alpha1.CiliumEgressNATPolicyList, error)
ListCiliumEndpoints(ctx context.Context, namespace string, options metav1.ListOptions) (*ciliumv2.CiliumEndpointList, error)
ListCiliumLocalRedirectPolicies(ctx context.Context, namespace string, options metav1.ListOptions) (*ciliumv2.CiliumLocalRedirectPolicyList, error)
ListCiliumNetworkPolicies(ctx context.Context, namespace string, opts metav1.ListOptions) (*ciliumv2.CiliumNetworkPolicyList, error)
ListCiliumNodes(ctx context.Context) (*ciliumv2.CiliumNodeList, error)
ListEvents(ctx context.Context, o metav1.ListOptions) (*corev1.EventList, error)
Expand Down
1 change: 1 addition & 0 deletions sysdump/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const (
ciliumEndpointsFileName = "ciliumendpoints-<ts>.yaml"
ciliumEtcdSecretFileName = "cilium-etcd-secrets-secret-<ts>.yaml"
ciliumIdentitiesFileName = "ciliumidentities-<ts>.yaml"
ciliumLocalRedirectPoliciesFileName = "ciliumlocalredirectpolicies-<ts>.yaml"
ciliumLogsFileName = "logs-%s-%s-<ts>.log"
ciliumPreviousLogsFileName = "logs-%s-%s-<ts>-prev.log"
ciliumNetworkPoliciesFileName = "ciliumnetworkpolicies-<ts>.yaml"
Expand Down
14 changes: 14 additions & 0 deletions sysdump/sysdump.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,20 @@ func (c *Collector) Run() error {
return nil
},
},
{
Description: "Collecting Cilium local redirect policies",
Quick: true,
Task: func(ctx context.Context) error {
v, err := c.client.ListCiliumLocalRedirectPolicies(ctx, corev1.NamespaceAll, metav1.ListOptions{})
if err != nil {
return fmt.Errorf("failed to collect Cilium local redirect policies: %w", err)
}
if err := writeYaml(absoluteTempPath(ciliumLocalRedirectPoliciesFileName), v); err != nil {
return fmt.Errorf("failed to collect Cilium local redirect policies: %w", err)
}
return nil
},
},
{
Description: "Collecting Cilium endpoints",
Quick: true,
Expand Down

0 comments on commit 1d30ccd

Please sign in to comment.