Skip to content

Commit

Permalink
Update deps
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Jul 10, 2024
1 parent aee05f4 commit eae4578
Show file tree
Hide file tree
Showing 79 changed files with 116,922 additions and 323 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ require (
k8s.io/kube-state-metrics/v2 v2.12.0
kmodules.xyz/apiversion v0.2.0
kmodules.xyz/authorizer v0.29.1
kmodules.xyz/client-go v0.30.6
kmodules.xyz/client-go v0.30.9
kmodules.xyz/custom-resources v0.30.0
kmodules.xyz/go-containerregistry v0.0.12
kmodules.xyz/monitoring-agent-api v0.29.0
kmodules.xyz/resource-metadata v0.18.9-0.20240619032708-3f7bd1fd005f
kmodules.xyz/resource-metadata v0.18.11-0.20240710051435-5565311708b3
kmodules.xyz/resource-metrics v0.30.1
kmodules.xyz/resource-metrics/utils v0.30.1
kmodules.xyz/sets v0.29.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -904,8 +904,8 @@ kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk=
kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80=
kmodules.xyz/authorizer v0.29.1 h1:uByGGoryKbZcfiEAhjcK/Y345I9mygNQP7DVpkMbNQQ=
kmodules.xyz/authorizer v0.29.1/go.mod h1:kZRhclL8twzyt2bQuJQJbpYww2sc+qFr8I5PPoq/sWY=
kmodules.xyz/client-go v0.30.6 h1:TvcN+8Grhj+LUU19nfFKDmg5VnB9NRXkCXF4tZ5+vCM=
kmodules.xyz/client-go v0.30.6/go.mod h1:XL3PDQIXG4s3xNRL2SSxIvi8b2WyMGpn26dFnOBz0j4=
kmodules.xyz/client-go v0.30.9 h1:wiLivFlqVZOitAqLFEa1n53GkbYYOmiR8upjIHPHrYk=
kmodules.xyz/client-go v0.30.9/go.mod h1:XL3PDQIXG4s3xNRL2SSxIvi8b2WyMGpn26dFnOBz0j4=
kmodules.xyz/crd-schema-fuzz v0.29.1 h1:zJTlWYOrT5dsVVHW8HGcnR/vaWfxQfNh11QwTtkYpcs=
kmodules.xyz/crd-schema-fuzz v0.29.1/go.mod h1:n708z9YQqLMP2KNLQVgBcRJw1QpSWLvpNCEi+KJDOYE=
kmodules.xyz/custom-resources v0.30.0 h1:vR3CbseHMLwR4GvtcJJuRuwIV8voKqFqNii27rMcm1o=
Expand All @@ -916,8 +916,8 @@ kmodules.xyz/monitoring-agent-api v0.29.0 h1:gpFl6OZrlMLb/ySMHdREI9EwGtnJ91oZBn9
kmodules.xyz/monitoring-agent-api v0.29.0/go.mod h1:iNbvaMTgVFOI5q2LJtGK91j4Dmjv4ZRiRdasGmWLKQI=
kmodules.xyz/offshoot-api v0.29.4 h1:WQV2BIUIoVKKiqZNmZ4gAy367jEdwBhEl3dFCLZM1qA=
kmodules.xyz/offshoot-api v0.29.4/go.mod h1:e+NQ0s4gW/YTPWBWEfdISZcmk+tlTq8IjvP5SLdqvko=
kmodules.xyz/resource-metadata v0.18.9-0.20240619032708-3f7bd1fd005f h1:7E4vF/GTcDsCyWPAXaHHNWlTE8kW0MX2xvcwlat35fs=
kmodules.xyz/resource-metadata v0.18.9-0.20240619032708-3f7bd1fd005f/go.mod h1:uiu1orJEM2ZiXN1zML4S0ejgITj2npKVIg46a2v0SE8=
kmodules.xyz/resource-metadata v0.18.11-0.20240710051435-5565311708b3 h1:uMK96+2UuVoTgVusOVsBYyaisPCaqfmGkN2jx17AqZg=
kmodules.xyz/resource-metadata v0.18.11-0.20240710051435-5565311708b3/go.mod h1:PXyZXif1b1QRpe0Pwr92OeOveptZricB0jLssCjsYTc=
kmodules.xyz/resource-metrics v0.30.1 h1:o7mVY8ZwSe5iEILy1eMG4EPZCli7mXZCkgQONjoY9uU=
kmodules.xyz/resource-metrics v0.30.1/go.mod h1:UYcQQLN+3o8rNPQJwJa2D9bt5ihJCeo5bCDuQ4O3MPY=
kmodules.xyz/resource-metrics/utils v0.30.1 h1:iRnAKNMMdAi7QYjMQrK9W3vNMhSC21RWNx9yS3qlpTA=
Expand Down
86 changes: 66 additions & 20 deletions vendor/kmodules.xyz/client-go/apiextensions/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,29 @@ import (
"sync"

apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime/schema"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/log"
)

type (
SetupFn func(ctx context.Context, mgr ctrl.Manager)
TestFn func(*apiextensionsv1.CustomResourceDefinition) (bool, any)
SetupFn func(context.Context, ctrl.Manager)
TestFn func(meta.RESTMapper, *apiextensionsv1.CustomResourceDefinition) bool
)

type setupGroup struct {
gks []schema.GroupKind
fn SetupFn
}

var (
setupFns = make(map[schema.GroupKind]SetupFn)
testFns = make(map[schema.GroupKind]TestFn)
setupDone = map[schema.GroupKind]bool{}
ExtraSetupParam = struct{}{}
mu sync.Mutex
setupFns = make(map[schema.GroupKind]setupGroup)
testFns = make(map[schema.GroupKind]TestFn)
setupDone = map[schema.GroupKind]bool{}
CRDParam = struct{}{}
mu sync.Mutex
)

type Reconciler struct {
Expand Down Expand Up @@ -72,18 +78,16 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
if !setupFnExists {
return ctrl.Result{}, nil
}

ctxSetup := r.ctx
if test, testFnExists := testFns[gk]; testFnExists {
passed, extra := test(&crd)
if !passed {
return ctrl.Result{}, nil
}
ctxSetup = context.WithValue(r.ctx, ExtraSetupParam, extra)
if !testFns[gk](r.mgr.GetRESTMapper(), &crd) {
return ctrl.Result{}, nil
}

setup(ctxSetup, r.mgr)
setupDone[gk] = true
ctxSetup := context.WithValue(r.ctx, CRDParam, &crd)
setup.fn(ctxSetup, r.mgr)

for _, gk := range setup.gks {
setupDone[gk] = true
}
return ctrl.Result{}, nil
}

Expand All @@ -97,8 +101,50 @@ func RegisterSetup(gk schema.GroupKind, fn SetupFn, tn ...TestFn) {
mu.Lock()
defer mu.Unlock()

setupFns[gk] = fn
if len(tn) == 1 {
testFns[gk] = tn[0]
setupFns[gk] = setupGroup{
gks: []schema.GroupKind{gk},
fn: fn,
}
testFns[gk] = andTestFn(tn...)
}

func MultiRegisterSetup(gks []schema.GroupKind, fn SetupFn, tn ...TestFn) {
mu.Lock()
defer mu.Unlock()

testFN := andTestFn(append(tn, allCRDPresent(gks))...)
for _, gk := range gks {
setupFns[gk] = setupGroup{
gks: gks,
fn: fn,
}
testFns[gk] = testFN
}
}

func allCRDPresent(gks []schema.GroupKind) TestFn {
return func(mapper meta.RESTMapper, definition *apiextensionsv1.CustomResourceDefinition) bool {
for _, gk := range gks {
if !crdFound(mapper, gk) {
return false
}
}
return true
}
}

func crdFound(mapper meta.RESTMapper, gk schema.GroupKind) bool {
_, err := mapper.RESTMappings(gk)
return err == nil
}

func andTestFn(fns ...TestFn) TestFn {
return func(mapper meta.RESTMapper, crd *apiextensionsv1.CustomResourceDefinition) bool {
for _, fn := range fns {
if !fn(mapper, crd) {
return false
}
}
return true
}
}
9 changes: 9 additions & 0 deletions vendor/kmodules.xyz/client-go/core/v1/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ func GetContainerByName(containers []core.Container, name string) *core.Containe
return nil
}

func GetContainerIdByName(containers []core.Container, name string) int {
for i := range containers {
if containers[i].Name == name {
return i
}
}
return -1
}

func UpsertContainer(containers []core.Container, upsert core.Container) []core.Container {
for i, container := range containers {
if container.Name == upsert.Name {
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type KubernetesInfo struct {
Cluster *kmapi.ClusterMetadata `json:"cluster,omitempty"`
Version *version.Info `json:"version,omitempty"`
ControlPlane *ControlPlaneInfo `json:"controlPlane,omitempty"`
NodeStats NodeStats `json:"nodeStats"`
NodeStats NodeInfo `json:"nodeStats"`
}

// https://github.com/kmodules/client-go/blob/kubernetes-1.16.3/tools/analytics/analytics.go#L66
Expand All @@ -89,6 +89,12 @@ type ControlPlaneInfo struct {
NotAfter metav1.Time `json:"notAfter"`
}

type NodeInfo struct {
NodeStats `json:",inline"`
ControlPlane *NodeStats `json:"controlPlane,omitempty"`
Workers *NodeStats `json:"workers,omitempty"`
}

type NodeStats struct {
Count int `json:"count,omitempty"`

Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,58 @@ spec:
description: 'Capacity represents the total resources of a node.
More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity'
type: object
controlPlane:
properties:
allocatable:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: Allocatable represents the resources of a node
that are available for scheduling. Defaults to Capacity.
type: object
capacity:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Capacity represents the total resources of a
node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity'
type: object
count:
type: integer
type: object
count:
type: integer
workers:
properties:
allocatable:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: Allocatable represents the resources of a node
that are available for scheduling. Defaults to Capacity.
type: object
capacity:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Capacity represents the total resources of a
node. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#capacity'
type: object
count:
type: integer
type: object
type: object
version:
description: 'Info contains versioning information. TODO: Add []string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ spec:
type:
group: cluster.open-cluster-management.io
kind: ManagedCluster
- name: Cluster Claims
required: true
type:
group: cluster.open-cluster-management.io
kind: ClusterClaim
- name: AddOn Placement Scores
required: true
type:
Expand Down Expand Up @@ -115,7 +110,7 @@ spec:
- name: Cluster Gateways
required: true
type:
group: cluster.core.oam.dev
group: gateway.open-cluster-management.io
kind: ClusterGateway
- name: Managed Proxy Service Resolvers
type:
Expand All @@ -128,6 +123,6 @@ spec:
- name: Cluster Gateway Configurations
required: true
type:
group: proxy.open-cluster-management.io
group: config.gateway.open-cluster-management.io
kind: ClusterGatewayConfiguration
name: OCM Core AddOns Config
Loading

0 comments on commit eae4578

Please sign in to comment.