Skip to content

[UX-749] rpk: add --format json/yaml to shadow describe#29111

Merged
r-vasquez merged 1 commit into
redpanda-data:devfrom
r-vasquez:shadow-describe-json
Jan 2, 2026
Merged

[UX-749] rpk: add --format json/yaml to shadow describe#29111
r-vasquez merged 1 commit into
redpanda-data:devfrom
r-vasquez:shadow-describe-json

Conversation

@r-vasquez

Copy link
Copy Markdown
Contributor

It is pretty similar to our raw text response, the only difference is that the fields in the overview section are flattened now in the top level as it makes more sense when querying the resource.

Sample:

$ rpk shadow describe shadow-test --format json
{"name":"shadow-test","id":"f895a293-21bc-4c49-a1d4-501d3abde03e","state":"ACTIVE","client_options":{"client_id":"cluster-link-shadow-test-444-21bc-444-a1d4-444","bootstrap_servers":["444.foo.bar.cloud.redpanda.com:9092"],"tls_settings":{"enabled":true},"authentication_configuration":{"username":"foo","mechanism":"SCRAM-SHA-256","password_set":true,"password_set_at":"2025-12-19T20:13:10Z"},"metadata_max_age_ms":10000,"connection_timeout_ms":1000,"retry_backoff_ms":100,"fetch_wait_max_ms":500,"fetch_min_bytes":5242880,"fetch_max_bytes":20971520,"fetch_partition_max_bytes":5242880},"topic_metadata_sync_options":{"interval":"30s","paused":false,"start_offset":"EARLIEST","auto_create_shadow_topic_filters":[{"pattern_type":"PREFIX","filter_type":"INCLUDE","name":"shadow-"}],"synced_shadow_topic_properties":["retention.ms","compression.type","segment.ms"]},"consumer_offset_sync_options":{"interval":"30s","paused":false,"group_filters":[{"pattern_type":"LITERAL","filter_type":"INCLUDE","name":"*"}]},"security_sync_options":{"interval":"30s","paused":false,"acl_filters":[{"resource_filter":{"resource_type":"TOPIC","pattern_type":"PREFIXED","name":"test-"},"access_filter":{"principal":"User:admin","operation":"ANY","permission_type":"ALLOW","host":"*"}}]},"schema_registry_sync_options":{"shadowing_mode":"shadow schema registry topic"}}

Pretty print:

{
  "name": "shadow-test",
  "id": "f895a293-21bc-4c49-a1d4-501d3abde03e",
  "state": "ACTIVE",
  "client_options": {
    "client_id": "cluster-link-shadow-test-444-21bc-444-a1d4-444",
    "bootstrap_servers": [
      "444.foo.bar.cloud.redpanda.com:9092"
    ],
    "tls_settings": {
      "enabled": true
    },
    "authentication_configuration": {
      "username": "foo",
      "mechanism": "SCRAM-SHA-256",
      "password_set": true,
      "password_set_at": "2025-12-19T20:13:10Z"
    },
    "metadata_max_age_ms": 10000,
    "connection_timeout_ms": 1000,
    "retry_backoff_ms": 100,
    "fetch_wait_max_ms": 500,
    "fetch_min_bytes": 5242880,
    "fetch_max_bytes": 20971520,
    "fetch_partition_max_bytes": 5242880
  },
  "topic_metadata_sync_options": {
    "interval": "30s",
    "paused": false,
    "start_offset": "EARLIEST",
    "auto_create_shadow_topic_filters": [
      {
        "pattern_type": "PREFIX",
        "filter_type": "INCLUDE",
        "name": "shadow-"
      }
    ],
    "synced_shadow_topic_properties": [
      "segment.ms",
      "retention.ms",
      "compression.type"
    ]
  },
  "consumer_offset_sync_options": {
    "interval": "30s",
    "paused": false,
    "group_filters": [
      {
        "pattern_type": "LITERAL",
        "filter_type": "INCLUDE",
        "name": "*"
      }
    ]
  },
  "security_sync_options": {
    "interval": "30s",
    "paused": false,
    "acl_filters": [
      {
        "resource_filter": {
          "resource_type": "TOPIC",
          "pattern_type": "PREFIXED",
          "name": "test-"
        },
        "access_filter": {
          "principal": "User:admin",
          "operation": "ANY",
          "permission_type": "ALLOW",
          "host": "*"
        }
      }
    ]
  },
  "schema_registry_sync_options": {
    "shadowing_mode": "shadow schema registry topic"
  }
}

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v25.3.x
  • v25.2.x
  • v25.1.x

Release Notes

Improvements

  • rpk shadow describe now supports the --format json/yaml flag.

@r-vasquez r-vasquez requested review from a team and kbatuigas as code owners December 23, 2025 20:38
@r-vasquez r-vasquez requested review from andresaristizabal and Copilot and removed request for a team December 23, 2025 20:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds JSON and YAML output format support to the rpk shadow describe command. Previously, the command only supported text output with configurable sections. Now users can output the complete shadow link configuration in structured formats suitable for programmatic consumption or configuration management.

Key Changes:

  • Added shadowLinkDescription and related structs to represent the unified output format
  • Modified printShadowLinkDescription and printCloudShadowLinkDescription to support formatters
  • Implemented conversion functions to transform protobuf types into the output structs
  • Added the --format flag to the command

Comment thread src/go/rpk/pkg/cli/shadow/describe.go
Comment thread src/go/rpk/pkg/cli/shadow/describe.go
Comment thread src/go/rpk/pkg/cli/shadow/describe.go
Comment thread src/go/rpk/pkg/cli/shadow/describe.go
Comment thread src/go/rpk/pkg/cli/shadow/describe.go
@r-vasquez

Copy link
Copy Markdown
Contributor Author

For the record, copilot review is mistaken, probably misguided as both core and cloud share some proto definitions. Go build would have failed if this was the case.

@r-vasquez r-vasquez merged commit 3dc9c91 into redpanda-data:dev Jan 2, 2026
27 checks passed
@r-vasquez

Copy link
Copy Markdown
Contributor Author

/backport v25.3.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants