chore: update dependencies to contain v1beta1 addondeploymentconfig api and sdk-go (#1315)

🤖 Generated with [Claude Code](https://claude.ai/code)

Signed-off-by: Qing Hao <qhao@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Qing Hao
2026-01-08 20:22:34 +08:00
committed by GitHub
parent 635b0ff7e9
commit 8e401c34a9
78 changed files with 2198 additions and 259 deletions

View File

@@ -406,6 +406,18 @@ spec:
- feature
type: object
type: array
importerConfiguration:
description: ImporterConfiguration represents the configuration
of the cluster importer
properties:
renderers:
description: |-
renderers specifies which import renderers to use.
Valid values are: "render-auto", "render-from-config-secret"
items:
type: string
type: array
type: object
registrationDrivers:
description: |-
RegistrationDrivers represent the list of hub registration drivers that contain information used by hub to initialize the hub cluster
@@ -850,6 +862,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
generations:
description: Generations are used to determine when an item needs
to be reconciled or has changed in a way that needs a reaction.

View File

@@ -406,6 +406,18 @@ spec:
- feature
type: object
type: array
importerConfiguration:
description: ImporterConfiguration represents the configuration
of the cluster importer
properties:
renderers:
description: |-
renderers specifies which import renderers to use.
Valid values are: "render-auto", "render-from-config-secret"
items:
type: string
type: array
type: object
registrationDrivers:
description: |-
RegistrationDrivers represent the list of hub registration drivers that contain information used by hub to initialize the hub cluster
@@ -850,6 +862,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
generations:
description: Generations are used to determine when an item needs
to be reconciled or has changed in a way that needs a reaction.

View File

@@ -59,7 +59,7 @@ metadata:
categories: Integration & Delivery,OpenShift Optional
certified: "false"
containerImage: quay.io/open-cluster-management/registration-operator:latest
createdAt: "2025-12-17T06:07:52Z"
createdAt: "2026-01-08T08:09:25Z"
description: Manages the installation and upgrade of the ClusterManager.
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3

View File

@@ -406,6 +406,18 @@ spec:
- feature
type: object
type: array
importerConfiguration:
description: ImporterConfiguration represents the configuration
of the cluster importer
properties:
renderers:
description: |-
renderers specifies which import renderers to use.
Valid values are: "render-auto", "render-from-config-secret"
items:
type: string
type: array
type: object
registrationDrivers:
description: |-
RegistrationDrivers represent the list of hub registration drivers that contain information used by hub to initialize the hub cluster
@@ -850,6 +862,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
generations:
description: Generations are used to determine when an item needs
to be reconciled or has changed in a way that needs a reaction.

View File

@@ -591,6 +591,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
generations:
description: Generations are used to determine when an item needs
to be reconciled or has changed in a way that needs a reaction.

View File

@@ -591,6 +591,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
generations:
description: Generations are used to determine when an item needs
to be reconciled or has changed in a way that needs a reaction.

View File

@@ -31,7 +31,7 @@ metadata:
categories: Integration & Delivery,OpenShift Optional
certified: "false"
containerImage: quay.io/open-cluster-management/registration-operator:latest
createdAt: "2025-12-17T06:07:53Z"
createdAt: "2026-01-08T08:09:25Z"
description: Manages the installation and upgrade of the Klusterlet.
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3

View File

@@ -591,6 +591,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
generations:
description: Generations are used to determine when an item needs
to be reconciled or has changed in a way that needs a reaction.

4
go.mod
View File

@@ -40,8 +40,8 @@ require (
k8s.io/kubectl v0.34.3
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
open-cluster-management.io/addon-framework v1.1.1-0.20251222073158-b5846d76add9
open-cluster-management.io/api v1.1.1-0.20251222023835-510285203ee6
open-cluster-management.io/sdk-go v1.1.1-0.20251218093423-de3e6c682fd0
open-cluster-management.io/api v1.1.1-0.20260108015315-68cef17a0643
open-cluster-management.io/sdk-go v1.1.1-0.20260108080638-c607eaaa5d12
sigs.k8s.io/about-api v0.0.0-20250131010323-518069c31c03
sigs.k8s.io/cluster-inventory-api v0.0.0-20251124125836-445319b6307a
sigs.k8s.io/controller-runtime v0.22.4

8
go.sum
View File

@@ -585,10 +585,10 @@ k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 h1:hwvWFiBzdWw1FhfY1FooPn3kzWuJ8
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
open-cluster-management.io/addon-framework v1.1.1-0.20251222073158-b5846d76add9 h1:Ll4rTS7hlg9PvEZwVjfpRqvG+Vywclcw1B08Vnf0w3E=
open-cluster-management.io/addon-framework v1.1.1-0.20251222073158-b5846d76add9/go.mod h1:St9LTEuZ5ADLY9cVXSp+rVE/ZbPJ+hzNQ7/YcsiQVd8=
open-cluster-management.io/api v1.1.1-0.20251222023835-510285203ee6 h1:mfcUKaSOYVDLzuontUOcasesbU9whNnvgrA0qf9trKs=
open-cluster-management.io/api v1.1.1-0.20251222023835-510285203ee6/go.mod h1:YcmA6SpGEekIMxdoeVIIyOaBhMA6ImWRLXP4g8n8T+4=
open-cluster-management.io/sdk-go v1.1.1-0.20251218093423-de3e6c682fd0 h1:nup1pOFCuBgjisq2F5Bda9NQPyhCR/GRAfdHFdS1aJE=
open-cluster-management.io/sdk-go v1.1.1-0.20251218093423-de3e6c682fd0/go.mod h1:3xQf3gISaZ3377vFnwjH3QH8EF2UNaf8D9igLPUBChk=
open-cluster-management.io/api v1.1.1-0.20260108015315-68cef17a0643 h1:eA/8UpvFuWr79O7/aAT4bcx/tVG9kkl7+4u9o9dRShM=
open-cluster-management.io/api v1.1.1-0.20260108015315-68cef17a0643/go.mod h1:YcmA6SpGEekIMxdoeVIIyOaBhMA6ImWRLXP4g8n8T+4=
open-cluster-management.io/sdk-go v1.1.1-0.20260108080638-c607eaaa5d12 h1:WZrNXgDKxAneVjiiNf0b3ApOyjuEgBcz2akw6vYVxJ8=
open-cluster-management.io/sdk-go v1.1.1-0.20260108080638-c607eaaa5d12/go.mod h1:4haPv/uuKqQ3gxi62/PPknlrUFi132ga0KYLwj5tpx0=
sigs.k8s.io/about-api v0.0.0-20250131010323-518069c31c03 h1:1ShFiMjGQOR/8jTBkmZrk1gORxnvMwm1nOy2/DbHg4U=
sigs.k8s.io/about-api v0.0.0-20250131010323-518069c31c03/go.mod h1:F1pT4mK53U6F16/zuaPSYpBaR7x5Kjym6aKJJC0/DHU=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM=

View File

@@ -5,7 +5,6 @@ set -o nounset
set -o pipefail
HUB_CRD_FILES="./vendor/open-cluster-management.io/api/cluster/v1/*.crd.yaml
./vendor/open-cluster-management.io/api/addon/v1alpha1/0000_02_addon.open-cluster-management.io_addondeploymentconfigs.crd.yaml
./vendor/open-cluster-management.io/api/addon/v1alpha1/0000_03_addon.open-cluster-management.io_addontemplates.crd.yaml
./vendor/open-cluster-management.io/api/addon/v1beta1/*.crd.yaml
./vendor/open-cluster-management.io/api/cluster/v1beta2/0000_01_clusters.open-cluster-management.io_managedclustersetbindings.crd.yaml

View File

@@ -537,6 +537,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: configReferences is a list of current add-on configuration
references.
@@ -1111,6 +1114,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: configReferences is a list of current add-on configuration
references.

View File

@@ -262,6 +262,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
managedNamespaces:
description: |-
managedNamespaces are a list of namespaces managed by the clustersets the
@@ -330,6 +333,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
name:
description: name is the name of the namespace.
maxLength: 63

View File

@@ -723,6 +723,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
placementSummary:
description: PlacementRef Summary
items:

View File

@@ -453,6 +453,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
resourceStatus:
description: |-
ResourceStatus represents the status of each resource in manifestwork deployed on a
@@ -532,6 +535,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
resourceMeta:
description: ResourceMeta represents the group, version,
kind, name and namespace of a resoure.

View File

@@ -205,6 +205,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: |-
configReferences is a list of current add-on configuration references.
@@ -558,6 +561,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: |-
configReferences is a list of current add-on configuration references.

View File

@@ -273,6 +273,267 @@ spec:
type: object
served: true
storage: true
- name: v1beta1
schema:
openAPIV3Schema:
description: |-
AddOnDeploymentConfig represents a configuration to customize the deployments of an add-on.
For example, you can specify the nodePlacement to control the scheduling of the add-on agents.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: spec represents a desired configuration for an add-on.
properties:
agentInstallNamespace:
default: open-cluster-management-agent-addon
description: |-
agentInstallNamespace is the namespace where the add-on agent should be installed on the managed cluster.
For template-type addons: set to empty string "" to use the namespace defined in the addonTemplate.
For non-template addons: defaults to "open-cluster-management-agent-addon" if not specified.
maxLength: 63
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$
type: string
customizedVariables:
description: |-
customizedVariables is a list of name-value variables for the current add-on deployment.
The add-on implementation can use these variables to render its add-on deployment.
The default is an empty list.
items:
description: CustomizedVariable represents a customized variable
for add-on deployment.
properties:
name:
description: name of this variable.
maxLength: 255
pattern: ^[a-zA-Z_][_a-zA-Z0-9]*$
type: string
value:
description: value of this variable.
maxLength: 1024
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
nodePlacement:
description: |-
nodePlacement enables explicit control over the scheduling of the add-on agents on the
managed cluster.
All add-on agent pods are expected to comply with this node placement.
If the placement is nil, the placement is not specified, it will be omitted.
If the placement is an empty object, the placement will match all nodes and tolerate nothing.
properties:
nodeSelector:
additionalProperties:
type: string
description: |-
nodeSelector defines which Nodes the Pods are scheduled on.
If the selector is an empty list, it will match all nodes.
The default is an empty list.
type: object
tolerations:
description: |-
tolerations is attached by pods to tolerate any taint that matches
the triple <key,value,effect> using the matching operator <operator>.
If the tolerations is an empty list, it will tolerate nothing.
The default is an empty list.
items:
description: |-
The pod this Toleration is attached to tolerates any taint that matches
the triple <key,value,effect> using the matching operator <operator>.
properties:
effect:
description: |-
Effect indicates the taint effect to match. Empty means match all taint effects.
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
type: string
key:
description: |-
Key is the taint key that the toleration applies to. Empty means match all taint keys.
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
type: string
operator:
description: |-
Operator represents a key's relationship to the value.
Valid operators are Exists and Equal. Defaults to Equal.
Exists is equivalent to wildcard for value, so that a pod can
tolerate all taints of a particular category.
type: string
tolerationSeconds:
description: |-
TolerationSeconds represents the period of time the toleration (which must be
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
it is not set, which means tolerate the taint forever (do not evict). Zero and
negative values will be treated as 0 (evict immediately) by the system.
format: int64
type: integer
value:
description: |-
Value is the taint value the toleration matches to.
If the operator is Exists, the value should be empty, otherwise just a regular string.
type: string
type: object
type: array
type: object
proxyConfig:
description: |-
proxyConfig holds proxy settings for add-on agent on the managed cluster.
Empty means no proxy settings is available.
properties:
caBundle:
description: |-
caBundle is a CA certificate bundle to verify the proxy server.
And it's only useful when httpsProxy is set and a HTTPS proxy server is specified.
format: byte
type: string
httpProxy:
description: httpProxy is the URL of the proxy for HTTP requests
type: string
httpsProxy:
description: httpsProxy is the URL of the proxy for HTTPS requests
type: string
noProxy:
description: |-
noProxy is a comma-separated list of hostnames and/or CIDRs and/or IPs for which the proxy
should not be used.
type: string
type: object
registries:
description: |-
registries describes how to override images used by the addon agent on the managed cluster.
the following example will override image "quay.io/open-cluster-management/addon-agent" to
"quay.io/ocm/addon-agent" when deploying the addon agent
registries:
- source: quay.io/open-cluster-management/addon-agent
mirror: quay.io/ocm/addon-agent
items:
description: ImageMirror describes how to mirror images from a source
properties:
mirror:
description: mirror is the mirrored registry of the Source.
Will be ignored if mirror is empty.
type: string
source:
description: source is the source registry. All image registries
will be replaced by Mirror if Source is empty.
type: string
required:
- mirror
type: object
type: array
resourceRequirements:
description: |-
resourceRequirements specify the resources required by add-on agents.
If a container matches multiple ContainerResourceRequirements, the last matched configuration in the
array will take precedence.
items:
description: ContainerResourceRequirements defines resources required
by one or a group of containers.
properties:
containerID:
description: |-
containerID is a unique identifier for an agent container. It consists of three parts: resource types,
resource name, and container name, separated by ':'. The format follows
'{resource_types}:{resource_name}:{container_name}' where
1). Supported resource types include deployments, daemonsets, statefulsets, replicasets, jobs,
cronjobs and pods;
2). Wildcards (*) can be used in any part to match multiple containers. For example, '*:*:*'
matches all containers of the agent.
pattern: ^(deployments|daemonsets|statefulsets|replicasets|jobs|cronjobs|pods|\*):.+:.+$
type: string
resources:
description: Compute resources required by matched containers.
properties:
claims:
description: |-
Claims lists the names of resources, defined in spec.resourceClaims,
that are used by this container.
This field depends on the
DynamicResourceAllocation feature gate.
This field is immutable. It can only be set for containers.
items:
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
properties:
name:
description: |-
Name must match the name of one entry in pod.spec.resourceClaims of
the Pod where this field is used. It makes that resource available
inside a container.
type: string
request:
description: |-
Request is the name chosen for a request in the referenced claim.
If empty, everything from the claim is made available, otherwise
only the result of this request.
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
limits:
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: |-
Limits describes the maximum amount of compute resources allowed.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
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: |-
Requests describes the minimum amount of compute resources required.
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
otherwise to an implementation-defined value. Requests cannot exceed Limits.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
type: object
required:
- containerID
- resources
type: object
type: array
x-kubernetes-list-map-keys:
- containerID
x-kubernetes-list-type: map
type: object
required:
- spec
type: object
served: true
storage: false
status:
acceptedNames:
kind: ""

View File

@@ -601,6 +601,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
decisionGroups:
description: List of decision groups determined by the placement and
DecisionStrategy.

4
vendor/modules.txt vendored
View File

@@ -1888,7 +1888,7 @@ open-cluster-management.io/addon-framework/pkg/agent
open-cluster-management.io/addon-framework/pkg/assets
open-cluster-management.io/addon-framework/pkg/index
open-cluster-management.io/addon-framework/pkg/utils
# open-cluster-management.io/api v1.1.1-0.20251222023835-510285203ee6
# open-cluster-management.io/api v1.1.1-0.20260108015315-68cef17a0643
## explicit; go 1.25.0
open-cluster-management.io/api/addon/v1alpha1
open-cluster-management.io/api/addon/v1beta1
@@ -1961,7 +1961,7 @@ open-cluster-management.io/api/operator/v1
open-cluster-management.io/api/utils/work/v1/workapplier
open-cluster-management.io/api/work/v1
open-cluster-management.io/api/work/v1alpha1
# open-cluster-management.io/sdk-go v1.1.1-0.20251218093423-de3e6c682fd0
# open-cluster-management.io/sdk-go v1.1.1-0.20260108080638-c607eaaa5d12
## explicit; go 1.25.0
open-cluster-management.io/sdk-go/pkg/apis/cluster/v1alpha1
open-cluster-management.io/sdk-go/pkg/apis/cluster/v1beta1

View File

@@ -524,6 +524,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: configReferences is a list of current add-on configuration
references.

View File

@@ -192,6 +192,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: |-
configReferences is a list of current add-on configuration references.

View File

@@ -211,8 +211,8 @@ type InstallProgression struct {
ConfigReferences []InstallConfigReference `json:"configReferences,omitempty"`
// conditions describe the state of the managed and monitored components for the operator.
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
}

View File

@@ -101,8 +101,8 @@ type Subject struct {
// +k8s:deepcopy-gen=true
type ManagedClusterAddOnStatus struct {
// conditions describe the state of the managed and monitored components for the operator.
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`

View File

@@ -524,6 +524,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: configReferences is a list of current add-on configuration
references.
@@ -1098,6 +1101,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: configReferences is a list of current add-on configuration
references.

View File

@@ -192,6 +192,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: |-
configReferences is a list of current add-on configuration references.
@@ -545,6 +548,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configReferences:
description: |-
configReferences is a list of current add-on configuration references.

View File

@@ -0,0 +1,542 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: addondeploymentconfigs.addon.open-cluster-management.io
spec:
group: addon.open-cluster-management.io
names:
kind: AddOnDeploymentConfig
listKind: AddOnDeploymentConfigList
plural: addondeploymentconfigs
singular: addondeploymentconfig
preserveUnknownFields: false
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: |-
AddOnDeploymentConfig represents a configuration to customize the deployments of an add-on.
For example, you can specify the NodePlacement to control the scheduling of the add-on agents.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: spec represents a desired configuration for an add-on.
properties:
agentInstallNamespace:
default: open-cluster-management-agent-addon
description: |-
AgentInstallNamespace is the namespace where the add-on agent should be installed on the managed cluster.
For template-type addons: set to empty string "" to use the namespace defined in the addonTemplate.
For non-template addons: defaults to "open-cluster-management-agent-addon" if not specified.
maxLength: 63
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$
type: string
customizedVariables:
description: |-
customizedVariables is a list of name-value variables for the current add-on deployment.
The add-on implementation can use these variables to render its add-on deployment.
The default is an empty list.
items:
description: CustomizedVariable represents a customized variable
for add-on deployment.
properties:
name:
description: Name of this variable.
maxLength: 255
pattern: ^[a-zA-Z_][_a-zA-Z0-9]*$
type: string
value:
description: Value of this variable.
maxLength: 1024
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
nodePlacement:
description: |-
nodePlacement enables explicit control over the scheduling of the add-on agents on the
managed cluster.
All add-on agent pods are expected to comply with this node placement.
If the placement is nil, the placement is not specified, it will be omitted.
If the placement is an empty object, the placement will match all nodes and tolerate nothing.
properties:
nodeSelector:
additionalProperties:
type: string
description: |-
NodeSelector defines which Nodes the Pods are scheduled on.
If the selector is an empty list, it will match all nodes.
The default is an empty list.
type: object
tolerations:
description: |-
Tolerations is attached by pods to tolerate any taint that matches
the triple <key,value,effect> using the matching operator <operator>.
If the tolerations is an empty list, it will tolerate nothing.
The default is an empty list.
items:
description: |-
The pod this Toleration is attached to tolerates any taint that matches
the triple <key,value,effect> using the matching operator <operator>.
properties:
effect:
description: |-
Effect indicates the taint effect to match. Empty means match all taint effects.
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
type: string
key:
description: |-
Key is the taint key that the toleration applies to. Empty means match all taint keys.
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
type: string
operator:
description: |-
Operator represents a key's relationship to the value.
Valid operators are Exists and Equal. Defaults to Equal.
Exists is equivalent to wildcard for value, so that a pod can
tolerate all taints of a particular category.
type: string
tolerationSeconds:
description: |-
TolerationSeconds represents the period of time the toleration (which must be
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
it is not set, which means tolerate the taint forever (do not evict). Zero and
negative values will be treated as 0 (evict immediately) by the system.
format: int64
type: integer
value:
description: |-
Value is the taint value the toleration matches to.
If the operator is Exists, the value should be empty, otherwise just a regular string.
type: string
type: object
type: array
type: object
proxyConfig:
description: |-
ProxyConfig holds proxy settings for add-on agent on the managed cluster.
Empty means no proxy settings is available.
properties:
caBundle:
description: |-
CABundle is a CA certificate bundle to verify the proxy server.
And it's only useful when HTTPSProxy is set and a HTTPS proxy server is specified.
format: byte
type: string
httpProxy:
description: HTTPProxy is the URL of the proxy for HTTP requests
type: string
httpsProxy:
description: HTTPSProxy is the URL of the proxy for HTTPS requests
type: string
noProxy:
description: |-
NoProxy is a comma-separated list of hostnames and/or CIDRs and/or IPs for which the proxy
should not be used.
type: string
type: object
registries:
description: |-
registries describes how to override images used by the addon agent on the managed cluster.
the following example will override image "quay.io/open-cluster-management/addon-agent" to
"quay.io/ocm/addon-agent" when deploying the addon agent
registries:
- source: quay.io/open-cluster-management/addon-agent
mirror: quay.io/ocm/addon-agent
items:
description: ImageMirror describes how to mirror images from a source
properties:
mirror:
description: Mirror is the mirrored registry of the Source.
Will be ignored if Mirror is empty.
type: string
source:
description: Source is the source registry. All image registries
will be replaced by Mirror if Source is empty.
type: string
required:
- mirror
type: object
type: array
resourceRequirements:
description: |-
ResourceRequirements specify the resources required by add-on agents.
If a container matches multiple ContainerResourceRequirements, the last matched configuration in the
array will take precedence.
items:
description: ContainerResourceRequirements defines resources required
by one or a group of containers.
properties:
containerID:
description: |-
ContainerID is a unique identifier for an agent container. It consists of three parts: resource types,
resource name, and container name, separated by ':'. The format follows
'{resource_types}:{resource_name}:{container_name}' where
1). Supported resource types include deployments, daemonsets, statefulsets, replicasets, jobs,
cronjobs and pods;
2). Wildcards (*) can be used in any part to match multiple containers. For example, '*:*:*'
matches all containers of the agent.
pattern: ^(deployments|daemonsets|statefulsets|replicasets|jobs|cronjobs|pods|\*):.+:.+$
type: string
resources:
description: Compute resources required by matched containers.
properties:
claims:
description: |-
Claims lists the names of resources, defined in spec.resourceClaims,
that are used by this container.
This field depends on the
DynamicResourceAllocation feature gate.
This field is immutable. It can only be set for containers.
items:
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
properties:
name:
description: |-
Name must match the name of one entry in pod.spec.resourceClaims of
the Pod where this field is used. It makes that resource available
inside a container.
type: string
request:
description: |-
Request is the name chosen for a request in the referenced claim.
If empty, everything from the claim is made available, otherwise
only the result of this request.
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
limits:
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: |-
Limits describes the maximum amount of compute resources allowed.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
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: |-
Requests describes the minimum amount of compute resources required.
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
otherwise to an implementation-defined value. Requests cannot exceed Limits.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
type: object
required:
- containerID
- resources
type: object
type: array
x-kubernetes-list-map-keys:
- containerID
x-kubernetes-list-type: map
type: object
required:
- spec
type: object
served: true
storage: true
- name: v1beta1
schema:
openAPIV3Schema:
description: |-
AddOnDeploymentConfig represents a configuration to customize the deployments of an add-on.
For example, you can specify the nodePlacement to control the scheduling of the add-on agents.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: spec represents a desired configuration for an add-on.
properties:
agentInstallNamespace:
default: open-cluster-management-agent-addon
description: |-
agentInstallNamespace is the namespace where the add-on agent should be installed on the managed cluster.
For template-type addons: set to empty string "" to use the namespace defined in the addonTemplate.
For non-template addons: defaults to "open-cluster-management-agent-addon" if not specified.
maxLength: 63
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$
type: string
customizedVariables:
description: |-
customizedVariables is a list of name-value variables for the current add-on deployment.
The add-on implementation can use these variables to render its add-on deployment.
The default is an empty list.
items:
description: CustomizedVariable represents a customized variable
for add-on deployment.
properties:
name:
description: name of this variable.
maxLength: 255
pattern: ^[a-zA-Z_][_a-zA-Z0-9]*$
type: string
value:
description: value of this variable.
maxLength: 1024
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
nodePlacement:
description: |-
nodePlacement enables explicit control over the scheduling of the add-on agents on the
managed cluster.
All add-on agent pods are expected to comply with this node placement.
If the placement is nil, the placement is not specified, it will be omitted.
If the placement is an empty object, the placement will match all nodes and tolerate nothing.
properties:
nodeSelector:
additionalProperties:
type: string
description: |-
nodeSelector defines which Nodes the Pods are scheduled on.
If the selector is an empty list, it will match all nodes.
The default is an empty list.
type: object
tolerations:
description: |-
tolerations is attached by pods to tolerate any taint that matches
the triple <key,value,effect> using the matching operator <operator>.
If the tolerations is an empty list, it will tolerate nothing.
The default is an empty list.
items:
description: |-
The pod this Toleration is attached to tolerates any taint that matches
the triple <key,value,effect> using the matching operator <operator>.
properties:
effect:
description: |-
Effect indicates the taint effect to match. Empty means match all taint effects.
When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
type: string
key:
description: |-
Key is the taint key that the toleration applies to. Empty means match all taint keys.
If the key is empty, operator must be Exists; this combination means to match all values and all keys.
type: string
operator:
description: |-
Operator represents a key's relationship to the value.
Valid operators are Exists and Equal. Defaults to Equal.
Exists is equivalent to wildcard for value, so that a pod can
tolerate all taints of a particular category.
type: string
tolerationSeconds:
description: |-
TolerationSeconds represents the period of time the toleration (which must be
of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default,
it is not set, which means tolerate the taint forever (do not evict). Zero and
negative values will be treated as 0 (evict immediately) by the system.
format: int64
type: integer
value:
description: |-
Value is the taint value the toleration matches to.
If the operator is Exists, the value should be empty, otherwise just a regular string.
type: string
type: object
type: array
type: object
proxyConfig:
description: |-
proxyConfig holds proxy settings for add-on agent on the managed cluster.
Empty means no proxy settings is available.
properties:
caBundle:
description: |-
caBundle is a CA certificate bundle to verify the proxy server.
And it's only useful when httpsProxy is set and a HTTPS proxy server is specified.
format: byte
type: string
httpProxy:
description: httpProxy is the URL of the proxy for HTTP requests
type: string
httpsProxy:
description: httpsProxy is the URL of the proxy for HTTPS requests
type: string
noProxy:
description: |-
noProxy is a comma-separated list of hostnames and/or CIDRs and/or IPs for which the proxy
should not be used.
type: string
type: object
registries:
description: |-
registries describes how to override images used by the addon agent on the managed cluster.
the following example will override image "quay.io/open-cluster-management/addon-agent" to
"quay.io/ocm/addon-agent" when deploying the addon agent
registries:
- source: quay.io/open-cluster-management/addon-agent
mirror: quay.io/ocm/addon-agent
items:
description: ImageMirror describes how to mirror images from a source
properties:
mirror:
description: mirror is the mirrored registry of the Source.
Will be ignored if mirror is empty.
type: string
source:
description: source is the source registry. All image registries
will be replaced by Mirror if Source is empty.
type: string
required:
- mirror
type: object
type: array
resourceRequirements:
description: |-
resourceRequirements specify the resources required by add-on agents.
If a container matches multiple ContainerResourceRequirements, the last matched configuration in the
array will take precedence.
items:
description: ContainerResourceRequirements defines resources required
by one or a group of containers.
properties:
containerID:
description: |-
containerID is a unique identifier for an agent container. It consists of three parts: resource types,
resource name, and container name, separated by ':'. The format follows
'{resource_types}:{resource_name}:{container_name}' where
1). Supported resource types include deployments, daemonsets, statefulsets, replicasets, jobs,
cronjobs and pods;
2). Wildcards (*) can be used in any part to match multiple containers. For example, '*:*:*'
matches all containers of the agent.
pattern: ^(deployments|daemonsets|statefulsets|replicasets|jobs|cronjobs|pods|\*):.+:.+$
type: string
resources:
description: Compute resources required by matched containers.
properties:
claims:
description: |-
Claims lists the names of resources, defined in spec.resourceClaims,
that are used by this container.
This field depends on the
DynamicResourceAllocation feature gate.
This field is immutable. It can only be set for containers.
items:
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
properties:
name:
description: |-
Name must match the name of one entry in pod.spec.resourceClaims of
the Pod where this field is used. It makes that resource available
inside a container.
type: string
request:
description: |-
Request is the name chosen for a request in the referenced claim.
If empty, everything from the claim is made available, otherwise
only the result of this request.
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
limits:
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: |-
Limits describes the maximum amount of compute resources allowed.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
requests:
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: |-
Requests describes the minimum amount of compute resources required.
If Requests is omitted for a container, it defaults to Limits if that is explicitly specified,
otherwise to an implementation-defined value. Requests cannot exceed Limits.
More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
type: object
type: object
required:
- containerID
- resources
type: object
type: array
x-kubernetes-list-map-keys:
- containerID
x-kubernetes-list-type: map
type: object
required:
- spec
type: object
served: true
storage: false
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -0,0 +1,168 @@
// Copyright Contributors to the Open Cluster Management project
package v1beta1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// AddOnDeploymentConfig represents a configuration to customize the deployments of an add-on.
// For example, you can specify the nodePlacement to control the scheduling of the add-on agents.
type AddOnDeploymentConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// spec represents a desired configuration for an add-on.
// +required
Spec AddOnDeploymentConfigSpec `json:"spec"`
}
type AddOnDeploymentConfigSpec struct {
// customizedVariables is a list of name-value variables for the current add-on deployment.
// The add-on implementation can use these variables to render its add-on deployment.
// The default is an empty list.
// +optional
// +listType=map
// +listMapKey=name
CustomizedVariables []CustomizedVariable `json:"customizedVariables,omitempty"`
// nodePlacement enables explicit control over the scheduling of the add-on agents on the
// managed cluster.
// All add-on agent pods are expected to comply with this node placement.
// If the placement is nil, the placement is not specified, it will be omitted.
// If the placement is an empty object, the placement will match all nodes and tolerate nothing.
// +optional
NodePlacement *NodePlacement `json:"nodePlacement,omitempty"`
// registries describes how to override images used by the addon agent on the managed cluster.
// the following example will override image "quay.io/open-cluster-management/addon-agent" to
// "quay.io/ocm/addon-agent" when deploying the addon agent
//
// registries:
// - source: quay.io/open-cluster-management/addon-agent
// mirror: quay.io/ocm/addon-agent
//
// +optional
Registries []ImageMirror `json:"registries,omitempty"`
// proxyConfig holds proxy settings for add-on agent on the managed cluster.
// Empty means no proxy settings is available.
// +optional
ProxyConfig ProxyConfig `json:"proxyConfig,omitempty"`
// agentInstallNamespace is the namespace where the add-on agent should be installed on the managed cluster.
// For template-type addons: set to empty string "" to use the namespace defined in the addonTemplate.
// For non-template addons: defaults to "open-cluster-management-agent-addon" if not specified.
// +optional
// +kubebuilder:default=open-cluster-management-agent-addon
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:Pattern=^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$
AgentInstallNamespace string `json:"agentInstallNamespace,omitempty"`
// resourceRequirements specify the resources required by add-on agents.
// If a container matches multiple ContainerResourceRequirements, the last matched configuration in the
// array will take precedence.
// +optional
// +listType=map
// +listMapKey=containerID
ResourceRequirements []ContainerResourceRequirements `json:"resourceRequirements,omitempty"`
}
// ContainerResourceRequirements defines resources required by one or a group of containers.
type ContainerResourceRequirements struct {
// containerID is a unique identifier for an agent container. It consists of three parts: resource types,
// resource name, and container name, separated by ':'. The format follows
// '{resource_types}:{resource_name}:{container_name}' where
// 1). Supported resource types include deployments, daemonsets, statefulsets, replicasets, jobs,
// cronjobs and pods;
// 2). Wildcards (*) can be used in any part to match multiple containers. For example, '*:*:*'
// matches all containers of the agent.
// +required
// +kubebuilder:validation:Required
// +kubebuilder:validation:Pattern=`^(deployments|daemonsets|statefulsets|replicasets|jobs|cronjobs|pods|\*):.+:.+$`
ContainerID string `json:"containerID"`
// Compute resources required by matched containers.
// +required
// +kubebuilder:validation:Required
Resources corev1.ResourceRequirements `json:"resources"`
}
// CustomizedVariable represents a customized variable for add-on deployment.
type CustomizedVariable struct {
// name of this variable.
// +required
// +kubebuilder:validation:Required
// +kubebuilder:validation:MaxLength=255
// +kubebuilder:validation:Pattern=^[a-zA-Z_][_a-zA-Z0-9]*$
Name string `json:"name"`
// value of this variable.
// +kubebuilder:validation:MaxLength=1024
Value string `json:"value"`
}
// NodePlacement describes node scheduling configuration for the pods.
type NodePlacement struct {
// nodeSelector defines which Nodes the Pods are scheduled on.
// If the selector is an empty list, it will match all nodes.
// The default is an empty list.
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// tolerations is attached by pods to tolerate any taint that matches
// the triple <key,value,effect> using the matching operator <operator>.
// If the tolerations is an empty list, it will tolerate nothing.
// The default is an empty list.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
}
// ImageMirror describes how to mirror images from a source
type ImageMirror struct {
// mirror is the mirrored registry of the Source. Will be ignored if mirror is empty.
// +kubebuilder:validation:Required
// +required
Mirror string `json:"mirror"`
// source is the source registry. All image registries will be replaced by Mirror if Source is empty.
// +optional
Source string `json:"source"`
}
// ProxyConfig describes the proxy settings for the add-on agent
type ProxyConfig struct {
// httpProxy is the URL of the proxy for HTTP requests
// +optional
HTTPProxy string `json:"httpProxy,omitempty"`
// httpsProxy is the URL of the proxy for HTTPS requests
// +optional
HTTPSProxy string `json:"httpsProxy,omitempty"`
// caBundle is a CA certificate bundle to verify the proxy server.
// And it's only useful when httpsProxy is set and a HTTPS proxy server is specified.
// +optional
CABundle []byte `json:"caBundle,omitempty"`
// noProxy is a comma-separated list of hostnames and/or CIDRs and/or IPs for which the proxy
// should not be used.
// +optional
NoProxy string `json:"noProxy,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// AddOnDeploymentConfigList is a collection of add-on deployment config.
type AddOnDeploymentConfigList struct {
metav1.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// items is a list of add-on deployment config.
Items []AddOnDeploymentConfig `json:"items"`
}

View File

@@ -172,8 +172,8 @@ type InstallProgression struct {
ConfigReferences []InstallConfigReference `json:"configReferences,omitempty"`
// conditions describe the state of the managed and monitored components for the operator.
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
}

View File

@@ -133,8 +133,8 @@ type Subject struct {
// +k8s:deepcopy-gen=true
type ManagedClusterAddOnStatus struct {
// conditions describe the state of the managed and monitored components for the operator.
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`

View File

@@ -9,6 +9,7 @@ package v1beta1
import (
unsafe "unsafe"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
@@ -32,6 +33,36 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*AddOnDeploymentConfig)(nil), (*v1alpha1.AddOnDeploymentConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_AddOnDeploymentConfig_To_v1alpha1_AddOnDeploymentConfig(a.(*AddOnDeploymentConfig), b.(*v1alpha1.AddOnDeploymentConfig), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.AddOnDeploymentConfig)(nil), (*AddOnDeploymentConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_AddOnDeploymentConfig_To_v1beta1_AddOnDeploymentConfig(a.(*v1alpha1.AddOnDeploymentConfig), b.(*AddOnDeploymentConfig), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*AddOnDeploymentConfigList)(nil), (*v1alpha1.AddOnDeploymentConfigList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_AddOnDeploymentConfigList_To_v1alpha1_AddOnDeploymentConfigList(a.(*AddOnDeploymentConfigList), b.(*v1alpha1.AddOnDeploymentConfigList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.AddOnDeploymentConfigList)(nil), (*AddOnDeploymentConfigList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_AddOnDeploymentConfigList_To_v1beta1_AddOnDeploymentConfigList(a.(*v1alpha1.AddOnDeploymentConfigList), b.(*AddOnDeploymentConfigList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*AddOnDeploymentConfigSpec)(nil), (*v1alpha1.AddOnDeploymentConfigSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_AddOnDeploymentConfigSpec_To_v1alpha1_AddOnDeploymentConfigSpec(a.(*AddOnDeploymentConfigSpec), b.(*v1alpha1.AddOnDeploymentConfigSpec), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.AddOnDeploymentConfigSpec)(nil), (*AddOnDeploymentConfigSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_AddOnDeploymentConfigSpec_To_v1beta1_AddOnDeploymentConfigSpec(a.(*v1alpha1.AddOnDeploymentConfigSpec), b.(*AddOnDeploymentConfigSpec), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*AddOnMeta)(nil), (*v1alpha1.AddOnMeta)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_AddOnMeta_To_v1alpha1_AddOnMeta(a.(*AddOnMeta), b.(*v1alpha1.AddOnMeta), scope)
}); err != nil {
@@ -107,6 +138,26 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*ContainerResourceRequirements)(nil), (*v1alpha1.ContainerResourceRequirements)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_ContainerResourceRequirements_To_v1alpha1_ContainerResourceRequirements(a.(*ContainerResourceRequirements), b.(*v1alpha1.ContainerResourceRequirements), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.ContainerResourceRequirements)(nil), (*ContainerResourceRequirements)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ContainerResourceRequirements_To_v1beta1_ContainerResourceRequirements(a.(*v1alpha1.ContainerResourceRequirements), b.(*ContainerResourceRequirements), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*CustomizedVariable)(nil), (*v1alpha1.CustomizedVariable)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_CustomizedVariable_To_v1alpha1_CustomizedVariable(a.(*CustomizedVariable), b.(*v1alpha1.CustomizedVariable), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.CustomizedVariable)(nil), (*CustomizedVariable)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_CustomizedVariable_To_v1beta1_CustomizedVariable(a.(*v1alpha1.CustomizedVariable), b.(*CustomizedVariable), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*DefaultConfigReference)(nil), (*v1alpha1.DefaultConfigReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_DefaultConfigReference_To_v1alpha1_DefaultConfigReference(a.(*DefaultConfigReference), b.(*v1alpha1.DefaultConfigReference), scope)
}); err != nil {
@@ -127,6 +178,16 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*ImageMirror)(nil), (*v1alpha1.ImageMirror)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_ImageMirror_To_v1alpha1_ImageMirror(a.(*ImageMirror), b.(*v1alpha1.ImageMirror), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.ImageMirror)(nil), (*ImageMirror)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ImageMirror_To_v1beta1_ImageMirror(a.(*v1alpha1.ImageMirror), b.(*ImageMirror), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*InstallConfigReference)(nil), (*v1alpha1.InstallConfigReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_InstallConfigReference_To_v1alpha1_InstallConfigReference(a.(*InstallConfigReference), b.(*v1alpha1.InstallConfigReference), scope)
}); err != nil {
@@ -187,6 +248,16 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*NodePlacement)(nil), (*v1alpha1.NodePlacement)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_NodePlacement_To_v1alpha1_NodePlacement(a.(*NodePlacement), b.(*v1alpha1.NodePlacement), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.NodePlacement)(nil), (*NodePlacement)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_NodePlacement_To_v1beta1_NodePlacement(a.(*v1alpha1.NodePlacement), b.(*NodePlacement), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*ObjectReference)(nil), (*v1alpha1.ObjectReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_ObjectReference_To_v1alpha1_ObjectReference(a.(*ObjectReference), b.(*v1alpha1.ObjectReference), scope)
}); err != nil {
@@ -217,6 +288,16 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*ProxyConfig)(nil), (*v1alpha1.ProxyConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_ProxyConfig_To_v1alpha1_ProxyConfig(a.(*ProxyConfig), b.(*v1alpha1.ProxyConfig), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1alpha1.ProxyConfig)(nil), (*ProxyConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ProxyConfig_To_v1beta1_ProxyConfig(a.(*v1alpha1.ProxyConfig), b.(*ProxyConfig), scope)
}); err != nil {
return err
}
if err := s.AddConversionFunc((*v1alpha1.ClusterManagementAddOnSpec)(nil), (*ClusterManagementAddOnSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ClusterManagementAddOnSpec_To_v1beta1_ClusterManagementAddOnSpec(a.(*v1alpha1.ClusterManagementAddOnSpec), b.(*ClusterManagementAddOnSpec), scope)
}); err != nil {
@@ -295,6 +376,88 @@ func Convert_v1alpha1_AddOnConfig_To_v1beta1_AddOnConfig(in *v1alpha1.AddOnConfi
return autoConvert_v1alpha1_AddOnConfig_To_v1beta1_AddOnConfig(in, out, s)
}
func autoConvert_v1beta1_AddOnDeploymentConfig_To_v1alpha1_AddOnDeploymentConfig(in *AddOnDeploymentConfig, out *v1alpha1.AddOnDeploymentConfig, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
if err := Convert_v1beta1_AddOnDeploymentConfigSpec_To_v1alpha1_AddOnDeploymentConfigSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
return nil
}
// Convert_v1beta1_AddOnDeploymentConfig_To_v1alpha1_AddOnDeploymentConfig is an autogenerated conversion function.
func Convert_v1beta1_AddOnDeploymentConfig_To_v1alpha1_AddOnDeploymentConfig(in *AddOnDeploymentConfig, out *v1alpha1.AddOnDeploymentConfig, s conversion.Scope) error {
return autoConvert_v1beta1_AddOnDeploymentConfig_To_v1alpha1_AddOnDeploymentConfig(in, out, s)
}
func autoConvert_v1alpha1_AddOnDeploymentConfig_To_v1beta1_AddOnDeploymentConfig(in *v1alpha1.AddOnDeploymentConfig, out *AddOnDeploymentConfig, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
if err := Convert_v1alpha1_AddOnDeploymentConfigSpec_To_v1beta1_AddOnDeploymentConfigSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
return nil
}
// Convert_v1alpha1_AddOnDeploymentConfig_To_v1beta1_AddOnDeploymentConfig is an autogenerated conversion function.
func Convert_v1alpha1_AddOnDeploymentConfig_To_v1beta1_AddOnDeploymentConfig(in *v1alpha1.AddOnDeploymentConfig, out *AddOnDeploymentConfig, s conversion.Scope) error {
return autoConvert_v1alpha1_AddOnDeploymentConfig_To_v1beta1_AddOnDeploymentConfig(in, out, s)
}
func autoConvert_v1beta1_AddOnDeploymentConfigList_To_v1alpha1_AddOnDeploymentConfigList(in *AddOnDeploymentConfigList, out *v1alpha1.AddOnDeploymentConfigList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]v1alpha1.AddOnDeploymentConfig)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_v1beta1_AddOnDeploymentConfigList_To_v1alpha1_AddOnDeploymentConfigList is an autogenerated conversion function.
func Convert_v1beta1_AddOnDeploymentConfigList_To_v1alpha1_AddOnDeploymentConfigList(in *AddOnDeploymentConfigList, out *v1alpha1.AddOnDeploymentConfigList, s conversion.Scope) error {
return autoConvert_v1beta1_AddOnDeploymentConfigList_To_v1alpha1_AddOnDeploymentConfigList(in, out, s)
}
func autoConvert_v1alpha1_AddOnDeploymentConfigList_To_v1beta1_AddOnDeploymentConfigList(in *v1alpha1.AddOnDeploymentConfigList, out *AddOnDeploymentConfigList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]AddOnDeploymentConfig)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_v1alpha1_AddOnDeploymentConfigList_To_v1beta1_AddOnDeploymentConfigList is an autogenerated conversion function.
func Convert_v1alpha1_AddOnDeploymentConfigList_To_v1beta1_AddOnDeploymentConfigList(in *v1alpha1.AddOnDeploymentConfigList, out *AddOnDeploymentConfigList, s conversion.Scope) error {
return autoConvert_v1alpha1_AddOnDeploymentConfigList_To_v1beta1_AddOnDeploymentConfigList(in, out, s)
}
func autoConvert_v1beta1_AddOnDeploymentConfigSpec_To_v1alpha1_AddOnDeploymentConfigSpec(in *AddOnDeploymentConfigSpec, out *v1alpha1.AddOnDeploymentConfigSpec, s conversion.Scope) error {
out.CustomizedVariables = *(*[]v1alpha1.CustomizedVariable)(unsafe.Pointer(&in.CustomizedVariables))
out.NodePlacement = (*v1alpha1.NodePlacement)(unsafe.Pointer(in.NodePlacement))
out.Registries = *(*[]v1alpha1.ImageMirror)(unsafe.Pointer(&in.Registries))
if err := Convert_v1beta1_ProxyConfig_To_v1alpha1_ProxyConfig(&in.ProxyConfig, &out.ProxyConfig, s); err != nil {
return err
}
out.AgentInstallNamespace = in.AgentInstallNamespace
out.ResourceRequirements = *(*[]v1alpha1.ContainerResourceRequirements)(unsafe.Pointer(&in.ResourceRequirements))
return nil
}
// Convert_v1beta1_AddOnDeploymentConfigSpec_To_v1alpha1_AddOnDeploymentConfigSpec is an autogenerated conversion function.
func Convert_v1beta1_AddOnDeploymentConfigSpec_To_v1alpha1_AddOnDeploymentConfigSpec(in *AddOnDeploymentConfigSpec, out *v1alpha1.AddOnDeploymentConfigSpec, s conversion.Scope) error {
return autoConvert_v1beta1_AddOnDeploymentConfigSpec_To_v1alpha1_AddOnDeploymentConfigSpec(in, out, s)
}
func autoConvert_v1alpha1_AddOnDeploymentConfigSpec_To_v1beta1_AddOnDeploymentConfigSpec(in *v1alpha1.AddOnDeploymentConfigSpec, out *AddOnDeploymentConfigSpec, s conversion.Scope) error {
out.CustomizedVariables = *(*[]CustomizedVariable)(unsafe.Pointer(&in.CustomizedVariables))
out.NodePlacement = (*NodePlacement)(unsafe.Pointer(in.NodePlacement))
out.Registries = *(*[]ImageMirror)(unsafe.Pointer(&in.Registries))
if err := Convert_v1alpha1_ProxyConfig_To_v1beta1_ProxyConfig(&in.ProxyConfig, &out.ProxyConfig, s); err != nil {
return err
}
out.AgentInstallNamespace = in.AgentInstallNamespace
out.ResourceRequirements = *(*[]ContainerResourceRequirements)(unsafe.Pointer(&in.ResourceRequirements))
return nil
}
// Convert_v1alpha1_AddOnDeploymentConfigSpec_To_v1beta1_AddOnDeploymentConfigSpec is an autogenerated conversion function.
func Convert_v1alpha1_AddOnDeploymentConfigSpec_To_v1beta1_AddOnDeploymentConfigSpec(in *v1alpha1.AddOnDeploymentConfigSpec, out *AddOnDeploymentConfigSpec, s conversion.Scope) error {
return autoConvert_v1alpha1_AddOnDeploymentConfigSpec_To_v1beta1_AddOnDeploymentConfigSpec(in, out, s)
}
func autoConvert_v1beta1_AddOnMeta_To_v1alpha1_AddOnMeta(in *AddOnMeta, out *v1alpha1.AddOnMeta, s conversion.Scope) error {
out.DisplayName = in.DisplayName
out.Description = in.Description
@@ -532,6 +695,50 @@ func Convert_v1alpha1_ConfigSpecHash_To_v1beta1_ConfigSpecHash(in *v1alpha1.Conf
return autoConvert_v1alpha1_ConfigSpecHash_To_v1beta1_ConfigSpecHash(in, out, s)
}
func autoConvert_v1beta1_ContainerResourceRequirements_To_v1alpha1_ContainerResourceRequirements(in *ContainerResourceRequirements, out *v1alpha1.ContainerResourceRequirements, s conversion.Scope) error {
out.ContainerID = in.ContainerID
out.Resources = in.Resources
return nil
}
// Convert_v1beta1_ContainerResourceRequirements_To_v1alpha1_ContainerResourceRequirements is an autogenerated conversion function.
func Convert_v1beta1_ContainerResourceRequirements_To_v1alpha1_ContainerResourceRequirements(in *ContainerResourceRequirements, out *v1alpha1.ContainerResourceRequirements, s conversion.Scope) error {
return autoConvert_v1beta1_ContainerResourceRequirements_To_v1alpha1_ContainerResourceRequirements(in, out, s)
}
func autoConvert_v1alpha1_ContainerResourceRequirements_To_v1beta1_ContainerResourceRequirements(in *v1alpha1.ContainerResourceRequirements, out *ContainerResourceRequirements, s conversion.Scope) error {
out.ContainerID = in.ContainerID
out.Resources = in.Resources
return nil
}
// Convert_v1alpha1_ContainerResourceRequirements_To_v1beta1_ContainerResourceRequirements is an autogenerated conversion function.
func Convert_v1alpha1_ContainerResourceRequirements_To_v1beta1_ContainerResourceRequirements(in *v1alpha1.ContainerResourceRequirements, out *ContainerResourceRequirements, s conversion.Scope) error {
return autoConvert_v1alpha1_ContainerResourceRequirements_To_v1beta1_ContainerResourceRequirements(in, out, s)
}
func autoConvert_v1beta1_CustomizedVariable_To_v1alpha1_CustomizedVariable(in *CustomizedVariable, out *v1alpha1.CustomizedVariable, s conversion.Scope) error {
out.Name = in.Name
out.Value = in.Value
return nil
}
// Convert_v1beta1_CustomizedVariable_To_v1alpha1_CustomizedVariable is an autogenerated conversion function.
func Convert_v1beta1_CustomizedVariable_To_v1alpha1_CustomizedVariable(in *CustomizedVariable, out *v1alpha1.CustomizedVariable, s conversion.Scope) error {
return autoConvert_v1beta1_CustomizedVariable_To_v1alpha1_CustomizedVariable(in, out, s)
}
func autoConvert_v1alpha1_CustomizedVariable_To_v1beta1_CustomizedVariable(in *v1alpha1.CustomizedVariable, out *CustomizedVariable, s conversion.Scope) error {
out.Name = in.Name
out.Value = in.Value
return nil
}
// Convert_v1alpha1_CustomizedVariable_To_v1beta1_CustomizedVariable is an autogenerated conversion function.
func Convert_v1alpha1_CustomizedVariable_To_v1beta1_CustomizedVariable(in *v1alpha1.CustomizedVariable, out *CustomizedVariable, s conversion.Scope) error {
return autoConvert_v1alpha1_CustomizedVariable_To_v1beta1_CustomizedVariable(in, out, s)
}
func autoConvert_v1beta1_DefaultConfigReference_To_v1alpha1_DefaultConfigReference(in *DefaultConfigReference, out *v1alpha1.DefaultConfigReference, s conversion.Scope) error {
if err := Convert_v1beta1_ConfigGroupResource_To_v1alpha1_ConfigGroupResource(&in.ConfigGroupResource, &out.ConfigGroupResource, s); err != nil {
return err
@@ -578,6 +785,28 @@ func Convert_v1alpha1_HealthCheck_To_v1beta1_HealthCheck(in *v1alpha1.HealthChec
return autoConvert_v1alpha1_HealthCheck_To_v1beta1_HealthCheck(in, out, s)
}
func autoConvert_v1beta1_ImageMirror_To_v1alpha1_ImageMirror(in *ImageMirror, out *v1alpha1.ImageMirror, s conversion.Scope) error {
out.Mirror = in.Mirror
out.Source = in.Source
return nil
}
// Convert_v1beta1_ImageMirror_To_v1alpha1_ImageMirror is an autogenerated conversion function.
func Convert_v1beta1_ImageMirror_To_v1alpha1_ImageMirror(in *ImageMirror, out *v1alpha1.ImageMirror, s conversion.Scope) error {
return autoConvert_v1beta1_ImageMirror_To_v1alpha1_ImageMirror(in, out, s)
}
func autoConvert_v1alpha1_ImageMirror_To_v1beta1_ImageMirror(in *v1alpha1.ImageMirror, out *ImageMirror, s conversion.Scope) error {
out.Mirror = in.Mirror
out.Source = in.Source
return nil
}
// Convert_v1alpha1_ImageMirror_To_v1beta1_ImageMirror is an autogenerated conversion function.
func Convert_v1alpha1_ImageMirror_To_v1beta1_ImageMirror(in *v1alpha1.ImageMirror, out *ImageMirror, s conversion.Scope) error {
return autoConvert_v1alpha1_ImageMirror_To_v1beta1_ImageMirror(in, out, s)
}
func autoConvert_v1beta1_InstallConfigReference_To_v1alpha1_InstallConfigReference(in *InstallConfigReference, out *v1alpha1.InstallConfigReference, s conversion.Scope) error {
if err := Convert_v1beta1_ConfigGroupResource_To_v1alpha1_ConfigGroupResource(&in.ConfigGroupResource, &out.ConfigGroupResource, s); err != nil {
return err
@@ -826,6 +1055,28 @@ func autoConvert_v1alpha1_ManagedClusterAddOnStatus_To_v1beta1_ManagedClusterAdd
return nil
}
func autoConvert_v1beta1_NodePlacement_To_v1alpha1_NodePlacement(in *NodePlacement, out *v1alpha1.NodePlacement, s conversion.Scope) error {
out.NodeSelector = *(*map[string]string)(unsafe.Pointer(&in.NodeSelector))
out.Tolerations = *(*[]corev1.Toleration)(unsafe.Pointer(&in.Tolerations))
return nil
}
// Convert_v1beta1_NodePlacement_To_v1alpha1_NodePlacement is an autogenerated conversion function.
func Convert_v1beta1_NodePlacement_To_v1alpha1_NodePlacement(in *NodePlacement, out *v1alpha1.NodePlacement, s conversion.Scope) error {
return autoConvert_v1beta1_NodePlacement_To_v1alpha1_NodePlacement(in, out, s)
}
func autoConvert_v1alpha1_NodePlacement_To_v1beta1_NodePlacement(in *v1alpha1.NodePlacement, out *NodePlacement, s conversion.Scope) error {
out.NodeSelector = *(*map[string]string)(unsafe.Pointer(&in.NodeSelector))
out.Tolerations = *(*[]corev1.Toleration)(unsafe.Pointer(&in.Tolerations))
return nil
}
// Convert_v1alpha1_NodePlacement_To_v1beta1_NodePlacement is an autogenerated conversion function.
func Convert_v1alpha1_NodePlacement_To_v1beta1_NodePlacement(in *v1alpha1.NodePlacement, out *NodePlacement, s conversion.Scope) error {
return autoConvert_v1alpha1_NodePlacement_To_v1beta1_NodePlacement(in, out, s)
}
func autoConvert_v1beta1_ObjectReference_To_v1alpha1_ObjectReference(in *ObjectReference, out *v1alpha1.ObjectReference, s conversion.Scope) error {
out.Group = in.Group
out.Resource = in.Resource
@@ -902,6 +1153,32 @@ func Convert_v1alpha1_PlacementStrategy_To_v1beta1_PlacementStrategy(in *v1alpha
return autoConvert_v1alpha1_PlacementStrategy_To_v1beta1_PlacementStrategy(in, out, s)
}
func autoConvert_v1beta1_ProxyConfig_To_v1alpha1_ProxyConfig(in *ProxyConfig, out *v1alpha1.ProxyConfig, s conversion.Scope) error {
out.HTTPProxy = in.HTTPProxy
out.HTTPSProxy = in.HTTPSProxy
out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle))
out.NoProxy = in.NoProxy
return nil
}
// Convert_v1beta1_ProxyConfig_To_v1alpha1_ProxyConfig is an autogenerated conversion function.
func Convert_v1beta1_ProxyConfig_To_v1alpha1_ProxyConfig(in *ProxyConfig, out *v1alpha1.ProxyConfig, s conversion.Scope) error {
return autoConvert_v1beta1_ProxyConfig_To_v1alpha1_ProxyConfig(in, out, s)
}
func autoConvert_v1alpha1_ProxyConfig_To_v1beta1_ProxyConfig(in *v1alpha1.ProxyConfig, out *ProxyConfig, s conversion.Scope) error {
out.HTTPProxy = in.HTTPProxy
out.HTTPSProxy = in.HTTPSProxy
out.CABundle = *(*[]byte)(unsafe.Pointer(&in.CABundle))
out.NoProxy = in.NoProxy
return nil
}
// Convert_v1alpha1_ProxyConfig_To_v1beta1_ProxyConfig is an autogenerated conversion function.
func Convert_v1alpha1_ProxyConfig_To_v1beta1_ProxyConfig(in *v1alpha1.ProxyConfig, out *ProxyConfig, s conversion.Scope) error {
return autoConvert_v1alpha1_ProxyConfig_To_v1beta1_ProxyConfig(in, out, s)
}
func autoConvert_v1beta1_RegistrationConfig_To_v1alpha1_RegistrationConfig(in *RegistrationConfig, out *v1alpha1.RegistrationConfig, s conversion.Scope) error {
// WARNING: in.Type requires manual conversion: does not exist in peer-type
// WARNING: in.KubeClient requires manual conversion: does not exist in peer-type

View File

@@ -7,6 +7,7 @@
package v1beta1
import (
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@@ -29,6 +30,105 @@ func (in *AddOnConfig) DeepCopy() *AddOnConfig {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AddOnDeploymentConfig) DeepCopyInto(out *AddOnDeploymentConfig) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddOnDeploymentConfig.
func (in *AddOnDeploymentConfig) DeepCopy() *AddOnDeploymentConfig {
if in == nil {
return nil
}
out := new(AddOnDeploymentConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *AddOnDeploymentConfig) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AddOnDeploymentConfigList) DeepCopyInto(out *AddOnDeploymentConfigList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]AddOnDeploymentConfig, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddOnDeploymentConfigList.
func (in *AddOnDeploymentConfigList) DeepCopy() *AddOnDeploymentConfigList {
if in == nil {
return nil
}
out := new(AddOnDeploymentConfigList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *AddOnDeploymentConfigList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AddOnDeploymentConfigSpec) DeepCopyInto(out *AddOnDeploymentConfigSpec) {
*out = *in
if in.CustomizedVariables != nil {
in, out := &in.CustomizedVariables, &out.CustomizedVariables
*out = make([]CustomizedVariable, len(*in))
copy(*out, *in)
}
if in.NodePlacement != nil {
in, out := &in.NodePlacement, &out.NodePlacement
*out = new(NodePlacement)
(*in).DeepCopyInto(*out)
}
if in.Registries != nil {
in, out := &in.Registries, &out.Registries
*out = make([]ImageMirror, len(*in))
copy(*out, *in)
}
in.ProxyConfig.DeepCopyInto(&out.ProxyConfig)
if in.ResourceRequirements != nil {
in, out := &in.ResourceRequirements, &out.ResourceRequirements
*out = make([]ContainerResourceRequirements, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddOnDeploymentConfigSpec.
func (in *AddOnDeploymentConfigSpec) DeepCopy() *AddOnDeploymentConfigSpec {
if in == nil {
return nil
}
out := new(AddOnDeploymentConfigSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AddOnMeta) DeepCopyInto(out *AddOnMeta) {
*out = *in
@@ -273,6 +373,39 @@ func (in *ConfigSpecHash) DeepCopy() *ConfigSpecHash {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ContainerResourceRequirements) DeepCopyInto(out *ContainerResourceRequirements) {
*out = *in
in.Resources.DeepCopyInto(&out.Resources)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerResourceRequirements.
func (in *ContainerResourceRequirements) DeepCopy() *ContainerResourceRequirements {
if in == nil {
return nil
}
out := new(ContainerResourceRequirements)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CustomizedVariable) DeepCopyInto(out *CustomizedVariable) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomizedVariable.
func (in *CustomizedVariable) DeepCopy() *CustomizedVariable {
if in == nil {
return nil
}
out := new(CustomizedVariable)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DefaultConfigReference) DeepCopyInto(out *DefaultConfigReference) {
*out = *in
@@ -311,6 +444,22 @@ func (in *HealthCheck) DeepCopy() *HealthCheck {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImageMirror) DeepCopyInto(out *ImageMirror) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImageMirror.
func (in *ImageMirror) DeepCopy() *ImageMirror {
if in == nil {
return nil
}
out := new(ImageMirror)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *InstallConfigReference) DeepCopyInto(out *InstallConfigReference) {
*out = *in
@@ -562,6 +711,36 @@ func (in *ManagedClusterAddOnStatus) DeepCopy() *ManagedClusterAddOnStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodePlacement) DeepCopyInto(out *NodePlacement) {
*out = *in
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
*out = make([]corev1.Toleration, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePlacement.
func (in *NodePlacement) DeepCopy() *NodePlacement {
if in == nil {
return nil
}
out := new(NodePlacement)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ObjectReference) DeepCopyInto(out *ObjectReference) {
*out = *in
@@ -617,6 +796,27 @@ func (in *PlacementStrategy) DeepCopy() *PlacementStrategy {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProxyConfig) DeepCopyInto(out *ProxyConfig) {
*out = *in
if in.CABundle != nil {
in, out := &in.CABundle, &out.CABundle
*out = make([]byte, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProxyConfig.
func (in *ProxyConfig) DeepCopy() *ProxyConfig {
if in == nil {
return nil
}
out := new(ProxyConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RegistrationConfig) DeepCopyInto(out *RegistrationConfig) {
*out = *in

View File

@@ -46,6 +46,8 @@ func init() {
// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&AddOnDeploymentConfig{},
&AddOnDeploymentConfigList{},
&ClusterManagementAddOn{},
&ClusterManagementAddOnList{},
&ManagedClusterAddOn{},

View File

@@ -13,6 +13,7 @@ import (
type AddonV1beta1Interface interface {
RESTClient() rest.Interface
AddOnDeploymentConfigsGetter
ClusterManagementAddOnsGetter
ManagedClusterAddOnsGetter
}
@@ -22,6 +23,10 @@ type AddonV1beta1Client struct {
restClient rest.Interface
}
func (c *AddonV1beta1Client) AddOnDeploymentConfigs(namespace string) AddOnDeploymentConfigInterface {
return newAddOnDeploymentConfigs(c, namespace)
}
func (c *AddonV1beta1Client) ClusterManagementAddOns() ClusterManagementAddOnInterface {
return newClusterManagementAddOns(c)
}

View File

@@ -0,0 +1,53 @@
// Copyright Contributors to the Open Cluster Management project
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
context "context"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
gentype "k8s.io/client-go/gentype"
addonv1beta1 "open-cluster-management.io/api/addon/v1beta1"
scheme "open-cluster-management.io/api/client/addon/clientset/versioned/scheme"
)
// AddOnDeploymentConfigsGetter has a method to return a AddOnDeploymentConfigInterface.
// A group's client should implement this interface.
type AddOnDeploymentConfigsGetter interface {
AddOnDeploymentConfigs(namespace string) AddOnDeploymentConfigInterface
}
// AddOnDeploymentConfigInterface has methods to work with AddOnDeploymentConfig resources.
type AddOnDeploymentConfigInterface interface {
Create(ctx context.Context, addOnDeploymentConfig *addonv1beta1.AddOnDeploymentConfig, opts v1.CreateOptions) (*addonv1beta1.AddOnDeploymentConfig, error)
Update(ctx context.Context, addOnDeploymentConfig *addonv1beta1.AddOnDeploymentConfig, opts v1.UpdateOptions) (*addonv1beta1.AddOnDeploymentConfig, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*addonv1beta1.AddOnDeploymentConfig, error)
List(ctx context.Context, opts v1.ListOptions) (*addonv1beta1.AddOnDeploymentConfigList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *addonv1beta1.AddOnDeploymentConfig, err error)
AddOnDeploymentConfigExpansion
}
// addOnDeploymentConfigs implements AddOnDeploymentConfigInterface
type addOnDeploymentConfigs struct {
*gentype.ClientWithList[*addonv1beta1.AddOnDeploymentConfig, *addonv1beta1.AddOnDeploymentConfigList]
}
// newAddOnDeploymentConfigs returns a AddOnDeploymentConfigs
func newAddOnDeploymentConfigs(c *AddonV1beta1Client, namespace string) *addOnDeploymentConfigs {
return &addOnDeploymentConfigs{
gentype.NewClientWithList[*addonv1beta1.AddOnDeploymentConfig, *addonv1beta1.AddOnDeploymentConfigList](
"addondeploymentconfigs",
c.RESTClient(),
scheme.ParameterCodec,
namespace,
func() *addonv1beta1.AddOnDeploymentConfig { return &addonv1beta1.AddOnDeploymentConfig{} },
func() *addonv1beta1.AddOnDeploymentConfigList { return &addonv1beta1.AddOnDeploymentConfigList{} },
),
}
}

View File

@@ -13,6 +13,10 @@ type FakeAddonV1beta1 struct {
*testing.Fake
}
func (c *FakeAddonV1beta1) AddOnDeploymentConfigs(namespace string) v1beta1.AddOnDeploymentConfigInterface {
return newFakeAddOnDeploymentConfigs(c, namespace)
}
func (c *FakeAddonV1beta1) ClusterManagementAddOns() v1beta1.ClusterManagementAddOnInterface {
return newFakeClusterManagementAddOns(c)
}

View File

@@ -0,0 +1,37 @@
// Copyright Contributors to the Open Cluster Management project
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
gentype "k8s.io/client-go/gentype"
v1beta1 "open-cluster-management.io/api/addon/v1beta1"
addonv1beta1 "open-cluster-management.io/api/client/addon/clientset/versioned/typed/addon/v1beta1"
)
// fakeAddOnDeploymentConfigs implements AddOnDeploymentConfigInterface
type fakeAddOnDeploymentConfigs struct {
*gentype.FakeClientWithList[*v1beta1.AddOnDeploymentConfig, *v1beta1.AddOnDeploymentConfigList]
Fake *FakeAddonV1beta1
}
func newFakeAddOnDeploymentConfigs(fake *FakeAddonV1beta1, namespace string) addonv1beta1.AddOnDeploymentConfigInterface {
return &fakeAddOnDeploymentConfigs{
gentype.NewFakeClientWithList[*v1beta1.AddOnDeploymentConfig, *v1beta1.AddOnDeploymentConfigList](
fake.Fake,
namespace,
v1beta1.SchemeGroupVersion.WithResource("addondeploymentconfigs"),
v1beta1.SchemeGroupVersion.WithKind("AddOnDeploymentConfig"),
func() *v1beta1.AddOnDeploymentConfig { return &v1beta1.AddOnDeploymentConfig{} },
func() *v1beta1.AddOnDeploymentConfigList { return &v1beta1.AddOnDeploymentConfigList{} },
func(dst, src *v1beta1.AddOnDeploymentConfigList) { dst.ListMeta = src.ListMeta },
func(list *v1beta1.AddOnDeploymentConfigList) []*v1beta1.AddOnDeploymentConfig {
return gentype.ToPointerSlice(list.Items)
},
func(list *v1beta1.AddOnDeploymentConfigList, items []*v1beta1.AddOnDeploymentConfig) {
list.Items = gentype.FromPointerSlice(items)
},
),
fake,
}
}

View File

@@ -3,6 +3,8 @@
package v1beta1
type AddOnDeploymentConfigExpansion interface{}
type ClusterManagementAddOnExpansion interface{}
type ManagedClusterAddOnExpansion interface{}

View File

@@ -0,0 +1,87 @@
// Copyright Contributors to the Open Cluster Management project
// Code generated by informer-gen. DO NOT EDIT.
package v1beta1
import (
context "context"
time "time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
apiaddonv1beta1 "open-cluster-management.io/api/addon/v1beta1"
versioned "open-cluster-management.io/api/client/addon/clientset/versioned"
internalinterfaces "open-cluster-management.io/api/client/addon/informers/externalversions/internalinterfaces"
addonv1beta1 "open-cluster-management.io/api/client/addon/listers/addon/v1beta1"
)
// AddOnDeploymentConfigInformer provides access to a shared informer and lister for
// AddOnDeploymentConfigs.
type AddOnDeploymentConfigInformer interface {
Informer() cache.SharedIndexInformer
Lister() addonv1beta1.AddOnDeploymentConfigLister
}
type addOnDeploymentConfigInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewAddOnDeploymentConfigInformer constructs a new informer for AddOnDeploymentConfig type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewAddOnDeploymentConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredAddOnDeploymentConfigInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredAddOnDeploymentConfigInformer constructs a new informer for AddOnDeploymentConfig type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredAddOnDeploymentConfigInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.AddonV1beta1().AddOnDeploymentConfigs(namespace).List(context.Background(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.AddonV1beta1().AddOnDeploymentConfigs(namespace).Watch(context.Background(), options)
},
ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.AddonV1beta1().AddOnDeploymentConfigs(namespace).List(ctx, options)
},
WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.AddonV1beta1().AddOnDeploymentConfigs(namespace).Watch(ctx, options)
},
},
&apiaddonv1beta1.AddOnDeploymentConfig{},
resyncPeriod,
indexers,
)
}
func (f *addOnDeploymentConfigInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredAddOnDeploymentConfigInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *addOnDeploymentConfigInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&apiaddonv1beta1.AddOnDeploymentConfig{}, f.defaultInformer)
}
func (f *addOnDeploymentConfigInformer) Lister() addonv1beta1.AddOnDeploymentConfigLister {
return addonv1beta1.NewAddOnDeploymentConfigLister(f.Informer().GetIndexer())
}

View File

@@ -9,6 +9,8 @@ import (
// Interface provides access to all the informers in this group version.
type Interface interface {
// AddOnDeploymentConfigs returns a AddOnDeploymentConfigInformer.
AddOnDeploymentConfigs() AddOnDeploymentConfigInformer
// ClusterManagementAddOns returns a ClusterManagementAddOnInformer.
ClusterManagementAddOns() ClusterManagementAddOnInformer
// ManagedClusterAddOns returns a ManagedClusterAddOnInformer.
@@ -26,6 +28,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// AddOnDeploymentConfigs returns a AddOnDeploymentConfigInformer.
func (v *version) AddOnDeploymentConfigs() AddOnDeploymentConfigInformer {
return &addOnDeploymentConfigInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// ClusterManagementAddOns returns a ClusterManagementAddOnInformer.
func (v *version) ClusterManagementAddOns() ClusterManagementAddOnInformer {
return &clusterManagementAddOnInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}

View File

@@ -49,6 +49,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Addon().V1alpha1().ManagedClusterAddOns().Informer()}, nil
// Group=addon.open-cluster-management.io, Version=v1beta1
case v1beta1.SchemeGroupVersion.WithResource("addondeploymentconfigs"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Addon().V1beta1().AddOnDeploymentConfigs().Informer()}, nil
case v1beta1.SchemeGroupVersion.WithResource("clustermanagementaddons"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Addon().V1beta1().ClusterManagementAddOns().Informer()}, nil
case v1beta1.SchemeGroupVersion.WithResource("managedclusteraddons"):

View File

@@ -0,0 +1,55 @@
// Copyright Contributors to the Open Cluster Management project
// Code generated by lister-gen. DO NOT EDIT.
package v1beta1
import (
labels "k8s.io/apimachinery/pkg/labels"
listers "k8s.io/client-go/listers"
cache "k8s.io/client-go/tools/cache"
addonv1beta1 "open-cluster-management.io/api/addon/v1beta1"
)
// AddOnDeploymentConfigLister helps list AddOnDeploymentConfigs.
// All objects returned here must be treated as read-only.
type AddOnDeploymentConfigLister interface {
// List lists all AddOnDeploymentConfigs in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*addonv1beta1.AddOnDeploymentConfig, err error)
// AddOnDeploymentConfigs returns an object that can list and get AddOnDeploymentConfigs.
AddOnDeploymentConfigs(namespace string) AddOnDeploymentConfigNamespaceLister
AddOnDeploymentConfigListerExpansion
}
// addOnDeploymentConfigLister implements the AddOnDeploymentConfigLister interface.
type addOnDeploymentConfigLister struct {
listers.ResourceIndexer[*addonv1beta1.AddOnDeploymentConfig]
}
// NewAddOnDeploymentConfigLister returns a new AddOnDeploymentConfigLister.
func NewAddOnDeploymentConfigLister(indexer cache.Indexer) AddOnDeploymentConfigLister {
return &addOnDeploymentConfigLister{listers.New[*addonv1beta1.AddOnDeploymentConfig](indexer, addonv1beta1.Resource("addondeploymentconfig"))}
}
// AddOnDeploymentConfigs returns an object that can list and get AddOnDeploymentConfigs.
func (s *addOnDeploymentConfigLister) AddOnDeploymentConfigs(namespace string) AddOnDeploymentConfigNamespaceLister {
return addOnDeploymentConfigNamespaceLister{listers.NewNamespaced[*addonv1beta1.AddOnDeploymentConfig](s.ResourceIndexer, namespace)}
}
// AddOnDeploymentConfigNamespaceLister helps list and get AddOnDeploymentConfigs.
// All objects returned here must be treated as read-only.
type AddOnDeploymentConfigNamespaceLister interface {
// List lists all AddOnDeploymentConfigs in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*addonv1beta1.AddOnDeploymentConfig, err error)
// Get retrieves the AddOnDeploymentConfig from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*addonv1beta1.AddOnDeploymentConfig, error)
AddOnDeploymentConfigNamespaceListerExpansion
}
// addOnDeploymentConfigNamespaceLister implements the AddOnDeploymentConfigNamespaceLister
// interface.
type addOnDeploymentConfigNamespaceLister struct {
listers.ResourceIndexer[*addonv1beta1.AddOnDeploymentConfig]
}

View File

@@ -3,6 +3,14 @@
package v1beta1
// AddOnDeploymentConfigListerExpansion allows custom methods to be added to
// AddOnDeploymentConfigLister.
type AddOnDeploymentConfigListerExpansion interface{}
// AddOnDeploymentConfigNamespaceListerExpansion allows custom methods to be added to
// AddOnDeploymentConfigNamespaceLister.
type AddOnDeploymentConfigNamespaceListerExpansion interface{}
// ClusterManagementAddOnListerExpansion allows custom methods to be added to
// ClusterManagementAddOnLister.
type ClusterManagementAddOnListerExpansion interface{}

View File

@@ -262,6 +262,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
managedNamespaces:
description: |-
managedNamespaces are a list of namespaces managed by the clustersets the
@@ -330,6 +333,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
name:
description: name is the name of the namespace.
maxLength: 63

View File

@@ -145,6 +145,8 @@ const (
// ManagedClusterStatus represents the current status of joined managed cluster.
type ManagedClusterStatus struct {
// conditions contains the different condition statuses for this managed cluster.
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions"`
// capacity represents the total resource capacity from all nodeStatuses
@@ -214,6 +216,8 @@ type ClusterSetManagedNamespaceConfig struct {
ClusterSet string `json:"clusterSet"`
// conditions are the status conditions of the managed namespace
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

View File

@@ -24,8 +24,6 @@ type AddOnPlacementScore struct {
// AddOnPlacementScoreStatus represents the current status of AddOnPlacementScore.
type AddOnPlacementScoreStatus struct {
// Conditions contain the different condition statuses for this AddOnPlacementScore.
// +patchMergeKey=type
// +patchStrategy=merge
// +listType=map
// +listMapKey=type
// +optional

View File

@@ -601,6 +601,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
decisionGroups:
description: List of decision groups determined by the placement and
DecisionStrategy.

View File

@@ -438,6 +438,8 @@ type PlacementStatus struct {
DecisionGroups []DecisionGroupStatus `json:"decisionGroups"`
// Conditions contains the different condition status for this Placement.
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions"`
}

View File

@@ -591,6 +591,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
generations:
description: Generations are used to determine when an item needs
to be reconciled or has changed in a way that needs a reaction.

View File

@@ -406,6 +406,18 @@ spec:
- feature
type: object
type: array
importerConfiguration:
description: ImporterConfiguration represents the configuration
of the cluster importer
properties:
renderers:
description: |-
renderers specifies which import renderers to use.
Valid values are: "render-auto", "render-from-config-secret"
items:
type: string
type: array
type: object
registrationDrivers:
description: |-
RegistrationDrivers represent the list of hub registration drivers that contain information used by hub to initialize the hub cluster
@@ -850,6 +862,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
generations:
description: Generations are used to determine when an item needs
to be reconciled or has changed in a way that needs a reaction.

View File

@@ -120,6 +120,17 @@ type RegistrationHubConfiguration struct {
// +listType=map
// +listMapKey=authType
RegistrationDrivers []RegistrationDriverHub `json:"registrationDrivers,omitempty"`
// ImporterConfiguration represents the configuration of the cluster importer
// +optional
ImporterConfiguration *ImporterConfiguration `json:"importerConfiguration,omitempty"`
}
type ImporterConfiguration struct {
// renderers specifies which import renderers to use.
// Valid values are: "render-auto", "render-from-config-secret"
// +optional
Renderers []string `json:"renderers,omitempty"`
}
const (
@@ -499,6 +510,8 @@ type ClusterManagerStatus struct {
// Progressing: Components in hub are in a transitioning state.
// Degraded: Components in hub do not match the desired configuration and only provide
// degraded service.
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions"`
// Generations are used to determine when an item needs to be reconciled or has changed in a way that needs a reaction.

View File

@@ -358,6 +358,8 @@ type KlusterletStatus struct {
// Progressing: Components in the managed cluster are in a transitioning state.
// Degraded: Components in the managed cluster do not match the desired configuration and only provide
// degraded service.
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions"`
// Generations are used to determine when an item needs to be reconciled or has changed in a way that needs a reaction.

View File

@@ -542,6 +542,27 @@ func (in *HubApiServerHostAlias) DeepCopy() *HubApiServerHostAlias {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ImporterConfiguration) DeepCopyInto(out *ImporterConfiguration) {
*out = *in
if in.Renderers != nil {
in, out := &in.Renderers, &out.Renderers
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImporterConfiguration.
func (in *ImporterConfiguration) DeepCopy() *ImporterConfiguration {
if in == nil {
return nil
}
out := new(ImporterConfiguration)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Klusterlet) DeepCopyInto(out *Klusterlet) {
*out = *in
@@ -899,6 +920,11 @@ func (in *RegistrationHubConfiguration) DeepCopyInto(out *RegistrationHubConfigu
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.ImporterConfiguration != nil {
in, out := &in.ImporterConfiguration, &out.ImporterConfiguration
*out = new(ImporterConfiguration)
(*in).DeepCopyInto(*out)
}
return
}

View File

@@ -453,6 +453,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
resourceStatus:
description: |-
ResourceStatus represents the status of each resource in manifestwork deployed on a
@@ -532,6 +535,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
resourceMeta:
description: ResourceMeta represents the group, version,
kind, name and namespace of a resoure.

View File

@@ -470,6 +470,8 @@ type ManifestWorkStatus struct {
// 3. Available represents workload in ManifestWork exists on the managed cluster.
// 4. Degraded represents the current state of workload does not match the desired
// state for a certain period.
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`
// ResourceStatus represents the status of each resource in manifestwork deployed on a
@@ -538,6 +540,8 @@ type ManifestCondition struct {
// Conditions represents the conditions of this resource on a managed cluster.
// +required
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions"`
}

View File

@@ -723,6 +723,9 @@ spec:
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
placementSummary:
description: PlacementRef Summary
items:

View File

@@ -79,6 +79,8 @@ type ManifestWorkReplicaSetStatus struct {
// Valid condition types are:
// 1. AppliedManifestWorks represents ManifestWorks have been distributed as per placement All, Partial, None, Problem
// 2. PlacementRefValid
// +listType=map
// +listMapKey=type
Conditions []metav1.Condition `json:"conditions,omitempty"`
// Summary totals of resulting ManifestWorks for all placements

View File

@@ -2,9 +2,10 @@ package v1alpha1
import (
"context"
"k8s.io/client-go/rest"
"net/http"
"k8s.io/client-go/rest"
addonapiv1alpha1 "open-cluster-management.io/api/addon/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
@@ -73,7 +74,7 @@ func (c *ManagedClusterAddOnClient) DeleteCollection(ctx context.Context, opts m
func (c *ManagedClusterAddOnClient) Get(ctx context.Context, name string, opts metav1.GetOptions) (*addonapiv1alpha1.ManagedClusterAddOn, error) {
logger := klog.FromContext(ctx)
logger.V(4).Info("getting ManagedClusterAddOn", "namespace", c.namespace, "name", name)
addon, exists, err := c.watcherStore.Get(c.namespace, name)
addon, exists, err := c.watcherStore.Get(ctx, c.namespace, name)
if err != nil {
return nil, errors.NewInternalError(err)
}
@@ -87,7 +88,7 @@ func (c *ManagedClusterAddOnClient) Get(ctx context.Context, name string, opts m
func (c *ManagedClusterAddOnClient) List(ctx context.Context, opts metav1.ListOptions) (*addonapiv1alpha1.ManagedClusterAddOnList, error) {
logger := klog.FromContext(ctx)
logger.V(4).Info("list ManagedClusterAddon")
addonList, err := c.watcherStore.List(c.namespace, opts)
addonList, err := c.watcherStore.List(ctx, c.namespace, opts)
if err != nil {
return nil, errors.NewInternalError(err)
}
@@ -103,7 +104,7 @@ func (c *ManagedClusterAddOnClient) List(ctx context.Context, opts metav1.ListOp
func (c *ManagedClusterAddOnClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
logger := klog.FromContext(ctx)
logger.V(4).Info("watch ManagedClusterAddOn")
watcher, err := c.watcherStore.GetWatcher(c.namespace, opts)
watcher, err := c.watcherStore.GetWatcher(ctx, c.namespace, opts)
if err != nil {
return nil, errors.NewInternalError(err)
}
@@ -115,7 +116,7 @@ func (c *ManagedClusterAddOnClient) Patch(
ctx context.Context, name string, pt kubetypes.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (*addonapiv1alpha1.ManagedClusterAddOn, error) {
logger := klog.FromContext(ctx)
logger.V(4).Info("patching ManagedClusterAddon", "namespace", c.namespace, "name", name)
last, exists, err := c.watcherStore.Get(c.namespace, name)
last, exists, err := c.watcherStore.Get(ctx, c.namespace, name)
if err != nil {
return nil, errors.NewInternalError(err)
}

View File

@@ -2,13 +2,14 @@ package v1beta1
import (
"context"
"net/http"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kubetypes "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
"net/http"
addonapiv1beta1 "open-cluster-management.io/api/addon/v1beta1"
addonv1beta1client "open-cluster-management.io/api/client/addon/clientset/versioned/typed/addon/v1beta1"
@@ -71,7 +72,7 @@ func (c *ManagedClusterAddOnClient) DeleteCollection(_ context.Context, _ metav1
func (c *ManagedClusterAddOnClient) Get(ctx context.Context, name string, _ metav1.GetOptions) (*addonapiv1beta1.ManagedClusterAddOn, error) {
logger := klog.FromContext(ctx)
logger.V(4).Info("getting ManagedClusterAddOn", "namespace", c.namespace, "name", name)
addon, exists, err := c.watcherStore.Get(c.namespace, name)
addon, exists, err := c.watcherStore.Get(ctx, c.namespace, name)
if err != nil {
return nil, errors.NewInternalError(err)
}
@@ -85,7 +86,7 @@ func (c *ManagedClusterAddOnClient) Get(ctx context.Context, name string, _ meta
func (c *ManagedClusterAddOnClient) List(ctx context.Context, opts metav1.ListOptions) (*addonapiv1beta1.ManagedClusterAddOnList, error) {
logger := klog.FromContext(ctx)
logger.V(4).Info("list ManagedClusterAddon")
addonList, err := c.watcherStore.List(c.namespace, opts)
addonList, err := c.watcherStore.List(ctx, c.namespace, opts)
if err != nil {
return nil, errors.NewInternalError(err)
}
@@ -101,7 +102,7 @@ func (c *ManagedClusterAddOnClient) List(ctx context.Context, opts metav1.ListOp
func (c *ManagedClusterAddOnClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
logger := klog.FromContext(ctx)
logger.V(4).Info("watch ManagedClusterAddOn")
watcher, err := c.watcherStore.GetWatcher(c.namespace, opts)
watcher, err := c.watcherStore.GetWatcher(ctx, c.namespace, opts)
if err != nil {
return nil, errors.NewInternalError(err)
}
@@ -113,7 +114,7 @@ func (c *ManagedClusterAddOnClient) Patch(
ctx context.Context, name string, pt kubetypes.PatchType, data []byte, _ metav1.PatchOptions, subresources ...string) (*addonapiv1beta1.ManagedClusterAddOn, error) {
logger := klog.FromContext(ctx)
logger.V(4).Info("patching ManagedClusterAddon", "namespace", c.namespace, "name", name)
last, exists, err := c.watcherStore.Get(c.namespace, name)
last, exists, err := c.watcherStore.Get(ctx, c.namespace, name)
if err != nil {
return nil, errors.NewInternalError(err)
}
@@ -170,3 +171,7 @@ func (c *AddonClientWrapper) RESTClient() rest.Interface {
func (c *AddonClientWrapper) ManagedClusterAddOns(namespace string) addonv1beta1client.ManagedClusterAddOnInterface {
return c.client.Namespace(namespace)
}
func (c *AddonClientWrapper) AddOnDeploymentConfigs(namespace string) addonv1beta1client.AddOnDeploymentConfigInterface {
panic("AddOnDeploymentConfigs is unsupported")
}

View File

@@ -43,7 +43,7 @@ func NewManagedClusterClient(
func (c *ManagedClusterClient) Create(ctx context.Context, cluster *clusterv1.ManagedCluster, opts metav1.CreateOptions) (*clusterv1.ManagedCluster, error) {
klog.V(4).Infof("creating ManagedCluster %s", cluster.Name)
_, exists, err := c.watcherStore.Get("", cluster.Name)
_, exists, err := c.watcherStore.Get(ctx, "", cluster.Name)
if err != nil {
return nil, errors.NewInternalError(err)
}
@@ -85,7 +85,7 @@ func (c *ManagedClusterClient) DeleteCollection(ctx context.Context, opts metav1
func (c *ManagedClusterClient) Get(ctx context.Context, name string, opts metav1.GetOptions) (*clusterv1.ManagedCluster, error) {
klog.V(4).Infof("getting ManagedCluster %s", name)
cluster, exists, err := c.watcherStore.Get("", name)
cluster, exists, err := c.watcherStore.Get(ctx, "", name)
if err != nil {
return nil, errors.NewInternalError(err)
}
@@ -98,7 +98,7 @@ func (c *ManagedClusterClient) Get(ctx context.Context, name string, opts metav1
func (c *ManagedClusterClient) List(ctx context.Context, opts metav1.ListOptions) (*clusterv1.ManagedClusterList, error) {
klog.V(4).Info("list ManagedCluster")
clusterList, err := c.watcherStore.List("", opts)
clusterList, err := c.watcherStore.List(ctx, "", opts)
if err != nil {
return nil, errors.NewInternalError(err)
}
@@ -113,7 +113,7 @@ func (c *ManagedClusterClient) List(ctx context.Context, opts metav1.ListOptions
func (c *ManagedClusterClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
klog.V(4).Info("watch ManagedCluster")
watcher, err := c.watcherStore.GetWatcher("", opts)
watcher, err := c.watcherStore.GetWatcher(ctx, "", opts)
if err != nil {
return nil, errors.NewInternalError(err)
}
@@ -123,7 +123,7 @@ func (c *ManagedClusterClient) Watch(ctx context.Context, opts metav1.ListOption
func (c *ManagedClusterClient) Patch(ctx context.Context, name string, pt kubetypes.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *clusterv1.ManagedCluster, err error) {
klog.V(4).Infof("patching ManagedCluster %s", name)
lastCluster, exists, err := c.watcherStore.Get("", name)
lastCluster, exists, err := c.watcherStore.Get(ctx, "", name)
if err != nil {
return nil, errors.NewInternalError(err)
}

View File

@@ -28,6 +28,7 @@ type CSRClient struct {
}
var _ cache.ListerWatcher = &CSRClient{}
var _ cache.ListerWatcherWithContext = &CSRClient{}
func NewCSRClient(
cloudEventsClient generic.CloudEventsClient[*certificatev1.CertificateSigningRequest],
@@ -47,7 +48,7 @@ func (c *CSRClient) Create(ctx context.Context, csr *certificatev1.CertificateSi
csr.GenerateName = ""
}
klog.V(4).Infof("creating CSR %s", csr.Name)
_, exists, err := c.watcherStore.Get("", csr.Name)
_, exists, err := c.watcherStore.Get(ctx, "", csr.Name)
if err != nil {
return nil, errors.NewInternalError(err)
}
@@ -78,7 +79,7 @@ func (c *CSRClient) Create(ctx context.Context, csr *certificatev1.CertificateSi
func (c *CSRClient) Get(ctx context.Context, name string, opts metav1.GetOptions) (*certificatev1.CertificateSigningRequest, error) {
klog.V(4).Infof("getting csr %s", name)
csr, exists, err := c.watcherStore.Get("", name)
csr, exists, err := c.watcherStore.Get(ctx, "", name)
if err != nil {
return nil, errors.NewInternalError(err)
}
@@ -90,8 +91,19 @@ func (c *CSRClient) Get(ctx context.Context, name string, opts metav1.GetOptions
}
func (c *CSRClient) List(opts metav1.ListOptions) (runtime.Object, error) {
klog.V(4).Info("list csr")
csrList, err := c.watcherStore.List("", opts)
// the ListWithContext is called in informer actually
return c.ListWithContext(context.TODO(), opts)
}
func (c *CSRClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
// the WatchWithContext is called in informer actually
return c.WatchWithContext(context.TODO(), opts)
}
func (c *CSRClient) ListWithContext(ctx context.Context, opts metav1.ListOptions) (runtime.Object, error) {
logger := klog.FromContext(ctx)
logger.V(4).Info("list csr")
csrList, err := c.watcherStore.List(ctx, "", opts)
if err != nil {
return nil, errors.NewInternalError(err)
}
@@ -103,9 +115,10 @@ func (c *CSRClient) List(opts metav1.ListOptions) (runtime.Object, error) {
return &certificatev1.CertificateSigningRequestList{ListMeta: csrList.ListMeta, Items: items}, nil
}
func (c *CSRClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
klog.V(4).Info("watch csr")
watcher, err := c.watcherStore.GetWatcher("", opts)
func (c *CSRClient) WatchWithContext(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
logger := klog.FromContext(ctx)
logger.V(4).Info("watch csr")
watcher, err := c.watcherStore.GetWatcher(context.Background(), "", opts)
if err != nil {
return nil, errors.NewInternalError(err)
}

View File

@@ -53,7 +53,7 @@ func (l LeaseClient) DeleteCollection(ctx context.Context, opts metav1.DeleteOpt
func (l LeaseClient) Get(ctx context.Context, name string, opts metav1.GetOptions) (*coordinationv1.Lease, error) {
klog.V(4).Infof("getting lease %s", name)
lease, exists, err := l.watcherStore.Get(l.namespace, name)
lease, exists, err := l.watcherStore.Get(ctx, l.namespace, name)
if err != nil {
return nil, errors.NewInternalError(err)
}

View File

@@ -1,6 +1,7 @@
package store
import (
"context"
"fmt"
"sync"
@@ -20,7 +21,7 @@ type BaseClientWatchStore[T generic.ResourceObject] struct {
}
// List the resources from the store with the list options
func (s *BaseClientWatchStore[T]) List(namespace string, opts metav1.ListOptions) (*ResourceList[T], error) {
func (s *BaseClientWatchStore[T]) List(ctx context.Context, namespace string, opts metav1.ListOptions) (*ResourceList[T], error) {
s.RLock()
defer s.RUnlock()
@@ -33,7 +34,7 @@ func (s *BaseClientWatchStore[T]) List(namespace string, opts metav1.ListOptions
}
// Get a resource from the store
func (s *BaseClientWatchStore[T]) Get(namespace, name string) (resource T, exists bool, err error) {
func (s *BaseClientWatchStore[T]) Get(ctx context.Context, namespace, name string) (resource T, exists bool, err error) {
s.RLock()
defer s.RUnlock()
@@ -60,7 +61,7 @@ func (s *BaseClientWatchStore[T]) Get(namespace, name string) (resource T, exist
}
// List all of resources from the store
func (s *BaseClientWatchStore[T]) ListAll() ([]T, error) {
func (s *BaseClientWatchStore[T]) ListAll(ctx context.Context) ([]T, error) {
s.RLock()
defer s.RUnlock()

View File

@@ -58,7 +58,7 @@ func (s *AgentInformerWatcherStore[T]) HandleReceivedResource(ctx context.Contex
return err
}
lastResource, exists, err := s.Get(metaObj.GetNamespace(), metaObj.GetName())
lastResource, exists, err := s.Get(ctx, metaObj.GetNamespace(), metaObj.GetName())
if err != nil {
return err
}
@@ -91,7 +91,7 @@ func (s *AgentInformerWatcherStore[T]) HandleReceivedResource(ctx context.Contex
return s.Update(runtimeObj)
}
func (s *AgentInformerWatcherStore[T]) GetWatcher(namespace string, opts metav1.ListOptions) (watch.Interface, error) {
func (s *AgentInformerWatcherStore[T]) GetWatcher(ctx context.Context, namespace string, opts metav1.ListOptions) (watch.Interface, error) {
return s.Watcher, nil
}

View File

@@ -30,7 +30,7 @@ type StoreInitiated func() bool
// ClientWatcherStore provides a watcher with a resource store.
type ClientWatcherStore[T generic.ResourceObject] interface {
// GetWatcher returns a watcher to receive resource changes.
GetWatcher(namespace string, opts metav1.ListOptions) (watch.Interface, error)
GetWatcher(ctx context.Context, namespace string, opts metav1.ListOptions) (watch.Interface, error)
// HandleReceivedResource handles the client received resource events.
HandleReceivedResource(ctx context.Context, resource T) error
@@ -48,13 +48,13 @@ type ClientWatcherStore[T generic.ResourceObject] interface {
Delete(resource runtime.Object) error
// List returns the resources from store for a given namespace with list options
List(namespace string, opts metav1.ListOptions) (*ResourceList[T], error)
List(ctx context.Context, namespace string, opts metav1.ListOptions) (*ResourceList[T], error)
// ListAll list all of the resources from store
ListAll() ([]T, error)
ListAll(ctx context.Context) ([]T, error)
// Get returns a resource from store with resource namespace and name
Get(namespace, name string) (T, bool, error)
Get(ctx context.Context, namespace, name string) (T, bool, error)
// HasInitiated marks the store has been initiated, A resync may be required after the store is initiated
// when building a resource client.

View File

@@ -1,6 +1,8 @@
package store
import (
"context"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"open-cluster-management.io/sdk-go/pkg/cloudevents/generic"
@@ -19,12 +21,12 @@ func NewAgentWatcherStoreLister[T generic.ResourceObject](store ClientWatcherSto
}
// List returns the resources from a ClientWatcherStore with list options
func (l *AgentWatcherStoreLister[T]) List(options types.ListOptions) ([]T, error) {
func (l *AgentWatcherStoreLister[T]) List(ctx context.Context, options types.ListOptions) ([]T, error) {
opts := metav1.ListOptions{}
// TODO we might want to specify source when list
list, err := l.store.List("", opts)
list, err := l.store.List(ctx, "", opts)
if err != nil {
return nil, err
}
@@ -44,8 +46,8 @@ func NewSourceWatcherStoreLister[T generic.ResourceObject](store ClientWatcherSt
}
// List returns the resources from a ClientWatcherStore with list options.
func (l *SourceWatcherStoreLister[T]) List(options types.ListOptions) ([]T, error) {
list, err := l.store.List(options.ClusterName, metav1.ListOptions{})
func (l *SourceWatcherStoreLister[T]) List(ctx context.Context, options types.ListOptions) ([]T, error) {
list, err := l.store.List(ctx, options.ClusterName, metav1.ListOptions{})
if err != nil {
return nil, err
}

View File

@@ -28,7 +28,7 @@ func NewSimpleStore[T generic.ResourceObject]() *SimpleStore[T] {
}
}
func (s *SimpleStore[T]) GetWatcher(namespace string, opts metav1.ListOptions) (watch.Interface, error) {
func (s *SimpleStore[T]) GetWatcher(ctx context.Context, namespace string, opts metav1.ListOptions) (watch.Interface, error) {
panic("watcher is unsupported")
}
@@ -59,7 +59,7 @@ func (s *SimpleStore[T]) HandleReceivedResource(ctx context.Context, resource T)
return err
}
_, exists, err := s.Get(metaObj.GetNamespace(), metaObj.GetName())
_, exists, err := s.Get(ctx, metaObj.GetNamespace(), metaObj.GetName())
if err != nil {
return err
}

View File

@@ -3,11 +3,12 @@ package client
import (
"context"
"fmt"
"k8s.io/apimachinery/pkg/api/meta"
"net/http"
"strconv"
"sync"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kubetypes "k8s.io/apimachinery/pkg/types"
@@ -79,7 +80,7 @@ func (c *ManifestWorkAgentClient) Get(ctx context.Context, name string, opts met
logger := klog.FromContext(ctx)
logger.V(4).Info("getting manifestwork", "manifestWorkNamespace", c.namespace, "manifestWorkName", name)
work, exists, err := c.watcherStore.Get(c.namespace, name)
work, exists, err := c.watcherStore.Get(ctx, c.namespace, name)
if err != nil {
returnErr := errors.NewInternalError(err)
metrics.IncreaseWorkProcessedCounter("get", string(returnErr.ErrStatus.Reason))
@@ -98,7 +99,7 @@ func (c *ManifestWorkAgentClient) Get(ctx context.Context, name string, opts met
func (c *ManifestWorkAgentClient) List(ctx context.Context, opts metav1.ListOptions) (*workv1.ManifestWorkList, error) {
logger := klog.FromContext(ctx)
logger.V(4).Info("list manifestworks from cluster", "cluster", c.namespace)
works, err := c.watcherStore.List(c.namespace, opts)
works, err := c.watcherStore.List(ctx, c.namespace, opts)
if err != nil {
returnErr := errors.NewInternalError(err)
metrics.IncreaseWorkProcessedCounter("list", string(returnErr.ErrStatus.Reason))
@@ -117,7 +118,7 @@ func (c *ManifestWorkAgentClient) List(ctx context.Context, opts metav1.ListOpti
func (c *ManifestWorkAgentClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
logger := klog.FromContext(ctx)
logger.V(4).Info("watch manifestworks from cluster", "cluster", c.namespace)
watcher, err := c.watcherStore.GetWatcher(c.namespace, opts)
watcher, err := c.watcherStore.GetWatcher(ctx, c.namespace, opts)
if err != nil {
returnErr := errors.NewInternalError(err)
metrics.IncreaseWorkProcessedCounter("watch", string(returnErr.ErrStatus.Reason))
@@ -151,7 +152,7 @@ func (c *ManifestWorkAgentClient) Patch(ctx context.Context, name string, pt kub
return nil, returnErr
}
lastWork, exists, err := c.watcherStore.Get(c.namespace, name)
lastWork, exists, err := c.watcherStore.Get(ctx, c.namespace, name)
if err != nil {
returnErr = errors.NewInternalError(err)
return nil, returnErr
@@ -227,7 +228,7 @@ func (c *ManifestWorkAgentClient) Patch(ctx context.Context, name string, pt kub
// with outdated work. Return a conflict error if the resource version is outdated.
// Due to the lack of read-modify-write guarantees in the store, race conditions may occur between
// this update operation and one from the agent informer after receiving the event from the source.
latestWork, exists, err := c.watcherStore.Get(c.namespace, name)
latestWork, exists, err := c.watcherStore.Get(ctx, c.namespace, name)
if err != nil {
returnErr = errors.NewInternalError(err)
return nil, returnErr

View File

@@ -4,9 +4,10 @@ import (
"context"
"fmt"
"net/http"
"open-cluster-management.io/sdk-go/pkg/logging"
"strconv"
"open-cluster-management.io/sdk-go/pkg/logging"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kubetypes "k8s.io/apimachinery/pkg/types"
@@ -75,7 +76,7 @@ func (c *ManifestWorkSourceClient) Create(ctx context.Context, manifestWork *wor
return nil, returnErr
}
_, exists, err := c.watcherStore.Get(c.namespace, manifestWork.Name)
_, exists, err := c.watcherStore.Get(ctx, c.namespace, manifestWork.Name)
if err != nil {
returnErr = errors.NewInternalError(err)
return nil, returnErr
@@ -141,7 +142,7 @@ func (c *ManifestWorkSourceClient) UpdateStatus(ctx context.Context, manifestWor
}
func (c *ManifestWorkSourceClient) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error {
work, exists, err := c.watcherStore.Get(c.namespace, name)
work, exists, err := c.watcherStore.Get(ctx, c.namespace, name)
if err != nil {
returnErr := errors.NewInternalError(err)
metrics.IncreaseWorkProcessedCounter("delete", string(returnErr.ErrStatus.Reason))
@@ -204,7 +205,7 @@ func (c *ManifestWorkSourceClient) DeleteCollection(ctx context.Context, opts me
func (c *ManifestWorkSourceClient) Get(ctx context.Context, name string, opts metav1.GetOptions) (*workv1.ManifestWork, error) {
logger := klog.FromContext(ctx)
logger.V(4).Info("getting manifestwork", "manifestWorkName", name)
work, exists, err := c.watcherStore.Get(c.namespace, name)
work, exists, err := c.watcherStore.Get(ctx, c.namespace, name)
if err != nil {
returnErr := errors.NewInternalError(err)
metrics.IncreaseWorkProcessedCounter("get", string(returnErr.ErrStatus.Reason))
@@ -223,7 +224,7 @@ func (c *ManifestWorkSourceClient) Get(ctx context.Context, name string, opts me
func (c *ManifestWorkSourceClient) List(ctx context.Context, opts metav1.ListOptions) (*workv1.ManifestWorkList, error) {
logger := klog.FromContext(ctx)
logger.V(4).Info("list manifestworks")
works, err := c.watcherStore.List(c.namespace, opts)
works, err := c.watcherStore.List(ctx, c.namespace, opts)
if err != nil {
returnErr := errors.NewInternalError(err)
metrics.IncreaseWorkProcessedCounter("list", string(returnErr.ErrStatus.Reason))
@@ -240,7 +241,7 @@ func (c *ManifestWorkSourceClient) List(ctx context.Context, opts metav1.ListOpt
}
func (c *ManifestWorkSourceClient) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {
watcher, err := c.watcherStore.GetWatcher(c.namespace, opts)
watcher, err := c.watcherStore.GetWatcher(ctx, c.namespace, opts)
if err != nil {
returnErr := errors.NewInternalError(err)
metrics.IncreaseWorkProcessedCounter("watch", string(returnErr.ErrStatus.Reason))
@@ -270,7 +271,7 @@ func (c *ManifestWorkSourceClient) Patch(ctx context.Context, name string, pt ku
return nil, returnErr
}
lastWork, exists, err := c.watcherStore.Get(c.namespace, name)
lastWork, exists, err := c.watcherStore.Get(ctx, c.namespace, name)
if err != nil {
returnErr = errors.NewInternalError(err)
return nil, returnErr

View File

@@ -148,7 +148,7 @@ func (b *workProcessor) handleWork(ctx context.Context, work *workv1.ManifestWor
func (b *workProcessor) getWork(ctx context.Context, uid kubetypes.UID) *workv1.ManifestWork {
logger := klog.FromContext(ctx)
works, err := b.store.ListAll()
works, err := b.store.ListAll(ctx)
if err != nil {
logger.Error(err, "failed to lists works")
return nil

View File

@@ -69,7 +69,7 @@ func (s *SourceInformerWatcherStore) HasInitiated() bool {
return s.Initiated && s.informer.HasSynced()
}
func (s *SourceInformerWatcherStore) GetWatcher(namespace string, opts metav1.ListOptions) (watch.Interface, error) {
func (s *SourceInformerWatcherStore) GetWatcher(ctx context.Context, namespace string, opts metav1.ListOptions) (watch.Interface, error) {
if namespace != metav1.NamespaceAll {
return nil, fmt.Errorf("unsupported to watch from the namespace %s", namespace)
}
@@ -168,7 +168,7 @@ func (s *AgentInformerWatcherStore) Delete(resource runtime.Object) error {
func (s *AgentInformerWatcherStore) HandleReceivedResource(ctx context.Context, work *workv1.ManifestWork) error {
// for compatibility, we get the work by its UID
// TODO get the work by its namespace/name
existingWorks, err := s.findWorksByUID(work.UID)
existingWorks, err := s.findWorksByUID(ctx, work.UID)
if err != nil {
return err
}
@@ -220,9 +220,9 @@ func (s *AgentInformerWatcherStore) HandleReceivedResource(ctx context.Context,
return s.Update(updatedWork)
}
func (s *AgentInformerWatcherStore) findWorksByUID(uid kubetypes.UID) ([]*workv1.ManifestWork, error) {
func (s *AgentInformerWatcherStore) findWorksByUID(ctx context.Context, uid kubetypes.UID) ([]*workv1.ManifestWork, error) {
existingWorks := []*workv1.ManifestWork{}
works, err := s.ListAll()
works, err := s.ListAll(ctx)
if err != nil {
return existingWorks, err
}

View File

@@ -152,7 +152,7 @@ func (s *SourceLocalWatcherStore) HasInitiated() bool {
return s.Initiated
}
func (s *SourceLocalWatcherStore) GetWatcher(namespace string, opts metav1.ListOptions) (watch.Interface, error) {
func (s *SourceLocalWatcherStore) GetWatcher(ctx context.Context, namespace string, opts metav1.ListOptions) (watch.Interface, error) {
// TODO may consider to support watch with namespace
if namespace != metav1.NamespaceAll {
return nil, fmt.Errorf("unsupported to watch from the namespace %s", namespace)

View File

@@ -15,7 +15,6 @@ import (
"open-cluster-management.io/sdk-go/pkg/cloudevents/generic/options"
"open-cluster-management.io/sdk-go/pkg/cloudevents/generic/payload"
"open-cluster-management.io/sdk-go/pkg/cloudevents/generic/types"
"open-cluster-management.io/sdk-go/pkg/cloudevents/generic/utils"
)
// CloudEventAgentClient is a client for an agent to resync/send/receive its resources with cloud events.
@@ -45,13 +44,7 @@ func NewCloudEventAgentClient[T generic.ResourceObject](
statusHashGetter generic.StatusHashGetter[T],
codec generic.Codec[T],
) (generic.CloudEventsClient[T], error) {
baseClient := &baseClient{
clientID: agentOptions.AgentID,
transport: agentOptions.CloudEventsTransport,
cloudEventsRateLimiter: utils.NewRateLimiter(agentOptions.EventRateLimit),
reconnectedChan: make(chan struct{}),
}
baseClient := newBaseClient(agentOptions.AgentID, agentOptions.CloudEventsTransport, agentOptions.EventRateLimit)
if err := baseClient.connect(ctx); err != nil {
return nil, err
}
@@ -69,14 +62,14 @@ func NewCloudEventAgentClient[T generic.ResourceObject](
// ReconnectedChan returns a chan which indicates the source/agent client is reconnected.
// The source/agent client callers should consider sending a resync request when receiving this signal.
func (c *CloudEventAgentClient[T]) ReconnectedChan() <-chan struct{} {
return c.reconnectedChan
return c.resyncChan
}
// Resync the resources spec by sending a spec resync request from the current to the given source.
func (c *CloudEventAgentClient[T]) Resync(ctx context.Context, source string) error {
// list the resource objects that are maintained by the current agent with the given source
options := types.ListOptions{Source: source, ClusterName: c.clusterName, CloudEventsDataType: c.codec.EventDataType()}
objs, err := c.lister.List(options)
objs, err := c.lister.List(ctx, options)
if err != nil {
return err
}
@@ -222,7 +215,7 @@ func (c *CloudEventAgentClient[T]) respondResyncStatusRequest(
logger := klog.FromContext(ctx).WithValues("eventDataType", eventDataType.String())
options := types.ListOptions{ClusterName: c.clusterName, Source: evt.Source(), CloudEventsDataType: eventDataType}
objs, err := c.lister.List(options)
objs, err := c.lister.List(ctx, options)
if err != nil {
return err
}

View File

@@ -3,10 +3,11 @@ package clients
import (
"context"
"fmt"
"open-cluster-management.io/sdk-go/pkg/logging"
"sync"
"sync/atomic"
"time"
"open-cluster-management.io/sdk-go/pkg/logging"
cloudevents "github.com/cloudevents/sdk-go/v2"
"k8s.io/apimachinery/pkg/util/runtime"
@@ -21,11 +22,15 @@ import (
)
const (
restartReceiverSignal = iota
// startReceiverSignal signals the receiver goroutine to start with a new context.
// This is sent after successful connection and subscription to start event processing.
startReceiverSignal = iota
// stopReceiverSignal signals the receiver goroutine to cancel its context and stop processing events.
// This is sent when the transport connection fails or encounters an error.
stopReceiverSignal
)
// the reconnect backoff will stop at [1,5) min interval. If we don't backoff for 10min, we reset the backoff.
// the reconnect backoff will stop at [5s, 1min) interval. If we don't backoff for 10min, we reset the backoff.
var DelayFn = wait.Backoff{
Duration: 5 * time.Second,
Cap: 1 * time.Minute,
@@ -46,18 +51,30 @@ type receiveFn func(ctx context.Context, evt cloudevents.Event)
//
// The client maintains connection state and automatically attempts to reconnect when
// errors are detected from the transport layer. Upon successful reconnection, it restarts
// the event receiver and notifies listeners via the reconnectedChan.
// the event receiver and notifies listeners via the resyncChan.
//
// Thread-safety: All public methods are safe for concurrent use. The clientReady flag
// and receiverChan are protected by an embedded RWMutex.
// Thread-safety: All public methods are safe for concurrent use. The connected and subscribed flags
// use atomic operations for thread-safe access.
type baseClient struct {
sync.RWMutex
clientID string // the client id is used to identify the client, either a source or an agent ID
transport options.CloudEventTransport
cloudEventsRateLimiter flowcontrol.RateLimiter
receiverChan chan int
reconnectedChan chan struct{}
clientReady bool
resyncChan chan struct{}
subscribeChan chan struct{}
connected atomic.Bool
subscribed atomic.Bool
}
func newBaseClient(clientID string, transport options.CloudEventTransport, limit utils.EventRateLimit) *baseClient {
return &baseClient{
clientID: clientID,
transport: transport,
cloudEventsRateLimiter: utils.NewRateLimiter(limit),
resyncChan: make(chan struct{}, 1),
subscribeChan: make(chan struct{}, 1),
receiverChan: make(chan int, 2), // Allow both stop and start signals to be buffered
}
}
func (c *baseClient) connect(ctx context.Context) error {
@@ -68,12 +85,17 @@ func (c *baseClient) connect(ctx context.Context) error {
if err != nil {
return err
}
c.setClientReady(true)
c.connected.Store(true)
// start a go routine to handle cloudevents client connection errors
// Start a goroutine to monitor transport health and handle reconnection.
// This goroutine runs a loop that:
// 1. Checks if disconnected and attempts to reconnect with exponential backoff
// 2. Listens for errors from the transport's error channel
// 3. On error: sends stopReceiverSignal, sets connected to false, closes the transport, and waits for backoff delay
// 4. On successful reconnection: sets connected to true and sends signal to subscribeChan to trigger subscription
go func() {
for {
if !c.isClientReady() {
if !c.connected.Load() {
logger.V(2).Info("reconnecting the cloudevents client")
err = c.transport.Connect(ctx)
@@ -85,16 +107,24 @@ func (c *baseClient) connect(ctx context.Context) error {
<-wait.RealTimer(DelayFn()).C()
continue
}
// the cloudevents network connection is back, mark the client ready and send the receiver restart signal
// the cloudevents network connection is back, set connected to true and notify the client to resubscribe
logger.V(2).Info("the cloudevents client is reconnected")
metrics.IncreaseClientReconnectedCounter(c.clientID)
c.setClientReady(true)
c.sendReceiverSignal(restartReceiverSignal)
c.connected.Store(true)
select {
case c.subscribeChan <- struct{}{}:
// Signal sent successfully
default:
// Subscribe channel is unavailable, that's okay - don't block
klog.FromContext(ctx).Info("subscribe signal not sent, subscribe channel is unavailable")
}
}
select {
case <-ctx.Done():
c.closeChannels()
// Don't need to close channels here. Closing channels here would race
// with current goroutines trying to send/receive on the same channels.
// The channels will be garbage collected once all goroutines exit.
return
case err, ok := <-c.transport.ErrorChan():
if !ok {
@@ -103,10 +133,16 @@ func (c *baseClient) connect(ctx context.Context) error {
}
runtime.HandleErrorWithContext(ctx, err, "the cloudevents client is disconnected")
// the cloudevents client network connection is closed, send the receiver stop signal, set the current client not ready
// and close the current client
c.sendReceiverSignal(stopReceiverSignal)
c.setClientReady(false)
// transport reported an error (connection failed), stop the receiver, set connected to false,
// close the transport, and wait for backoff delay before attempting reconnection
select {
case c.receiverChan <- stopReceiverSignal:
// Signal sent successfully
default:
// Receiver channel is unavailable, that's okay - don't block
klog.FromContext(ctx).V(2).Info("stopReceiverSignal not sent, receiver channel unavailable")
}
c.connected.Store(false)
if err := c.transport.Close(ctx); err != nil {
runtime.HandleErrorWithContext(ctx, err, "failed to close the cloudevents protocol")
}
@@ -136,7 +172,7 @@ func (c *baseClient) publish(ctx context.Context, evt cloudevents.Event) error {
)
}
if !c.isClientReady() {
if !c.connected.Load() {
return fmt.Errorf("the cloudevents client is not ready")
}
@@ -155,153 +191,132 @@ func (c *baseClient) publish(ctx context.Context, evt cloudevents.Event) error {
}
func (c *baseClient) subscribe(ctx context.Context, receive receiveFn) {
c.Lock()
defer c.Unlock()
logger := klog.FromContext(ctx)
// make sure there is only one subscription go routine starting for one client.
if c.receiverChan != nil {
// Swap returns the old value, so if it was already true, we've already subscribed
if c.subscribed.Swap(true) {
logger.V(2).Info("the subscription has already started")
return
}
// send subscription request before starting to receive events
if err := c.transport.Subscribe(ctx); err != nil {
runtime.HandleErrorWithContext(ctx, err, "failed to subscribe")
return
}
c.receiverChan = make(chan int)
// start a go routine to handle cloudevents subscription
// Start a goroutine to handle subscription.
// This goroutine listens for signals on subscribeChan (sent on initial subscribe,
// and after reconnection by the connection monitor goroutine), attempts to subscribe to the
// event stream, and if successful, sends startReceiverSignal to start the receiver and
// notifies any listeners via resyncChan that they should resync their resources.
go func() {
receiverCtx, receiverCancel := context.WithCancel(ctx)
startReceiving := true
subscribed := true
for {
if !subscribed {
// resubscribe before restarting the receiver
if err := c.transport.Subscribe(ctx); err != nil {
if ctx.Err() != nil {
receiverCancel()
return
}
runtime.HandleError(fmt.Errorf("failed to resubscribe, %v", err))
select {
case <-ctx.Done():
receiverCancel()
return
case <-wait.RealTimer(DelayFn()).C():
}
continue
}
subscribed = true
// notify the client caller to resync the resources
c.sendReconnectedSignal(ctx)
}
if startReceiving {
go func() {
if err := c.transport.Receive(receiverCtx, func(ctx context.Context, evt cloudevents.Event) {
receiveLogger := logging.SetLogTracingByCloudEvent(klog.FromContext(ctx), &evt)
ctx = klog.NewContext(ctx, receiveLogger)
if receiveLogger.V(5).Enabled() {
evtData, _ := evt.MarshalJSON()
receiveLogger.V(5).Info("Received event", "event", string(evtData))
} else {
receiveLogger.V(2).Info("Received event",
"eventType", evt.Type(), "extensions", evt.Extensions())
}
receive(ctx, evt)
}); err != nil {
runtime.HandleErrorWithContext(ctx, err, "failed to receive cloudevents")
}
}()
startReceiving = false
}
select {
case <-ctx.Done():
receiverCancel()
return
case signal, ok := <-c.getReceiverChan():
case <-c.subscribeChan:
if err := c.transport.Subscribe(ctx); err != nil {
// Failed to send subscribe request, it should be connection failed, will retry on next reconnection
runtime.HandleErrorWithContext(ctx, err, "failed to subscribe after connection")
continue
}
// Send startReceiverSignal to start/restart the receiver after successful subscription.
// The receiver lifecycle goroutine will create a new context and spawn a goroutine
// to call c.transport.Receive() if not already running.
select {
case c.receiverChan <- startReceiverSignal:
// Signal sent successfully
default:
// Receiver channel full or closed, that's okay - will retry on next reconnection
klog.FromContext(ctx).V(2).Info("startReceiverSignal not sent, receiver channel unavailable")
}
// Notify the client caller to resync the resources
select {
case c.resyncChan <- struct{}{}:
// Signal sent successfully
default:
// Resync channel is unavailable, that's okay - don't block
klog.FromContext(ctx).V(2).Info("resync signal not sent, resync channel unavailable")
}
}
}
}()
// Start a goroutine to manage the event receiver lifecycle.
// This goroutine responds to signals on receiverChan:
// - startReceiverSignal: Creates a new receiver context and spawns a c.transport.Receive() goroutine
// if not already running (tracked by startReceiving flag)
// - stopReceiverSignal: Cancels the receiver context to stop the running c.transport.Receive()
// goroutine and clears the startReceiving flag
go func() {
var startReceiving bool
var receiverCtx context.Context
var receiverCancel context.CancelFunc
for {
select {
case <-ctx.Done():
if receiverCancel != nil {
receiverCancel()
}
return
case signal, ok := <-c.receiverChan:
if !ok {
// receiver channel is closed, stop the receiver
receiverCancel()
if receiverCancel != nil {
receiverCancel()
}
return
}
switch signal {
case restartReceiverSignal:
logger.V(2).Info("restart the cloudevents receiver")
// rebuild the receiver context and restart receiving
receiverCtx, receiverCancel = context.WithCancel(ctx)
startReceiving = true
subscribed = false
case startReceiverSignal:
if !startReceiving {
logger.V(2).Info("start the cloudevents receiver")
// Cancel old context before creating a new one to prevent context leak
if receiverCancel != nil {
receiverCancel()
}
// create a new receiver context
receiverCtx, receiverCancel = context.WithCancel(ctx)
// Set flag before spawning goroutine to prevent race condition
startReceiving = true
go func() {
if err := c.transport.Receive(receiverCtx, func(handlerCtx context.Context, evt cloudevents.Event) {
receiveLogger := logging.SetLogTracingByCloudEvent(klog.FromContext(handlerCtx), &evt)
handlerCtx = klog.NewContext(handlerCtx, receiveLogger)
if receiveLogger.V(5).Enabled() {
evtData, _ := evt.MarshalJSON()
receiveLogger.V(5).Info("Received event", "event", string(evtData))
} else {
receiveLogger.V(2).Info("Received event",
"eventType", evt.Type(), "extensions", evt.Extensions())
}
receive(handlerCtx, evt)
}); err != nil {
runtime.HandleErrorWithContext(ctx, err, "failed to receive cloudevents")
}
}()
}
case stopReceiverSignal:
logger.V(2).Info("stop the cloudevents receiver")
receiverCancel()
if receiverCancel != nil {
receiverCancel()
receiverCancel = nil
receiverCtx = nil
}
startReceiving = false
default:
runtime.HandleErrorWithContext(ctx, fmt.Errorf("unknown receiver signal"), "", "signal", signal)
}
}
}
}()
}
func (c *baseClient) sendReceiverSignal(signal int) {
c.RLock()
defer c.RUnlock()
if c.receiverChan != nil {
c.receiverChan <- signal
// Send initial subscription signal to trigger the first subscription attempt
select {
case c.subscribeChan <- struct{}{}:
// Signal sent successfully
default:
// Channel full or closed - should not happen during normal initialization
logger.V(2).Info("initial subscribe signal not sent, channel unavailable")
}
}
func (c *baseClient) closeChannels() {
c.Lock()
defer c.Unlock()
if c.receiverChan != nil {
close(c.receiverChan)
c.receiverChan = nil
}
if c.reconnectedChan != nil {
close(c.reconnectedChan)
c.reconnectedChan = nil
}
}
func (c *baseClient) sendReconnectedSignal(ctx context.Context) {
c.RLock()
defer c.RUnlock()
if c.reconnectedChan != nil {
select {
case c.reconnectedChan <- struct{}{}:
// Signal sent successfully
default:
// No receiver listening on reconnectedChan, that's okay - don't block
klog.FromContext(ctx).Info("reconnected signal not sent, no receiver listening")
}
}
}
func (c *baseClient) isClientReady() bool {
c.RLock()
defer c.RUnlock()
return c.clientReady
}
func (c *baseClient) setClientReady(ready bool) {
c.Lock()
defer c.Unlock()
c.clientReady = ready
}
func (c *baseClient) getReceiverChan() chan int {
c.RLock()
defer c.RUnlock()
return c.receiverChan
}

View File

@@ -17,7 +17,6 @@ import (
"open-cluster-management.io/sdk-go/pkg/cloudevents/generic/options"
"open-cluster-management.io/sdk-go/pkg/cloudevents/generic/payload"
"open-cluster-management.io/sdk-go/pkg/cloudevents/generic/types"
"open-cluster-management.io/sdk-go/pkg/cloudevents/generic/utils"
)
// CloudEventSourceClient is a client for a source to resync/send/receive its resources with cloud events.
@@ -46,13 +45,7 @@ func NewCloudEventSourceClient[T generic.ResourceObject](
statusHashGetter generic.StatusHashGetter[T],
codec generic.Codec[T],
) (*CloudEventSourceClient[T], error) {
baseClient := &baseClient{
clientID: sourceOptions.SourceID,
transport: sourceOptions.CloudEventsTransport,
cloudEventsRateLimiter: utils.NewRateLimiter(sourceOptions.EventRateLimit),
reconnectedChan: make(chan struct{}),
}
baseClient := newBaseClient(sourceOptions.SourceID, sourceOptions.CloudEventsTransport, sourceOptions.EventRateLimit)
if err := baseClient.connect(ctx); err != nil {
return nil, err
}
@@ -67,14 +60,14 @@ func NewCloudEventSourceClient[T generic.ResourceObject](
}
func (c *CloudEventSourceClient[T]) ReconnectedChan() <-chan struct{} {
return c.reconnectedChan
return c.resyncChan
}
// Resync the resources status by sending a status resync request from the current source to a specified cluster.
func (c *CloudEventSourceClient[T]) Resync(ctx context.Context, clusterName string) error {
// list the resource objects that are maintained by the current source with a specified cluster
options := types.ListOptions{Source: c.sourceID, ClusterName: clusterName, CloudEventsDataType: c.codec.EventDataType()}
objs, err := c.lister.List(options)
objs, err := c.lister.List(ctx, options)
if err != nil {
return err
}
@@ -248,7 +241,7 @@ func (c *CloudEventSourceClient[T]) respondResyncSpecRequest(
Source: c.sourceID,
CloudEventsDataType: evtDataType,
}
objs, err := c.lister.List(options)
objs, err := c.lister.List(ctx, options)
if err != nil {
return err
}

View File

@@ -39,7 +39,7 @@ type ResourceObject interface {
type Lister[T ResourceObject] interface {
// List returns the list of resource objects that are maintained by source/agent.
List(options types.ListOptions) ([]T, error)
List(ctx context.Context, options types.ListOptions) ([]T, error)
}
type Codec[T ResourceObject] interface {

View File

@@ -22,6 +22,10 @@ type PubSubOptions struct {
Subscriptions types.Subscriptions
KeepaliveSettings *KeepaliveSettings
ReceiveSettings *ReceiveSettings
// DisableTLS indicates whether to use an insecure connection (without TLS).
// Set to true for test environments (e.g., pubsub emulator or test server).
// Defaults to false (secure/TLS enabled) for production environments.
DisableTLS bool
}
// PubSubConfig holds the information needed to connect to Google Cloud Pub/Sub.
@@ -52,6 +56,11 @@ type PubSubConfig struct {
// (Optional) ReceiveSettings configures the pubsub subscriber's receive settings.
ReceiveSettings *ReceiveSettings `json:"receiveSettings,omitempty" yaml:"receiveSettings,omitempty"`
// (Optional) DisableTLS indicates whether to use an insecure connection (without TLS).
// Set to true for test environments like pubsub emulator or test server that don't support TLS.
// Defaults to false (secure/TLS enabled) for production environments.
DisableTLS bool `json:"disableTLS,omitempty" yaml:"disableTLS,omitempty"`
}
// KeepaliveSettings defines gRPC keepalive options for the Pub/Sub client.
@@ -115,6 +124,11 @@ func BuildPubSubOptionsFromFlags(configPath string) (*PubSubOptions, error) {
return nil, err
}
// validate insecure connection requires endpoint
if config.DisableTLS && config.Endpoint == "" {
return nil, fmt.Errorf("endpoint must be specified when tls is disabled")
}
// validate topics and subscriptions
if err := validateTopicsAndSubscriptions(config.Topics, config.Subscriptions, config.ProjectID); err != nil {
return nil, err
@@ -126,6 +140,7 @@ func BuildPubSubOptionsFromFlags(configPath string) (*PubSubOptions, error) {
CredentialsFile: config.CredentialsFile,
Topics: *config.Topics,
Subscriptions: *config.Subscriptions,
DisableTLS: config.DisableTLS,
// enable keepalive by default
KeepaliveSettings: &KeepaliveSettings{
Time: 5 * time.Minute,

View File

@@ -3,7 +3,6 @@ package pubsub
import (
"context"
"fmt"
"strings"
"cloud.google.com/go/pubsub/v2"
cloudevents "github.com/cloudevents/sdk-go/v2"
@@ -47,15 +46,16 @@ func (o *pubsubTransport) Connect(ctx context.Context) error {
}
if o.Endpoint != "" {
clientOptions = append(clientOptions, option.WithEndpoint(o.Endpoint))
if strings.Contains(o.Endpoint, "localhost") || strings.Contains(o.Endpoint, "127.0.0.1") {
// use the insecure connection for local development/testing
pubsubConn, err := grpc.NewClient(o.Endpoint, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return err
}
o.grpcConn = pubsubConn
clientOptions = append(clientOptions, option.WithGRPCConn(pubsubConn))
}
// Use insecure connection for test environments (e.g., pubsub emulator or test server)
if o.DisableTLS {
pubsubConn, err := grpc.NewClient(o.Endpoint, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
return err
}
o.grpcConn = pubsubConn
clientOptions = append(clientOptions, option.WithGRPCConn(pubsubConn))
}
if o.KeepaliveSettings != nil {

View File

@@ -7,31 +7,32 @@ import (
"open-cluster-management.io/sdk-go/pkg/cloudevents/generic/types"
)
func NewPubSubSourceOptions(endpoint, projectID, sourceID string) *pubsub.PubSubOptions {
func NewPubSubSourceOptions(endpoint, projectID, sourceID string, disableTLS bool) *pubsub.PubSubOptions {
return newPubSubOptions(endpoint, projectID, types.Topics{
SourceEvents: fmt.Sprintf("projects/%s/topics/sourceevents", projectID),
SourceBroadcast: fmt.Sprintf("projects/%s/topics/sourcebroadcast", projectID),
}, types.Subscriptions{
AgentEvents: fmt.Sprintf("projects/%s/subscriptions/agentevents-%s", projectID, sourceID),
AgentBroadcast: fmt.Sprintf("projects/%s/subscriptions/agentbroadcast-%s", projectID, sourceID),
})
}, disableTLS)
}
func NewPubSubAgentOptions(endpoint, projectID, clusterName string) *pubsub.PubSubOptions {
func NewPubSubAgentOptions(endpoint, projectID, clusterName string, disableTLS bool) *pubsub.PubSubOptions {
return newPubSubOptions(endpoint, projectID, types.Topics{
AgentEvents: fmt.Sprintf("projects/%s/topics/agentevents", projectID),
AgentBroadcast: fmt.Sprintf("projects/%s/topics/agentbroadcast", projectID),
}, types.Subscriptions{
SourceEvents: fmt.Sprintf("projects/%s/subscriptions/sourceevents-%s", projectID, clusterName),
SourceBroadcast: fmt.Sprintf("projects/%s/subscriptions/sourcebroadcast-%s", projectID, clusterName),
})
}, disableTLS)
}
func newPubSubOptions(endpoint, projectID string, topics types.Topics, subscriptions types.Subscriptions) *pubsub.PubSubOptions {
func newPubSubOptions(endpoint, projectID string, topics types.Topics, subscriptions types.Subscriptions, disableTLS bool) *pubsub.PubSubOptions {
return &pubsub.PubSubOptions{
Endpoint: endpoint,
ProjectID: projectID,
Topics: topics,
Subscriptions: subscriptions,
DisableTLS: disableTLS,
}
}