Skip to content

Order YAML type meta fields before resource data#1717

Merged
k8s-ci-robot merged 3 commits intomasterfrom
copilot/fix-clone-yaml-go-functionality
Feb 15, 2026
Merged

Order YAML type meta fields before resource data#1717
k8s-ci-robot merged 3 commits intomasterfrom
copilot/fix-clone-yaml-go-functionality

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

  • Review CI failures and run local build/tests
  • Fix StyleCop formatting issue in KubernetesYaml.cs
  • Re-run build/tests to confirm pipeline passes
  • Run code review and CodeQL checks
  • Reply to PR comment after fixes
Original prompt

fix #1715

clone https://github.com/kubernetes/kubernetes/blob/e3684b7eb2bbeed2ca77d56120f3b97258b5858c/staging/src/k8s.io/cli-runtime/pkg/printers/yaml.go#L41C1-L42C1 to c# sdk

remember to add testcases


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 19, 2026
Co-authored-by: tg123 <170430+tg123@users.noreply.github.com>
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 19, 2026
Copilot AI changed the title [WIP] Fix cloning YAML.go functionality in C# SDK Order YAML type meta fields before resource data Jan 19, 2026
Copilot AI requested a review from tg123 January 19, 2026 09:53
@tg123
Copy link
Member

tg123 commented Jan 20, 2026

@copilot Fix pipelines

Co-authored-by: tg123 <170430+tg123@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 20, 2026

@copilot Fix pipelines

Fixed the pipeline StyleCop SA1513 issue by adding the required blank line in KubernetesYaml.cs. Commit: 38a5ce3. No UI changes.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • crl.comodoca.com
    • Triggering command: /home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/.dotnet/dotnet /home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/csharp/csharp/src/KubernetesClient.Classic/KubernetesClient.Classic.csproj --packages /home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot (dns block)
  • ocsp.comodoca.com
    • Triggering command: /home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/.dotnet/dotnet /home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/.dotnet/dotnet restore --no-dependencies /home/REDACTED/work/csharp/csharp/src/KubernetesClient.Classic/KubernetesClient.Classic.csproj --packages /home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/csharp/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@tg123 tg123 marked this pull request as ready for review February 15, 2026 14:13
Copilot AI review requested due to automatic review settings February 15, 2026 14:13
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 15, 2026
Copy link
Contributor

Copilot AI left a comment

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 addresses issue #1715 by implementing property ordering for Kubernetes YAML serialization, ensuring TypeMeta fields (apiVersion, kind, metadata) appear before resource-specific data fields. This matches the behavior of the Kubernetes Go client's CLI runtime printer.

Changes:

  • Modified WithOverridesFromJsonPropertyAttributes to assign explicit order values to properties in types with ApiVersion/Kind fields
  • Updated existing tests to expect the new property ordering
  • Added new test WriteConfigMapOrdersTypeMetaFirst to explicitly verify the ordering behavior

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/KubernetesClient/KubernetesYaml.cs Implements property ordering logic using YamlMemberAttribute.Order for types with ApiVersion/Kind, ensuring TypeMeta fields (ApiVersion, Kind, Metadata) are serialized first, followed by other properties in metadata token order
tests/KubernetesClient.Tests/KubernetesYamlTests.cs Updates WriteSecret and WriteConfigMap test expectations to match new property ordering, and adds WriteConfigMapOrdersTypeMetaFirst test to verify the feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@tg123 tg123 left a comment

Choose a reason for hiding this comment

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

/LGTM

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 15, 2026
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Copilot, tg123

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 15, 2026
@k8s-ci-robot k8s-ci-robot merged commit f93cab4 into master Feb 15, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Serialization order of ConfigMap properties

4 participants