diff --git a/api/v1/types.go b/api/v1/types.go index db6521ba..cdc9b771 100644 --- a/api/v1/types.go +++ b/api/v1/types.go @@ -35,12 +35,12 @@ const ( // +k8s:deepcopy-gen=false type Event struct { LicenseID string `json:"licenseID,omitempty"` - ResourceID kmapi.ResourceID `json:"resourceID,omitempty"` + ResourceID kmapi.ResourceID `json:"resourceID"` Resource client.Object `json:"resource,omitempty"` } type UnstructuredEvent struct { LicenseID string `json:"licenseID,omitempty"` - ResourceID kmapi.ResourceID `json:"resourceID,omitempty"` + ResourceID kmapi.ResourceID `json:"resourceID"` Resource *unstructured.Unstructured `json:"resource,omitempty"` } diff --git a/go.mod b/go.mod index 25bf2968..c16cea1e 100644 --- a/go.mod +++ b/go.mod @@ -13,8 +13,8 @@ require ( k8s.io/apimachinery v0.34.3 k8s.io/client-go v0.34.3 k8s.io/klog/v2 v2.130.1 - kmodules.xyz/client-go v0.34.2 - kmodules.xyz/resource-metadata v0.42.1 + kmodules.xyz/client-go v0.34.3 + kmodules.xyz/resource-metadata v0.42.4 sigs.k8s.io/controller-runtime v0.22.4 ) @@ -108,7 +108,7 @@ require ( golang.org/x/net v0.47.0 // indirect golang.org/x/oauth2 v0.33.0 // indirect golang.org/x/sync v0.19.0 // indirect - golang.org/x/sys v0.39.0 // indirect + golang.org/x/sys v0.40.0 // indirect golang.org/x/term v0.38.0 // indirect golang.org/x/text v0.32.0 // indirect golang.org/x/time v0.14.0 // indirect diff --git a/go.sum b/go.sum index 10107f45..a317c2ee 100644 --- a/go.sum +++ b/go.sum @@ -267,8 +267,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= -golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ= +golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q= golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -343,14 +343,14 @@ k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 h1:SjGebBtkBqHFOli+05xYbK8YF1Dzk k8s.io/utils v0.0.0-20251002143259-bc988d571ff4/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk= kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80= -kmodules.xyz/client-go v0.34.2 h1:2Cec+nyfj9kfbR+5KPK3AksxN6h4jSjhn/tw+Dhqggo= -kmodules.xyz/client-go v0.34.2/go.mod h1:kQRuGMxhb+B9rVdcfBzjK+PV7oBDo+SaDiQ66u1QG+4= +kmodules.xyz/client-go v0.34.3 h1:2K2Tjwwy62QOpgIpuRB0STDAt2e7omkKt06oC8YV+/U= +kmodules.xyz/client-go v0.34.3/go.mod h1:myCt7AfRao4PBdUtKXu01xxbqqmLZ5U8fW0LQDaifhQ= kmodules.xyz/go-containerregistry v0.0.15 h1:PRY5FDOzb6u23KOulQ4SWNdeUkBKmezLyJXP88q4EPw= kmodules.xyz/go-containerregistry v0.0.15/go.mod h1:rO0DEbYYEu1BfVcZ1pXV+3RgzVXr/k5hXcO+BQYVVDI= kmodules.xyz/offshoot-api v0.34.0 h1:HnOOp8FrCjTWjtNApRDo6Ahe79tOlLrJmyye4xxO4Kk= kmodules.xyz/offshoot-api v0.34.0/go.mod h1:F+B59yYw4CZJ4uD4xu6C+mMLzIXUtuH7E+SbDICl9jE= -kmodules.xyz/resource-metadata v0.42.1 h1:RxAi354cKOeCVLoZI+WjR+tooU4lEq/axIafm1SYa20= -kmodules.xyz/resource-metadata v0.42.1/go.mod h1:xntcQko2QLbLEHwGE4TQ7I/80fcBQzcexbep97Akstk= +kmodules.xyz/resource-metadata v0.42.4 h1:nFVo+PKmwWdzVwk7U3VZuKBQj3tPo6fyY5BC7gE2OB8= +kmodules.xyz/resource-metadata v0.42.4/go.mod h1:++18wSB28Wrw3ZxnOd8o8IVg7oMyWPwaPfuLw21QnPc= kmodules.xyz/resource-metrics v0.34.0 h1:cqscgTx3PONxHj6PIySK3sTlKKv8iKTGzRd+S6YSwXg= kmodules.xyz/resource-metrics v0.34.0/go.mod h1:R34IKtp5+NqcQz7AQJheBJK6Iem0LqrCbm/55Mn+ECQ= moul.io/http2curl/v2 v2.3.1-0.20221024080105-10c404f653f7 h1:NykkTlRB+X40z86cLHdEmuoTxhNKhQebLT379b1EumA= diff --git a/lib/nats.go b/lib/nats.go index 675fcb41..7ee1ec93 100644 --- a/lib/nats.go +++ b/lib/nats.go @@ -52,7 +52,7 @@ type NatsConfig struct { // NatsCredential represents the api response of the register licensed user api type NatsCredential struct { - NatsConfig `json:",inline,omitempty"` + NatsConfig `json:",inline"` Credential []byte `json:"credential"` } diff --git a/vendor/golang.org/x/sys/cpu/cpu_x86.go b/vendor/golang.org/x/sys/cpu/cpu_x86.go index 1e642f33..f5723d4f 100644 --- a/vendor/golang.org/x/sys/cpu/cpu_x86.go +++ b/vendor/golang.org/x/sys/cpu/cpu_x86.go @@ -64,6 +64,80 @@ func initOptions() { func archInit() { + // From internal/cpu + const ( + // eax bits + cpuid_AVXVNNI = 1 << 4 + + // ecx bits + cpuid_SSE3 = 1 << 0 + cpuid_PCLMULQDQ = 1 << 1 + cpuid_AVX512VBMI = 1 << 1 + cpuid_AVX512VBMI2 = 1 << 6 + cpuid_SSSE3 = 1 << 9 + cpuid_AVX512GFNI = 1 << 8 + cpuid_AVX512VAES = 1 << 9 + cpuid_AVX512VNNI = 1 << 11 + cpuid_AVX512BITALG = 1 << 12 + cpuid_FMA = 1 << 12 + cpuid_AVX512VPOPCNTDQ = 1 << 14 + cpuid_SSE41 = 1 << 19 + cpuid_SSE42 = 1 << 20 + cpuid_POPCNT = 1 << 23 + cpuid_AES = 1 << 25 + cpuid_OSXSAVE = 1 << 27 + cpuid_AVX = 1 << 28 + + // "Extended Feature Flag" bits returned in EBX for CPUID EAX=0x7 ECX=0x0 + cpuid_BMI1 = 1 << 3 + cpuid_AVX2 = 1 << 5 + cpuid_BMI2 = 1 << 8 + cpuid_ERMS = 1 << 9 + cpuid_AVX512F = 1 << 16 + cpuid_AVX512DQ = 1 << 17 + cpuid_ADX = 1 << 19 + cpuid_AVX512CD = 1 << 28 + cpuid_SHA = 1 << 29 + cpuid_AVX512BW = 1 << 30 + cpuid_AVX512VL = 1 << 31 + + // "Extended Feature Flag" bits returned in ECX for CPUID EAX=0x7 ECX=0x0 + cpuid_AVX512_VBMI = 1 << 1 + cpuid_AVX512_VBMI2 = 1 << 6 + cpuid_GFNI = 1 << 8 + cpuid_AVX512VPCLMULQDQ = 1 << 10 + cpuid_AVX512_BITALG = 1 << 12 + + // edx bits + cpuid_FSRM = 1 << 4 + // edx bits for CPUID 0x80000001 + cpuid_RDTSCP = 1 << 27 + ) + // Additional constants not in internal/cpu + const ( + // eax=1: edx + cpuid_SSE2 = 1 << 26 + // eax=1: ecx + cpuid_CX16 = 1 << 13 + cpuid_RDRAND = 1 << 30 + // eax=7,ecx=0: ebx + cpuid_RDSEED = 1 << 18 + cpuid_AVX512IFMA = 1 << 21 + cpuid_AVX512PF = 1 << 26 + cpuid_AVX512ER = 1 << 27 + // eax=7,ecx=0: edx + cpuid_AVX5124VNNIW = 1 << 2 + cpuid_AVX5124FMAPS = 1 << 3 + cpuid_AMXBF16 = 1 << 22 + cpuid_AMXTile = 1 << 24 + cpuid_AMXInt8 = 1 << 25 + // eax=7,ecx=1: eax + cpuid_AVX512BF16 = 1 << 5 + cpuid_AVXIFMA = 1 << 23 + // eax=7,ecx=1: edx + cpuid_AVXVNNIInt8 = 1 << 4 + ) + Initialized = true maxID, _, _, _ := cpuid(0, 0) @@ -73,90 +147,90 @@ func archInit() { } _, _, ecx1, edx1 := cpuid(1, 0) - X86.HasSSE2 = isSet(26, edx1) - - X86.HasSSE3 = isSet(0, ecx1) - X86.HasPCLMULQDQ = isSet(1, ecx1) - X86.HasSSSE3 = isSet(9, ecx1) - X86.HasFMA = isSet(12, ecx1) - X86.HasCX16 = isSet(13, ecx1) - X86.HasSSE41 = isSet(19, ecx1) - X86.HasSSE42 = isSet(20, ecx1) - X86.HasPOPCNT = isSet(23, ecx1) - X86.HasAES = isSet(25, ecx1) - X86.HasOSXSAVE = isSet(27, ecx1) - X86.HasRDRAND = isSet(30, ecx1) + X86.HasSSE2 = isSet(edx1, cpuid_SSE2) + + X86.HasSSE3 = isSet(ecx1, cpuid_SSE3) + X86.HasPCLMULQDQ = isSet(ecx1, cpuid_PCLMULQDQ) + X86.HasSSSE3 = isSet(ecx1, cpuid_SSSE3) + X86.HasFMA = isSet(ecx1, cpuid_FMA) + X86.HasCX16 = isSet(ecx1, cpuid_CX16) + X86.HasSSE41 = isSet(ecx1, cpuid_SSE41) + X86.HasSSE42 = isSet(ecx1, cpuid_SSE42) + X86.HasPOPCNT = isSet(ecx1, cpuid_POPCNT) + X86.HasAES = isSet(ecx1, cpuid_AES) + X86.HasOSXSAVE = isSet(ecx1, cpuid_OSXSAVE) + X86.HasRDRAND = isSet(ecx1, cpuid_RDRAND) var osSupportsAVX, osSupportsAVX512 bool // For XGETBV, OSXSAVE bit is required and sufficient. if X86.HasOSXSAVE { eax, _ := xgetbv() // Check if XMM and YMM registers have OS support. - osSupportsAVX = isSet(1, eax) && isSet(2, eax) + osSupportsAVX = isSet(eax, 1<<1) && isSet(eax, 1<<2) if runtime.GOOS == "darwin" { // Darwin requires special AVX512 checks, see cpu_darwin_x86.go osSupportsAVX512 = osSupportsAVX && darwinSupportsAVX512() } else { // Check if OPMASK and ZMM registers have OS support. - osSupportsAVX512 = osSupportsAVX && isSet(5, eax) && isSet(6, eax) && isSet(7, eax) + osSupportsAVX512 = osSupportsAVX && isSet(eax, 1<<5) && isSet(eax, 1<<6) && isSet(eax, 1<<7) } } - X86.HasAVX = isSet(28, ecx1) && osSupportsAVX + X86.HasAVX = isSet(ecx1, cpuid_AVX) && osSupportsAVX if maxID < 7 { return } eax7, ebx7, ecx7, edx7 := cpuid(7, 0) - X86.HasBMI1 = isSet(3, ebx7) - X86.HasAVX2 = isSet(5, ebx7) && osSupportsAVX - X86.HasBMI2 = isSet(8, ebx7) - X86.HasERMS = isSet(9, ebx7) - X86.HasRDSEED = isSet(18, ebx7) - X86.HasADX = isSet(19, ebx7) - - X86.HasAVX512 = isSet(16, ebx7) && osSupportsAVX512 // Because avx-512 foundation is the core required extension + X86.HasBMI1 = isSet(ebx7, cpuid_BMI1) + X86.HasAVX2 = isSet(ebx7, cpuid_AVX2) && osSupportsAVX + X86.HasBMI2 = isSet(ebx7, cpuid_BMI2) + X86.HasERMS = isSet(ebx7, cpuid_ERMS) + X86.HasRDSEED = isSet(ebx7, cpuid_RDSEED) + X86.HasADX = isSet(ebx7, cpuid_ADX) + + X86.HasAVX512 = isSet(ebx7, cpuid_AVX512F) && osSupportsAVX512 // Because avx-512 foundation is the core required extension if X86.HasAVX512 { X86.HasAVX512F = true - X86.HasAVX512CD = isSet(28, ebx7) - X86.HasAVX512ER = isSet(27, ebx7) - X86.HasAVX512PF = isSet(26, ebx7) - X86.HasAVX512VL = isSet(31, ebx7) - X86.HasAVX512BW = isSet(30, ebx7) - X86.HasAVX512DQ = isSet(17, ebx7) - X86.HasAVX512IFMA = isSet(21, ebx7) - X86.HasAVX512VBMI = isSet(1, ecx7) - X86.HasAVX5124VNNIW = isSet(2, edx7) - X86.HasAVX5124FMAPS = isSet(3, edx7) - X86.HasAVX512VPOPCNTDQ = isSet(14, ecx7) - X86.HasAVX512VPCLMULQDQ = isSet(10, ecx7) - X86.HasAVX512VNNI = isSet(11, ecx7) - X86.HasAVX512GFNI = isSet(8, ecx7) - X86.HasAVX512VAES = isSet(9, ecx7) - X86.HasAVX512VBMI2 = isSet(6, ecx7) - X86.HasAVX512BITALG = isSet(12, ecx7) + X86.HasAVX512CD = isSet(ebx7, cpuid_AVX512CD) + X86.HasAVX512ER = isSet(ebx7, cpuid_AVX512ER) + X86.HasAVX512PF = isSet(ebx7, cpuid_AVX512PF) + X86.HasAVX512VL = isSet(ebx7, cpuid_AVX512VL) + X86.HasAVX512BW = isSet(ebx7, cpuid_AVX512BW) + X86.HasAVX512DQ = isSet(ebx7, cpuid_AVX512DQ) + X86.HasAVX512IFMA = isSet(ebx7, cpuid_AVX512IFMA) + X86.HasAVX512VBMI = isSet(ecx7, cpuid_AVX512_VBMI) + X86.HasAVX5124VNNIW = isSet(edx7, cpuid_AVX5124VNNIW) + X86.HasAVX5124FMAPS = isSet(edx7, cpuid_AVX5124FMAPS) + X86.HasAVX512VPOPCNTDQ = isSet(ecx7, cpuid_AVX512VPOPCNTDQ) + X86.HasAVX512VPCLMULQDQ = isSet(ecx7, cpuid_AVX512VPCLMULQDQ) + X86.HasAVX512VNNI = isSet(ecx7, cpuid_AVX512VNNI) + X86.HasAVX512GFNI = isSet(ecx7, cpuid_AVX512GFNI) + X86.HasAVX512VAES = isSet(ecx7, cpuid_AVX512VAES) + X86.HasAVX512VBMI2 = isSet(ecx7, cpuid_AVX512VBMI2) + X86.HasAVX512BITALG = isSet(ecx7, cpuid_AVX512BITALG) } - X86.HasAMXTile = isSet(24, edx7) - X86.HasAMXInt8 = isSet(25, edx7) - X86.HasAMXBF16 = isSet(22, edx7) + X86.HasAMXTile = isSet(edx7, cpuid_AMXTile) + X86.HasAMXInt8 = isSet(edx7, cpuid_AMXInt8) + X86.HasAMXBF16 = isSet(edx7, cpuid_AMXBF16) // These features depend on the second level of extended features. if eax7 >= 1 { eax71, _, _, edx71 := cpuid(7, 1) if X86.HasAVX512 { - X86.HasAVX512BF16 = isSet(5, eax71) + X86.HasAVX512BF16 = isSet(eax71, cpuid_AVX512BF16) } if X86.HasAVX { - X86.HasAVXIFMA = isSet(23, eax71) - X86.HasAVXVNNI = isSet(4, eax71) - X86.HasAVXVNNIInt8 = isSet(4, edx71) + X86.HasAVXIFMA = isSet(eax71, cpuid_AVXIFMA) + X86.HasAVXVNNI = isSet(eax71, cpuid_AVXVNNI) + X86.HasAVXVNNIInt8 = isSet(edx71, cpuid_AVXVNNIInt8) } } } -func isSet(bitpos uint, value uint32) bool { - return value&(1< 0 { - for iNdEx := len(m.EnabledFeatures) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.EnabledFeatures[iNdEx]) - copy(dAtA[i:], m.EnabledFeatures[iNdEx]) - i = encodeVarintGenerated(dAtA, i, uint64(len(m.EnabledFeatures[iNdEx]))) + keysForEnabledFeatures := make([]string, 0, len(m.EnabledFeatures)) + for k := range m.EnabledFeatures { + keysForEnabledFeatures = append(keysForEnabledFeatures, string(k)) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForEnabledFeatures) + for iNdEx := len(keysForEnabledFeatures) - 1; iNdEx >= 0; iNdEx-- { + v := m.EnabledFeatures[string(keysForEnabledFeatures[iNdEx])] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintGenerated(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(keysForEnabledFeatures[iNdEx]) + copy(dAtA[i:], keysForEnabledFeatures[iNdEx]) + i = encodeVarintGenerated(dAtA, i, uint64(len(keysForEnabledFeatures[iNdEx]))) + i-- + dAtA[i] = 0xa + i = encodeVarintGenerated(dAtA, i, uint64(baseI-i)) i-- dAtA[i] = 0xa } @@ -2005,9 +2025,11 @@ func (m *ClusterClaimFeatures) Size() (n int) { var l int _ = l if len(m.EnabledFeatures) > 0 { - for _, s := range m.EnabledFeatures { - l = len(s) - n += 1 + l + sovGenerated(uint64(l)) + for k, v := range m.EnabledFeatures { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovGenerated(uint64(len(k))) + 1 + len(v) + sovGenerated(uint64(len(v))) + n += mapEntrySize + 1 + sovGenerated(uint64(mapEntrySize)) } } if len(m.ExternallyManagedFeatures) > 0 { @@ -2421,8 +2443,18 @@ func (this *ClusterClaimFeatures) String() string { if this == nil { return "nil" } + keysForEnabledFeatures := make([]string, 0, len(this.EnabledFeatures)) + for k := range this.EnabledFeatures { + keysForEnabledFeatures = append(keysForEnabledFeatures, k) + } + github_com_gogo_protobuf_sortkeys.Strings(keysForEnabledFeatures) + mapStringForEnabledFeatures := "map[string]string{" + for _, k := range keysForEnabledFeatures { + mapStringForEnabledFeatures += fmt.Sprintf("%v: %v,", k, this.EnabledFeatures[k]) + } + mapStringForEnabledFeatures += "}" s := strings.Join([]string{`&ClusterClaimFeatures{`, - `EnabledFeatures:` + fmt.Sprintf("%v", this.EnabledFeatures) + `,`, + `EnabledFeatures:` + mapStringForEnabledFeatures + `,`, `ExternallyManagedFeatures:` + fmt.Sprintf("%v", this.ExternallyManagedFeatures) + `,`, `DisabledFeatures:` + fmt.Sprintf("%v", this.DisabledFeatures) + `,`, `}`, @@ -3359,7 +3391,7 @@ func (m *ClusterClaimFeatures) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EnabledFeatures", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -3369,23 +3401,118 @@ func (m *ClusterClaimFeatures) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenerated } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenerated } if postIndex > l { return io.ErrUnexpectedEOF } - m.EnabledFeatures = append(m.EnabledFeatures, string(dAtA[iNdEx:postIndex])) + if m.EnabledFeatures == nil { + m.EnabledFeatures = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthGenerated + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthGenerated + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.EnabledFeatures[mapkey] = mapvalue iNdEx = postIndex case 2: if wireType != 2 { diff --git a/vendor/kmodules.xyz/client-go/api/v1/generated.proto b/vendor/kmodules.xyz/client-go/api/v1/generated.proto index c3a8864e..dc1b76e3 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/generated.proto +++ b/vendor/kmodules.xyz/client-go/api/v1/generated.proto @@ -100,7 +100,7 @@ message CertificateSpec { } message ClusterClaimFeatures { - repeated string enabledFeatures = 1; + map enabledFeatures = 1; repeated string externallyManagedFeatures = 2; diff --git a/vendor/kmodules.xyz/client-go/api/v1/object.go b/vendor/kmodules.xyz/client-go/api/v1/object.go index 90e50df8..c582ae5f 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/object.go +++ b/vendor/kmodules.xyz/client-go/api/v1/object.go @@ -115,8 +115,8 @@ func NewObjectID(obj client.Object) *ObjectID { func ParseObjectID(key OID) (*ObjectID, error) { var id ObjectID - chunks := strings.Split(string(key), ",") - for _, chunk := range chunks { + chunks := strings.SplitSeq(string(key), ",") + for chunk := range chunks { parts := strings.FieldsFunc(chunk, func(r rune) bool { return r == '=' || unicode.IsSpace(r) }) @@ -166,8 +166,8 @@ func ObjectIDMap(key OID) (map[string]any, error) { "name": "", } - chunks := strings.Split(string(key), ",") - for _, chunk := range chunks { + chunks := strings.SplitSeq(string(key), ",") + for chunk := range chunks { parts := strings.FieldsFunc(chunk, func(r rune) bool { return r == '=' || unicode.IsSpace(r) }) diff --git a/vendor/kmodules.xyz/client-go/api/v1/zz_generated.deepcopy.go b/vendor/kmodules.xyz/client-go/api/v1/zz_generated.deepcopy.go index 303ef0d2..cacb9e1c 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/zz_generated.deepcopy.go +++ b/vendor/kmodules.xyz/client-go/api/v1/zz_generated.deepcopy.go @@ -124,8 +124,10 @@ func (in *ClusterClaimFeatures) DeepCopyInto(out *ClusterClaimFeatures) { *out = *in if in.EnabledFeatures != nil { in, out := &in.EnabledFeatures, &out.EnabledFeatures - *out = make([]string, len(*in)) - copy(*out, *in) + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } } if in.ExternallyManagedFeatures != nil { in, out := &in.ExternallyManagedFeatures, &out.ExternallyManagedFeatures diff --git a/vendor/kmodules.xyz/client-go/core/v1/kubernetes.go b/vendor/kmodules.xyz/client-go/core/v1/kubernetes.go index 9a5c5ef1..ade90bc2 100644 --- a/vendor/kmodules.xyz/client-go/core/v1/kubernetes.go +++ b/vendor/kmodules.xyz/client-go/core/v1/kubernetes.go @@ -17,6 +17,7 @@ limitations under the License. package v1 import ( + "slices" "sort" "kmodules.xyz/client-go/meta" @@ -31,22 +32,15 @@ import ( var json = jsoniter.ConfigFastest func AddFinalizer(m metav1.ObjectMeta, finalizer string) metav1.ObjectMeta { - for _, name := range m.Finalizers { - if name == finalizer { - return m - } + if slices.Contains(m.Finalizers, finalizer) { + return m } m.Finalizers = append(m.Finalizers, finalizer) return m } func HasFinalizer(m metav1.ObjectMeta, finalizer string) bool { - for _, name := range m.Finalizers { - if name == finalizer { - return true - } - } - return false + return slices.Contains(m.Finalizers, finalizer) } func RemoveFinalizer(m metav1.ObjectMeta, finalizer string) metav1.ObjectMeta { diff --git a/vendor/kmodules.xyz/client-go/meta/conditions.go b/vendor/kmodules.xyz/client-go/meta/conditions.go index 2c72db47..34792870 100644 --- a/vendor/kmodules.xyz/client-go/meta/conditions.go +++ b/vendor/kmodules.xyz/client-go/meta/conditions.go @@ -18,6 +18,7 @@ package meta import ( "fmt" + "slices" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -156,10 +157,8 @@ func (s Status) String() string { // not a valid status. func StatusFromStringOrDie(text string) Status { s := Status(text) - for _, r := range Statuses { - if s == r { - return s - } + if slices.Contains(Statuses, s) { + return s } panic(fmt.Errorf("string has invalid status: %s", s)) } diff --git a/vendor/kmodules.xyz/client-go/meta/encoding.go b/vendor/kmodules.xyz/client-go/meta/encoding.go index 1ba1b120..cb562db7 100644 --- a/vendor/kmodules.xyz/client-go/meta/encoding.go +++ b/vendor/kmodules.xyz/client-go/meta/encoding.go @@ -174,7 +174,7 @@ func StringToQuantityHookFunc() mapstructure.DecodeHookFunc { if f.Kind() != reflect.String { return data, nil } - if t != reflect.TypeOf(resource.Quantity{}) { + if t != reflect.TypeFor[resource.Quantity]() { return data, nil } diff --git a/vendor/kmodules.xyz/client-go/meta/lib.go b/vendor/kmodules.xyz/client-go/meta/lib.go index 0e6f761e..d9027fdd 100644 --- a/vendor/kmodules.xyz/client-go/meta/lib.go +++ b/vendor/kmodules.xyz/client-go/meta/lib.go @@ -18,6 +18,7 @@ package meta import ( "fmt" + "maps" "reflect" "strings" @@ -131,9 +132,7 @@ func OverwriteKeys(out map[string]string, ins ...map[string]string) map[string]s } for _, in := range ins { - for k, v := range in { - out[k] = v - } + maps.Copy(out, in) } return out } @@ -198,20 +197,6 @@ func ValidCronJobNameWithPrefixNSuffix(prefix, name, suffix string) string { return ValidNameWithPrefixNSuffix(prefix, name, suffix, MaxCronJobNameLength) } -func min(x, y int) int { - if x < y { - return x - } - return y -} - -func max(x, y int) int { - if x > y { - return x - } - return y -} - func IsOfficialType(group string) bool { switch { case group == "": diff --git a/vendor/kmodules.xyz/resource-metadata/apis/core/v1alpha1/openapi_generated.go b/vendor/kmodules.xyz/resource-metadata/apis/core/v1alpha1/openapi_generated.go index d68bdaa9..d4f36c15 100644 --- a/vendor/kmodules.xyz/resource-metadata/apis/core/v1alpha1/openapi_generated.go +++ b/vendor/kmodules.xyz/resource-metadata/apis/core/v1alpha1/openapi_generated.go @@ -17120,8 +17120,9 @@ func schema_kmodulesxyz_client_go_api_v1_ClusterClaimFeatures(ref common.Referen Properties: map[string]spec.Schema{ "enabledFeatures": { SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ Default: "", diff --git a/vendor/kmodules.xyz/resource-metadata/apis/identity/v1alpha1/openapi_generated.go b/vendor/kmodules.xyz/resource-metadata/apis/identity/v1alpha1/openapi_generated.go index 91e05eb9..0672db24 100644 --- a/vendor/kmodules.xyz/resource-metadata/apis/identity/v1alpha1/openapi_generated.go +++ b/vendor/kmodules.xyz/resource-metadata/apis/identity/v1alpha1/openapi_generated.go @@ -17107,8 +17107,9 @@ func schema_kmodulesxyz_client_go_api_v1_ClusterClaimFeatures(ref common.Referen Properties: map[string]spec.Schema{ "enabledFeatures": { SchemaProps: spec.SchemaProps{ - Type: []string{"array"}, - Items: &spec.SchemaOrArray{ + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ Default: "", @@ -19976,12 +19977,17 @@ func schema_resource_metadata_apis_identity_v1alpha1_KubernetesInfo(ref common.R }, }, }, + "features": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kmodules.xyz/client-go/api/v1.ClusterClaimFeatures"), + }, + }, }, Required: []string{"nodeStats"}, }, }, Dependencies: []string{ - "k8s.io/apimachinery/pkg/version.Info", "kmodules.xyz/client-go/api/v1.ClusterMetadata", "kmodules.xyz/resource-metadata/apis/identity/v1alpha1.ControlPlaneInfo", "kmodules.xyz/resource-metadata/apis/identity/v1alpha1.NodeInfo"}, + "k8s.io/apimachinery/pkg/version.Info", "kmodules.xyz/client-go/api/v1.ClusterClaimFeatures", "kmodules.xyz/client-go/api/v1.ClusterMetadata", "kmodules.xyz/resource-metadata/apis/identity/v1alpha1.ControlPlaneInfo", "kmodules.xyz/resource-metadata/apis/identity/v1alpha1.NodeInfo"}, } } diff --git a/vendor/kmodules.xyz/resource-metadata/apis/identity/v1alpha1/siteinfo_types.go b/vendor/kmodules.xyz/resource-metadata/apis/identity/v1alpha1/siteinfo_types.go index ac3d540f..e0b55126 100644 --- a/vendor/kmodules.xyz/resource-metadata/apis/identity/v1alpha1/siteinfo_types.go +++ b/vendor/kmodules.xyz/resource-metadata/apis/identity/v1alpha1/siteinfo_types.go @@ -72,13 +72,14 @@ type KubernetesInfo struct { // Deprecated ClusterName string `json:"clusterName,omitempty"` // Deprecated - ClusterUID string `json:"clusterUID,omitempty"` - Cluster *kmapi.ClusterMetadata `json:"cluster,omitempty"` - Version *version.Info `json:"version,omitempty"` - ControlPlane *ControlPlaneInfo `json:"controlPlane,omitempty"` - NodeStats NodeInfo `json:"nodeStats"` - Distributions []string `json:"distributions,omitempty"` - StorageProvisioners []string `json:"storageProvisioners,omitempty"` + ClusterUID string `json:"clusterUID,omitempty"` + Cluster *kmapi.ClusterMetadata `json:"cluster,omitempty"` + Version *version.Info `json:"version,omitempty"` + ControlPlane *ControlPlaneInfo `json:"controlPlane,omitempty"` + NodeStats NodeInfo `json:"nodeStats"` + Distributions []string `json:"distributions,omitempty"` + StorageProvisioners []string `json:"storageProvisioners,omitempty"` + Features *kmapi.ClusterClaimFeatures `json:"features,omitempty"` } // https://github.com/kmodules/client-go/blob/kubernetes-1.16.3/tools/analytics/analytics.go#L66 diff --git a/vendor/kmodules.xyz/resource-metadata/apis/identity/v1alpha1/zz_generated.deepcopy.go b/vendor/kmodules.xyz/resource-metadata/apis/identity/v1alpha1/zz_generated.deepcopy.go index 6005bc37..580371d9 100644 --- a/vendor/kmodules.xyz/resource-metadata/apis/identity/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/kmodules.xyz/resource-metadata/apis/identity/v1alpha1/zz_generated.deepcopy.go @@ -224,6 +224,11 @@ func (in *KubernetesInfo) DeepCopyInto(out *KubernetesInfo) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.Features != nil { + in, out := &in.Features, &out.Features + *out = new(v1.ClusterClaimFeatures) + (*in).DeepCopyInto(*out) + } return } diff --git a/vendor/kmodules.xyz/resource-metadata/pkg/identity/siteinfo.go b/vendor/kmodules.xyz/resource-metadata/pkg/identity/siteinfo.go index 6b4a0b40..319afa89 100644 --- a/vendor/kmodules.xyz/resource-metadata/pkg/identity/siteinfo.go +++ b/vendor/kmodules.xyz/resource-metadata/pkg/identity/siteinfo.go @@ -31,11 +31,15 @@ import ( v "gomodules.xyz/x/version" core "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/client-go/discovery/cached/memory" + "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" "k8s.io/client-go/rest" "k8s.io/client-go/restmapper" + "sigs.k8s.io/yaml" ) func GetSiteInfo(cfg *rest.Config, kc kubernetes.Interface, nodes []*core.Node, licenseID string) (*identityapi.SiteInfo, error) { @@ -144,6 +148,24 @@ func GetSiteInfo(cfg *rest.Config, kc kubernetes.Interface, nodes []*core.Node, si.Kubernetes.StorageProvisioners = scProvisioners.List() } + dc, err := dynamic.NewForConfig(cfg) + if err != nil { + return nil, err + } + if fc, err := dc.Resource(schema.GroupVersionResource{ + Group: "cluster.open-cluster-management.io", + Version: "v1alpha1", + Resource: "ClusterClaim", + }).Get(context.Background(), kmapi.ClusterClaimKeyFeatures, metav1.GetOptions{}); err == nil { + val, ok, err := unstructured.NestedString(fc.UnstructuredContent(), "spec", "value") + if err == nil && ok && val != "" { + var features kmapi.ClusterClaimFeatures + if err := yaml.Unmarshal([]byte(val), &features); err == nil { + si.Kubernetes.Features = &features + } + } + } + if len(nodes) == 0 { result, err := kc.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{}) if err != nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index a085e22f..a6dbcec6 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -402,7 +402,7 @@ golang.org/x/oauth2/internal # golang.org/x/sync v0.19.0 ## explicit; go 1.24.0 golang.org/x/sync/errgroup -# golang.org/x/sys v0.39.0 +# golang.org/x/sys v0.40.0 ## explicit; go 1.24.0 golang.org/x/sys/cpu golang.org/x/sys/plan9 @@ -944,7 +944,7 @@ k8s.io/utils/trace # kmodules.xyz/apiversion v0.2.0 ## explicit; go 1.14 kmodules.xyz/apiversion -# kmodules.xyz/client-go v0.34.2 +# kmodules.xyz/client-go v0.34.3 ## explicit; go 1.24.0 kmodules.xyz/client-go kmodules.xyz/client-go/api/v1 @@ -965,7 +965,7 @@ kmodules.xyz/go-containerregistry/name ## explicit; go 1.24.0 kmodules.xyz/offshoot-api/api/v1 kmodules.xyz/offshoot-api/api/v2 -# kmodules.xyz/resource-metadata v0.42.1 +# kmodules.xyz/resource-metadata v0.42.4 ## explicit; go 1.25 kmodules.xyz/resource-metadata/apis/core/v1alpha1 kmodules.xyz/resource-metadata/apis/identity/v1alpha1