Skip to content

Commit

Permalink
Merge pull request #1103 from wzshiming/fix/old-kwok
Browse files Browse the repository at this point in the history
Fix kwokctl compatibility
  • Loading branch information
wzshiming authored May 23, 2024
2 parents b08e17f + 6fe6c9c commit dfa5971
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
26 changes: 24 additions & 2 deletions pkg/apis/internalversion/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ func Convert_v1alpha1_StageNext_To_internalversion_StageNext(in *v1alpha1.StageN
return err
}

if in.StatusTemplate != "" {
if in.StatusTemplate != "" && len(out.Patches) == 0 {
template := in.StatusTemplate

subresource := "status"
Expand All @@ -419,7 +419,29 @@ func Convert_v1alpha1_StageNext_To_internalversion_StageNext(in *v1alpha1.StageN
Impersonation: impersonation,
}

out.Patches = append([]StagePatch{patch}, out.Patches...)
out.Patches = []StagePatch{patch}
}
return nil
}

// Convert_internalversion_StageNext_To_v1alpha1_StageNext is an autogenerated conversion function.
func Convert_internalversion_StageNext_To_v1alpha1_StageNext(in *StageNext, out *v1alpha1.StageNext, s conversion.Scope) error {
err := autoConvert_internalversion_StageNext_To_v1alpha1_StageNext(in, out, s)
if err != nil {
return err
}

if len(in.Patches) != 0 {
patch := in.Patches[0]
if patch.Root == "status" {
out.StatusSubresource = &patch.Subresource
out.StatusTemplate = patch.Template
if patch.Impersonation != nil {
out.StatusPatchAs = &v1alpha1.ImpersonationConfig{
Username: patch.Impersonation.Username,
}
}
}
}
return nil
}
Expand Down
15 changes: 5 additions & 10 deletions pkg/apis/internalversion/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dfa5971

Please sign in to comment.