-
Notifications
You must be signed in to change notification settings - Fork 0
Feature implementation from commits 984acef..6ccc2c0 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feature-base-branch-2
Are you sure you want to change the base?
Conversation
Signed-off-by: zhzhuang-zju <m17799853869@163.com>
add gen-resourcesdocs to generate API docs
Signed-off-by: RainbowMango <qdurenhongcai@gmail.com>
…en_cluster_modes Explain the difference between Push and Pull mode in details
Signed-off-by: Arhell <arhell333@gmail.com>
update semi-ui
Signed-off-by: zhzhuang-zju <m17799853869@163.com>
improve document-releasing process
Signed-off-by: zhzhuang-zju <m17799853869@163.com>
Signed-off-by: 宋阳 <songyang2@xiaohongshu.com>
Add rednote to adopters
update install-binary.md to adjust the installation order
Signed-off-by: changzhen <changzhen5@huawei.com>
…or-components Add binding address configuration for security considerations
Signed-off-by: changzhen <changzhen5@huawei.com>
Signed-off-by: Arhell <arhell333@gmail.com>
update semi-ui to 2.77.1
Signed-off-by: Arhell <arhell333@gmail.com>
update semi-ui to 2.78.0
Signed-off-by: zhzhuang-zju <m17799853869@163.com>
add karmadactl operation scope docs
Signed-off-by: changzhen <changzhen5@huawei.com>
add more description for op/cop resourceSelectors
…cations Add secure coding specifications
Signed-off-by: wei-chenglai <qazwsx0939059006@gmail.com>
SilenceErrors: true, | ||
SilenceUsage: true, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
file := cmd.Flag(fileOption).Value.String() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Correctness Issue
Undefined variable 'fileOption' causes runtime panic.
The code references 'fileOption' variable which is not defined in this file, leading to a nil pointer dereference at runtime.
Current Code (Diff):
- file := cmd.Flag(fileOption).Value.String()
+ file := cmd.Flag("file").Value.String()
📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
file := cmd.Flag(fileOption).Value.String() | |
file := cmd.Flag("file").Value.String() |
} | ||
value, ok := extension.(string) | ||
if !ok { | ||
return nil, errors.New("x-bubernetes-patch-strategy is not a string") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Correctness Issue
Critical typo in error message.
Error message references 'x-bubernetes-patch-strategy' instead of 'x-kubernetes-patch-strategy', which will cause confusion during debugging.
Current Code (Diff):
- return nil, errors.New("x-bubernetes-patch-strategy is not a string")
+ return nil, errors.New("x-kubernetes-patch-strategy is not a string")
📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
return nil, errors.New("x-bubernetes-patch-strategy is not a string") | |
return nil, errors.New("x-kubernetes-patch-strategy is not a string") |
} | ||
value, ok := extension.(string) | ||
if !ok { | ||
return nil, errors.New("x-bubernetes-patch-merge-key is not a string") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Correctness Issue
Critical typo in error message.
Error message references 'x-bubernetes-patch-merge-key' instead of 'x-kubernetes-patch-merge-key', which will cause confusion during debugging.
Current Code (Diff):
- return nil, errors.New("x-bubernetes-patch-merge-key is not a string")
+ return nil, errors.New("x-kubernetes-patch-merge-key is not a string")
📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
return nil, errors.New("x-bubernetes-patch-merge-key is not a string") | |
return nil, errors.New("x-kubernetes-patch-merge-key is not a string") |
} | ||
value, ok := extension.(string) | ||
if !ok { | ||
return nil, errors.New("x-bubernetes-list-type is not a string") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Correctness Issue
Critical typo in error message.
Error message references 'x-bubernetes-list-type' instead of 'x-kubernetes-list-type', which will cause confusion during debugging.
Current Code (Diff):
- return nil, errors.New("x-bubernetes-list-type is not a string")
+ return nil, errors.New("x-kubernetes-list-type is not a string")
📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
return nil, errors.New("x-bubernetes-list-type is not a string") | |
return nil, errors.New("x-kubernetes-list-type is not a string") |
} | ||
value, ok := extension.([]interface{}) | ||
if !ok { | ||
return nil, errors.New("x-bubernetes-list-map-keys is not an array") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Correctness Issue
Critical typo in error message.
Error message references 'x-bubernetes-list-map-keys' instead of 'x-kubernetes-list-map-keys', which will cause confusion during debugging.
Current Code (Diff):
- return nil, errors.New("x-bubernetes-list-map-keys is not an array")
+ return nil, errors.New("x-kubernetes-list-map-keys is not an array")
📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
return nil, errors.New("x-bubernetes-list-map-keys is not an array") | |
return nil, errors.New("x-kubernetes-list-map-keys is not an array") |
for _, val := range value { | ||
v, ok := val.(string) | ||
if !ok { | ||
return nil, errors.New("x-bubernetes-list-map-keys value is not a string") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Correctness Issue
Critical typo in error message.
Error message references 'x-bubernetes-list-map-keys' instead of 'x-kubernetes-list-map-keys', which will cause confusion during debugging.
Current Code (Diff):
- return nil, errors.New("x-bubernetes-list-map-keys value is not a string")
+ return nil, errors.New("x-kubernetes-list-map-keys value is not a string")
📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
return nil, errors.New("x-bubernetes-list-map-keys value is not a string") | |
return nil, errors.New("x-kubernetes-list-map-keys value is not a string") |
} | ||
value, ok := extension.(string) | ||
if !ok { | ||
return nil, errors.New("x-bubernetes-action is not a string") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Correctness Issue
Critical typo in error message.
Error message references 'x-bubernetes-action' instead of 'x-kubernetes-action', which will cause confusion during debugging.
Current Code (Diff):
- return nil, errors.New("x-bubernetes-action is not a string")
+ return nil, errors.New("x-kubernetes-action is not a string")
📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
return nil, errors.New("x-bubernetes-action is not a string") | |
return nil, errors.New("x-kubernetes-action is not a string") |
🔄 Dependencies Affected
infra/gen-resourcesdocs/pkg/kubernetes/actions.go
Function: Actions.Add
Issue: This function calls getActionExtension which has an incorrect error message
Suggestion: No change needed in the dependency, just fix the error message in the current file
return value, nil | ||
} | ||
|
||
panic(fmt.Errorf("No type found for object %v", s)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Correctness Issue
Application Crash Risk: Panic in GetTypeNameAndKey().
Using panic() will cause the application to crash unexpectedly when encountering unknown schema types, which should be handled with error returns instead.
Current Code (Diff):
- panic(fmt.Errorf("No type found for object %v", s))
+ return "", nil, fmt.Errorf("No type found for object %v", s)
📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
panic(fmt.Errorf("No type found for object %v", s)) | |
return "", nil, fmt.Errorf("No type found for object %v", s) |
// primitive types. | ||
func GetTypeNameAndKey(s spec.Schema) (string, *Key) { | ||
if isMap(s) { | ||
typ, key := GetTypeNameAndKey(*s.AdditionalProperties.Schema) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Correctness Issue
Potential Nil Pointer Dereference in Schema Access.
Accessing s.AdditionalProperties.Schema without nil check could cause runtime panic if Schema is nil, even though AdditionalProperties is verified non-nil.
Current Code (Diff):
- typ, key := GetTypeNameAndKey(*s.AdditionalProperties.Schema)
+ if s.AdditionalProperties.Schema == nil {
+ return "map[string]interface{}", nil
+ }
+ typ, key := GetTypeNameAndKey(*s.AdditionalProperties.Schema)
📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
typ, key := GetTypeNameAndKey(*s.AdditionalProperties.Schema) | |
if s.AdditionalProperties.Schema == nil { | |
return "map[string]interface{}", nil | |
} | |
typ, key := GetTypeNameAndKey(*s.AdditionalProperties.Schema) |
|
||
// Recurse if type is array | ||
if isArray(s) { | ||
typ, key := GetTypeNameAndKey(*s.Items.Schema) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐛 Correctness Issue
Potential Nil Pointer Dereference in Array Items Schema.
Accessing s.Items.Schema without nil check could cause runtime panic if Schema is nil, even though isArray confirms the type is array.
Current Code (Diff):
- typ, key := GetTypeNameAndKey(*s.Items.Schema)
+ if s.Items.Schema == nil {
+ return "[]interface{}", nil
+ }
+ typ, key := GetTypeNameAndKey(*s.Items.Schema)
📝 Committable suggestion
‼️ IMPORTANT
Trust, but verify! 🕵️ Please review this suggestion with the care of a code archaeologist - check that it perfectly replaces the highlighted code, preserves all lines, maintains proper indentation, and won't break anything in production. Your future self will thank you! 🚀
typ, key := GetTypeNameAndKey(*s.Items.Schema) | |
if s.Items.Schema == nil { | |
return "[]interface{}", nil | |
} | |
typ, key := GetTypeNameAndKey(*s.Items.Schema) |
PR Summary
Add Kubernetes Resources Documentation Generator Tool
Overview
This PR introduces a new tool for generating and listing Kubernetes resources documentation from OpenAPI specification files. It includes a new CLI command and several supporting packages for processing Kubernetes configurations and OpenAPI specs.
Change Types
Affected Modules
gen-resourcesdocs/cmd/cli/resourceslist.go
gen-resourcesdocs/pkg/config/categories.go
gen-resourcesdocs/pkg/kubernetes/
gen-resourcesdocs/pkg/openapi/
Notes for Reviewers
extensions.go
as there's a typo where "kubernetes" is misspelled as "bubernetes"