mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-07-31 07:32:09 +00:00
code clean for if condtion (#1037)
Signed-off-by: yanggang <gang.yang@daocloud.io>
This commit is contained in:
parent
f5b64339bf
commit
43e2008107
@ -39,7 +39,7 @@ func main() {
|
||||
flag.BoolVar(&versionOpt, "v", false, "Show application version")
|
||||
|
||||
flag.Parse()
|
||||
if versionOpt == true {
|
||||
if versionOpt {
|
||||
fmt.Printf("multus-shim: %s\n", multus.PrintVersionString())
|
||||
return
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ func main() {
|
||||
flag.BoolVar(&versionOpt, "version", false, "Show application version")
|
||||
flag.BoolVar(&versionOpt, "v", false, "Show application version")
|
||||
flag.Parse()
|
||||
if versionOpt == true {
|
||||
if versionOpt {
|
||||
fmt.Printf("multus: %s\n", multus.PrintVersionString())
|
||||
return
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ func TryLoadPodDelegates(pod *v1.Pod, conf *types.NetConf, clientInfo *ClientInf
|
||||
}
|
||||
}
|
||||
|
||||
if isGatewayConfigured == true {
|
||||
if isGatewayConfigured {
|
||||
err = types.CheckGatewayConfig(conf.Delegates)
|
||||
if err != nil {
|
||||
return 0, nil, err
|
||||
@ -680,7 +680,7 @@ const ConfigSourceAnnotationKey = "kubernetes.io/config.source"
|
||||
// IsStaticPod returns true if the pod is static pod.
|
||||
func IsStaticPod(pod *v1.Pod) bool {
|
||||
if pod.Annotations != nil {
|
||||
if source, ok := pod.Annotations[ConfigSourceAnnotationKey]; ok == true {
|
||||
if source, ok := pod.Annotations[ConfigSourceAnnotationKey]; ok {
|
||||
return source != "api"
|
||||
}
|
||||
}
|
||||
|
@ -875,7 +875,7 @@ func CmdDel(args *skel.CmdArgs, exec invoke.Exec, kubeClient *k8s.ClientInfo) er
|
||||
|
||||
// set CNIVersion in delegate CNI config if there is no CNIVersion and multus conf have CNIVersion.
|
||||
for _, v := range in.Delegates {
|
||||
if v.ConfListPlugin == true && v.ConfList.CNIVersion == "" && in.CNIVersion != "" {
|
||||
if v.ConfListPlugin && v.ConfList.CNIVersion == "" && in.CNIVersion != "" {
|
||||
v.ConfList.CNIVersion = in.CNIVersion
|
||||
v.Bytes, err = json.Marshal(v.ConfList)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user