fix(region): vendor update for aliyun tags (#18727)

This commit is contained in:
屈轩
2023-11-17 16:30:20 +08:00
committed by GitHub
parent 2309dfc27c
commit 09af132d52
5 changed files with 22 additions and 12 deletions
+1 -1
View File
@@ -86,7 +86,7 @@ require (
k8s.io/client-go v0.19.3
k8s.io/cluster-bootstrap v0.19.3
moul.io/http2curl/v2 v2.3.0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231117031849-8f6ec8929ac0
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231117073513-e4f90b4cabe4
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32
yunion.io/x/jsonutils v1.0.1-0.20230613121553-0f3b41e2ef19
yunion.io/x/log v1.0.1-0.20230411060016-feb3f46ab361
+2 -2
View File
@@ -1192,8 +1192,8 @@ sigs.k8s.io/structured-merge-diff/v4 v4.0.1/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231117031849-8f6ec8929ac0 h1:bPeaFNz/h4Ex4O0n66dLdSA72FweG0HPeQavjJmUgkw=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231117031849-8f6ec8929ac0/go.mod h1:aj1gR9PPb6eqqKOwvANe26CoZFY8ydmXy0fuvgKYXH0=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231117073513-e4f90b4cabe4 h1:cMkp0GGx770vEryaMBZLWdcR3lhmScM+FbE6XWmqEZU=
yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231117073513-e4f90b4cabe4/go.mod h1:aj1gR9PPb6eqqKOwvANe26CoZFY8ydmXy0fuvgKYXH0=
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32 h1:v7POYkQwo1XzOxBoIoRVr/k0V9Y5JyjpshlIFa9raug=
yunion.io/x/executor v0.0.0-20230705125604-c5ac3141db32/go.mod h1:Uxuou9WQIeJXNpy7t2fPLL0BYLvLiMvGQwY7Qc6aSws=
yunion.io/x/jsonutils v0.0.0-20190625054549-a964e1e8a051/go.mod h1:4N0/RVzsYL3kH3WE/H1BjUQdFiWu50JGCFQuuy+Z634=
+1 -1
View File
@@ -1458,7 +1458,7 @@ sigs.k8s.io/structured-merge-diff/v4/value
# sigs.k8s.io/yaml v1.2.0
## explicit; go 1.12
sigs.k8s.io/yaml
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231117031849-8f6ec8929ac0
# yunion.io/x/cloudmux v0.3.10-0-alpha.1.0.20231117073513-e4f90b4cabe4
## explicit; go 1.18
yunion.io/x/cloudmux/pkg/apis
yunion.io/x/cloudmux/pkg/apis/billing
+4 -8
View File
@@ -15,8 +15,6 @@
package aliyun
import (
"strings"
"yunion.io/x/pkg/errors"
"yunion.io/x/cloudmux/pkg/cloudprovider"
@@ -32,12 +30,12 @@ type AliyunTags struct {
}
}
var sysTags = []string{"aliyun", "acs:", "ack.aliyun.com", "k8s.io"}
func (self *AliyunTags) GetTags() (map[string]string, error) {
ret := map[string]string{}
for _, tag := range self.Tags.Tag {
if strings.HasPrefix(tag.TagKey, "aliyun") || strings.HasPrefix(tag.TagKey, "acs:") ||
strings.HasSuffix(tag.Key, "aliyun") || strings.HasPrefix(tag.Key, "acs:") ||
strings.HasSuffix(tag.Key, "ack.aliyun.com") { // k8s
if tag.IsSysTagPrefix(sysTags) {
continue
}
if len(tag.TagKey) > 0 {
@@ -53,9 +51,7 @@ func (self *AliyunTags) GetTags() (map[string]string, error) {
func (self *AliyunTags) GetSysTags() map[string]string {
ret := map[string]string{}
for _, tag := range self.Tags.Tag {
if strings.HasPrefix(tag.TagKey, "aliyun") || strings.HasPrefix(tag.TagKey, "acs:") ||
strings.HasPrefix(tag.Key, "aliyun") || strings.HasPrefix(tag.Key, "acs:") ||
strings.HasPrefix(tag.Key, "ack.aliyun.com") { // k8s
if tag.IsSysTagPrefix(sysTags) {
if len(tag.TagKey) > 0 {
ret[tag.TagKey] = tag.TagValue
} else if len(tag.Key) > 0 {
+14
View File
@@ -15,6 +15,8 @@
package multicloud
import (
"strings"
"yunion.io/x/pkg/errors"
"yunion.io/x/cloudmux/pkg/cloudprovider"
@@ -42,3 +44,15 @@ type STag struct {
Key string
Value string
}
func (self STag) IsSysTagPrefix(keys []string) bool {
for _, prefix := range keys {
if strings.HasPrefix(self.TagKey, prefix) {
return true
}
if strings.HasPrefix(self.Key, prefix) {
return true
}
}
return false
}