Merge pull request #104 from skeeey/enable-addon-manager

enable addon manager
This commit is contained in:
OpenShift Merge Robot
2021-04-07 05:47:37 -04:00
committed by GitHub
33 changed files with 2255 additions and 15 deletions

View File

@@ -5,6 +5,7 @@ set -o nounset
set -o pipefail
HUB_CRD_FILES="./vendor/github.com/open-cluster-management/api/cluster/v1/*.crd.yaml
./vendor/github.com/open-cluster-management/api/addon/v1alpha1/*.crd.yaml
./vendor/github.com/open-cluster-management/api/cluster/v1alpha1/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml
./vendor/github.com/open-cluster-management/api/cluster/v1alpha1/0000_01_clusters.open-cluster-management.io_managedclustersetbindings.crd.yaml
./vendor/github.com/open-cluster-management/api/work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml

View File

@@ -0,0 +1,96 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
name: clustermanagementaddons.addon.open-cluster-management.io
spec:
additionalPrinterColumns:
- JSONPath: .spec.addOnMeta.displayName
name: DISPLAY NAME
type: string
- JSONPath: .spec.addOnConfiguration.crdName
name: CRD NAME
type: string
group: addon.open-cluster-management.io
names:
kind: ClusterManagementAddOn
listKind: ClusterManagementAddOnList
plural: clustermanagementaddons
singular: clustermanagementaddon
preserveUnknownFields: false
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
description: ClusterManagementAddOn represents the registration of an add-on
to the cluster manager. This resource allows the user to discover which add-on
is available for the cluster manager and also provides metadata information
about the add-on. This resource also provides a linkage to ManagedClusterAddOn,
the name of the ClusterManagementAddOn resource will be used for the namespace-scoped
ManagedClusterAddOn resource. ClusterManagementAddOn is a cluster-scoped resource.
type: object
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 the agent on the
cluster management add-on.
type: object
properties:
addOnConfiguration:
description: addOnConfiguration is a reference to configuration information
for the add-on. In scenario where a multiple add-ons share the same
add-on CRD, multiple ClusterManagementAddOn resources need to be created
and reference the same AddOnConfiguration.
type: object
properties:
crName:
description: crName is the name of the CR used to configure instances
of the managed add-on. This field should be configured if add-on
CR have a consistent name across the all of the ManagedCluster
instaces.
type: string
crdName:
description: crdName is the name of the CRD used to configure instances
of the managed add-on. This field should be configured if the
add-on have a CRD that controls the configuration of the add-on.
type: string
addOnMeta:
description: addOnMeta is a reference to the metadata information for
the add-on.
type: object
properties:
description:
description: description represents the detailed description of
the add-on.
type: string
displayName:
description: displayName represents the name of add-on that will
be displayed.
type: string
status:
description: status represents the current status of cluster management
add-on.
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -0,0 +1,192 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
name: managedclusteraddons.addon.open-cluster-management.io
spec:
additionalPrinterColumns:
- JSONPath: .status.conditions[?(@.type=="Available")].status
name: Available
type: string
- JSONPath: .status.conditions[?(@.type=="Degraded")].status
name: Degraded
type: string
- JSONPath: .status.conditions[?(@.type=="Progressing")].status
name: Progressing
type: string
group: addon.open-cluster-management.io
names:
kind: ManagedClusterAddOn
listKind: ManagedClusterAddOnList
plural: managedclusteraddons
singular: managedclusteraddon
preserveUnknownFields: false
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: ManagedClusterAddOn is the Custom Resource object which holds the
current state of an add-on. This object is used by add-on operators to convey
their state. This resource should be created in the ManagedCluster namespace.
type: object
required:
- spec
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 holds configuration that could apply to any operator.
type: object
status:
description: status holds the information about the state of an operator. It
is consistent with status information across the Kubernetes ecosystem.
type: object
properties:
addOnConfiguration:
description: addOnConfiguration is a reference to configuration information
for the add-on. This resource is use to locate the configuration resource
for the add-on.
type: object
properties:
crName:
description: crName is the name of the CR used to configure instances
of the managed add-on. This field should be configured if add-on
CR have a consistent name across the all of the ManagedCluster
instaces.
type: string
crdName:
description: crdName is the name of the CRD used to configure instances
of the managed add-on. This field should be configured if the
add-on have a CRD that controls the configuration of the add-on.
type: string
addOnMeta:
description: addOnMeta is a reference to the metadata information for
the add-on. This should be same as the addOnMeta for the corresponding
ClusterManagementAddOn resource.
type: object
properties:
description:
description: description represents the detailed description of
the add-on.
type: string
displayName:
description: displayName represents the name of add-on that will
be displayed.
type: string
conditions:
description: conditions describe the state of the managed and monitored
components for the operator.
type: array
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a foo's
current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type //
+patchStrategy=merge // +listType=map // +listMapKey=type
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
\n // other fields }"
type: object
required:
- lastTransitionTime
- message
- reason
- status
- type
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
type: string
format: date-time
message:
description: message is a human readable message indicating details
about the transition. This may be an empty string.
type: string
maxLength: 32768
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
type: integer
format: int64
minimum: 0
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers of
specific condition types may define expected values and meanings
for this field, and whether the values are considered a guaranteed
API. The value should be a CamelCase string. This field may
not be empty.
type: string
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
status:
description: status of the condition, one of True, False, Unknown.
type: string
enum:
- "True"
- "False"
- Unknown
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
relatedObjects:
description: 'relatedObjects is a list of objects that are "interesting"
or related to this operator. Common uses are: 1. the detailed resource
driving the operator 2. operator namespaces 3. operand namespaces
4. related ClusterManagementAddon resource'
type: array
items:
description: ObjectReference contains enough information to let you
inspect or modify the referred object.
type: object
required:
- group
- name
- resource
properties:
group:
description: group of the referent.
type: string
name:
description: name of the referent.
type: string
resource:
description: resource of the referent.
type: string
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -61,3 +61,10 @@ rules:
- apiGroups: ["authorization.k8s.io"]
resources: ["subjectaccessreviews"]
verbs: ["create"]
# Allow hub to manage managed cluster addons
- apiGroups: ["addon.open-cluster-management.io"]
resources: ["managedclusteraddons"]
verbs: ["get", "list", "watch"]
- apiGroups: ["addon.open-cluster-management.io"]
resources: ["managedclusteraddons/status"]
verbs: ["patch", "update"]

View File

@@ -4,10 +4,14 @@ kind: ClusterRole
metadata:
name: open-cluster-management:{{ .KlusterletName }}-registration:agent
rules:
# Allow agent to get/list/watch nodes.
# Allow agent to get/list/watch nodes and configmaps.
- apiGroups: [""]
resources: ["nodes", "configmaps", "secrets"]
resources: ["nodes", "configmaps"]
verbs: ["get", "list", "watch"]
# Allow agent to get/list/watch/create/delete/update/patch secrets.
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
- apiGroups: ["authorization.k8s.io"]
resources: ["subjectaccessreviews"]
verbs: ["create"]
@@ -15,4 +19,7 @@ rules:
- apiGroups: ["cluster.open-cluster-management.io"]
resources: ["clusterclaims"]
verbs: ["get", "list", "watch"]
# Allow agent to list addons lease
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "list", "watch"]

View File

@@ -45,6 +45,7 @@ spec:
- "agent"
- "--cluster-name={{ .ClusterName }}"
- "--bootstrap-kubeconfig=/spoke/bootstrap/kubeconfig"
- "--feature-gates=AddonManagement=true"
{{if .ExternalServerURL}}
- "--spoke-external-server-urls={{ .ExternalServerURL }}"
{{end}}

View File

@@ -6,6 +6,7 @@ package dependencymagnet
import (
_ "github.com/go-bindata/go-bindata/go-bindata"
_ "github.com/open-cluster-management/api/addon/v1alpha1"
_ "github.com/open-cluster-management/api/cluster/v1"
_ "github.com/open-cluster-management/api/cluster/v1alpha1"
_ "github.com/open-cluster-management/api/work/v1"

View File

@@ -1,8 +1,10 @@
// Code generated for package bindata by go-bindata DO NOT EDIT. (@generated)
// sources:
// manifests/cluster-manager/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml
// manifests/cluster-manager/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml
// manifests/cluster-manager/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml
// manifests/cluster-manager/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml
// manifests/cluster-manager/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml
// manifests/cluster-manager/0000_01_clusters.open-cluster-management.io_managedclustersetbindings.crd.yaml
// manifests/cluster-manager/cluster-manager-namespace.yaml
// manifests/cluster-manager/cluster-manager-registration-clusterrole.yaml
@@ -78,6 +80,119 @@ func (fi bindataFileInfo) Sys() interface{} {
return nil
}
var _manifestsClusterManager0000_00_addonOpenClusterManagementIo_clustermanagementaddonsCrdYaml = []byte(`apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
name: clustermanagementaddons.addon.open-cluster-management.io
spec:
additionalPrinterColumns:
- JSONPath: .spec.addOnMeta.displayName
name: DISPLAY NAME
type: string
- JSONPath: .spec.addOnConfiguration.crdName
name: CRD NAME
type: string
group: addon.open-cluster-management.io
names:
kind: ClusterManagementAddOn
listKind: ClusterManagementAddOnList
plural: clustermanagementaddons
singular: clustermanagementaddon
preserveUnknownFields: false
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
description: ClusterManagementAddOn represents the registration of an add-on
to the cluster manager. This resource allows the user to discover which add-on
is available for the cluster manager and also provides metadata information
about the add-on. This resource also provides a linkage to ManagedClusterAddOn,
the name of the ClusterManagementAddOn resource will be used for the namespace-scoped
ManagedClusterAddOn resource. ClusterManagementAddOn is a cluster-scoped resource.
type: object
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 the agent on the
cluster management add-on.
type: object
properties:
addOnConfiguration:
description: addOnConfiguration is a reference to configuration information
for the add-on. In scenario where a multiple add-ons share the same
add-on CRD, multiple ClusterManagementAddOn resources need to be created
and reference the same AddOnConfiguration.
type: object
properties:
crName:
description: crName is the name of the CR used to configure instances
of the managed add-on. This field should be configured if add-on
CR have a consistent name across the all of the ManagedCluster
instaces.
type: string
crdName:
description: crdName is the name of the CRD used to configure instances
of the managed add-on. This field should be configured if the
add-on have a CRD that controls the configuration of the add-on.
type: string
addOnMeta:
description: addOnMeta is a reference to the metadata information for
the add-on.
type: object
properties:
description:
description: description represents the detailed description of
the add-on.
type: string
displayName:
description: displayName represents the name of add-on that will
be displayed.
type: string
status:
description: status represents the current status of cluster management
add-on.
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
`)
func manifestsClusterManager0000_00_addonOpenClusterManagementIo_clustermanagementaddonsCrdYamlBytes() ([]byte, error) {
return _manifestsClusterManager0000_00_addonOpenClusterManagementIo_clustermanagementaddonsCrdYaml, nil
}
func manifestsClusterManager0000_00_addonOpenClusterManagementIo_clustermanagementaddonsCrdYaml() (*asset, error) {
bytes, err := manifestsClusterManager0000_00_addonOpenClusterManagementIo_clustermanagementaddonsCrdYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "manifests/cluster-manager/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _manifestsClusterManager0000_00_clustersOpenClusterManagementIo_managedclustersCrdYaml = []byte(`apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
@@ -775,6 +890,215 @@ func manifestsClusterManager0000_00_workOpenClusterManagementIo_manifestworksCrd
return a, nil
}
var _manifestsClusterManager0000_01_addonOpenClusterManagementIo_managedclusteraddonsCrdYaml = []byte(`apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
name: managedclusteraddons.addon.open-cluster-management.io
spec:
additionalPrinterColumns:
- JSONPath: .status.conditions[?(@.type=="Available")].status
name: Available
type: string
- JSONPath: .status.conditions[?(@.type=="Degraded")].status
name: Degraded
type: string
- JSONPath: .status.conditions[?(@.type=="Progressing")].status
name: Progressing
type: string
group: addon.open-cluster-management.io
names:
kind: ManagedClusterAddOn
listKind: ManagedClusterAddOnList
plural: managedclusteraddons
singular: managedclusteraddon
preserveUnknownFields: false
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: ManagedClusterAddOn is the Custom Resource object which holds the
current state of an add-on. This object is used by add-on operators to convey
their state. This resource should be created in the ManagedCluster namespace.
type: object
required:
- spec
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 holds configuration that could apply to any operator.
type: object
status:
description: status holds the information about the state of an operator. It
is consistent with status information across the Kubernetes ecosystem.
type: object
properties:
addOnConfiguration:
description: addOnConfiguration is a reference to configuration information
for the add-on. This resource is use to locate the configuration resource
for the add-on.
type: object
properties:
crName:
description: crName is the name of the CR used to configure instances
of the managed add-on. This field should be configured if add-on
CR have a consistent name across the all of the ManagedCluster
instaces.
type: string
crdName:
description: crdName is the name of the CRD used to configure instances
of the managed add-on. This field should be configured if the
add-on have a CRD that controls the configuration of the add-on.
type: string
addOnMeta:
description: addOnMeta is a reference to the metadata information for
the add-on. This should be same as the addOnMeta for the corresponding
ClusterManagementAddOn resource.
type: object
properties:
description:
description: description represents the detailed description of
the add-on.
type: string
displayName:
description: displayName represents the name of add-on that will
be displayed.
type: string
conditions:
description: conditions describe the state of the managed and monitored
components for the operator.
type: array
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a foo's
current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type //
+patchStrategy=merge // +listType=map // +listMapKey=type
\ Conditions []metav1.Condition ` + "`" + `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` + "`" + `
\n // other fields }"
type: object
required:
- lastTransitionTime
- message
- reason
- status
- type
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
type: string
format: date-time
message:
description: message is a human readable message indicating details
about the transition. This may be an empty string.
type: string
maxLength: 32768
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
type: integer
format: int64
minimum: 0
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers of
specific condition types may define expected values and meanings
for this field, and whether the values are considered a guaranteed
API. The value should be a CamelCase string. This field may
not be empty.
type: string
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
status:
description: status of the condition, one of True, False, Unknown.
type: string
enum:
- "True"
- "False"
- Unknown
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
relatedObjects:
description: 'relatedObjects is a list of objects that are "interesting"
or related to this operator. Common uses are: 1. the detailed resource
driving the operator 2. operator namespaces 3. operand namespaces
4. related ClusterManagementAddon resource'
type: array
items:
description: ObjectReference contains enough information to let you
inspect or modify the referred object.
type: object
required:
- group
- name
- resource
properties:
group:
description: group of the referent.
type: string
name:
description: name of the referent.
type: string
resource:
description: resource of the referent.
type: string
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
`)
func manifestsClusterManager0000_01_addonOpenClusterManagementIo_managedclusteraddonsCrdYamlBytes() ([]byte, error) {
return _manifestsClusterManager0000_01_addonOpenClusterManagementIo_managedclusteraddonsCrdYaml, nil
}
func manifestsClusterManager0000_01_addonOpenClusterManagementIo_managedclusteraddonsCrdYaml() (*asset, error) {
bytes, err := manifestsClusterManager0000_01_addonOpenClusterManagementIo_managedclusteraddonsCrdYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "manifests/cluster-manager/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _manifestsClusterManager0000_01_clustersOpenClusterManagementIo_managedclustersetbindingsCrdYaml = []byte(`apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
@@ -933,6 +1257,13 @@ rules:
- apiGroups: ["authorization.k8s.io"]
resources: ["subjectaccessreviews"]
verbs: ["create"]
# Allow hub to manage managed cluster addons
- apiGroups: ["addon.open-cluster-management.io"]
resources: ["managedclusteraddons"]
verbs: ["get", "list", "watch"]
- apiGroups: ["addon.open-cluster-management.io"]
resources: ["managedclusteraddons/status"]
verbs: ["patch", "update"]
`)
func manifestsClusterManagerClusterManagerRegistrationClusterroleYamlBytes() ([]byte, error) {
@@ -1764,9 +2095,11 @@ func AssetNames() []string {
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
"manifests/cluster-manager/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml": manifestsClusterManager0000_00_addonOpenClusterManagementIo_clustermanagementaddonsCrdYaml,
"manifests/cluster-manager/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml": manifestsClusterManager0000_00_clustersOpenClusterManagementIo_managedclustersCrdYaml,
"manifests/cluster-manager/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml": manifestsClusterManager0000_00_clustersOpenClusterManagementIo_managedclustersetsCrdYaml,
"manifests/cluster-manager/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml": manifestsClusterManager0000_00_workOpenClusterManagementIo_manifestworksCrdYaml,
"manifests/cluster-manager/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml": manifestsClusterManager0000_01_addonOpenClusterManagementIo_managedclusteraddonsCrdYaml,
"manifests/cluster-manager/0000_01_clusters.open-cluster-management.io_managedclustersetbindings.crd.yaml": manifestsClusterManager0000_01_clustersOpenClusterManagementIo_managedclustersetbindingsCrdYaml,
"manifests/cluster-manager/cluster-manager-namespace.yaml": manifestsClusterManagerClusterManagerNamespaceYaml,
"manifests/cluster-manager/cluster-manager-registration-clusterrole.yaml": manifestsClusterManagerClusterManagerRegistrationClusterroleYaml,
@@ -1834,9 +2167,11 @@ type bintree struct {
var _bintree = &bintree{nil, map[string]*bintree{
"manifests": {nil, map[string]*bintree{
"cluster-manager": {nil, map[string]*bintree{
"0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml": {manifestsClusterManager0000_00_addonOpenClusterManagementIo_clustermanagementaddonsCrdYaml, map[string]*bintree{}},
"0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml": {manifestsClusterManager0000_00_clustersOpenClusterManagementIo_managedclustersCrdYaml, map[string]*bintree{}},
"0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml": {manifestsClusterManager0000_00_clustersOpenClusterManagementIo_managedclustersetsCrdYaml, map[string]*bintree{}},
"0000_00_work.open-cluster-management.io_manifestworks.crd.yaml": {manifestsClusterManager0000_00_workOpenClusterManagementIo_manifestworksCrdYaml, map[string]*bintree{}},
"0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml": {manifestsClusterManager0000_01_addonOpenClusterManagementIo_managedclusteraddonsCrdYaml, map[string]*bintree{}},
"0000_01_clusters.open-cluster-management.io_managedclustersetbindings.crd.yaml": {manifestsClusterManager0000_01_clustersOpenClusterManagementIo_managedclustersetbindingsCrdYaml, map[string]*bintree{}},
"cluster-manager-namespace.yaml": {manifestsClusterManagerClusterManagerNamespaceYaml, map[string]*bintree{}},
"cluster-manager-registration-clusterrole.yaml": {manifestsClusterManagerClusterManagerRegistrationClusterroleYaml, map[string]*bintree{}},

View File

@@ -38,9 +38,11 @@ var (
"managedclusters.cluster.open-cluster-management.io",
}
staticResourceFiles = []string{
"manifests/cluster-manager/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml",
"manifests/cluster-manager/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml",
"manifests/cluster-manager/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml",
"manifests/cluster-manager/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml",
"manifests/cluster-manager/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml",
"manifests/cluster-manager/0000_01_clusters.open-cluster-management.io_managedclustersetbindings.crd.yaml",
"manifests/cluster-manager/cluster-manager-registration-clusterrole.yaml",
"manifests/cluster-manager/cluster-manager-registration-clusterrolebinding.yaml",

View File

@@ -139,7 +139,7 @@ func TestSyncDeploy(t *testing.T) {
}
}
// Check if resources are created as expected
testinghelper.AssertEqualNumber(t, len(createCRDObjects), 4)
testinghelper.AssertEqualNumber(t, len(createCRDObjects), 6)
createAPIServiceObjects := []runtime.Object{}
apiServiceActions := controller.apiRegistrationClient.Actions()
@@ -192,7 +192,7 @@ func TestSyncDelete(t *testing.T) {
}
}
// Check if resources are created as expected
testinghelper.AssertEqualNumber(t, len(deleteCRDActions), 6)
testinghelper.AssertEqualNumber(t, len(deleteCRDActions), 8)
deleteAPIServiceActions := []clienttesting.DeleteActionImpl{}
apiServiceActions := controller.apiRegistrationClient.Actions()

View File

@@ -264,10 +264,14 @@ kind: ClusterRole
metadata:
name: open-cluster-management:{{ .KlusterletName }}-registration:agent
rules:
# Allow agent to get/list/watch nodes.
# Allow agent to get/list/watch nodes and configmaps.
- apiGroups: [""]
resources: ["nodes", "configmaps", "secrets"]
resources: ["nodes", "configmaps"]
verbs: ["get", "list", "watch"]
# Allow agent to get/list/watch/create/delete/update/patch secrets.
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
- apiGroups: ["authorization.k8s.io"]
resources: ["subjectaccessreviews"]
verbs: ["create"]
@@ -275,7 +279,10 @@ rules:
- apiGroups: ["cluster.open-cluster-management.io"]
resources: ["clusterclaims"]
verbs: ["get", "list", "watch"]
# Allow agent to list addons lease
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "list", "watch"]
`)
func manifestsKlusterletKlusterletRegistrationClusterroleYamlBytes() ([]byte, error) {
@@ -369,6 +376,7 @@ spec:
- "agent"
- "--cluster-name={{ .ClusterName }}"
- "--bootstrap-kubeconfig=/spoke/bootstrap/kubeconfig"
- "--feature-gates=AddonManagement=true"
{{if .ExternalServerURL}}
- "--spoke-external-server-urls={{ .ExternalServerURL }}"
{{end}}

View File

@@ -162,12 +162,12 @@ func ensureRegistrationDeployment(t *testing.T, deployment *appsv1.Deployment, s
t.Errorf("Expect 1 containers in deployment spec, actual %d", len(deployment.Spec.Template.Spec.Containers))
}
args := deployment.Spec.Template.Spec.Containers[0].Args
if serverURL == "" && len(args) != 4 {
t.Errorf("Expect 4 args in container spec, actual %d", len(args))
}
if serverURL != "" && len(deployment.Spec.Template.Spec.Containers[0].Args) != 5 {
if serverURL == "" && len(args) != 5 {
t.Errorf("Expect 5 args in container spec, actual %d", len(args))
}
if serverURL != "" && len(deployment.Spec.Template.Spec.Containers[0].Args) != 6 {
t.Errorf("Expect 6 args in container spec, actual %d", len(args))
}
clusterNameArg := ""
serverURLArg := ""
for _, arg := range args {

62
test/e2e/addon_test.go Normal file
View File

@@ -0,0 +1,62 @@
package e2e
import (
"fmt"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/util/rand"
)
var _ = Describe("Manage the managed cluster addons", func() {
var klusterletName = fmt.Sprintf("e2e-klusterlet-%s", rand.String(6))
var clusterName = fmt.Sprintf("e2e-managedcluster-%s", rand.String(6))
var agentNamespace = fmt.Sprintf("e2e-agent-%s", rand.String(6))
var addOnName = fmt.Sprintf("e2e-addon-%s", rand.String(6))
AfterEach(func() {
By(fmt.Sprintf("clean klusterlet %v resources after the test case", klusterletName))
t.cleanKlusterletResources(klusterletName, clusterName)
})
It("Create one managed cluster addon and make sure it is available", func() {
var err error
By(fmt.Sprintf("create klusterlet %v with managed cluster name %v", klusterletName, clusterName))
_, err = t.CreateKlusterlet(klusterletName, clusterName, agentNamespace)
Expect(err).ToNot(HaveOccurred())
By(fmt.Sprintf("waiting for the managed cluster %v to be created", clusterName))
Eventually(func() error {
_, err = t.GetCreatedManagedCluster(clusterName)
return err
}, t.EventuallyTimeout*5, t.EventuallyInterval*5).Should(Succeed())
By(fmt.Sprintf("approve the created managed cluster %v", clusterName))
Eventually(func() error {
return t.ApproveCSR(clusterName)
}, t.EventuallyTimeout, t.EventuallyInterval).Should(Succeed())
By(fmt.Sprintf("accept the created managed cluster %v", clusterName))
Eventually(func() error {
return t.AcceptsClient(clusterName)
}, t.EventuallyTimeout, t.EventuallyInterval).Should(Succeed())
By(fmt.Sprintf("waiting for the managed cluster %v to be ready", clusterName))
Eventually(func() error {
return t.CheckManagedClusterStatus(clusterName)
}, t.EventuallyTimeout*5, t.EventuallyInterval*5).Should(Succeed())
By(fmt.Sprintf("create the addon %v on the managed cluster namespace %v", addOnName, clusterName))
err = t.CreateManagedClusterAddOn(clusterName, addOnName)
Expect(err).ToNot(HaveOccurred())
By(fmt.Sprintf("create the addon lease %v on addon install namespace %v", addOnName, addOnName))
err = t.CreateManagedClusterAddOnLease(addOnName, addOnName)
Expect(err).ToNot(HaveOccurred())
By(fmt.Sprintf("wait the addon %v available condition to be true", addOnName))
Eventually(func() error {
return t.CheckManagedClusterAddOnStatus(clusterName, addOnName)
}, t.EventuallyTimeout*5, t.EventuallyInterval*5).Should(Succeed())
})
})

View File

@@ -12,6 +12,8 @@ import (
"github.com/onsi/gomega"
addonv1alpha1 "github.com/open-cluster-management/api/addon/v1alpha1"
addonclient "github.com/open-cluster-management/api/client/addon/clientset/versioned"
clusterclient "github.com/open-cluster-management/api/client/cluster/clientset/versioned"
operatorclient "github.com/open-cluster-management/api/client/operator/clientset/versioned"
workv1client "github.com/open-cluster-management/api/client/work/clientset/versioned"
@@ -20,9 +22,10 @@ import (
workapiv1 "github.com/open-cluster-management/api/work/v1"
"github.com/open-cluster-management/registration-operator/pkg/helpers"
certificatesv1beta1 "k8s.io/api/certificates/v1beta1"
coordv1 "k8s.io/api/coordination/v1"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1beta1"
"k8s.io/client-go/kubernetes"
@@ -37,6 +40,7 @@ type Tester struct {
OperatorClient operatorclient.Interface
ClusterClient clusterclient.Interface
WorkClient workv1client.Interface
AddOnClinet addonclient.Interface
bootstrapHubSecret *corev1.Secret
EventuallyTimeout time.Duration
EventuallyInterval time.Duration
@@ -89,6 +93,10 @@ func NewTester(kubeconfigPath string) (*Tester, error) {
klog.Errorf("failed to get WorkClient. %v", err)
return nil, err
}
if tester.AddOnClinet, err = addonclient.NewForConfig(tester.ClusterCfg); err != nil {
klog.Errorf("failed to get AddOnClinet. %v", err)
return nil, err
}
return &tester, nil
}
@@ -157,7 +165,7 @@ func (t *Tester) CreateKlusterlet(name, clusterName, agentNamespace string) (*op
}
// create agentNamespace
namespace := &v1.Namespace{
namespace := &corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: agentNamespace,
},
@@ -501,3 +509,64 @@ func (t *Tester) PodLog(podName, nameSpace string, lines int64) (string, error)
return buf.String(), nil
}
func (t *Tester) CreateManagedClusterAddOn(managedClusterNamespace, addOnName string) error {
_, err := t.AddOnClinet.AddonV1alpha1().ManagedClusterAddOns(managedClusterNamespace).Create(
context.TODO(),
&addonv1alpha1.ManagedClusterAddOn{
ObjectMeta: metav1.ObjectMeta{
Namespace: managedClusterNamespace,
Name: addOnName,
Annotations: map[string]string{"addon.open-cluster-management.io/installNamespace": addOnName},
},
},
metav1.CreateOptions{},
)
return err
}
func (t *Tester) CreateManagedClusterAddOnLease(addOnInstallNamespace, addOnName string) error {
if _, err := t.KubeClient.CoreV1().Namespaces().Create(
context.TODO(),
&corev1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: addOnInstallNamespace,
},
},
metav1.CreateOptions{},
); err != nil {
return err
}
_, err := t.KubeClient.CoordinationV1().Leases(addOnInstallNamespace).Create(
context.TODO(),
&coordv1.Lease{
ObjectMeta: metav1.ObjectMeta{
Name: addOnName,
Namespace: addOnInstallNamespace,
},
Spec: coordv1.LeaseSpec{
RenewTime: &metav1.MicroTime{Time: time.Now()},
},
},
metav1.CreateOptions{},
)
return err
}
func (t *Tester) CheckManagedClusterAddOnStatus(managedClusterNamespace, addOnName string) error {
addOn, err := t.AddOnClinet.AddonV1alpha1().ManagedClusterAddOns(managedClusterNamespace).Get(context.TODO(), addOnName, metav1.GetOptions{})
if err != nil {
return err
}
if addOn.Status.Conditions == nil {
return fmt.Errorf("there is no conditions in addon %v/%v", managedClusterNamespace, addOnName)
}
if !meta.IsStatusConditionTrue(addOn.Status.Conditions, "ManagedClusterAddOnConditionAvailable") {
return fmt.Errorf("The addon %v/%v available condition is not true", managedClusterNamespace, addOnName)
}
return nil
}

View File

@@ -290,7 +290,7 @@ var _ = ginkgo.Describe("Klusterlet", func() {
return false
}
gomega.Expect(len(actual.Spec.Template.Spec.Containers)).Should(gomega.Equal(1))
gomega.Expect(len(actual.Spec.Template.Spec.Containers[0].Args)).Should(gomega.Equal(5))
gomega.Expect(len(actual.Spec.Template.Spec.Containers[0].Args)).Should(gomega.Equal(6))
if actual.Spec.Template.Spec.Containers[0].Args[2] != "--cluster-name=cluster2" {
return false
}

View File

@@ -0,0 +1,96 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
name: clustermanagementaddons.addon.open-cluster-management.io
spec:
additionalPrinterColumns:
- JSONPath: .spec.addOnMeta.displayName
name: DISPLAY NAME
type: string
- JSONPath: .spec.addOnConfiguration.crdName
name: CRD NAME
type: string
group: addon.open-cluster-management.io
names:
kind: ClusterManagementAddOn
listKind: ClusterManagementAddOnList
plural: clustermanagementaddons
singular: clustermanagementaddon
preserveUnknownFields: false
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
description: ClusterManagementAddOn represents the registration of an add-on
to the cluster manager. This resource allows the user to discover which add-on
is available for the cluster manager and also provides metadata information
about the add-on. This resource also provides a linkage to ManagedClusterAddOn,
the name of the ClusterManagementAddOn resource will be used for the namespace-scoped
ManagedClusterAddOn resource. ClusterManagementAddOn is a cluster-scoped resource.
type: object
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 the agent on the
cluster management add-on.
type: object
properties:
addOnConfiguration:
description: addOnConfiguration is a reference to configuration information
for the add-on. In scenario where a multiple add-ons share the same
add-on CRD, multiple ClusterManagementAddOn resources need to be created
and reference the same AddOnConfiguration.
type: object
properties:
crName:
description: crName is the name of the CR used to configure instances
of the managed add-on. This field should be configured if add-on
CR have a consistent name across the all of the ManagedCluster
instaces.
type: string
crdName:
description: crdName is the name of the CRD used to configure instances
of the managed add-on. This field should be configured if the
add-on have a CRD that controls the configuration of the add-on.
type: string
addOnMeta:
description: addOnMeta is a reference to the metadata information for
the add-on.
type: object
properties:
description:
description: description represents the detailed description of
the add-on.
type: string
displayName:
description: displayName represents the name of add-on that will
be displayed.
type: string
status:
description: status represents the current status of cluster management
add-on.
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -0,0 +1,192 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
name: managedclusteraddons.addon.open-cluster-management.io
spec:
additionalPrinterColumns:
- JSONPath: .status.conditions[?(@.type=="Available")].status
name: Available
type: string
- JSONPath: .status.conditions[?(@.type=="Degraded")].status
name: Degraded
type: string
- JSONPath: .status.conditions[?(@.type=="Progressing")].status
name: Progressing
type: string
group: addon.open-cluster-management.io
names:
kind: ManagedClusterAddOn
listKind: ManagedClusterAddOnList
plural: managedclusteraddons
singular: managedclusteraddon
preserveUnknownFields: false
scope: Namespaced
subresources:
status: {}
validation:
openAPIV3Schema:
description: ManagedClusterAddOn is the Custom Resource object which holds the
current state of an add-on. This object is used by add-on operators to convey
their state. This resource should be created in the ManagedCluster namespace.
type: object
required:
- spec
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 holds configuration that could apply to any operator.
type: object
status:
description: status holds the information about the state of an operator. It
is consistent with status information across the Kubernetes ecosystem.
type: object
properties:
addOnConfiguration:
description: addOnConfiguration is a reference to configuration information
for the add-on. This resource is use to locate the configuration resource
for the add-on.
type: object
properties:
crName:
description: crName is the name of the CR used to configure instances
of the managed add-on. This field should be configured if add-on
CR have a consistent name across the all of the ManagedCluster
instaces.
type: string
crdName:
description: crdName is the name of the CRD used to configure instances
of the managed add-on. This field should be configured if the
add-on have a CRD that controls the configuration of the add-on.
type: string
addOnMeta:
description: addOnMeta is a reference to the metadata information for
the add-on. This should be same as the addOnMeta for the corresponding
ClusterManagementAddOn resource.
type: object
properties:
description:
description: description represents the detailed description of
the add-on.
type: string
displayName:
description: displayName represents the name of add-on that will
be displayed.
type: string
conditions:
description: conditions describe the state of the managed and monitored
components for the operator.
type: array
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a foo's
current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type //
+patchStrategy=merge // +listType=map // +listMapKey=type
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
\n // other fields }"
type: object
required:
- lastTransitionTime
- message
- reason
- status
- type
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
type: string
format: date-time
message:
description: message is a human readable message indicating details
about the transition. This may be an empty string.
type: string
maxLength: 32768
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
type: integer
format: int64
minimum: 0
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers of
specific condition types may define expected values and meanings
for this field, and whether the values are considered a guaranteed
API. The value should be a CamelCase string. This field may
not be empty.
type: string
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
status:
description: status of the condition, one of True, False, Unknown.
type: string
enum:
- "True"
- "False"
- Unknown
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
type: string
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
relatedObjects:
description: 'relatedObjects is a list of objects that are "interesting"
or related to this operator. Common uses are: 1. the detailed resource
driving the operator 2. operator namespaces 3. operand namespaces
4. related ClusterManagementAddon resource'
type: array
items:
description: ObjectReference contains enough information to let you
inspect or modify the referred object.
type: object
required:
- group
- name
- resource
properties:
group:
description: group of the referent.
type: string
name:
description: name of the referent.
type: string
resource:
description: resource of the referent.
type: string
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -0,0 +1,8 @@
// Package v1alpha1 contains API Schema definitions for the addon v1alpha1 API group
// +k8s:deepcopy-gen=package,register
// +k8s:defaulter-gen=TypeMeta
// +k8s:openapi-gen=true
// +kubebuilder:validation:Optional
// +groupName=addon.open-cluster-management.io
package v1alpha1

View File

@@ -0,0 +1,40 @@
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
var (
GroupName = "addon.open-cluster-management.io"
GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
// Install is a function which adds this version to a scheme
Install = schemeBuilder.AddToScheme
// SchemeGroupVersion generated code relies on this name
// Deprecated
SchemeGroupVersion = GroupVersion
// AddToScheme exists solely to keep the old generators creating valid code
// DEPRECATED
AddToScheme = schemeBuilder.AddToScheme
)
// Resource generated code relies on this being here, but it logically belongs to the group
// DEPRECATED
func Resource(resource string) schema.GroupResource {
return schema.GroupResource{Group: GroupName, Resource: resource}
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(GroupVersion,
&ClusterManagementAddOn{},
&ClusterManagementAddOnList{},
&ManagedClusterAddOn{},
&ManagedClusterAddOnList{},
)
metav1.AddToGroupVersion(scheme, GroupVersion)
return nil
}

View File

@@ -0,0 +1,86 @@
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope="Cluster"
// +kubebuilder:printcolumn:name="DISPLAY NAME",type=string,JSONPath=`.spec.addOnMeta.displayName`
// +kubebuilder:printcolumn:name="CRD NAME",type=string,JSONPath=`.spec.addOnConfiguration.crdName`
// ClusterManagementAddOn represents the registration of an add-on to the cluster manager.
// This resource allows the user to discover which add-on is available for the cluster manager and
// also provides metadata information about the add-on.
// This resource also provides a linkage to ManagedClusterAddOn, the name of the ClusterManagementAddOn
// resource will be used for the namespace-scoped ManagedClusterAddOn resource.
// ClusterManagementAddOn is a cluster-scoped resource.
type ClusterManagementAddOn struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// spec represents a desired configuration for the agent on the cluster management add-on.
// +required
Spec ClusterManagementAddOnSpec `json:"spec"`
// status represents the current status of cluster management add-on.
// +optional
Status ClusterManagementAddOnStatus `json:"status,omitempty"`
}
// ClusterManagementAddOnSpec provides information for the add-on.
type ClusterManagementAddOnSpec struct {
// addOnMeta is a reference to the metadata information for the add-on.
// +optional
AddOnMeta AddOnMeta `json:"addOnMeta"`
// addOnConfiguration is a reference to configuration information for the add-on.
// In scenario where a multiple add-ons share the same add-on CRD,
// multiple ClusterManagementAddOn resources need to be created and reference the same AddOnConfiguration.
// +optional
AddOnConfiguration ConfigCoordinates `json:"addOnConfiguration"`
}
// AddOnMeta represents a collection of metadata information for the add-on.
type AddOnMeta struct {
// displayName represents the name of add-on that will be displayed.
// +optional
DisplayName string `json:"displayName"`
// description represents the detailed description of the add-on.
// +optional
Description string `json:"description"`
}
// ConfigCoordinates represents the information for locating the CRD and CR that configures the add-on.
type ConfigCoordinates struct {
// crdName is the name of the CRD used to configure instances of the managed add-on.
// This field should be configured if the add-on have a CRD that controls the configuration of the add-on.
// +optional
CRDName string `json:"crdName"`
// crName is the name of the CR used to configure instances of the managed add-on.
// This field should be configured if add-on CR have a consistent name across the all of the ManagedCluster instaces.
// +optional
CRName string `json:"crName"`
}
// ClusterManagementAddOnStatus represents the current status of cluster management add-on.
type ClusterManagementAddOnStatus struct {
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ClusterManagementAddOnList is a collection of cluster management add-ons.
type ClusterManagementAddOnList 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 cluster management add-ons.
Items []ClusterManagementAddOn `json:"items"`
}

View File

@@ -0,0 +1,87 @@
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=`.status.conditions[?(@.type=="Available")].status`
// +kubebuilder:printcolumn:name="Degraded",type=string,JSONPath=`.status.conditions[?(@.type=="Degraded")].status`
// +kubebuilder:printcolumn:name="Progressing",type=string,JSONPath=`.status.conditions[?(@.type=="Progressing")].status`
// ManagedClusterAddOn is the Custom Resource object which holds the current state
// of an add-on. This object is used by add-on operators to convey their state.
// This resource should be created in the ManagedCluster namespace.
type ManagedClusterAddOn struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
// spec holds configuration that could apply to any operator.
// +kubebuilder:validation:Required
// +required
Spec ManagedClusterAddOnSpec `json:"spec"`
// status holds the information about the state of an operator. It is consistent with status information across
// the Kubernetes ecosystem.
// +optional
Status ManagedClusterAddOnStatus `json:"status"`
}
// ManagedClusterAddOnSpec is empty for now.
type ManagedClusterAddOnSpec struct {
}
// ManagedClusterAddOnStatus provides information about the status of the operator.
// +k8s:deepcopy-gen=true
type ManagedClusterAddOnStatus struct {
// conditions describe the state of the managed and monitored components for the operator.
// +patchMergeKey=type
// +patchStrategy=merge
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
// relatedObjects is a list of objects that are "interesting" or related to this operator. Common uses are:
// 1. the detailed resource driving the operator
// 2. operator namespaces
// 3. operand namespaces
// 4. related ClusterManagementAddon resource
// +optional
RelatedObjects []ObjectReference `json:"relatedObjects,omitempty"`
// addOnMeta is a reference to the metadata information for the add-on.
// This should be same as the addOnMeta for the corresponding ClusterManagementAddOn resource.
// +optional
AddOnMeta AddOnMeta `json:"addOnMeta"`
// addOnConfiguration is a reference to configuration information for the add-on.
// This resource is use to locate the configuration resource for the add-on.
// +optional
AddOnConfiguration ConfigCoordinates `json:"addOnConfiguration"`
}
// ObjectReference contains enough information to let you inspect or modify the referred object.
type ObjectReference struct {
// group of the referent.
// +kubebuilder:validation:Required
// +required
Group string `json:"group"`
// resource of the referent.
// +kubebuilder:validation:Required
// +required
Resource string `json:"resource"`
// name of the referent.
// +kubebuilder:validation:Required
// +required
Name string `json:"name"`
}
// ManagedClusterAddOnList is a list of ManagedClusterAddOn resources.
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ManagedClusterAddOnList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []ManagedClusterAddOn `json:"items"`
}

View File

@@ -0,0 +1,260 @@
// +build !ignore_autogenerated
// Code generated by deepcopy-gen. DO NOT EDIT.
package v1alpha1
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// 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
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AddOnMeta.
func (in *AddOnMeta) DeepCopy() *AddOnMeta {
if in == nil {
return nil
}
out := new(AddOnMeta)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterManagementAddOn) DeepCopyInto(out *ClusterManagementAddOn) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
out.Status = in.Status
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterManagementAddOn.
func (in *ClusterManagementAddOn) DeepCopy() *ClusterManagementAddOn {
if in == nil {
return nil
}
out := new(ClusterManagementAddOn)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterManagementAddOn) 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 *ClusterManagementAddOnList) DeepCopyInto(out *ClusterManagementAddOnList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ClusterManagementAddOn, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterManagementAddOnList.
func (in *ClusterManagementAddOnList) DeepCopy() *ClusterManagementAddOnList {
if in == nil {
return nil
}
out := new(ClusterManagementAddOnList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ClusterManagementAddOnList) 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 *ClusterManagementAddOnSpec) DeepCopyInto(out *ClusterManagementAddOnSpec) {
*out = *in
out.AddOnMeta = in.AddOnMeta
out.AddOnConfiguration = in.AddOnConfiguration
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterManagementAddOnSpec.
func (in *ClusterManagementAddOnSpec) DeepCopy() *ClusterManagementAddOnSpec {
if in == nil {
return nil
}
out := new(ClusterManagementAddOnSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ClusterManagementAddOnStatus) DeepCopyInto(out *ClusterManagementAddOnStatus) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterManagementAddOnStatus.
func (in *ClusterManagementAddOnStatus) DeepCopy() *ClusterManagementAddOnStatus {
if in == nil {
return nil
}
out := new(ClusterManagementAddOnStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ConfigCoordinates) DeepCopyInto(out *ConfigCoordinates) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigCoordinates.
func (in *ConfigCoordinates) DeepCopy() *ConfigCoordinates {
if in == nil {
return nil
}
out := new(ConfigCoordinates)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ManagedClusterAddOn) DeepCopyInto(out *ManagedClusterAddOn) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterAddOn.
func (in *ManagedClusterAddOn) DeepCopy() *ManagedClusterAddOn {
if in == nil {
return nil
}
out := new(ManagedClusterAddOn)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ManagedClusterAddOn) 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 *ManagedClusterAddOnList) DeepCopyInto(out *ManagedClusterAddOnList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ManagedClusterAddOn, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterAddOnList.
func (in *ManagedClusterAddOnList) DeepCopy() *ManagedClusterAddOnList {
if in == nil {
return nil
}
out := new(ManagedClusterAddOnList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ManagedClusterAddOnList) 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 *ManagedClusterAddOnSpec) DeepCopyInto(out *ManagedClusterAddOnSpec) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterAddOnSpec.
func (in *ManagedClusterAddOnSpec) DeepCopy() *ManagedClusterAddOnSpec {
if in == nil {
return nil
}
out := new(ManagedClusterAddOnSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ManagedClusterAddOnStatus) DeepCopyInto(out *ManagedClusterAddOnStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]v1.Condition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.RelatedObjects != nil {
in, out := &in.RelatedObjects, &out.RelatedObjects
*out = make([]ObjectReference, len(*in))
copy(*out, *in)
}
out.AddOnMeta = in.AddOnMeta
out.AddOnConfiguration = in.AddOnConfiguration
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedClusterAddOnStatus.
func (in *ManagedClusterAddOnStatus) DeepCopy() *ManagedClusterAddOnStatus {
if in == nil {
return nil
}
out := new(ManagedClusterAddOnStatus)
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
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectReference.
func (in *ObjectReference) DeepCopy() *ObjectReference {
if in == nil {
return nil
}
out := new(ObjectReference)
in.DeepCopyInto(out)
return out
}

View File

@@ -0,0 +1,121 @@
package v1alpha1
// This file contains a collection of methods that can be used from go-restful to
// generate Swagger API documentation for its models. Please read this PR for more
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
//
// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
// they are on one line! For multiple line or blocks that you want to ignore use ---.
// Any context after a --- is ignored.
//
// Those methods can be generated by using hack/update-swagger-docs.sh
// AUTO-GENERATED FUNCTIONS START HERE
var map_AddOnMeta = map[string]string{
"": "AddOnMeta represents a collection of metadata information for the add-on.",
"displayName": "displayName represents the name of add-on that will be displayed.",
"description": "description represents the detailed description of the add-on.",
}
func (AddOnMeta) SwaggerDoc() map[string]string {
return map_AddOnMeta
}
var map_ClusterManagementAddOn = map[string]string{
"": "ClusterManagementAddOn represents the registration of an add-on to the cluster manager. This resource allows the user to discover which add-on is available for the cluster manager and also provides metadata information about the add-on. This resource also provides a linkage to ManagedClusterAddOn, the name of the ClusterManagementAddOn resource will be used for the namespace-scoped ManagedClusterAddOn resource. ClusterManagementAddOn is a cluster-scoped resource.",
"spec": "spec represents a desired configuration for the agent on the cluster management add-on.",
"status": "status represents the current status of cluster management add-on.",
}
func (ClusterManagementAddOn) SwaggerDoc() map[string]string {
return map_ClusterManagementAddOn
}
var map_ClusterManagementAddOnList = map[string]string{
"": "ClusterManagementAddOnList is a collection of cluster management add-ons.",
"metadata": "Standard list metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds",
"items": "Items is a list of cluster management add-ons.",
}
func (ClusterManagementAddOnList) SwaggerDoc() map[string]string {
return map_ClusterManagementAddOnList
}
var map_ClusterManagementAddOnSpec = map[string]string{
"": "ClusterManagementAddOnSpec provides information for the add-on.",
"addOnMeta": "addOnMeta is a reference to the metadata information for the add-on.",
"addOnConfiguration": "addOnConfiguration is a reference to configuration information for the add-on. In scenario where a multiple add-ons share the same add-on CRD, multiple ClusterManagementAddOn resources need to be created and reference the same AddOnConfiguration.",
}
func (ClusterManagementAddOnSpec) SwaggerDoc() map[string]string {
return map_ClusterManagementAddOnSpec
}
var map_ClusterManagementAddOnStatus = map[string]string{
"": "ClusterManagementAddOnStatus represents the current status of cluster management add-on.",
}
func (ClusterManagementAddOnStatus) SwaggerDoc() map[string]string {
return map_ClusterManagementAddOnStatus
}
var map_ConfigCoordinates = map[string]string{
"": "ConfigCoordinates represents the information for locating the CRD and CR that configures the add-on.",
"crdName": "crdName is the name of the CRD used to configure instances of the managed add-on. This field should be configured if the add-on have a CRD that controls the configuration of the add-on.",
"crName": "crName is the name of the CR used to configure instances of the managed add-on. This field should be configured if add-on CR have a consistent name across the all of the ManagedCluster instaces.",
}
func (ConfigCoordinates) SwaggerDoc() map[string]string {
return map_ConfigCoordinates
}
var map_ManagedClusterAddOn = map[string]string{
"": "ManagedClusterAddOn is the Custom Resource object which holds the current state of an add-on. This object is used by add-on operators to convey their state. This resource should be created in the ManagedCluster namespace.",
"spec": "spec holds configuration that could apply to any operator.",
"status": "status holds the information about the state of an operator. It is consistent with status information across the Kubernetes ecosystem.",
}
func (ManagedClusterAddOn) SwaggerDoc() map[string]string {
return map_ManagedClusterAddOn
}
var map_ManagedClusterAddOnList = map[string]string{
"": "ManagedClusterAddOnList is a list of ManagedClusterAddOn resources.",
}
func (ManagedClusterAddOnList) SwaggerDoc() map[string]string {
return map_ManagedClusterAddOnList
}
var map_ManagedClusterAddOnSpec = map[string]string{
"": "ManagedClusterAddOnSpec is empty for now.",
}
func (ManagedClusterAddOnSpec) SwaggerDoc() map[string]string {
return map_ManagedClusterAddOnSpec
}
var map_ManagedClusterAddOnStatus = map[string]string{
"": "ManagedClusterAddOnStatus provides information about the status of the operator.",
"conditions": "conditions describe the state of the managed and monitored components for the operator.",
"relatedObjects": "relatedObjects is a list of objects that are \"interesting\" or related to this operator. Common uses are: 1. the detailed resource driving the operator 2. operator namespaces 3. operand namespaces 4. related ClusterManagementAddon resource",
"addOnMeta": "addOnMeta is a reference to the metadata information for the add-on. This should be same as the addOnMeta for the corresponding ClusterManagementAddOn resource.",
"addOnConfiguration": "addOnConfiguration is a reference to configuration information for the add-on. This resource is use to locate the configuration resource for the add-on.",
}
func (ManagedClusterAddOnStatus) SwaggerDoc() map[string]string {
return map_ManagedClusterAddOnStatus
}
var map_ObjectReference = map[string]string{
"": "ObjectReference contains enough information to let you inspect or modify the referred object.",
"group": "group of the referent.",
"resource": "resource of the referent.",
"name": "name of the referent.",
}
func (ObjectReference) SwaggerDoc() map[string]string {
return map_ObjectReference
}
// AUTO-GENERATED FUNCTIONS END HERE

View File

@@ -0,0 +1,81 @@
// Code generated by client-gen. DO NOT EDIT.
package versioned
import (
"fmt"
addonv1alpha1 "github.com/open-cluster-management/api/client/addon/clientset/versioned/typed/addon/v1alpha1"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
)
type Interface interface {
Discovery() discovery.DiscoveryInterface
AddonV1alpha1() addonv1alpha1.AddonV1alpha1Interface
}
// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
addonV1alpha1 *addonv1alpha1.AddonV1alpha1Client
}
// AddonV1alpha1 retrieves the AddonV1alpha1Client
func (c *Clientset) AddonV1alpha1() addonv1alpha1.AddonV1alpha1Interface {
return c.addonV1alpha1
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
if c == nil {
return nil
}
return c.DiscoveryClient
}
// NewForConfig creates a new Clientset for the given config.
// If config's RateLimiter is not set and QPS and Burst are acceptable,
// NewForConfig will generate a rate-limiter in configShallowCopy.
func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
if configShallowCopy.Burst <= 0 {
return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
}
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
}
var cs Clientset
var err error
cs.addonV1alpha1, err = addonv1alpha1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
return &cs, nil
}
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset
cs.addonV1alpha1 = addonv1alpha1.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
}
// New creates a new Clientset for the given RESTClient.
func New(c rest.Interface) *Clientset {
var cs Clientset
cs.addonV1alpha1 = addonv1alpha1.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs
}

View File

@@ -0,0 +1,4 @@
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated clientset.
package versioned

View File

@@ -0,0 +1,4 @@
// Code generated by client-gen. DO NOT EDIT.
// This package contains the scheme of the automatically generated clientset.
package scheme

View File

@@ -0,0 +1,40 @@
// Code generated by client-gen. DO NOT EDIT.
package scheme
import (
addonv1alpha1 "github.com/open-cluster-management/api/addon/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
)
var Scheme = runtime.NewScheme()
var Codecs = serializer.NewCodecFactory(Scheme)
var ParameterCodec = runtime.NewParameterCodec(Scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
addonv1alpha1.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
// of clientsets, like in:
//
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
var AddToScheme = localSchemeBuilder.AddToScheme
func init() {
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
utilruntime.Must(AddToScheme(Scheme))
}

View File

@@ -0,0 +1,78 @@
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
v1alpha1 "github.com/open-cluster-management/api/addon/v1alpha1"
"github.com/open-cluster-management/api/client/addon/clientset/versioned/scheme"
rest "k8s.io/client-go/rest"
)
type AddonV1alpha1Interface interface {
RESTClient() rest.Interface
ClusterManagementAddOnsGetter
ManagedClusterAddOnsGetter
}
// AddonV1alpha1Client is used to interact with features provided by the addon.open-cluster-management.io group.
type AddonV1alpha1Client struct {
restClient rest.Interface
}
func (c *AddonV1alpha1Client) ClusterManagementAddOns() ClusterManagementAddOnInterface {
return newClusterManagementAddOns(c)
}
func (c *AddonV1alpha1Client) ManagedClusterAddOns(namespace string) ManagedClusterAddOnInterface {
return newManagedClusterAddOns(c, namespace)
}
// NewForConfig creates a new AddonV1alpha1Client for the given config.
func NewForConfig(c *rest.Config) (*AddonV1alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &AddonV1alpha1Client{client}, nil
}
// NewForConfigOrDie creates a new AddonV1alpha1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *AddonV1alpha1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new AddonV1alpha1Client for the given RESTClient.
func New(c rest.Interface) *AddonV1alpha1Client {
return &AddonV1alpha1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *AddonV1alpha1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@@ -0,0 +1,168 @@
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/open-cluster-management/api/addon/v1alpha1"
scheme "github.com/open-cluster-management/api/client/addon/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// ClusterManagementAddOnsGetter has a method to return a ClusterManagementAddOnInterface.
// A group's client should implement this interface.
type ClusterManagementAddOnsGetter interface {
ClusterManagementAddOns() ClusterManagementAddOnInterface
}
// ClusterManagementAddOnInterface has methods to work with ClusterManagementAddOn resources.
type ClusterManagementAddOnInterface interface {
Create(ctx context.Context, clusterManagementAddOn *v1alpha1.ClusterManagementAddOn, opts v1.CreateOptions) (*v1alpha1.ClusterManagementAddOn, error)
Update(ctx context.Context, clusterManagementAddOn *v1alpha1.ClusterManagementAddOn, opts v1.UpdateOptions) (*v1alpha1.ClusterManagementAddOn, error)
UpdateStatus(ctx context.Context, clusterManagementAddOn *v1alpha1.ClusterManagementAddOn, opts v1.UpdateOptions) (*v1alpha1.ClusterManagementAddOn, 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) (*v1alpha1.ClusterManagementAddOn, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterManagementAddOnList, 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 *v1alpha1.ClusterManagementAddOn, err error)
ClusterManagementAddOnExpansion
}
// clusterManagementAddOns implements ClusterManagementAddOnInterface
type clusterManagementAddOns struct {
client rest.Interface
}
// newClusterManagementAddOns returns a ClusterManagementAddOns
func newClusterManagementAddOns(c *AddonV1alpha1Client) *clusterManagementAddOns {
return &clusterManagementAddOns{
client: c.RESTClient(),
}
}
// Get takes name of the clusterManagementAddOn, and returns the corresponding clusterManagementAddOn object, and an error if there is any.
func (c *clusterManagementAddOns) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterManagementAddOn, err error) {
result = &v1alpha1.ClusterManagementAddOn{}
err = c.client.Get().
Resource("clustermanagementaddons").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ClusterManagementAddOns that match those selectors.
func (c *clusterManagementAddOns) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterManagementAddOnList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.ClusterManagementAddOnList{}
err = c.client.Get().
Resource("clustermanagementaddons").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusterManagementAddOns.
func (c *clusterManagementAddOns) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Resource("clustermanagementaddons").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a clusterManagementAddOn and creates it. Returns the server's representation of the clusterManagementAddOn, and an error, if there is any.
func (c *clusterManagementAddOns) Create(ctx context.Context, clusterManagementAddOn *v1alpha1.ClusterManagementAddOn, opts v1.CreateOptions) (result *v1alpha1.ClusterManagementAddOn, err error) {
result = &v1alpha1.ClusterManagementAddOn{}
err = c.client.Post().
Resource("clustermanagementaddons").
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterManagementAddOn).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a clusterManagementAddOn and updates it. Returns the server's representation of the clusterManagementAddOn, and an error, if there is any.
func (c *clusterManagementAddOns) Update(ctx context.Context, clusterManagementAddOn *v1alpha1.ClusterManagementAddOn, opts v1.UpdateOptions) (result *v1alpha1.ClusterManagementAddOn, err error) {
result = &v1alpha1.ClusterManagementAddOn{}
err = c.client.Put().
Resource("clustermanagementaddons").
Name(clusterManagementAddOn.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterManagementAddOn).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *clusterManagementAddOns) UpdateStatus(ctx context.Context, clusterManagementAddOn *v1alpha1.ClusterManagementAddOn, opts v1.UpdateOptions) (result *v1alpha1.ClusterManagementAddOn, err error) {
result = &v1alpha1.ClusterManagementAddOn{}
err = c.client.Put().
Resource("clustermanagementaddons").
Name(clusterManagementAddOn.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterManagementAddOn).
Do(ctx).
Into(result)
return
}
// Delete takes name of the clusterManagementAddOn and deletes it. Returns an error if one occurs.
func (c *clusterManagementAddOns) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Resource("clustermanagementaddons").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *clusterManagementAddOns) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Resource("clustermanagementaddons").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched clusterManagementAddOn.
func (c *clusterManagementAddOns) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterManagementAddOn, err error) {
result = &v1alpha1.ClusterManagementAddOn{}
err = c.client.Patch(pt).
Resource("clustermanagementaddons").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@@ -0,0 +1,4 @@
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1alpha1

View File

@@ -0,0 +1,7 @@
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
type ClusterManagementAddOnExpansion interface{}
type ManagedClusterAddOnExpansion interface{}

View File

@@ -0,0 +1,179 @@
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/open-cluster-management/api/addon/v1alpha1"
scheme "github.com/open-cluster-management/api/client/addon/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// ManagedClusterAddOnsGetter has a method to return a ManagedClusterAddOnInterface.
// A group's client should implement this interface.
type ManagedClusterAddOnsGetter interface {
ManagedClusterAddOns(namespace string) ManagedClusterAddOnInterface
}
// ManagedClusterAddOnInterface has methods to work with ManagedClusterAddOn resources.
type ManagedClusterAddOnInterface interface {
Create(ctx context.Context, managedClusterAddOn *v1alpha1.ManagedClusterAddOn, opts v1.CreateOptions) (*v1alpha1.ManagedClusterAddOn, error)
Update(ctx context.Context, managedClusterAddOn *v1alpha1.ManagedClusterAddOn, opts v1.UpdateOptions) (*v1alpha1.ManagedClusterAddOn, error)
UpdateStatus(ctx context.Context, managedClusterAddOn *v1alpha1.ManagedClusterAddOn, opts v1.UpdateOptions) (*v1alpha1.ManagedClusterAddOn, 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) (*v1alpha1.ManagedClusterAddOn, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ManagedClusterAddOnList, 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 *v1alpha1.ManagedClusterAddOn, err error)
ManagedClusterAddOnExpansion
}
// managedClusterAddOns implements ManagedClusterAddOnInterface
type managedClusterAddOns struct {
client rest.Interface
ns string
}
// newManagedClusterAddOns returns a ManagedClusterAddOns
func newManagedClusterAddOns(c *AddonV1alpha1Client, namespace string) *managedClusterAddOns {
return &managedClusterAddOns{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the managedClusterAddOn, and returns the corresponding managedClusterAddOn object, and an error if there is any.
func (c *managedClusterAddOns) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ManagedClusterAddOn, err error) {
result = &v1alpha1.ManagedClusterAddOn{}
err = c.client.Get().
Namespace(c.ns).
Resource("managedclusteraddons").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ManagedClusterAddOns that match those selectors.
func (c *managedClusterAddOns) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ManagedClusterAddOnList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.ManagedClusterAddOnList{}
err = c.client.Get().
Namespace(c.ns).
Resource("managedclusteraddons").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested managedClusterAddOns.
func (c *managedClusterAddOns) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("managedclusteraddons").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a managedClusterAddOn and creates it. Returns the server's representation of the managedClusterAddOn, and an error, if there is any.
func (c *managedClusterAddOns) Create(ctx context.Context, managedClusterAddOn *v1alpha1.ManagedClusterAddOn, opts v1.CreateOptions) (result *v1alpha1.ManagedClusterAddOn, err error) {
result = &v1alpha1.ManagedClusterAddOn{}
err = c.client.Post().
Namespace(c.ns).
Resource("managedclusteraddons").
VersionedParams(&opts, scheme.ParameterCodec).
Body(managedClusterAddOn).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a managedClusterAddOn and updates it. Returns the server's representation of the managedClusterAddOn, and an error, if there is any.
func (c *managedClusterAddOns) Update(ctx context.Context, managedClusterAddOn *v1alpha1.ManagedClusterAddOn, opts v1.UpdateOptions) (result *v1alpha1.ManagedClusterAddOn, err error) {
result = &v1alpha1.ManagedClusterAddOn{}
err = c.client.Put().
Namespace(c.ns).
Resource("managedclusteraddons").
Name(managedClusterAddOn.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(managedClusterAddOn).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *managedClusterAddOns) UpdateStatus(ctx context.Context, managedClusterAddOn *v1alpha1.ManagedClusterAddOn, opts v1.UpdateOptions) (result *v1alpha1.ManagedClusterAddOn, err error) {
result = &v1alpha1.ManagedClusterAddOn{}
err = c.client.Put().
Namespace(c.ns).
Resource("managedclusteraddons").
Name(managedClusterAddOn.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(managedClusterAddOn).
Do(ctx).
Into(result)
return
}
// Delete takes name of the managedClusterAddOn and deletes it. Returns an error if one occurs.
func (c *managedClusterAddOns) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("managedclusteraddons").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *managedClusterAddOns) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("managedclusteraddons").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched managedClusterAddOn.
func (c *managedClusterAddOns) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ManagedClusterAddOn, err error) {
result = &v1alpha1.ManagedClusterAddOn{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("managedclusteraddons").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

4
vendor/modules.txt vendored
View File

@@ -146,6 +146,10 @@ github.com/onsi/gomega/matchers/support/goraph/util
github.com/onsi/gomega/types
# github.com/open-cluster-management/api v0.0.0-20201126023000-353dd8370f4d
## explicit
github.com/open-cluster-management/api/addon/v1alpha1
github.com/open-cluster-management/api/client/addon/clientset/versioned
github.com/open-cluster-management/api/client/addon/clientset/versioned/scheme
github.com/open-cluster-management/api/client/addon/clientset/versioned/typed/addon/v1alpha1
github.com/open-cluster-management/api/client/cluster/clientset/versioned
github.com/open-cluster-management/api/client/cluster/clientset/versioned/scheme
github.com/open-cluster-management/api/client/cluster/clientset/versioned/typed/cluster/v1