From 0b749401de5aae17705b668666116dd01598d1eb Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Thu, 9 Sep 2021 11:23:59 +0800 Subject: [PATCH] Remove bindata and update api Signed-off-by: Jian Qiu --- Makefile | 7 +- go.mod | 3 +- go.sum | 5 +- hack/init.sh | 2 + ...-cluster-management.io_placements.crd.yaml | 63 +- manifests/fs.go | 12 + pkg/dependencymagnet/doc.go | 1 - .../clustermanager/bindata/bindata.go | 2985 ----------------- .../clustermanager_controller.go | 87 +- pkg/operators/klusterlet/bindata/bindata.go | 1135 ------- .../klusterlet_controller.go | 80 +- .../klusterlet/kube111bindata/bindata.go | 268 -- .../go-bindata/go-bindata/.gitignore | 16 - .../go-bindata/go-bindata/CONTRIBUTING.md | 79 - .../github.com/go-bindata/go-bindata/LICENSE | 3 - .../github.com/go-bindata/go-bindata/Makefile | 2 - .../go-bindata/go-bindata/README.md | 199 -- .../go-bindata/go-bindata/_config.yml | 1 - .../github.com/go-bindata/go-bindata/asset.go | 12 - .../go-bindata/go-bindata/bytewriter.go | 44 - .../go-bindata/go-bindata/config.go | 208 -- .../go-bindata/go-bindata/convert.go | 261 -- .../github.com/go-bindata/go-bindata/debug.go | 108 - .../github.com/go-bindata/go-bindata/doc.go | 129 - .../github.com/go-bindata/go-bindata/file.go | 102 - .../go-bindata/go-bindata/.gitignore | 1 - .../go-bindata/go-bindata/AppendSliceValue.go | 22 - .../go-bindata/go-bindata/go-bindata/main.go | 108 - .../go-bindata/go-bindata/version.go | 31 - .../go-bindata/go-bindata/release.go | 473 --- .../go-bindata/go-bindata/restore.go | 62 - .../go-bindata/go-bindata/stringwriter.go | 36 - .../github.com/go-bindata/go-bindata/toc.go | 288 -- vendor/modules.txt | 6 +- ...-cluster-management.io_placements.crd.yaml | 73 +- .../api/cluster/v1alpha1/types.go | 55 + .../cluster/v1alpha1/zz_generated.deepcopy.go | 38 + .../zz_generated.swagger_doc_generated.go | 28 +- 38 files changed, 362 insertions(+), 6671 deletions(-) create mode 100644 manifests/fs.go delete mode 100644 pkg/operators/clustermanager/bindata/bindata.go delete mode 100644 pkg/operators/klusterlet/bindata/bindata.go delete mode 100644 pkg/operators/klusterlet/kube111bindata/bindata.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/.gitignore delete mode 100644 vendor/github.com/go-bindata/go-bindata/CONTRIBUTING.md delete mode 100644 vendor/github.com/go-bindata/go-bindata/LICENSE delete mode 100644 vendor/github.com/go-bindata/go-bindata/Makefile delete mode 100644 vendor/github.com/go-bindata/go-bindata/README.md delete mode 100644 vendor/github.com/go-bindata/go-bindata/_config.yml delete mode 100644 vendor/github.com/go-bindata/go-bindata/asset.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/bytewriter.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/config.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/convert.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/debug.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/doc.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/file.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/go-bindata/.gitignore delete mode 100644 vendor/github.com/go-bindata/go-bindata/go-bindata/AppendSliceValue.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/go-bindata/main.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/go-bindata/version.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/release.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/restore.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/stringwriter.go delete mode 100644 vendor/github.com/go-bindata/go-bindata/toc.go diff --git a/Makefile b/Makefile index 013ff3a7f..8d43b9234 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,6 @@ include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \ golang.mk \ targets/openshift/deps.mk \ targets/openshift/images.mk \ - targets/openshift/bindata.mk \ lib/tmp.mk\ ) @@ -62,14 +61,10 @@ ifeq ($(GOHOSTOS),darwin) endif endif -$(call add-bindata,cluster-manager,./manifests/cluster-manager/...,bindata,bindata,./pkg/operators/clustermanager/bindata/bindata.go) -$(call add-bindata,klusterlet,./manifests/klusterlet/...,bindata,bindata,./pkg/operators/klusterlet/bindata/bindata.go) -$(call add-bindata,klusterletkube111,./manifests/klusterletkube111/...,kube111bindata,kube111bindata,./pkg/operators/klusterlet/kube111bindata/bindata.go) - copy-crd: bash -x hack/copy-crds.sh -update-all: copy-crd update-bindata-cluster-manager update-bindata-klusterlet update-bindata-klusterletkube111 update-csv +update: copy-crd verify-crds: bash -x hack/verify-crds.sh diff --git a/go.mod b/go.mod index fea07cd35..f56a1aaf8 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ replace github.com/googleapis/gnostic => github.com/googleapis/gnostic v0.4.1 // require ( github.com/davecgh/go-spew v1.1.1 - github.com/go-bindata/go-bindata v3.1.2+incompatible github.com/onsi/ginkgo v1.14.0 github.com/onsi/gomega v1.10.1 github.com/openshift/api v0.0.0-20210331193751-3acddb19d360 @@ -21,6 +20,6 @@ require ( k8s.io/component-base v0.21.0-rc.0 k8s.io/klog/v2 v2.8.0 k8s.io/kube-aggregator v0.21.0-rc.0 - open-cluster-management.io/api v0.0.0-20210907134339-b1a83afc26a3 + open-cluster-management.io/api v0.0.0-20210908005819-815ac23c7308 sigs.k8s.io/controller-runtime v0.6.1-0.20200829232221-efc74d056b24 ) diff --git a/go.sum b/go.sum index 1b99b7dd4..7bf731a1c 100644 --- a/go.sum +++ b/go.sum @@ -147,7 +147,6 @@ github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= -github.com/go-bindata/go-bindata v3.1.2+incompatible h1:5vjJMVhowQdPzjE1LdxyFF7YFTXg5IgGVW4gBr5IbvE= github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -964,8 +963,8 @@ modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I= -open-cluster-management.io/api v0.0.0-20210907134339-b1a83afc26a3 h1:AI93FdmDAjEXumaYPdWmWzm68KLfVoFf0Q2MoHjy7us= -open-cluster-management.io/api v0.0.0-20210907134339-b1a83afc26a3/go.mod h1:9qiA5h/8kvPQnJEOlAPHVjRO9a1jCmDhGzvgMBvXEaE= +open-cluster-management.io/api v0.0.0-20210908005819-815ac23c7308 h1:itWWudWVTqviZ2H2Arb1yTQ7NMUSPVDmWiVOpXiblOM= +open-cluster-management.io/api v0.0.0-20210908005819-815ac23c7308/go.mod h1:9qiA5h/8kvPQnJEOlAPHVjRO9a1jCmDhGzvgMBvXEaE= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/hack/init.sh b/hack/init.sh index c062e7467..8ac088002 100644 --- a/hack/init.sh +++ b/hack/init.sh @@ -8,6 +8,8 @@ HUB_CRD_FILES="./vendor/open-cluster-management.io/api/cluster/v1/*.crd.yaml ./vendor/open-cluster-management.io/api/addon/v1alpha1/*.crd.yaml ./vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml ./vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_01_clusters.open-cluster-management.io_managedclustersetbindings.crd.yaml +./vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_03_clusters.open-cluster-management.io_placements.crd.yaml +./vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_04_clusters.open-cluster-management.io_placementdecisions.crd.yaml ./vendor/open-cluster-management.io/api/work/v1/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml " diff --git a/manifests/cluster-manager/0000_03_clusters.open-cluster-management.io_placements.crd.yaml b/manifests/cluster-manager/0000_03_clusters.open-cluster-management.io_placements.crd.yaml index 619a15a89..f119d84c2 100644 --- a/manifests/cluster-manager/0000_03_clusters.open-cluster-management.io_placements.crd.yaml +++ b/manifests/cluster-manager/0000_03_clusters.open-cluster-management.io_placements.crd.yaml @@ -12,7 +12,17 @@ spec: scope: Namespaced preserveUnknownFields: false versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=="PlacementSatisfied")].status + name: Succeeded + type: string + - jsonPath: .status.conditions[?(@.type=="PlacementSatisfied")].reason + name: Reason + type: string + - jsonPath: .status.numberOfSelectedClusters + name: SelectedClusters + type: integer + name: v1alpha1 schema: openAPIV3Schema: description: "Placement defines a rule to select a set of ManagedClusters @@ -182,6 +192,57 @@ spec: type: object additionalProperties: type: string + prioritizerPolicy: + description: PrioritizerPolicy defines the policy of the prioritizers. + If this field is unset, then default prioritizer mode and configurations + are used. Referring to PrioritizerPolicy to see more description + about Mode and Configurations. + type: object + properties: + configurations: + type: array + items: + description: PrioritizerConfig represents the configuration + of prioritizer + type: object + required: + - name + properties: + name: + description: 'Name is the name of a prioritizer. Below are + the valid names: 1) Balance: balance the decisions among + the clusters. 2) Steady: ensure the existing decision + is stabilized. 3) ResourceRatioCPU & ResourceRatioMemory: + sort clusters based on the allocatable to capacity ratio. + 4) ResourceAllocatableCPU & ResourceAllocatableMemory: + sort clusters based on the allocatable.' + type: string + weight: + description: Weight defines the weight of prioritizer. The + value must be ranged in [0,10]. Each prioritizer will + calculate an integer score of a cluster in the range of + [-100, 100]. The final score of a cluster will be sum(weight + * prioritizer_score). A higher weight indicates that the + prioritizer weights more in the cluster selection, while + 0 weight indicate thats the prioritizer is disabled. + type: integer + format: int32 + default: 1 + maximum: 10 + minimum: 0 + mode: + description: Mode is either Exact, Additive, "" where "" is Additive + by default. In Additive mode, any prioritizer not explicitly + enumerated is enabled in its default Configurations, in which + Steady and Balance prioritizers have the weight of 1 while other + prioritizers have the weight of 0. Additive doesn't require + configuring all prioritizers. The default Configurations may + change in the future, and additional prioritization will happen. + In Exact mode, any prioritizer not explicitly enumerated is + weighted as zero. Exact requires knowing the full set of prioritizers + you want, but avoids behavior changes between releases. + type: string + default: Additive status: description: Status represents the current status of the Placement type: object diff --git a/manifests/fs.go b/manifests/fs.go new file mode 100644 index 000000000..e32b784cc --- /dev/null +++ b/manifests/fs.go @@ -0,0 +1,12 @@ +package manifests + +import "embed" + +//go:embed cluster-manager +var ClusterManagerManifestFiles embed.FS + +//go:embed klusterlet +var KlusterletManifestFiles embed.FS + +//go:embed klusterletkube111 +var Klusterlet111ManifestFiles embed.FS diff --git a/pkg/dependencymagnet/doc.go b/pkg/dependencymagnet/doc.go index 57f7fc631..739f179fb 100644 --- a/pkg/dependencymagnet/doc.go +++ b/pkg/dependencymagnet/doc.go @@ -5,7 +5,6 @@ package dependencymagnet import ( - _ "github.com/go-bindata/go-bindata/go-bindata" _ "github.com/openshift/build-machinery-go" _ "open-cluster-management.io/api/addon/v1alpha1" _ "open-cluster-management.io/api/cluster/v1" diff --git a/pkg/operators/clustermanager/bindata/bindata.go b/pkg/operators/clustermanager/bindata/bindata.go deleted file mode 100644 index 02e1e19a1..000000000 --- a/pkg/operators/clustermanager/bindata/bindata.go +++ /dev/null @@ -1,2985 +0,0 @@ -// 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/0000_03_clusters.open-cluster-management.io_placements.crd.yaml -// manifests/cluster-manager/0000_04_clusters.open-cluster-management.io_placementdecisions.crd.yaml -// manifests/cluster-manager/cluster-manager-namespace.yaml -// manifests/cluster-manager/cluster-manager-placement-clusterrole.yaml -// manifests/cluster-manager/cluster-manager-placement-clusterrolebinding.yaml -// manifests/cluster-manager/cluster-manager-placement-deployment.yaml -// manifests/cluster-manager/cluster-manager-placement-serviceaccount.yaml -// manifests/cluster-manager/cluster-manager-registration-clusterrole.yaml -// manifests/cluster-manager/cluster-manager-registration-clusterrolebinding.yaml -// manifests/cluster-manager/cluster-manager-registration-deployment.yaml -// manifests/cluster-manager/cluster-manager-registration-serviceaccount.yaml -// manifests/cluster-manager/cluster-manager-registration-webhook-apiservice.yaml -// manifests/cluster-manager/cluster-manager-registration-webhook-clusterrole.yaml -// manifests/cluster-manager/cluster-manager-registration-webhook-clusterrolebinding.yaml -// manifests/cluster-manager/cluster-manager-registration-webhook-clustersetbinding-validatingconfiguration.yaml -// manifests/cluster-manager/cluster-manager-registration-webhook-deployment.yaml -// manifests/cluster-manager/cluster-manager-registration-webhook-mutatingconfiguration.yaml -// manifests/cluster-manager/cluster-manager-registration-webhook-service.yaml -// manifests/cluster-manager/cluster-manager-registration-webhook-serviceaccount.yaml -// manifests/cluster-manager/cluster-manager-registration-webhook-validatingconfiguration.yaml -// manifests/cluster-manager/cluster-manager-work-webhook-apiservice.yaml -// manifests/cluster-manager/cluster-manager-work-webhook-clusterrole.yaml -// manifests/cluster-manager/cluster-manager-work-webhook-clusterrolebinding.yaml -// manifests/cluster-manager/cluster-manager-work-webhook-deployment.yaml -// manifests/cluster-manager/cluster-manager-work-webhook-service.yaml -// manifests/cluster-manager/cluster-manager-work-webhook-serviceaccount.yaml -// manifests/cluster-manager/cluster-manager-work-webhook-validatingconfiguration.yaml -package bindata - -import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time" -) - -type asset struct { - bytes []byte - info os.FileInfo -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -// Name return file name -func (fi bindataFileInfo) Name() string { - return fi.name -} - -// Size return file size -func (fi bindataFileInfo) Size() int64 { - return fi.size -} - -// Mode return file mode -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} - -// Mode return file modify time -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} - -// IsDir return file whether a directory -func (fi bindataFileInfo) IsDir() bool { - return fi.mode&os.ModeDir != 0 -} - -// Sys return file is sys mode -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -var _manifestsClusterManager0000_00_addonOpenClusterManagementIo_clustermanagementaddonsCrdYaml = []byte(`apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: clustermanagementaddons.addon.open-cluster-management.io -spec: - group: addon.open-cluster-management.io - names: - kind: ClusterManagementAddOn - listKind: ClusterManagementAddOnList - plural: clustermanagementaddons - singular: clustermanagementaddon - scope: Cluster - preserveUnknownFields: false - versions: - - additionalPrinterColumns: - - jsonPath: .spec.addOnMeta.displayName - name: DISPLAY NAME - type: string - - jsonPath: .spec.addOnConfiguration.crdName - name: CRD NAME - type: string - name: v1alpha1 - schema: - 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 - served: true - storage: true - subresources: - status: {} -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/v1 -kind: CustomResourceDefinition -metadata: - name: managedclusters.cluster.open-cluster-management.io -spec: - group: cluster.open-cluster-management.io - names: - kind: ManagedCluster - listKind: ManagedClusterList - plural: managedclusters - shortNames: - - mcl - - mcls - singular: managedcluster - scope: Cluster - preserveUnknownFields: false - versions: - - additionalPrinterColumns: - - jsonPath: .spec.hubAcceptsClient - name: Hub Accepted - type: boolean - - jsonPath: .spec.managedClusterClientConfigs[*].url - name: Managed Cluster URLs - type: string - - jsonPath: .status.conditions[?(@.type=="ManagedClusterJoined")].status - name: Joined - type: string - - jsonPath: .status.conditions[?(@.type=="ManagedClusterConditionAvailable")].status - name: Available - type: string - - jsonPath: .metadata.creationTimestamp - name: Age - type: date - name: v1 - schema: - openAPIV3Schema: - description: "ManagedCluster represents the desired state and current status - of managed cluster. ManagedCluster is a cluster scoped resource. The name - is the cluster UID. \n The cluster join process follows a double opt-in - process: \n 1. Agent on managed cluster creates CSR on hub with cluster - UID and agent name. 2. Agent on managed cluster creates ManagedCluster on - hub. 3. Cluster admin on hub approves the CSR for UID and agent name of - the ManagedCluster. 4. Cluster admin sets spec.acceptClient of ManagedCluster - to true. 5. Cluster admin on managed cluster creates credential of kubeconfig - to hub. \n Once the hub creates the cluster namespace, the Klusterlet agent - on the ManagedCluster pushes the credential to the hub to use against the - kube-apiserver of the ManagedCluster." - 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 managed cluster. - type: object - properties: - hubAcceptsClient: - description: hubAcceptsClient represents that hub accepts the joining - of Klusterlet agent on the managed cluster with the hub. The default - value is false, and can only be set true when the user on hub has - an RBAC rule to UPDATE on the virtual subresource of managedclusters/accept. - When the value is set true, a namespace whose name is the same as - the name of ManagedCluster is created on the hub. This namespace - represents the managed cluster, also role/rolebinding is created - on the namespace to grant the permision of access from the agent - on the managed cluster. When the value is set to false, the namespace - representing the managed cluster is deleted. - type: boolean - leaseDurationSeconds: - description: LeaseDurationSeconds is used to coordinate the lease - update time of Klusterlet agents on the managed cluster. If its - value is zero, the Klusterlet agent will update its lease every - 60 seconds by default - type: integer - format: int32 - managedClusterClientConfigs: - description: ManagedClusterClientConfigs represents a list of the - apiserver address of the managed cluster. If it is empty, the managed - cluster has no accessible address for the hub to connect with it. - type: array - items: - description: ClientConfig represents the apiserver address of the - managed cluster. TODO include credential to connect to managed - cluster kube-apiserver - type: object - properties: - caBundle: - description: CABundle is the ca bundle to connect to apiserver - of the managed cluster. System certs are used if it is not - set. - type: string - format: byte - url: - description: URL is the URL of apiserver endpoint of the managed - cluster. - type: string - status: - description: Status represents the current status of joined managed cluster - type: object - properties: - allocatable: - description: Allocatable represents the total allocatable resources - on the managed cluster. - type: object - additionalProperties: - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - capacity: - description: Capacity represents the total resource capacity from - all nodeStatuses on the managed cluster. - type: object - additionalProperties: - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - anyOf: - - type: integer - - type: string - x-kubernetes-int-or-string: true - clusterClaims: - description: ClusterClaims represents cluster information that a managed - cluster claims, for example a unique cluster identifier (id.k8s.io) - and kubernetes version (kubeversion.open-cluster-management.io). - They are written from the managed cluster. The set of claims is - not uniform across a fleet, some claims can be vendor or version - specific and may not be included from all managed clusters. - type: array - items: - description: ManagedClusterClaim represents a ClusterClaim collected - from a managed cluster. - type: object - properties: - name: - description: Name is the name of a ClusterClaim resource on - managed cluster. It's a well known or customized name to identify - the claim. - type: string - maxLength: 253 - minLength: 1 - value: - description: Value is a claim-dependent string - type: string - maxLength: 1024 - minLength: 1 - conditions: - description: Conditions contains the different condition statuses - for this managed cluster. - 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])$ - version: - description: Version represents the kubernetes version of the managed - cluster. - type: object - properties: - kubernetes: - description: Kubernetes is the kubernetes version of managed cluster. - type: string - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] -`) - -func manifestsClusterManager0000_00_clustersOpenClusterManagementIo_managedclustersCrdYamlBytes() ([]byte, error) { - return _manifestsClusterManager0000_00_clustersOpenClusterManagementIo_managedclustersCrdYaml, nil -} - -func manifestsClusterManager0000_00_clustersOpenClusterManagementIo_managedclustersCrdYaml() (*asset, error) { - bytes, err := manifestsClusterManager0000_00_clustersOpenClusterManagementIo_managedclustersCrdYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/0000_00_clusters.open-cluster-management.io_managedclusters.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_managedclustersetsCrdYaml = []byte(`apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: managedclustersets.cluster.open-cluster-management.io -spec: - group: cluster.open-cluster-management.io - names: - kind: ManagedClusterSet - listKind: ManagedClusterSetList - plural: managedclustersets - shortNames: - - mclset - - mclsets - singular: managedclusterset - scope: Cluster - preserveUnknownFields: false - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: "ManagedClusterSet defines a group of ManagedClusters that user's - workload can run on. A workload can be defined to deployed on a ManagedClusterSet, - which mean: 1. The workload can run on any ManagedCluster in the ManagedClusterSet - \ 2. The workload cannot run on any ManagedCluster outside the ManagedClusterSet - \ 3. The service exposed by the workload can be shared in any ManagedCluster - in the ManagedClusterSet \n In order to assign a ManagedCluster to a certian - ManagedClusterSet, add a label with name ` + "`" + `cluster.open-cluster-management.io/clusterset` + "`" + ` - on the ManagedCluster to refers to the ManagedClusterSet. User is not allow - to add/remove this label on a ManagedCluster unless they have a RBAC rule - to CREATE on a virtual subresource of managedclustersets/join. In order - to update this label, user must have the permission on both the old and - new ManagedClusterSet." - 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 defines the attributes of the ManagedClusterSet - type: object - status: - description: Status represents the current status of the ManagedClusterSet - type: object - properties: - conditions: - description: Conditions contains the different condition statuses - for this ManagedClusterSet. - 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])$ - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] -`) - -func manifestsClusterManager0000_00_clustersOpenClusterManagementIo_managedclustersetsCrdYamlBytes() ([]byte, error) { - return _manifestsClusterManager0000_00_clustersOpenClusterManagementIo_managedclustersetsCrdYaml, nil -} - -func manifestsClusterManager0000_00_clustersOpenClusterManagementIo_managedclustersetsCrdYaml() (*asset, error) { - bytes, err := manifestsClusterManager0000_00_clustersOpenClusterManagementIo_managedclustersetsCrdYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/0000_00_clusters.open-cluster-management.io_managedclustersets.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_workOpenClusterManagementIo_manifestworksCrdYaml = []byte(`apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: manifestworks.work.open-cluster-management.io -spec: - group: work.open-cluster-management.io - names: - kind: ManifestWork - listKind: ManifestWorkList - plural: manifestworks - singular: manifestwork - scope: Namespaced - preserveUnknownFields: false - versions: - - name: v1 - schema: - openAPIV3Schema: - description: ManifestWork represents a manifests workload that hub wants to - deploy on the managed cluster. A manifest workload is defined as a set of - Kubernetes resources. ManifestWork must be created in the cluster namespace - on the hub, so that agent on the corresponding managed cluster can access - this resource and deploy on the managed cluster. - 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 of work to be deployed - on the managed cluster. - type: object - properties: - deleteOption: - description: DeleteOption represents deletion strategy when the manifestwork - is deleted. Foreground deletion strategy is applied to all the resource - in this manifestwork if it is not set. - type: object - properties: - propagationPolicy: - description: propagationPolicy can be Foreground, Orphan or SelectivelyOrphan - SelectivelyOrphan should be rarely used. It is provided for - cases where particular resources is transfering ownership from - one ManifestWork to another or another management unit. Setting - this value will allow a flow like 1. create manifestwork/2 to - manage foo 2. update manifestwork/1 to selectively orphan foo - 3. remove foo from manifestwork/1 without impacting continuity - because manifestwork/2 adopts it. - type: string - default: ForeGround - selectivelyOrphans: - description: selectivelyOrphan represents a list of resources - following orphan deletion stratecy - type: object - properties: - orphaningRules: - description: orphaningRules defines a slice of orphaningrule. - Each orphaningrule identifies a single resource included - in this manifestwork - type: array - items: - description: OrphaningRule identifies a single resource - included in this manifestwork - type: object - properties: - Name: - description: Name is the names of the resources in the - workload that the strategy is applied - type: string - Namespace: - description: Namespace is the namespaces of the resources - in the workload that the strategy is applied - type: string - group: - description: Group is the api group of the resources - in the workload that the strategy is applied - type: string - resource: - description: Resource is the resources in the workload - that the strategy is applied - type: string - workload: - description: Workload represents the manifest workload to be deployed - on a managed cluster. - type: object - properties: - manifests: - description: Manifests represents a list of kuberenetes resources - to be deployed on a managed cluster. - type: array - items: - description: Manifest represents a resource to be deployed on - managed cluster. - type: object - x-kubernetes-preserve-unknown-fields: true - x-kubernetes-embedded-resource: true - status: - description: Status represents the current status of work. - type: object - properties: - conditions: - description: 'Conditions contains the different condition statuses - for this work. Valid condition types are: 1. Applied represents - workload in ManifestWork is applied successfully on managed cluster. - 2. Progressing represents workload in ManifestWork is being applied - on managed cluster. 3. Available represents workload in ManifestWork - exists on the managed cluster. 4. Degraded represents the current - state of workload does not match the desired state for a certain - period.' - 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])$ - resourceStatus: - description: ResourceStatus represents the status of each resource - in manifestwork deployed on a managed cluster. The Klusterlet agent - on managed cluster syncs the condition from the managed cluster - to the hub. - type: object - properties: - manifests: - description: 'Manifests represents the condition of manifests - deployed on managed cluster. Valid condition types are: 1. Progressing - represents the resource is being applied on managed cluster. - 2. Applied represents the resource is applied successfully on - managed cluster. 3. Available represents the resource exists - on the managed cluster. 4. Degraded represents the current state - of resource does not match the desired state for a certain period.' - type: array - items: - description: ManifestCondition represents the conditions of - the resources deployed on a managed cluster. - type: object - properties: - conditions: - description: Conditions represents the conditions of this - resource on a managed cluster. - 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])$ - resourceMeta: - description: ResourceMeta represents the group, version, - kind, name and namespace of a resoure. - type: object - properties: - group: - description: Group is the API Group of the Kubernetes - resource. - type: string - kind: - description: Kind is the kind of the Kubernetes resource. - type: string - name: - description: Name is the name of the Kubernetes resource. - type: string - namespace: - description: Name is the namespace of the Kubernetes - resource. - type: string - ordinal: - description: Ordinal represents the index of the manifest - on spec. - type: integer - format: int32 - resource: - description: Resource is the resource name of the Kubernetes - resource. - type: string - version: - description: Version is the version of the Kubernetes - resource. - type: string - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] -`) - -func manifestsClusterManager0000_00_workOpenClusterManagementIo_manifestworksCrdYamlBytes() ([]byte, error) { - return _manifestsClusterManager0000_00_workOpenClusterManagementIo_manifestworksCrdYaml, nil -} - -func manifestsClusterManager0000_00_workOpenClusterManagementIo_manifestworksCrdYaml() (*asset, error) { - bytes, err := manifestsClusterManager0000_00_workOpenClusterManagementIo_manifestworksCrdYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/0000_00_work.open-cluster-management.io_manifestworks.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_addonOpenClusterManagementIo_managedclusteraddonsCrdYaml = []byte(`apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: managedclusteraddons.addon.open-cluster-management.io -spec: - group: addon.open-cluster-management.io - names: - kind: ManagedClusterAddOn - listKind: ManagedClusterAddOnList - plural: managedclusteraddons - singular: managedclusteraddon - scope: Namespaced - preserveUnknownFields: false - versions: - - 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 - name: v1alpha1 - schema: - 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 - properties: - installNamespace: - description: installNamespace is the namespace on the managed cluster - to install the addon agent. If it is not set, open-cluster-management-agent-addon - namespace is used to install the addon agent. - type: string - maxLength: 63 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ - 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])$ - registrations: - description: registrations is the conifigurations for the addon agent - to register to hub. It should be set by each addon controller on - hub to define how the addon agent on managedcluster is registered. - With the registration defined, The addon agent can access to kube - apiserver with kube style API or other endpoints on hub cluster - with client certificate authentication. A csr will be created per - registration configuration. If more than one registrationConfig - is defined, a csr will be created for each registration configuration. - It is not allowed that multiple registrationConfigs have the same - signer name. After the csr is approved on the hub cluster, the klusterlet - agent will create a secret in the installNamespace for the registrationConfig. - If the signerName is "kubernetes.io/kube-apiserver-client", the - secret name will be "{addon name}-hub-kubeconfig" whose contents - includes key/cert and kubeconfig. Otherwise, the secret name will - be "{addon name}-{signer name}-client-cert" whose contents includes - key/cert. - type: array - items: - description: RegistrationConfig defines the configuration of the - addon agent to register to hub. The Klusterlet agent will create - a csr for the addon agent with the registrationConfig. - type: object - properties: - signerName: - description: signerName is the name of signer that addon agent - will use to create csr. - type: string - maxLength: 571 - minLength: 5 - subject: - description: "subject is the user subject of the addon agent - to be registered to the hub. If it is not set, the addon agent - will have the default subject \"subject\": { \t\"user\": \"system:open-cluster-management:addon:{addonName}:{clusterName}:{agentName}\", - \t\"groups: [\"system:open-cluster-management:addon\", \"system:open-cluster-management:addon:{addonName}\", - \"system:authenticated\"] }" - type: object - properties: - groups: - description: groups is the user group of the addon agent. - type: array - items: - type: string - organizationUnit: - description: organizationUnit is the ou of the addon agent - type: array - items: - type: string - user: - description: user is the user name of the addon agent. - type: string - 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 - namespace: - description: namespace of the referent. - type: string - resource: - description: resource of the referent. - type: string - served: true - storage: true - subresources: - status: {} -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/v1 -kind: CustomResourceDefinition -metadata: - name: managedclustersetbindings.cluster.open-cluster-management.io -spec: - group: cluster.open-cluster-management.io - names: - kind: ManagedClusterSetBinding - listKind: ManagedClusterSetBindingList - plural: managedclustersetbindings - shortNames: - - mclsetbinding - - mclsetbindings - singular: managedclustersetbinding - scope: Namespaced - preserveUnknownFields: false - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: ManagedClusterSetBinding projects a ManagedClusterSet into a - certain namespace. User is able to create a ManagedClusterSetBinding in - a namespace and bind it to a ManagedClusterSet if they have an RBAC rule - to CREATE on the virtual subresource of managedclustersets/bind. Workloads - created in the same namespace can only be distributed to ManagedClusters - in ManagedClusterSets bound in this namespace by higher level controllers. - 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 defines the attributes of ManagedClusterSetBinding. - type: object - properties: - clusterSet: - description: ClusterSet is the name of the ManagedClusterSet to bind. - It must match the instance name of the ManagedClusterSetBinding - and cannot change once created. User is allowed to set this field - if they have an RBAC rule to CREATE on the virtual subresource of - managedclustersets/bind. - type: string - minLength: 1 - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] -`) - -func manifestsClusterManager0000_01_clustersOpenClusterManagementIo_managedclustersetbindingsCrdYamlBytes() ([]byte, error) { - return _manifestsClusterManager0000_01_clustersOpenClusterManagementIo_managedclustersetbindingsCrdYaml, nil -} - -func manifestsClusterManager0000_01_clustersOpenClusterManagementIo_managedclustersetbindingsCrdYaml() (*asset, error) { - bytes, err := manifestsClusterManager0000_01_clustersOpenClusterManagementIo_managedclustersetbindingsCrdYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/0000_01_clusters.open-cluster-management.io_managedclustersetbindings.crd.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManager0000_03_clustersOpenClusterManagementIo_placementsCrdYaml = []byte(`apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: placements.cluster.open-cluster-management.io -spec: - group: cluster.open-cluster-management.io - names: - kind: Placement - listKind: PlacementList - plural: placements - singular: placement - scope: Namespaced - preserveUnknownFields: false - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: "Placement defines a rule to select a set of ManagedClusters - from the ManagedClusterSets bound to the placement namespace. \n Here is - how the placement policy combines with other selection methods to determine - a matching list of ManagedClusters: 1) Kubernetes clusters are registered - with hub as cluster-scoped ManagedClusters; 2) ManagedClusters are organized - into cluster-scoped ManagedClusterSets; 3) ManagedClusterSets are bound - to workload namespaces; 4) Namespace-scoped Placements specify a slice of - ManagedClusterSets which select a working set of potential ManagedClusters; - 5) Then Placements subselect from that working set using label/claim selection. - \n No ManagedCluster will be selected if no ManagedClusterSet is bound to - the placement namespace. User is able to bind a ManagedClusterSet to a namespace - by creating a ManagedClusterSetBinding in that namespace if they have a - RBAC rule to CREATE on the virtual subresource of ` + "`" + `managedclustersets/bind` + "`" + `. - \n A slice of PlacementDecisions with label cluster.open-cluster-management.io/placement={placement - name} will be created to represent the ManagedClusters selected by this - placement. \n If a ManagedCluster is selected and added into the PlacementDecisions, - other components may apply workload on it; once it is removed from the PlacementDecisions, - the workload applied on this ManagedCluster should be evicted accordingly." - 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 defines the attributes of Placement. - type: object - properties: - clusterSets: - description: ClusterSets represent the ManagedClusterSets from which - the ManagedClusters are selected. If the slice is empty, ManagedClusters - will be selected from the ManagedClusterSets bound to the placement - namespace, otherwise ManagedClusters will be selected from the intersection - of this slice and the ManagedClusterSets bound to the placement - namespace. - type: array - items: - type: string - numberOfClusters: - description: NumberOfClusters represents the desired number of ManagedClusters - to be selected which meet the placement requirements. 1) If not - specified, all ManagedClusters which meet the placement requirements - (including ClusterSets, and Predicates) will be selected; 2) - Otherwise if the nubmer of ManagedClusters meet the placement requirements - is larger than NumberOfClusters, a random subset with desired - number of ManagedClusters will be selected; 3) If the nubmer of - ManagedClusters meet the placement requirements is equal to NumberOfClusters, all - of them will be selected; 4) If the nubmer of ManagedClusters meet - the placement requirements is less than NumberOfClusters, all - of them will be selected, and the status of condition ` + "`" + `PlacementConditionSatisfied` + "`" + ` - will be set to false; - type: integer - format: int32 - predicates: - description: Predicates represent a slice of predicates to select - ManagedClusters. The predicates are ORed. - type: array - items: - description: ClusterPredicate represents a predicate to select ManagedClusters. - type: object - properties: - requiredClusterSelector: - description: RequiredClusterSelector represents a selector of - ManagedClusters by label and claim. If specified, 1) Any ManagedCluster, - which does not match the selector, should not be selected - by this ClusterPredicate; 2) If a selected ManagedCluster - (of this ClusterPredicate) ceases to match the selector (e.g. - due to an update) of any ClusterPredicate, it will be eventually - removed from the placement decisions; 3) If a ManagedCluster - (not selected previously) starts to match the selector, it - will either be selected or at least has a chance to be - selected (when NumberOfClusters is specified); - type: object - properties: - claimSelector: - description: ClaimSelector represents a selector of ManagedClusters - by clusterClaims in status - type: object - properties: - matchExpressions: - description: matchExpressions is a list of cluster claim - selector requirements. The requirements are ANDed. - type: array - items: - description: A label selector requirement is a selector - that contains values, a key, and an operator that - relates the key and values. - type: object - required: - - key - - operator - properties: - key: - description: key is the label key that the selector - applies to. - type: string - operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, - NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. - If the operator is In or NotIn, the values array - must be non-empty. If the operator is Exists - or DoesNotExist, the values array must be empty. - This array is replaced during a strategic merge - patch. - type: array - items: - type: string - labelSelector: - description: LabelSelector represents a selector of ManagedClusters - by label - type: object - properties: - matchExpressions: - description: matchExpressions is a list of label selector - requirements. The requirements are ANDed. - type: array - items: - description: A label selector requirement is a selector - that contains values, a key, and an operator that - relates the key and values. - type: object - required: - - key - - operator - properties: - key: - description: key is the label key that the selector - applies to. - type: string - operator: - description: operator represents a key's relationship - to a set of values. Valid operators are In, - NotIn, Exists and DoesNotExist. - type: string - values: - description: values is an array of string values. - If the operator is In or NotIn, the values array - must be non-empty. If the operator is Exists - or DoesNotExist, the values array must be empty. - This array is replaced during a strategic merge - patch. - type: array - items: - type: string - matchLabels: - description: matchLabels is a map of {key,value} pairs. - A single {key,value} in the matchLabels map is equivalent - to an element of matchExpressions, whose key field - is "key", the operator is "In", and the values array - contains only "value". The requirements are ANDed. - type: object - additionalProperties: - type: string - status: - description: Status represents the current status of the Placement - type: object - properties: - conditions: - description: Conditions contains the different condition statuses - for this Placement. - 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])$ - numberOfSelectedClusters: - description: NumberOfSelectedClusters represents the number of selected - ManagedClusters - type: integer - format: int32 - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] -`) - -func manifestsClusterManager0000_03_clustersOpenClusterManagementIo_placementsCrdYamlBytes() ([]byte, error) { - return _manifestsClusterManager0000_03_clustersOpenClusterManagementIo_placementsCrdYaml, nil -} - -func manifestsClusterManager0000_03_clustersOpenClusterManagementIo_placementsCrdYaml() (*asset, error) { - bytes, err := manifestsClusterManager0000_03_clustersOpenClusterManagementIo_placementsCrdYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/0000_03_clusters.open-cluster-management.io_placements.crd.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManager0000_04_clustersOpenClusterManagementIo_placementdecisionsCrdYaml = []byte(`apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: placementdecisions.cluster.open-cluster-management.io -spec: - group: cluster.open-cluster-management.io - names: - kind: PlacementDecision - listKind: PlacementDecisionList - plural: placementdecisions - singular: placementdecision - scope: Namespaced - preserveUnknownFields: false - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: "PlacementDecision indicates a decision from a placement PlacementDecision - should has a label cluster.open-cluster-management.io/placement={placement - name} to reference a certain placement. \n If a placement has spec.numberOfClusters - specified, the total number of decisions contained in status.decisions of - PlacementDecisions should always be NumberOfClusters; otherwise, the total - number of decisions should be the number of ManagedClusters which match - the placement requirements. \n Some of the decisions might be empty when - there are no enough ManagedClusters meet the placement requirements." - 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 - status: - description: Status represents the current status of the PlacementDecision - type: object - required: - - decisions - properties: - decisions: - description: Decisions is a slice of decisions according to a placement - The number of decisions should not be larger than 100 - type: array - items: - description: ClusterDecision represents a decision from a placement - An empty ClusterDecision indicates it is not scheduled yet. - type: object - required: - - clusterName - - reason - properties: - clusterName: - description: ClusterName is the name of the ManagedCluster. - If it is not empty, its value should be unique cross all placement - decisions for the Placement. - type: string - reason: - description: Reason represents the reason why the ManagedCluster - is selected. - type: string - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] -`) - -func manifestsClusterManager0000_04_clustersOpenClusterManagementIo_placementdecisionsCrdYamlBytes() ([]byte, error) { - return _manifestsClusterManager0000_04_clustersOpenClusterManagementIo_placementdecisionsCrdYaml, nil -} - -func manifestsClusterManager0000_04_clustersOpenClusterManagementIo_placementdecisionsCrdYaml() (*asset, error) { - bytes, err := manifestsClusterManager0000_04_clustersOpenClusterManagementIo_placementdecisionsCrdYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/0000_04_clusters.open-cluster-management.io_placementdecisions.crd.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerNamespaceYaml = []byte(`apiVersion: v1 -kind: Namespace -metadata: - name: open-cluster-management-hub -`) - -func manifestsClusterManagerClusterManagerNamespaceYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerNamespaceYaml, nil -} - -func manifestsClusterManagerClusterManagerNamespaceYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerNamespaceYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-namespace.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerPlacementClusterroleYaml = []byte(`apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: open-cluster-management:{{ .ClusterManagerName }}-placement:controller -rules: -# Allow controller to get/list/watch/create/delete configmaps -- apiGroups: [""] - resources: ["configmaps"] - verbs: ["get", "list", "watch", "create", "delete", "update"] -# Allow controller to create/patch/update events -- apiGroups: ["", "events.k8s.io"] - resources: ["events"] - verbs: ["create", "patch", "update"] -# Allow controller to view managedclusters/managedclustersets/managedclustersetbindings -- apiGroups: ["cluster.open-cluster-management.io"] - resources: ["managedclusters", "managedclustersets", "managedclustersetbindings"] - verbs: ["get", "list", "watch"] -# Allow controller to manage placements/placementdecisions -- apiGroups: ["cluster.open-cluster-management.io"] - resources: ["placements"] - verbs: ["get", "list", "watch"] -- apiGroups: ["cluster.open-cluster-management.io"] - resources: ["placementdecisions"] - verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] -- apiGroups: ["cluster.open-cluster-management.io"] - resources: ["placements/status", "placementdecisions/status"] - verbs: ["update", "patch"] -- apiGroups: ["cluster.open-cluster-management.io"] - resources: ["placements/finalizers"] - verbs: ["update"] -`) - -func manifestsClusterManagerClusterManagerPlacementClusterroleYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerPlacementClusterroleYaml, nil -} - -func manifestsClusterManagerClusterManagerPlacementClusterroleYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerPlacementClusterroleYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-placement-clusterrole.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerPlacementClusterrolebindingYaml = []byte(`apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: open-cluster-management:{{ .ClusterManagerName }}-placement:controller -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: open-cluster-management:{{ .ClusterManagerName }}-placement:controller -subjects: -- kind: ServiceAccount - namespace: open-cluster-management-hub - name: {{ .ClusterManagerName }}-placement-controller-sa -`) - -func manifestsClusterManagerClusterManagerPlacementClusterrolebindingYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerPlacementClusterrolebindingYaml, nil -} - -func manifestsClusterManagerClusterManagerPlacementClusterrolebindingYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerPlacementClusterrolebindingYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-placement-clusterrolebinding.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerPlacementDeploymentYaml = []byte(`kind: Deployment -apiVersion: apps/v1 -metadata: - name: {{ .ClusterManagerName }}-placement-controller - namespace: open-cluster-management-hub - labels: - app: clustermanager-controller -spec: - replicas: {{ .Replica }} - selector: - matchLabels: - app: clustermanager-placement-controller - template: - metadata: - labels: - app: clustermanager-placement-controller - spec: - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 70 - podAffinityTerm: - topologyKey: failure-domain.beta.kubernetes.io/zone - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - clustermanager-placement-controller - - weight: 30 - podAffinityTerm: - topologyKey: kubernetes.io/hostname - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - clustermanager-placement-controller - serviceAccountName: {{ .ClusterManagerName }}-placement-controller-sa - containers: - - name: placement-controller - image: {{ .PlacementImage }} - args: - - "/placement" - - "controller" - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - privileged: false - runAsNonRoot: true - livenessProbe: - httpGet: - path: /healthz - scheme: HTTPS - port: 8443 - initialDelaySeconds: 2 - periodSeconds: 10 - readinessProbe: - httpGet: - path: /healthz - scheme: HTTPS - port: 8443 - initialDelaySeconds: 2 - resources: - requests: - cpu: 100m - memory: 128Mi -`) - -func manifestsClusterManagerClusterManagerPlacementDeploymentYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerPlacementDeploymentYaml, nil -} - -func manifestsClusterManagerClusterManagerPlacementDeploymentYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerPlacementDeploymentYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-placement-deployment.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerPlacementServiceaccountYaml = []byte(`apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ .ClusterManagerName }}-placement-controller-sa - namespace: open-cluster-management-hub -`) - -func manifestsClusterManagerClusterManagerPlacementServiceaccountYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerPlacementServiceaccountYaml, nil -} - -func manifestsClusterManagerClusterManagerPlacementServiceaccountYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerPlacementServiceaccountYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-placement-serviceaccount.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerRegistrationClusterroleYaml = []byte(`apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: open-cluster-management:{{ .ClusterManagerName }}-registration:controller -rules: -# Allow hub to monitor and update status of csr -- apiGroups: ["certificates.k8s.io"] - resources: ["certificatesigningrequests"] - verbs: ["create", "get", "list", "watch"] -- apiGroups: ["certificates.k8s.io"] - resources: ["certificatesigningrequests/status", "certificatesigningrequests/approval"] - verbs: ["update"] -# Allow hub to get/list/watch/create/delete namespace and service account -- apiGroups: [""] - resources: ["namespaces", "serviceaccounts", "configmaps"] - verbs: ["get", "list", "watch", "create", "delete", "update"] -- apiGroups: ["", "events.k8s.io"] - resources: ["events"] - verbs: ["create", "patch", "update"] -- apiGroups: ["authorization.k8s.io"] - resources: ["subjectaccessreviews"] - verbs: ["create"] -# Allow hub to manage clusterrole/clusterrolebinding/role/rolebinding -- apiGroups: ["rbac.authorization.k8s.io"] - resources: ["clusterrolebindings", "rolebindings"] - verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] -- apiGroups: ["rbac.authorization.k8s.io"] - resources: ["clusterroles", "roles"] - verbs: ["get", "list", "watch", "create", "update", "patch", "delete", "escalate", "bind"] -# Allow hub to manage coordination.k8s.io/lease -- apiGroups: ["coordination.k8s.io"] - resources: ["leases"] - verbs: ["get", "list", "watch", "create", "delete", "update"] -# Allow hub to manage managedclusters -- apiGroups: ["cluster.open-cluster-management.io"] - resources: ["managedclusters"] - verbs: ["get", "list", "watch", "update", "patch"] -- apiGroups: ["cluster.open-cluster-management.io"] - resources: ["managedclusters/status"] - verbs: ["update", "patch"] -# Allow hub to monitor manifestworks -- apiGroups: ["work.open-cluster-management.io"] - resources: ["manifestworks"] - verbs: ["get", "list", "watch"] -# Allow hub to approve certificates that are signed by kubernetes.io/kube-apiserver-client (kube1.18.3+ needs) -- apiGroups: ["certificates.k8s.io"] - resources: ["signers"] - resourceNames: ["kubernetes.io/kube-apiserver-client"] - verbs: ["approve"] -# Allow hub to manage managedclustersets -- apiGroups: ["cluster.open-cluster-management.io"] - resources: ["managedclustersets"] - verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] -- apiGroups: ["cluster.open-cluster-management.io"] - resources: ["managedclustersets/status"] - verbs: ["update", "patch"] -# Allow to access metrics API -- apiGroups: ["authentication.k8s.io"] - resources: ["tokenreviews"] - verbs: ["create"] -- 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) { - return _manifestsClusterManagerClusterManagerRegistrationClusterroleYaml, nil -} - -func manifestsClusterManagerClusterManagerRegistrationClusterroleYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerRegistrationClusterroleYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-registration-clusterrole.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerRegistrationClusterrolebindingYaml = []byte(`apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: open-cluster-management:{{ .ClusterManagerName }}-registration:controller -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: open-cluster-management:{{ .ClusterManagerName }}-registration:controller -subjects: -- kind: ServiceAccount - namespace: open-cluster-management-hub - name: {{ .ClusterManagerName }}-registration-controller-sa -`) - -func manifestsClusterManagerClusterManagerRegistrationClusterrolebindingYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerRegistrationClusterrolebindingYaml, nil -} - -func manifestsClusterManagerClusterManagerRegistrationClusterrolebindingYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerRegistrationClusterrolebindingYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-registration-clusterrolebinding.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerRegistrationDeploymentYaml = []byte(`kind: Deployment -apiVersion: apps/v1 -metadata: - name: {{ .ClusterManagerName }}-registration-controller - namespace: open-cluster-management-hub - labels: - app: clustermanager-controller -spec: - replicas: {{ .Replica }} - selector: - matchLabels: - app: clustermanager-registration-controller - template: - metadata: - labels: - app: clustermanager-registration-controller - spec: - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 70 - podAffinityTerm: - topologyKey: failure-domain.beta.kubernetes.io/zone - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - clustermanager-registration-controller - - weight: 30 - podAffinityTerm: - topologyKey: kubernetes.io/hostname - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - clustermanager-registration-controller - serviceAccountName: {{ .ClusterManagerName }}-registration-controller-sa - containers: - - name: hub-registration-controller - image: {{ .RegistrationImage }} - args: - - "/registration" - - "controller" - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - privileged: false - runAsNonRoot: true - livenessProbe: - httpGet: - path: /healthz - scheme: HTTPS - port: 8443 - initialDelaySeconds: 2 - periodSeconds: 10 - readinessProbe: - httpGet: - path: /healthz - scheme: HTTPS - port: 8443 - initialDelaySeconds: 2 - resources: - requests: - cpu: 100m - memory: 128Mi -`) - -func manifestsClusterManagerClusterManagerRegistrationDeploymentYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerRegistrationDeploymentYaml, nil -} - -func manifestsClusterManagerClusterManagerRegistrationDeploymentYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerRegistrationDeploymentYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-registration-deployment.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerRegistrationServiceaccountYaml = []byte(`apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ .ClusterManagerName }}-registration-controller-sa - namespace: open-cluster-management-hub -`) - -func manifestsClusterManagerClusterManagerRegistrationServiceaccountYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerRegistrationServiceaccountYaml, nil -} - -func manifestsClusterManagerClusterManagerRegistrationServiceaccountYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerRegistrationServiceaccountYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-registration-serviceaccount.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerRegistrationWebhookApiserviceYaml = []byte(`apiVersion: apiregistration.k8s.io/v1 -kind: APIService -metadata: - name: v1.admission.cluster.open-cluster-management.io -spec: - group: admission.cluster.open-cluster-management.io - version: v1 - service: - name: cluster-manager-registration-webhook - namespace: open-cluster-management-hub - caBundle: {{ .RegistrationAPIServiceCABundle }} - groupPriorityMinimum: 10000 - versionPriority: 20 -`) - -func manifestsClusterManagerClusterManagerRegistrationWebhookApiserviceYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerRegistrationWebhookApiserviceYaml, nil -} - -func manifestsClusterManagerClusterManagerRegistrationWebhookApiserviceYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerRegistrationWebhookApiserviceYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-registration-webhook-apiservice.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerRegistrationWebhookClusterroleYaml = []byte(`apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: open-cluster-management:{{ .ClusterManagerName }}-registration:webhook -rules: -# Allow managedcluster admission to get/list/watch configmaps -- apiGroups: [""] - resources: ["configmaps"] - verbs: ["get", "list", "watch"] -# Allow managedcluster admission to create subjectaccessreviews -- apiGroups: ["authorization.k8s.io"] - resources: ["subjectaccessreviews"] - verbs: ["create"] -# API priority and fairness -- apiGroups: ["flowcontrol.apiserver.k8s.io"] - resources: ["prioritylevelconfigurations", "flowschemas"] - verbs: ["get", "list", "watch"] -`) - -func manifestsClusterManagerClusterManagerRegistrationWebhookClusterroleYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerRegistrationWebhookClusterroleYaml, nil -} - -func manifestsClusterManagerClusterManagerRegistrationWebhookClusterroleYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerRegistrationWebhookClusterroleYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-registration-webhook-clusterrole.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerRegistrationWebhookClusterrolebindingYaml = []byte(`apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: open-cluster-management:{{ .ClusterManagerName }}-registration:webhook -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: open-cluster-management:{{ .ClusterManagerName }}-registration:webhook -subjects: - - kind: ServiceAccount - name: {{ .ClusterManagerName }}-registration-webhook-sa - namespace: open-cluster-management-hub -`) - -func manifestsClusterManagerClusterManagerRegistrationWebhookClusterrolebindingYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerRegistrationWebhookClusterrolebindingYaml, nil -} - -func manifestsClusterManagerClusterManagerRegistrationWebhookClusterrolebindingYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerRegistrationWebhookClusterrolebindingYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-registration-webhook-clusterrolebinding.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerRegistrationWebhookClustersetbindingValidatingconfigurationYaml = []byte(`apiVersion: admissionregistration.k8s.io/v1 -kind: ValidatingWebhookConfiguration -metadata: - name: managedclustersetbindingvalidators.admission.cluster.open-cluster-management.io -webhooks: -- name: managedclustersetbindingvalidators.admission.cluster.open-cluster-management.io - failurePolicy: Fail - clientConfig: - service: - # reach the webhook via the registered aggregated API - namespace: default - name: kubernetes - path: /apis/admission.cluster.open-cluster-management.io/v1/managedclustersetbindingvalidators - rules: - - operations: - - CREATE - - UPDATE - apiGroups: - - cluster.open-cluster-management.io - apiVersions: - - "*" - resources: - - managedclustersetbindings - admissionReviewVersions: ["v1beta1"] - sideEffects: None - timeoutSeconds: 10 -`) - -func manifestsClusterManagerClusterManagerRegistrationWebhookClustersetbindingValidatingconfigurationYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerRegistrationWebhookClustersetbindingValidatingconfigurationYaml, nil -} - -func manifestsClusterManagerClusterManagerRegistrationWebhookClustersetbindingValidatingconfigurationYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerRegistrationWebhookClustersetbindingValidatingconfigurationYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-registration-webhook-clustersetbinding-validatingconfiguration.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerRegistrationWebhookDeploymentYaml = []byte(`apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ .ClusterManagerName }}-registration-webhook - namespace: open-cluster-management-hub - labels: - app: {{ .ClusterManagerName }}-registration-webhook -spec: - replicas: {{ .Replica }} - selector: - matchLabels: - app: {{ .ClusterManagerName }}-registration-webhook - template: - metadata: - labels: - app: {{ .ClusterManagerName }}-registration-webhook - spec: - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 70 - podAffinityTerm: - topologyKey: failure-domain.beta.kubernetes.io/zone - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - {{ .ClusterManagerName }}-registration-webhook - - weight: 30 - podAffinityTerm: - topologyKey: kubernetes.io/hostname - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - {{ .ClusterManagerName }}-registration-webhook - serviceAccountName: {{ .ClusterManagerName }}-registration-webhook-sa - containers: - - name: {{ .ClusterManagerName }}-registration-webhook-sa - image: {{ .RegistrationImage }} - args: - - "/registration" - - "webhook" - - "--secure-port=6443" - - "--tls-cert-file=/serving-cert/tls.crt" - - "--tls-private-key-file=/serving-cert/tls.key" - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - privileged: false - runAsNonRoot: true - livenessProbe: - httpGet: - path: /healthz - scheme: HTTPS - port: 6443 - initialDelaySeconds: 2 - periodSeconds: 10 - readinessProbe: - httpGet: - path: /healthz - scheme: HTTPS - port: 6443 - initialDelaySeconds: 2 - resources: - requests: - cpu: 100m - memory: 128Mi - volumeMounts: - - name: webhook-secret - mountPath: "/serving-cert" - readOnly: true - volumes: - - name: webhook-secret - secret: - secretName: registration-webhook-serving-cert - -`) - -func manifestsClusterManagerClusterManagerRegistrationWebhookDeploymentYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerRegistrationWebhookDeploymentYaml, nil -} - -func manifestsClusterManagerClusterManagerRegistrationWebhookDeploymentYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerRegistrationWebhookDeploymentYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-registration-webhook-deployment.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerRegistrationWebhookMutatingconfigurationYaml = []byte(`apiVersion: admissionregistration.k8s.io/v1 -kind: MutatingWebhookConfiguration -metadata: - name: managedclustermutators.admission.cluster.open-cluster-management.io -webhooks: -- name: managedclustermutators.admission.cluster.open-cluster-management.io - failurePolicy: Fail - clientConfig: - service: - # reach the webhook via the registered aggregated API - namespace: default - name: kubernetes - path: /apis/admission.cluster.open-cluster-management.io/v1/managedclustermutators - rules: - - operations: - - CREATE - - UPDATE - apiGroups: - - cluster.open-cluster-management.io - apiVersions: - - "*" - resources: - - managedclusters - admissionReviewVersions: ["v1beta1"] - sideEffects: None - timeoutSeconds: 10 -`) - -func manifestsClusterManagerClusterManagerRegistrationWebhookMutatingconfigurationYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerRegistrationWebhookMutatingconfigurationYaml, nil -} - -func manifestsClusterManagerClusterManagerRegistrationWebhookMutatingconfigurationYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerRegistrationWebhookMutatingconfigurationYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-registration-webhook-mutatingconfiguration.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerRegistrationWebhookServiceYaml = []byte(`apiVersion: v1 -kind: Service -metadata: - name: cluster-manager-registration-webhook - namespace: open-cluster-management-hub -spec: - selector: - app: {{ .ClusterManagerName }}-registration-webhook - ports: - - port: 443 - targetPort: 6443 -`) - -func manifestsClusterManagerClusterManagerRegistrationWebhookServiceYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerRegistrationWebhookServiceYaml, nil -} - -func manifestsClusterManagerClusterManagerRegistrationWebhookServiceYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerRegistrationWebhookServiceYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-registration-webhook-service.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerRegistrationWebhookServiceaccountYaml = []byte(`apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ .ClusterManagerName }}-registration-webhook-sa - namespace: open-cluster-management-hub -`) - -func manifestsClusterManagerClusterManagerRegistrationWebhookServiceaccountYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerRegistrationWebhookServiceaccountYaml, nil -} - -func manifestsClusterManagerClusterManagerRegistrationWebhookServiceaccountYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerRegistrationWebhookServiceaccountYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-registration-webhook-serviceaccount.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerRegistrationWebhookValidatingconfigurationYaml = []byte(`apiVersion: admissionregistration.k8s.io/v1 -kind: ValidatingWebhookConfiguration -metadata: - name: managedclustervalidators.admission.cluster.open-cluster-management.io -webhooks: -- name: managedclustervalidators.admission.cluster.open-cluster-management.io - failurePolicy: Fail - clientConfig: - service: - # reach the webhook via the registered aggregated API - namespace: default - name: kubernetes - path: /apis/admission.cluster.open-cluster-management.io/v1/managedclustervalidators - rules: - - operations: - - CREATE - - UPDATE - apiGroups: - - cluster.open-cluster-management.io - apiVersions: - - "*" - resources: - - managedclusters - admissionReviewVersions: ["v1beta1"] - sideEffects: None - timeoutSeconds: 10 -`) - -func manifestsClusterManagerClusterManagerRegistrationWebhookValidatingconfigurationYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerRegistrationWebhookValidatingconfigurationYaml, nil -} - -func manifestsClusterManagerClusterManagerRegistrationWebhookValidatingconfigurationYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerRegistrationWebhookValidatingconfigurationYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-registration-webhook-validatingconfiguration.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerWorkWebhookApiserviceYaml = []byte(`apiVersion: apiregistration.k8s.io/v1 -kind: APIService -metadata: - name: v1.admission.work.open-cluster-management.io -spec: - group: admission.work.open-cluster-management.io - version: v1 - service: - name: cluster-manager-work-webhook - namespace: open-cluster-management-hub - caBundle: {{ .WorkAPIServiceCABundle }} - groupPriorityMinimum: 10000 - versionPriority: 20 -`) - -func manifestsClusterManagerClusterManagerWorkWebhookApiserviceYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerWorkWebhookApiserviceYaml, nil -} - -func manifestsClusterManagerClusterManagerWorkWebhookApiserviceYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerWorkWebhookApiserviceYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-work-webhook-apiservice.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerWorkWebhookClusterroleYaml = []byte(`apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: open-cluster-management:{{ .ClusterManagerName }}-work:webhook -rules: -# Allow managedcluster admission to get/list/watch configmaps -- apiGroups: [""] - resources: ["configmaps"] - verbs: ["get", "list", "watch"] -# Allow managedcluster admission to create subjectaccessreviews -- apiGroups: ["authorization.k8s.io"] - resources: ["subjectaccessreviews"] - verbs: ["create"] -# API priority and fairness -- apiGroups: ["flowcontrol.apiserver.k8s.io"] - resources: ["prioritylevelconfigurations", "flowschemas"] - verbs: ["get", "list", "watch"] -`) - -func manifestsClusterManagerClusterManagerWorkWebhookClusterroleYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerWorkWebhookClusterroleYaml, nil -} - -func manifestsClusterManagerClusterManagerWorkWebhookClusterroleYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerWorkWebhookClusterroleYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-work-webhook-clusterrole.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerWorkWebhookClusterrolebindingYaml = []byte(`apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: open-cluster-management:{{ .ClusterManagerName }}-work:webhook -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: open-cluster-management:{{ .ClusterManagerName }}-work:webhook -subjects: - - kind: ServiceAccount - name: {{ .ClusterManagerName }}-work-webhook-sa - namespace: open-cluster-management-hub -`) - -func manifestsClusterManagerClusterManagerWorkWebhookClusterrolebindingYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerWorkWebhookClusterrolebindingYaml, nil -} - -func manifestsClusterManagerClusterManagerWorkWebhookClusterrolebindingYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerWorkWebhookClusterrolebindingYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-work-webhook-clusterrolebinding.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerWorkWebhookDeploymentYaml = []byte(`apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ .ClusterManagerName }}-work-webhook - namespace: open-cluster-management-hub - labels: - app: {{ .ClusterManagerName }}-work-webhook -spec: - replicas: {{ .Replica }} - selector: - matchLabels: - app: {{ .ClusterManagerName }}-work-webhook - template: - metadata: - labels: - app: {{ .ClusterManagerName }}-work-webhook - spec: - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 70 - podAffinityTerm: - topologyKey: failure-domain.beta.kubernetes.io/zone - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - {{ .ClusterManagerName }}-work-webhook - - weight: 30 - podAffinityTerm: - topologyKey: kubernetes.io/hostname - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - {{ .ClusterManagerName }}-work-webhook - serviceAccountName: {{ .ClusterManagerName }}-work-webhook-sa - containers: - - name: {{ .ClusterManagerName }}-work-webhook-sa - image: {{ .WorkImage }} - args: - - "/work" - - "webhook" - - "--secure-port=6443" - - "--tls-cert-file=/serving-cert/tls.crt" - - "--tls-private-key-file=/serving-cert/tls.key" - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - privileged: false - runAsNonRoot: true - livenessProbe: - httpGet: - path: /healthz - scheme: HTTPS - port: 6443 - initialDelaySeconds: 2 - periodSeconds: 10 - readinessProbe: - httpGet: - path: /healthz - scheme: HTTPS - port: 6443 - initialDelaySeconds: 2 - resources: - requests: - cpu: 100m - memory: 128Mi - volumeMounts: - - name: webhook-secret - mountPath: "/serving-cert" - readOnly: true - volumes: - - name: webhook-secret - secret: - secretName: work-webhook-serving-cert - -`) - -func manifestsClusterManagerClusterManagerWorkWebhookDeploymentYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerWorkWebhookDeploymentYaml, nil -} - -func manifestsClusterManagerClusterManagerWorkWebhookDeploymentYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerWorkWebhookDeploymentYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-work-webhook-deployment.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerWorkWebhookServiceYaml = []byte(`apiVersion: v1 -kind: Service -metadata: - name: cluster-manager-work-webhook - namespace: open-cluster-management-hub -spec: - selector: - app: {{ .ClusterManagerName }}-work-webhook - ports: - - port: 443 - targetPort: 6443 -`) - -func manifestsClusterManagerClusterManagerWorkWebhookServiceYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerWorkWebhookServiceYaml, nil -} - -func manifestsClusterManagerClusterManagerWorkWebhookServiceYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerWorkWebhookServiceYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-work-webhook-service.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerWorkWebhookServiceaccountYaml = []byte(`apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ .ClusterManagerName }}-work-webhook-sa - namespace: open-cluster-management-hub -`) - -func manifestsClusterManagerClusterManagerWorkWebhookServiceaccountYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerWorkWebhookServiceaccountYaml, nil -} - -func manifestsClusterManagerClusterManagerWorkWebhookServiceaccountYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerWorkWebhookServiceaccountYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-work-webhook-serviceaccount.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsClusterManagerClusterManagerWorkWebhookValidatingconfigurationYaml = []byte(`apiVersion: admissionregistration.k8s.io/v1 -kind: ValidatingWebhookConfiguration -metadata: - name: manifestworkvalidators.admission.work.open-cluster-management.io -webhooks: -- name: manifestworkvalidators.admission.work.open-cluster-management.io - failurePolicy: Fail - clientConfig: - service: - # reach the webhook via the registered aggregated API - namespace: default - name: kubernetes - path: /apis/admission.work.open-cluster-management.io/v1/manifestworkvalidators - rules: - - operations: - - CREATE - - UPDATE - apiGroups: - - work.open-cluster-management.io - apiVersions: - - "*" - resources: - - manifestworks - admissionReviewVersions: ["v1beta1"] - sideEffects: None - timeoutSeconds: 10 -`) - -func manifestsClusterManagerClusterManagerWorkWebhookValidatingconfigurationYamlBytes() ([]byte, error) { - return _manifestsClusterManagerClusterManagerWorkWebhookValidatingconfigurationYaml, nil -} - -func manifestsClusterManagerClusterManagerWorkWebhookValidatingconfigurationYaml() (*asset, error) { - bytes, err := manifestsClusterManagerClusterManagerWorkWebhookValidatingconfigurationYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/cluster-manager/cluster-manager-work-webhook-validatingconfiguration.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %s not found", name) -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %s not found", name) -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _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/0000_03_clusters.open-cluster-management.io_placements.crd.yaml": manifestsClusterManager0000_03_clustersOpenClusterManagementIo_placementsCrdYaml, - "manifests/cluster-manager/0000_04_clusters.open-cluster-management.io_placementdecisions.crd.yaml": manifestsClusterManager0000_04_clustersOpenClusterManagementIo_placementdecisionsCrdYaml, - "manifests/cluster-manager/cluster-manager-namespace.yaml": manifestsClusterManagerClusterManagerNamespaceYaml, - "manifests/cluster-manager/cluster-manager-placement-clusterrole.yaml": manifestsClusterManagerClusterManagerPlacementClusterroleYaml, - "manifests/cluster-manager/cluster-manager-placement-clusterrolebinding.yaml": manifestsClusterManagerClusterManagerPlacementClusterrolebindingYaml, - "manifests/cluster-manager/cluster-manager-placement-deployment.yaml": manifestsClusterManagerClusterManagerPlacementDeploymentYaml, - "manifests/cluster-manager/cluster-manager-placement-serviceaccount.yaml": manifestsClusterManagerClusterManagerPlacementServiceaccountYaml, - "manifests/cluster-manager/cluster-manager-registration-clusterrole.yaml": manifestsClusterManagerClusterManagerRegistrationClusterroleYaml, - "manifests/cluster-manager/cluster-manager-registration-clusterrolebinding.yaml": manifestsClusterManagerClusterManagerRegistrationClusterrolebindingYaml, - "manifests/cluster-manager/cluster-manager-registration-deployment.yaml": manifestsClusterManagerClusterManagerRegistrationDeploymentYaml, - "manifests/cluster-manager/cluster-manager-registration-serviceaccount.yaml": manifestsClusterManagerClusterManagerRegistrationServiceaccountYaml, - "manifests/cluster-manager/cluster-manager-registration-webhook-apiservice.yaml": manifestsClusterManagerClusterManagerRegistrationWebhookApiserviceYaml, - "manifests/cluster-manager/cluster-manager-registration-webhook-clusterrole.yaml": manifestsClusterManagerClusterManagerRegistrationWebhookClusterroleYaml, - "manifests/cluster-manager/cluster-manager-registration-webhook-clusterrolebinding.yaml": manifestsClusterManagerClusterManagerRegistrationWebhookClusterrolebindingYaml, - "manifests/cluster-manager/cluster-manager-registration-webhook-clustersetbinding-validatingconfiguration.yaml": manifestsClusterManagerClusterManagerRegistrationWebhookClustersetbindingValidatingconfigurationYaml, - "manifests/cluster-manager/cluster-manager-registration-webhook-deployment.yaml": manifestsClusterManagerClusterManagerRegistrationWebhookDeploymentYaml, - "manifests/cluster-manager/cluster-manager-registration-webhook-mutatingconfiguration.yaml": manifestsClusterManagerClusterManagerRegistrationWebhookMutatingconfigurationYaml, - "manifests/cluster-manager/cluster-manager-registration-webhook-service.yaml": manifestsClusterManagerClusterManagerRegistrationWebhookServiceYaml, - "manifests/cluster-manager/cluster-manager-registration-webhook-serviceaccount.yaml": manifestsClusterManagerClusterManagerRegistrationWebhookServiceaccountYaml, - "manifests/cluster-manager/cluster-manager-registration-webhook-validatingconfiguration.yaml": manifestsClusterManagerClusterManagerRegistrationWebhookValidatingconfigurationYaml, - "manifests/cluster-manager/cluster-manager-work-webhook-apiservice.yaml": manifestsClusterManagerClusterManagerWorkWebhookApiserviceYaml, - "manifests/cluster-manager/cluster-manager-work-webhook-clusterrole.yaml": manifestsClusterManagerClusterManagerWorkWebhookClusterroleYaml, - "manifests/cluster-manager/cluster-manager-work-webhook-clusterrolebinding.yaml": manifestsClusterManagerClusterManagerWorkWebhookClusterrolebindingYaml, - "manifests/cluster-manager/cluster-manager-work-webhook-deployment.yaml": manifestsClusterManagerClusterManagerWorkWebhookDeploymentYaml, - "manifests/cluster-manager/cluster-manager-work-webhook-service.yaml": manifestsClusterManagerClusterManagerWorkWebhookServiceYaml, - "manifests/cluster-manager/cluster-manager-work-webhook-serviceaccount.yaml": manifestsClusterManagerClusterManagerWorkWebhookServiceaccountYaml, - "manifests/cluster-manager/cluster-manager-work-webhook-validatingconfiguration.yaml": manifestsClusterManagerClusterManagerWorkWebhookValidatingconfigurationYaml, -} - -// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} - -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{}}, - "0000_03_clusters.open-cluster-management.io_placements.crd.yaml": {manifestsClusterManager0000_03_clustersOpenClusterManagementIo_placementsCrdYaml, map[string]*bintree{}}, - "0000_04_clusters.open-cluster-management.io_placementdecisions.crd.yaml": {manifestsClusterManager0000_04_clustersOpenClusterManagementIo_placementdecisionsCrdYaml, map[string]*bintree{}}, - "cluster-manager-namespace.yaml": {manifestsClusterManagerClusterManagerNamespaceYaml, map[string]*bintree{}}, - "cluster-manager-placement-clusterrole.yaml": {manifestsClusterManagerClusterManagerPlacementClusterroleYaml, map[string]*bintree{}}, - "cluster-manager-placement-clusterrolebinding.yaml": {manifestsClusterManagerClusterManagerPlacementClusterrolebindingYaml, map[string]*bintree{}}, - "cluster-manager-placement-deployment.yaml": {manifestsClusterManagerClusterManagerPlacementDeploymentYaml, map[string]*bintree{}}, - "cluster-manager-placement-serviceaccount.yaml": {manifestsClusterManagerClusterManagerPlacementServiceaccountYaml, map[string]*bintree{}}, - "cluster-manager-registration-clusterrole.yaml": {manifestsClusterManagerClusterManagerRegistrationClusterroleYaml, map[string]*bintree{}}, - "cluster-manager-registration-clusterrolebinding.yaml": {manifestsClusterManagerClusterManagerRegistrationClusterrolebindingYaml, map[string]*bintree{}}, - "cluster-manager-registration-deployment.yaml": {manifestsClusterManagerClusterManagerRegistrationDeploymentYaml, map[string]*bintree{}}, - "cluster-manager-registration-serviceaccount.yaml": {manifestsClusterManagerClusterManagerRegistrationServiceaccountYaml, map[string]*bintree{}}, - "cluster-manager-registration-webhook-apiservice.yaml": {manifestsClusterManagerClusterManagerRegistrationWebhookApiserviceYaml, map[string]*bintree{}}, - "cluster-manager-registration-webhook-clusterrole.yaml": {manifestsClusterManagerClusterManagerRegistrationWebhookClusterroleYaml, map[string]*bintree{}}, - "cluster-manager-registration-webhook-clusterrolebinding.yaml": {manifestsClusterManagerClusterManagerRegistrationWebhookClusterrolebindingYaml, map[string]*bintree{}}, - "cluster-manager-registration-webhook-clustersetbinding-validatingconfiguration.yaml": {manifestsClusterManagerClusterManagerRegistrationWebhookClustersetbindingValidatingconfigurationYaml, map[string]*bintree{}}, - "cluster-manager-registration-webhook-deployment.yaml": {manifestsClusterManagerClusterManagerRegistrationWebhookDeploymentYaml, map[string]*bintree{}}, - "cluster-manager-registration-webhook-mutatingconfiguration.yaml": {manifestsClusterManagerClusterManagerRegistrationWebhookMutatingconfigurationYaml, map[string]*bintree{}}, - "cluster-manager-registration-webhook-service.yaml": {manifestsClusterManagerClusterManagerRegistrationWebhookServiceYaml, map[string]*bintree{}}, - "cluster-manager-registration-webhook-serviceaccount.yaml": {manifestsClusterManagerClusterManagerRegistrationWebhookServiceaccountYaml, map[string]*bintree{}}, - "cluster-manager-registration-webhook-validatingconfiguration.yaml": {manifestsClusterManagerClusterManagerRegistrationWebhookValidatingconfigurationYaml, map[string]*bintree{}}, - "cluster-manager-work-webhook-apiservice.yaml": {manifestsClusterManagerClusterManagerWorkWebhookApiserviceYaml, map[string]*bintree{}}, - "cluster-manager-work-webhook-clusterrole.yaml": {manifestsClusterManagerClusterManagerWorkWebhookClusterroleYaml, map[string]*bintree{}}, - "cluster-manager-work-webhook-clusterrolebinding.yaml": {manifestsClusterManagerClusterManagerWorkWebhookClusterrolebindingYaml, map[string]*bintree{}}, - "cluster-manager-work-webhook-deployment.yaml": {manifestsClusterManagerClusterManagerWorkWebhookDeploymentYaml, map[string]*bintree{}}, - "cluster-manager-work-webhook-service.yaml": {manifestsClusterManagerClusterManagerWorkWebhookServiceYaml, map[string]*bintree{}}, - "cluster-manager-work-webhook-serviceaccount.yaml": {manifestsClusterManagerClusterManagerWorkWebhookServiceaccountYaml, map[string]*bintree{}}, - "cluster-manager-work-webhook-validatingconfiguration.yaml": {manifestsClusterManagerClusterManagerWorkWebhookValidatingconfigurationYaml, map[string]*bintree{}}, - }}, - }}, -}} - -// RestoreAsset restores an asset under the given directory -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil -} - -// RestoreAssets restores an asset under the given directory recursively -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) -} diff --git a/pkg/operators/clustermanager/controllers/clustermanagercontroller/clustermanager_controller.go b/pkg/operators/clustermanager/controllers/clustermanagercontroller/clustermanager_controller.go index 52b7d058d..bd37b66b4 100644 --- a/pkg/operators/clustermanager/controllers/clustermanagercontroller/clustermanager_controller.go +++ b/pkg/operators/clustermanager/controllers/clustermanagercontroller/clustermanager_controller.go @@ -4,7 +4,6 @@ import ( "context" "encoding/base64" "fmt" - "path/filepath" "time" apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" @@ -28,8 +27,8 @@ import ( operatorinformer "open-cluster-management.io/api/client/operator/informers/externalversions/operator/v1" operatorlister "open-cluster-management.io/api/client/operator/listers/operator/v1" operatorapiv1 "open-cluster-management.io/api/operator/v1" + "open-cluster-management.io/registration-operator/manifests" "open-cluster-management.io/registration-operator/pkg/helpers" - "open-cluster-management.io/registration-operator/pkg/operators/clustermanager/bindata" ) var ( @@ -38,42 +37,42 @@ 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/0000_03_clusters.open-cluster-management.io_placements.crd.yaml", - "manifests/cluster-manager/0000_04_clusters.open-cluster-management.io_placementdecisions.crd.yaml", - "manifests/cluster-manager/cluster-manager-registration-clusterrole.yaml", - "manifests/cluster-manager/cluster-manager-registration-clusterrolebinding.yaml", - "manifests/cluster-manager/cluster-manager-namespace.yaml", - "manifests/cluster-manager/cluster-manager-registration-serviceaccount.yaml", - "manifests/cluster-manager/cluster-manager-registration-webhook-clusterrole.yaml", - "manifests/cluster-manager/cluster-manager-registration-webhook-clusterrolebinding.yaml", - "manifests/cluster-manager/cluster-manager-registration-webhook-service.yaml", - "manifests/cluster-manager/cluster-manager-registration-webhook-serviceaccount.yaml", - "manifests/cluster-manager/cluster-manager-registration-webhook-apiservice.yaml", - "manifests/cluster-manager/cluster-manager-registration-webhook-clustersetbinding-validatingconfiguration.yaml", - "manifests/cluster-manager/cluster-manager-registration-webhook-validatingconfiguration.yaml", - "manifests/cluster-manager/cluster-manager-registration-webhook-mutatingconfiguration.yaml", - "manifests/cluster-manager/cluster-manager-work-webhook-clusterrole.yaml", - "manifests/cluster-manager/cluster-manager-work-webhook-clusterrolebinding.yaml", - "manifests/cluster-manager/cluster-manager-work-webhook-service.yaml", - "manifests/cluster-manager/cluster-manager-work-webhook-serviceaccount.yaml", - "manifests/cluster-manager/cluster-manager-work-webhook-apiservice.yaml", - "manifests/cluster-manager/cluster-manager-work-webhook-validatingconfiguration.yaml", - "manifests/cluster-manager/cluster-manager-placement-clusterrole.yaml", - "manifests/cluster-manager/cluster-manager-placement-clusterrolebinding.yaml", - "manifests/cluster-manager/cluster-manager-placement-serviceaccount.yaml", + "cluster-manager/0000_00_addon.open-cluster-management.io_clustermanagementaddons.crd.yaml", + "cluster-manager/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml", + "cluster-manager/0000_00_clusters.open-cluster-management.io_managedclustersets.crd.yaml", + "cluster-manager/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml", + "cluster-manager/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml", + "cluster-manager/0000_01_clusters.open-cluster-management.io_managedclustersetbindings.crd.yaml", + "cluster-manager/0000_03_clusters.open-cluster-management.io_placements.crd.yaml", + "cluster-manager/0000_04_clusters.open-cluster-management.io_placementdecisions.crd.yaml", + "cluster-manager/cluster-manager-registration-clusterrole.yaml", + "cluster-manager/cluster-manager-registration-clusterrolebinding.yaml", + "cluster-manager/cluster-manager-namespace.yaml", + "cluster-manager/cluster-manager-registration-serviceaccount.yaml", + "cluster-manager/cluster-manager-registration-webhook-clusterrole.yaml", + "cluster-manager/cluster-manager-registration-webhook-clusterrolebinding.yaml", + "cluster-manager/cluster-manager-registration-webhook-service.yaml", + "cluster-manager/cluster-manager-registration-webhook-serviceaccount.yaml", + "cluster-manager/cluster-manager-registration-webhook-apiservice.yaml", + "cluster-manager/cluster-manager-registration-webhook-clustersetbinding-validatingconfiguration.yaml", + "cluster-manager/cluster-manager-registration-webhook-validatingconfiguration.yaml", + "cluster-manager/cluster-manager-registration-webhook-mutatingconfiguration.yaml", + "cluster-manager/cluster-manager-work-webhook-clusterrole.yaml", + "cluster-manager/cluster-manager-work-webhook-clusterrolebinding.yaml", + "cluster-manager/cluster-manager-work-webhook-service.yaml", + "cluster-manager/cluster-manager-work-webhook-serviceaccount.yaml", + "cluster-manager/cluster-manager-work-webhook-apiservice.yaml", + "cluster-manager/cluster-manager-work-webhook-validatingconfiguration.yaml", + "cluster-manager/cluster-manager-placement-clusterrole.yaml", + "cluster-manager/cluster-manager-placement-clusterrolebinding.yaml", + "cluster-manager/cluster-manager-placement-serviceaccount.yaml", } deploymentFiles = []string{ - "manifests/cluster-manager/cluster-manager-registration-deployment.yaml", - "manifests/cluster-manager/cluster-manager-registration-webhook-deployment.yaml", - "manifests/cluster-manager/cluster-manager-work-webhook-deployment.yaml", - "manifests/cluster-manager/cluster-manager-placement-deployment.yaml", + "cluster-manager/cluster-manager-registration-deployment.yaml", + "cluster-manager/cluster-manager-registration-webhook-deployment.yaml", + "cluster-manager/cluster-manager-work-webhook-deployment.yaml", + "cluster-manager/cluster-manager-placement-deployment.yaml", } ) @@ -218,7 +217,11 @@ func (n *clusterManagerController) sync(ctx context.Context, controllerContext f n.apiRegistrationClient, controllerContext.Recorder(), func(name string) ([]byte, error) { - return assets.MustCreateAssetFromTemplate(name, bindata.MustAsset(filepath.Join("", name)), config).Data, nil + template, err := manifests.ClusterManagerManifestFiles.ReadFile(name) + if err != nil { + return nil, err + } + return assets.MustCreateAssetFromTemplate(name, template, config).Data, nil }, staticResourceFiles..., ) @@ -237,7 +240,11 @@ func (n *clusterManagerController) sync(ctx context.Context, controllerContext f clusterManager.Status.Generations, clusterManager.Spec.NodePlacement, func(name string) ([]byte, error) { - return assets.MustCreateAssetFromTemplate(name, bindata.MustAsset(filepath.Join("", name)), config).Data, nil + template, err := manifests.ClusterManagerManifestFiles.ReadFile(name) + if err != nil { + return nil, err + } + return assets.MustCreateAssetFromTemplate(name, template, config).Data, nil }, controllerContext.Recorder(), file) @@ -343,7 +350,11 @@ func (n *clusterManagerController) cleanUp( n.apiExtensionClient, n.apiRegistrationClient, func(name string) ([]byte, error) { - return assets.MustCreateAssetFromTemplate(name, bindata.MustAsset(filepath.Join("", name)), config).Data, nil + template, err := manifests.ClusterManagerManifestFiles.ReadFile(name) + if err != nil { + return nil, err + } + return assets.MustCreateAssetFromTemplate(name, template, config).Data, nil }, file, ) diff --git a/pkg/operators/klusterlet/bindata/bindata.go b/pkg/operators/klusterlet/bindata/bindata.go deleted file mode 100644 index 9b73ebf9d..000000000 --- a/pkg/operators/klusterlet/bindata/bindata.go +++ /dev/null @@ -1,1135 +0,0 @@ -// Code generated for package bindata by go-bindata DO NOT EDIT. (@generated) -// sources: -// manifests/klusterlet/0000_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml -// manifests/klusterlet/0000_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml -// manifests/klusterlet/0001_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml -// manifests/klusterlet/0001_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml -// manifests/klusterlet/klusterlet-registration-clusterrole.yaml -// manifests/klusterlet/klusterlet-registration-clusterrolebinding.yaml -// manifests/klusterlet/klusterlet-registration-deployment.yaml -// manifests/klusterlet/klusterlet-registration-role.yaml -// manifests/klusterlet/klusterlet-registration-rolebinding.yaml -// manifests/klusterlet/klusterlet-registration-serviceaccount.yaml -// manifests/klusterlet/klusterlet-work-clusterrole.yaml -// manifests/klusterlet/klusterlet-work-clusterrolebinding-addition.yaml -// manifests/klusterlet/klusterlet-work-clusterrolebinding.yaml -// manifests/klusterlet/klusterlet-work-deployment.yaml -// manifests/klusterlet/klusterlet-work-serviceaccount.yaml -package bindata - -import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time" -) - -type asset struct { - bytes []byte - info os.FileInfo -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -// Name return file name -func (fi bindataFileInfo) Name() string { - return fi.name -} - -// Size return file size -func (fi bindataFileInfo) Size() int64 { - return fi.size -} - -// Mode return file mode -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} - -// Mode return file modify time -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} - -// IsDir return file whether a directory -func (fi bindataFileInfo) IsDir() bool { - return fi.mode&os.ModeDir != 0 -} - -// Sys return file is sys mode -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -var _manifestsKlusterlet0000_01_workOpenClusterManagementIo_appliedmanifestworksCrdYaml = []byte(`apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: appliedmanifestworks.work.open-cluster-management.io -spec: - group: work.open-cluster-management.io - names: - kind: AppliedManifestWork - listKind: AppliedManifestWorkList - plural: appliedmanifestworks - singular: appliedmanifestwork - scope: Cluster - preserveUnknownFields: false - versions: - - name: v1 - schema: - openAPIV3Schema: - description: AppliedManifestWork represents an applied manifestwork on managed - cluster that is placed on a managed cluster. An AppliedManifestWork links - to a manifestwork on a hub recording resources deployed in the managed cluster. - When the agent is removed from managed cluster, cluster-admin on managed - cluster can delete appliedmanifestwork to remove resources deployed by the - agent. The name of the appliedmanifestwork must be in the format of {hash - of hub's first kube-apiserver url}-{manifestwork name} - 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 the desired configuration of AppliedManifestWork. - type: object - properties: - hubHash: - description: HubHash represents the hash of the first hub kube apiserver - to identify which hub this AppliedManifestWork links to. - type: string - manifestWorkName: - description: ManifestWorkName represents the name of the related manifestwork - on the hub. - type: string - status: - description: Status represents the current status of AppliedManifestWork. - type: object - properties: - appliedResources: - description: AppliedResources represents a list of resources defined - within the manifestwork that are applied. Only resources with valid - GroupVersionResource, namespace, and name are suitable. An item - in this slice is deleted when there is no mapped manifest in manifestwork.Spec - or by finalizer. The resource relating to the item will also be - removed from managed cluster. The deleted resource may still be - present until the finalizers for that resource are finished. However, - the resource will not be undeleted, so it can be removed from this - list and eventual consistency is preserved. - type: array - items: - description: AppliedManifestResourceMeta represents the group, version, - resource, name and namespace of a resource. Since these resources - have been created, they must have valid group, version, resource, - namespace, and name. - type: object - properties: - group: - description: Group is the API Group of the Kubernetes resource. - type: string - name: - description: Name is the name of the Kubernetes resource. - type: string - namespace: - description: Name is the namespace of the Kubernetes resource, - empty string indicates it is a cluster scoped resource. - type: string - resource: - description: Resource is the resource name of the Kubernetes - resource. - type: string - uid: - description: UID is set on successful deletion of the Kubernetes - resource by controller. The resource might be still visible - on the managed cluster after this field is set. It is not - directly settable by a client. - type: string - version: - description: Version is the version of the Kubernetes resource. - type: string - served: true - storage: true - subresources: - status: {} -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] -`) - -func manifestsKlusterlet0000_01_workOpenClusterManagementIo_appliedmanifestworksCrdYamlBytes() ([]byte, error) { - return _manifestsKlusterlet0000_01_workOpenClusterManagementIo_appliedmanifestworksCrdYaml, nil -} - -func manifestsKlusterlet0000_01_workOpenClusterManagementIo_appliedmanifestworksCrdYaml() (*asset, error) { - bytes, err := manifestsKlusterlet0000_01_workOpenClusterManagementIo_appliedmanifestworksCrdYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/0000_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterlet0000_02_clustersOpenClusterManagementIo_clusterclaimsCrdYaml = []byte(`apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: clusterclaims.cluster.open-cluster-management.io -spec: - group: cluster.open-cluster-management.io - names: - kind: ClusterClaim - listKind: ClusterClaimList - plural: clusterclaims - singular: clusterclaim - scope: Cluster - preserveUnknownFields: false - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: ClusterClaim represents cluster information that a managed cluster - claims ClusterClaims with well known names include, 1. id.k8s.io, it contains - a unique identifier for the cluster. 2. clusterset.k8s.io, it contains - an identifier that relates the cluster to the ClusterSet in which it - belongs. ClusterClaims created on a managed cluster will be collected and - saved into the status of the corresponding ManagedCluster on hub. - 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 defines the attributes of the ClusterClaim. - type: object - properties: - value: - description: Value is a claim-dependent string - type: string - maxLength: 1024 - minLength: 1 - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] -`) - -func manifestsKlusterlet0000_02_clustersOpenClusterManagementIo_clusterclaimsCrdYamlBytes() ([]byte, error) { - return _manifestsKlusterlet0000_02_clustersOpenClusterManagementIo_clusterclaimsCrdYaml, nil -} - -func manifestsKlusterlet0000_02_clustersOpenClusterManagementIo_clusterclaimsCrdYaml() (*asset, error) { - bytes, err := manifestsKlusterlet0000_02_clustersOpenClusterManagementIo_clusterclaimsCrdYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/0000_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterlet0001_01_workOpenClusterManagementIo_appliedmanifestworksCrdYaml = []byte(`apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - creationTimestamp: null - name: appliedmanifestworks.work.open-cluster-management.io -spec: - group: work.open-cluster-management.io - names: - kind: AppliedManifestWork - listKind: AppliedManifestWorkList - plural: appliedmanifestworks - singular: appliedmanifestwork - scope: "Cluster" - preserveUnknownFields: false - subresources: - status: {} - validation: - openAPIV3Schema: - description: AppliedManifestWork represents an applied manifestwork on managed - cluster that is placed on a managed cluster. An AppliedManifestWork links - to a manifestwork on a hub recording resources deployed in the managed cluster. - When the agent is removed from managed cluster, cluster-admin on managed cluster - can delete appliedmanifestwork to remove resources deployed by the agent. - The name of the appliedmanifestwork must be in the format of {hash of hub's - first kube-apiserver url}-{manifestwork name} - 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 the desired configuration of AppliedManifestWork. - type: object - properties: - hubHash: - description: HubHash represents the hash of the first hub kube apiserver - to identify which hub this AppliedManifestWork links to. - type: string - manifestWorkName: - description: ManifestWorkName represents the name of the related manifestwork - on the hub. - type: string - status: - description: Status represents the current status of AppliedManifestWork. - type: object - properties: - appliedResources: - description: AppliedResources represents a list of resources defined - within the manifestwork that are applied. Only resources with valid - GroupVersionResource, namespace, and name are suitable. An item in - this slice is deleted when there is no mapped manifest in manifestwork.Spec - or by finalizer. The resource relating to the item will also be removed - from managed cluster. The deleted resource may still be present until - the finalizers for that resource are finished. However, the resource - will not be undeleted, so it can be removed from this list and eventual - consistency is preserved. - type: array - items: - description: AppliedManifestResourceMeta represents the group, version, - resource, name and namespace of a resource. Since these resources - have been created, they must have valid group, version, resource, - namespace, and name. - type: object - properties: - group: - description: Group is the API Group of the Kubernetes resource. - type: string - name: - description: Name is the name of the Kubernetes resource. - type: string - namespace: - description: Name is the namespace of the Kubernetes resource, - empty string indicates it is a cluster scoped resource. - type: string - resource: - description: Resource is the resource name of the Kubernetes resource. - type: string - uid: - description: UID is set on successful deletion of the Kubernetes - resource by controller. The resource might be still visible - on the managed cluster after this field is set. It is not directly - settable by a client. - type: string - version: - description: Version is the version of the Kubernetes resource. - type: string - version: v1 - versions: - - name: v1 - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] -`) - -func manifestsKlusterlet0001_01_workOpenClusterManagementIo_appliedmanifestworksCrdYamlBytes() ([]byte, error) { - return _manifestsKlusterlet0001_01_workOpenClusterManagementIo_appliedmanifestworksCrdYaml, nil -} - -func manifestsKlusterlet0001_01_workOpenClusterManagementIo_appliedmanifestworksCrdYaml() (*asset, error) { - bytes, err := manifestsKlusterlet0001_01_workOpenClusterManagementIo_appliedmanifestworksCrdYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/0001_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterlet0001_02_clustersOpenClusterManagementIo_clusterclaimsCrdYaml = []byte(`apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: clusterclaims.cluster.open-cluster-management.io -spec: - group: cluster.open-cluster-management.io - names: - kind: ClusterClaim - listKind: ClusterClaimList - plural: clusterclaims - singular: clusterclaim - scope: Cluster - preserveUnknownFields: false - validation: - openAPIV3Schema: - description: ClusterClaim represents cluster information that a managed cluster - claims ClusterClaims with well known names include, 1. id.k8s.io, it contains - a unique identifier for the cluster. 2. clusterset.k8s.io, it contains an - identifier that relates the cluster to the ClusterSet in which it belongs. - ClusterClaims created on a managed cluster will be collected and saved into - the status of the corresponding ManagedCluster on hub. - 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 defines the attributes of the ClusterClaim. - type: object - properties: - value: - description: Value is a claim-dependent string - type: string - maxLength: 1024 - minLength: 1 - version: v1alpha1 - versions: - - name: v1alpha1 - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] -`) - -func manifestsKlusterlet0001_02_clustersOpenClusterManagementIo_clusterclaimsCrdYamlBytes() ([]byte, error) { - return _manifestsKlusterlet0001_02_clustersOpenClusterManagementIo_clusterclaimsCrdYaml, nil -} - -func manifestsKlusterlet0001_02_clustersOpenClusterManagementIo_clusterclaimsCrdYaml() (*asset, error) { - bytes, err := manifestsKlusterlet0001_02_clustersOpenClusterManagementIo_clusterclaimsCrdYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/0001_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterletKlusterletRegistrationClusterroleYaml = []byte(`# Clusterrole for work agent in addition to admin clusterrole. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: open-cluster-management:{{ .KlusterletName }}-registration:agent -rules: -# Allow agent to get/list/watch nodes and configmaps. -- apiGroups: [""] - 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"] -# Allow agent to list clusterclaims -- 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) { - return _manifestsKlusterletKlusterletRegistrationClusterroleYaml, nil -} - -func manifestsKlusterletKlusterletRegistrationClusterroleYaml() (*asset, error) { - bytes, err := manifestsKlusterletKlusterletRegistrationClusterroleYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/klusterlet-registration-clusterrole.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterletKlusterletRegistrationClusterrolebindingYaml = []byte(`apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: open-cluster-management:{{ .KlusterletName }}-registration:agent -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: open-cluster-management:{{ .KlusterletName }}-registration:agent -subjects: - - kind: ServiceAccount - name: {{ .KlusterletName }}-registration-sa - namespace: {{ .KlusterletNamespace }} -`) - -func manifestsKlusterletKlusterletRegistrationClusterrolebindingYamlBytes() ([]byte, error) { - return _manifestsKlusterletKlusterletRegistrationClusterrolebindingYaml, nil -} - -func manifestsKlusterletKlusterletRegistrationClusterrolebindingYaml() (*asset, error) { - bytes, err := manifestsKlusterletKlusterletRegistrationClusterrolebindingYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/klusterlet-registration-clusterrolebinding.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterletKlusterletRegistrationDeploymentYaml = []byte(`kind: Deployment -apiVersion: apps/v1 -metadata: - name: {{ .KlusterletName }}-registration-agent - namespace: {{ .KlusterletNamespace }} - labels: - app: klusterlet-registration-agent -spec: - replicas: {{ .Replica }} - selector: - matchLabels: - app: klusterlet-registration-agent - template: - metadata: - annotations: - target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}' - labels: - app: klusterlet-registration-agent - spec: - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 70 - podAffinityTerm: - topologyKey: failure-domain.beta.kubernetes.io/zone - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - klusterlet-registration-agent - - weight: 30 - podAffinityTerm: - topologyKey: kubernetes.io/hostname - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - klusterlet-registration-agent - serviceAccountName: {{ .KlusterletName }}-registration-sa - containers: - - name: registration-controller - image: {{ .RegistrationImage }} - args: - - "/registration" - - "agent" - - "--cluster-name={{ .ClusterName }}" - - "--bootstrap-kubeconfig=/spoke/bootstrap/kubeconfig" - - "--feature-gates=AddonManagement=true" - {{if .ExternalServerURL}} - - "--spoke-external-server-urls={{ .ExternalServerURL }}" - {{end}} - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - privileged: false - runAsNonRoot: true - volumeMounts: - - name: bootstrap-secret - mountPath: "/spoke/bootstrap" - readOnly: true - - name: hub-kubeconfig - mountPath: "/spoke/hub-kubeconfig" - livenessProbe: - httpGet: - path: /healthz - scheme: HTTPS - port: 8443 - initialDelaySeconds: 2 - periodSeconds: 10 - readinessProbe: - httpGet: - path: /healthz - scheme: HTTPS - port: 8443 - initialDelaySeconds: 2 - resources: - requests: - cpu: 100m - memory: 128Mi - volumes: - - name: bootstrap-secret - secret: - secretName: {{ .BootStrapKubeConfigSecret }} - - name: hub-kubeconfig - emptyDir: - medium: Memory -`) - -func manifestsKlusterletKlusterletRegistrationDeploymentYamlBytes() ([]byte, error) { - return _manifestsKlusterletKlusterletRegistrationDeploymentYaml, nil -} - -func manifestsKlusterletKlusterletRegistrationDeploymentYaml() (*asset, error) { - bytes, err := manifestsKlusterletKlusterletRegistrationDeploymentYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/klusterlet-registration-deployment.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterletKlusterletRegistrationRoleYaml = []byte(`# Role for registration agent. -apiVersion: rbac.authorization.k8s.io/v1 -kind: Role -metadata: - name: open-cluster-management:{{ .KlusterletName }}-registration:agent - namespace: {{ .KlusterletNamespace }} -rules: -- apiGroups: [""] - resources: ["configmaps", "secrets"] - verbs: ["get", "list", "watch", "create", "delete", "update", "patch"] -- apiGroups: ["", "events.k8s.io"] - resources: ["events"] - verbs: ["create", "patch", "update"] -`) - -func manifestsKlusterletKlusterletRegistrationRoleYamlBytes() ([]byte, error) { - return _manifestsKlusterletKlusterletRegistrationRoleYaml, nil -} - -func manifestsKlusterletKlusterletRegistrationRoleYaml() (*asset, error) { - bytes, err := manifestsKlusterletKlusterletRegistrationRoleYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/klusterlet-registration-role.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterletKlusterletRegistrationRolebindingYaml = []byte(`apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: open-cluster-management:{{ .KlusterletName }}-registration:agent - namespace: {{ .KlusterletNamespace }} -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: Role - name: open-cluster-management:{{ .KlusterletName }}-registration:agent -subjects: - - kind: ServiceAccount - name: {{ .KlusterletName }}-registration-sa - namespace: {{ .KlusterletNamespace }} -`) - -func manifestsKlusterletKlusterletRegistrationRolebindingYamlBytes() ([]byte, error) { - return _manifestsKlusterletKlusterletRegistrationRolebindingYaml, nil -} - -func manifestsKlusterletKlusterletRegistrationRolebindingYaml() (*asset, error) { - bytes, err := manifestsKlusterletKlusterletRegistrationRolebindingYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/klusterlet-registration-rolebinding.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterletKlusterletRegistrationServiceaccountYaml = []byte(`apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ .KlusterletName }}-registration-sa - namespace: {{ .KlusterletNamespace }} -imagePullSecrets: -- name: open-cluster-management-image-pull-credentials -`) - -func manifestsKlusterletKlusterletRegistrationServiceaccountYamlBytes() ([]byte, error) { - return _manifestsKlusterletKlusterletRegistrationServiceaccountYaml, nil -} - -func manifestsKlusterletKlusterletRegistrationServiceaccountYaml() (*asset, error) { - bytes, err := manifestsKlusterletKlusterletRegistrationServiceaccountYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/klusterlet-registration-serviceaccount.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterletKlusterletWorkClusterroleYaml = []byte(`# Clusterrole for work agent in addition to admin clusterrole. -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: open-cluster-management:{{ .KlusterletName }}-work:agent -rules: -# Allow agent to get/list/watch/create/delete crds. -- apiGroups: ["apiextensions.k8s.io"] - resources: ["customresourcedefinitions"] - verbs: ["get", "list", "watch", "create", "delete", "update"] -# Allow agent to create/update/patch/delete namespaces, get/list/watch are contained in admin role already -- apiGroups: [""] - resources: ["namespaces"] - verbs: ["create", "update", "patch", "delete"] -# Allow agent to manage role/rolebinding/clusterrole/clusterrolebinding -- apiGroups: ["rbac.authorization.k8s.io"] - resources: ["clusterrolebindings", "rolebindings"] - verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] -- apiGroups: ["rbac.authorization.k8s.io"] - resources: ["clusterroles", "roles"] - verbs: ["get", "list", "watch", "create", "update", "patch", "delete", "escalate", "bind"] -# Allow agent to create sar -- apiGroups: ["authorization.k8s.io"] - resources: ["subjectaccessreviews"] - verbs: ["create"] -# Allow agent to create events -- apiGroups: ["", "events.k8s.io"] - resources: ["events"] - verbs: ["create", "patch", "update"] -# Allow agent to managed appliedmanifestworks -- apiGroups: ["work.open-cluster-management.io"] - resources: ["appliedmanifestworks"] - verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] -- apiGroups: ["work.open-cluster-management.io"] - resources: ["appliedmanifestworks/status"] - verbs: ["patch", "update"] -- apiGroups: ["work.open-cluster-management.io"] - resources: ["appliedmanifestworks/finalizers"] - verbs: ["update"] -`) - -func manifestsKlusterletKlusterletWorkClusterroleYamlBytes() ([]byte, error) { - return _manifestsKlusterletKlusterletWorkClusterroleYaml, nil -} - -func manifestsKlusterletKlusterletWorkClusterroleYaml() (*asset, error) { - bytes, err := manifestsKlusterletKlusterletWorkClusterroleYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/klusterlet-work-clusterrole.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterletKlusterletWorkClusterrolebindingAdditionYaml = []byte(`apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: open-cluster-management:{{ .KlusterletName }}-work:agent-addition -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: open-cluster-management:{{ .KlusterletName }}-work:agent -subjects: - - kind: ServiceAccount - name: {{ .KlusterletName }}-work-sa - namespace: {{ .KlusterletNamespace }} -`) - -func manifestsKlusterletKlusterletWorkClusterrolebindingAdditionYamlBytes() ([]byte, error) { - return _manifestsKlusterletKlusterletWorkClusterrolebindingAdditionYaml, nil -} - -func manifestsKlusterletKlusterletWorkClusterrolebindingAdditionYaml() (*asset, error) { - bytes, err := manifestsKlusterletKlusterletWorkClusterrolebindingAdditionYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/klusterlet-work-clusterrolebinding-addition.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterletKlusterletWorkClusterrolebindingYaml = []byte(`apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: open-cluster-management:{{ .KlusterletName }}-work:agent -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - # We deploy a controller that could work with permission lower than cluster-admin, the tradeoff is - # responsivity because list/watch cannot be maintained over too many namespaces. - name: admin -subjects: - - kind: ServiceAccount - name: {{ .KlusterletName }}-work-sa - namespace: {{ .KlusterletNamespace }} -`) - -func manifestsKlusterletKlusterletWorkClusterrolebindingYamlBytes() ([]byte, error) { - return _manifestsKlusterletKlusterletWorkClusterrolebindingYaml, nil -} - -func manifestsKlusterletKlusterletWorkClusterrolebindingYaml() (*asset, error) { - bytes, err := manifestsKlusterletKlusterletWorkClusterrolebindingYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/klusterlet-work-clusterrolebinding.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterletKlusterletWorkDeploymentYaml = []byte(`kind: Deployment -apiVersion: apps/v1 -metadata: - name: {{ .KlusterletName }}-work-agent - namespace: {{ .KlusterletNamespace }} - labels: - app: klusterlet-manifestwork-agent -spec: - replicas: {{ .Replica }} - selector: - matchLabels: - app: klusterlet-manifestwork-agent - template: - metadata: - annotations: - target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}' - labels: - app: klusterlet-manifestwork-agent - spec: - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 70 - podAffinityTerm: - topologyKey: failure-domain.beta.kubernetes.io/zone - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - klusterlet-manifestwork-agent - - weight: 30 - podAffinityTerm: - topologyKey: kubernetes.io/hostname - labelSelector: - matchExpressions: - - key: app - operator: In - values: - - klusterlet-manifestwork-agent - serviceAccountName: {{ .KlusterletName }}-work-sa - containers: - - name: klusterlet-manifestwork-agent - image: {{ .WorkImage }} - args: - - "/work" - - "agent" - - "--spoke-cluster-name={{ .ClusterName }}" - - "--hub-kubeconfig=/spoke/hub-kubeconfig/kubeconfig" - securityContext: - allowPrivilegeEscalation: false - capabilities: - drop: - - ALL - privileged: false - runAsNonRoot: true - volumeMounts: - - name: hub-kubeconfig-secret - mountPath: "/spoke/hub-kubeconfig" - readOnly: true - livenessProbe: - httpGet: - path: /healthz - scheme: HTTPS - port: 8443 - initialDelaySeconds: 2 - periodSeconds: 10 - readinessProbe: - httpGet: - path: /healthz - scheme: HTTPS - port: 8443 - initialDelaySeconds: 2 - resources: - requests: - cpu: 100m - memory: 128Mi - volumes: - - name: hub-kubeconfig-secret - secret: - secretName: {{ .HubKubeConfigSecret }} -`) - -func manifestsKlusterletKlusterletWorkDeploymentYamlBytes() ([]byte, error) { - return _manifestsKlusterletKlusterletWorkDeploymentYaml, nil -} - -func manifestsKlusterletKlusterletWorkDeploymentYaml() (*asset, error) { - bytes, err := manifestsKlusterletKlusterletWorkDeploymentYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/klusterlet-work-deployment.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterletKlusterletWorkServiceaccountYaml = []byte(`apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ .KlusterletName }}-work-sa - namespace: {{ .KlusterletNamespace }} -imagePullSecrets: -- name: open-cluster-management-image-pull-credentials -`) - -func manifestsKlusterletKlusterletWorkServiceaccountYamlBytes() ([]byte, error) { - return _manifestsKlusterletKlusterletWorkServiceaccountYaml, nil -} - -func manifestsKlusterletKlusterletWorkServiceaccountYaml() (*asset, error) { - bytes, err := manifestsKlusterletKlusterletWorkServiceaccountYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterlet/klusterlet-work-serviceaccount.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %s not found", name) -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %s not found", name) -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ - "manifests/klusterlet/0000_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml": manifestsKlusterlet0000_01_workOpenClusterManagementIo_appliedmanifestworksCrdYaml, - "manifests/klusterlet/0000_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml": manifestsKlusterlet0000_02_clustersOpenClusterManagementIo_clusterclaimsCrdYaml, - "manifests/klusterlet/0001_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml": manifestsKlusterlet0001_01_workOpenClusterManagementIo_appliedmanifestworksCrdYaml, - "manifests/klusterlet/0001_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml": manifestsKlusterlet0001_02_clustersOpenClusterManagementIo_clusterclaimsCrdYaml, - "manifests/klusterlet/klusterlet-registration-clusterrole.yaml": manifestsKlusterletKlusterletRegistrationClusterroleYaml, - "manifests/klusterlet/klusterlet-registration-clusterrolebinding.yaml": manifestsKlusterletKlusterletRegistrationClusterrolebindingYaml, - "manifests/klusterlet/klusterlet-registration-deployment.yaml": manifestsKlusterletKlusterletRegistrationDeploymentYaml, - "manifests/klusterlet/klusterlet-registration-role.yaml": manifestsKlusterletKlusterletRegistrationRoleYaml, - "manifests/klusterlet/klusterlet-registration-rolebinding.yaml": manifestsKlusterletKlusterletRegistrationRolebindingYaml, - "manifests/klusterlet/klusterlet-registration-serviceaccount.yaml": manifestsKlusterletKlusterletRegistrationServiceaccountYaml, - "manifests/klusterlet/klusterlet-work-clusterrole.yaml": manifestsKlusterletKlusterletWorkClusterroleYaml, - "manifests/klusterlet/klusterlet-work-clusterrolebinding-addition.yaml": manifestsKlusterletKlusterletWorkClusterrolebindingAdditionYaml, - "manifests/klusterlet/klusterlet-work-clusterrolebinding.yaml": manifestsKlusterletKlusterletWorkClusterrolebindingYaml, - "manifests/klusterlet/klusterlet-work-deployment.yaml": manifestsKlusterletKlusterletWorkDeploymentYaml, - "manifests/klusterlet/klusterlet-work-serviceaccount.yaml": manifestsKlusterletKlusterletWorkServiceaccountYaml, -} - -// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} - -var _bintree = &bintree{nil, map[string]*bintree{ - "manifests": {nil, map[string]*bintree{ - "klusterlet": {nil, map[string]*bintree{ - "0000_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml": {manifestsKlusterlet0000_01_workOpenClusterManagementIo_appliedmanifestworksCrdYaml, map[string]*bintree{}}, - "0000_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml": {manifestsKlusterlet0000_02_clustersOpenClusterManagementIo_clusterclaimsCrdYaml, map[string]*bintree{}}, - "0001_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml": {manifestsKlusterlet0001_01_workOpenClusterManagementIo_appliedmanifestworksCrdYaml, map[string]*bintree{}}, - "0001_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml": {manifestsKlusterlet0001_02_clustersOpenClusterManagementIo_clusterclaimsCrdYaml, map[string]*bintree{}}, - "klusterlet-registration-clusterrole.yaml": {manifestsKlusterletKlusterletRegistrationClusterroleYaml, map[string]*bintree{}}, - "klusterlet-registration-clusterrolebinding.yaml": {manifestsKlusterletKlusterletRegistrationClusterrolebindingYaml, map[string]*bintree{}}, - "klusterlet-registration-deployment.yaml": {manifestsKlusterletKlusterletRegistrationDeploymentYaml, map[string]*bintree{}}, - "klusterlet-registration-role.yaml": {manifestsKlusterletKlusterletRegistrationRoleYaml, map[string]*bintree{}}, - "klusterlet-registration-rolebinding.yaml": {manifestsKlusterletKlusterletRegistrationRolebindingYaml, map[string]*bintree{}}, - "klusterlet-registration-serviceaccount.yaml": {manifestsKlusterletKlusterletRegistrationServiceaccountYaml, map[string]*bintree{}}, - "klusterlet-work-clusterrole.yaml": {manifestsKlusterletKlusterletWorkClusterroleYaml, map[string]*bintree{}}, - "klusterlet-work-clusterrolebinding-addition.yaml": {manifestsKlusterletKlusterletWorkClusterrolebindingAdditionYaml, map[string]*bintree{}}, - "klusterlet-work-clusterrolebinding.yaml": {manifestsKlusterletKlusterletWorkClusterrolebindingYaml, map[string]*bintree{}}, - "klusterlet-work-deployment.yaml": {manifestsKlusterletKlusterletWorkDeploymentYaml, map[string]*bintree{}}, - "klusterlet-work-serviceaccount.yaml": {manifestsKlusterletKlusterletWorkServiceaccountYaml, map[string]*bintree{}}, - }}, - }}, -}} - -// RestoreAsset restores an asset under the given directory -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil -} - -// RestoreAssets restores an asset under the given directory recursively -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) -} diff --git a/pkg/operators/klusterlet/controllers/klusterletcontroller/klusterlet_controller.go b/pkg/operators/klusterlet/controllers/klusterletcontroller/klusterlet_controller.go index d9c1b5710..2a9f0327a 100644 --- a/pkg/operators/klusterlet/controllers/klusterletcontroller/klusterlet_controller.go +++ b/pkg/operators/klusterlet/controllers/klusterletcontroller/klusterlet_controller.go @@ -4,7 +4,6 @@ import ( "context" "crypto/sha256" "fmt" - "path/filepath" "reflect" "strings" @@ -32,9 +31,8 @@ import ( operatorlister "open-cluster-management.io/api/client/operator/listers/operator/v1" workv1client "open-cluster-management.io/api/client/work/clientset/versioned/typed/work/v1" operatorapiv1 "open-cluster-management.io/api/operator/v1" + "open-cluster-management.io/registration-operator/manifests" "open-cluster-management.io/registration-operator/pkg/helpers" - "open-cluster-management.io/registration-operator/pkg/operators/klusterlet/bindata" - "open-cluster-management.io/registration-operator/pkg/operators/klusterlet/kube111bindata" ) const ( @@ -48,30 +46,30 @@ const ( var ( crdV1StaticFiles = []string{ - "manifests/klusterlet/0000_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml", - "manifests/klusterlet/0000_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml", + "klusterlet/0000_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml", + "klusterlet/0000_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml", } crdV1beta1StaticFiles = []string{ - "manifests/klusterlet/0001_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml", - "manifests/klusterlet/0001_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml", + "klusterlet/0001_01_work.open-cluster-management.io_appliedmanifestworks.crd.yaml", + "klusterlet/0001_02_clusters.open-cluster-management.io_clusterclaims.crd.yaml", } staticResourceFiles = []string{ - "manifests/klusterlet/klusterlet-registration-serviceaccount.yaml", - "manifests/klusterlet/klusterlet-registration-clusterrole.yaml", - "manifests/klusterlet/klusterlet-registration-clusterrolebinding.yaml", - "manifests/klusterlet/klusterlet-registration-role.yaml", - "manifests/klusterlet/klusterlet-registration-rolebinding.yaml", - "manifests/klusterlet/klusterlet-work-serviceaccount.yaml", - "manifests/klusterlet/klusterlet-work-clusterrole.yaml", - "manifests/klusterlet/klusterlet-work-clusterrolebinding.yaml", - "manifests/klusterlet/klusterlet-work-clusterrolebinding-addition.yaml", + "klusterlet/klusterlet-registration-serviceaccount.yaml", + "klusterlet/klusterlet-registration-clusterrole.yaml", + "klusterlet/klusterlet-registration-clusterrolebinding.yaml", + "klusterlet/klusterlet-registration-role.yaml", + "klusterlet/klusterlet-registration-rolebinding.yaml", + "klusterlet/klusterlet-work-serviceaccount.yaml", + "klusterlet/klusterlet-work-clusterrole.yaml", + "klusterlet/klusterlet-work-clusterrolebinding.yaml", + "klusterlet/klusterlet-work-clusterrolebinding-addition.yaml", } kube111StaticResourceFiles = []string{ - "manifests/klusterletkube111/klusterlet-registration-operator-clusterrolebinding.yaml", - "manifests/klusterletkube111/klusterlet-work-clusterrolebinding.yaml", + "klusterletkube111/klusterlet-registration-operator-clusterrolebinding.yaml", + "klusterletkube111/klusterlet-work-clusterrolebinding.yaml", } ) @@ -240,7 +238,11 @@ func (n *klusterletController) sync(ctx context.Context, controllerContext facto resourceapply.NewKubeClientHolder(n.kubeClient), controllerContext.Recorder(), func(name string) ([]byte, error) { - return assets.MustCreateAssetFromTemplate(name, kube111bindata.MustAsset(filepath.Join("", name)), config).Data, nil + template, err := manifests.Klusterlet111ManifestFiles.ReadFile(name) + if err != nil { + return nil, err + } + return assets.MustCreateAssetFromTemplate(name, template, config).Data, nil }, kube111StaticResourceFiles..., ) @@ -264,7 +266,11 @@ func (n *klusterletController) sync(ctx context.Context, controllerContext facto resourceapply.NewKubeClientHolder(n.kubeClient).WithAPIExtensionsClient(n.apiExtensionClient), controllerContext.Recorder(), func(name string) ([]byte, error) { - return assets.MustCreateAssetFromTemplate(name, bindata.MustAsset(filepath.Join("", name)), config).Data, nil + template, err := manifests.KlusterletManifestFiles.ReadFile(name) + if err != nil { + return nil, err + } + return assets.MustCreateAssetFromTemplate(name, template, config).Data, nil }, appliedStaticFiles..., ) @@ -318,10 +324,14 @@ func (n *klusterletController) sync(ctx context.Context, controllerContext facto klusterlet.Status.Generations, klusterlet.Spec.NodePlacement, func(name string) ([]byte, error) { - return assets.MustCreateAssetFromTemplate(name, bindata.MustAsset(filepath.Join("", name)), config).Data, nil + template, err := manifests.KlusterletManifestFiles.ReadFile(name) + if err != nil { + return nil, err + } + return assets.MustCreateAssetFromTemplate(name, template, config).Data, nil }, controllerContext.Recorder(), - "manifests/klusterlet/klusterlet-registration-deployment.yaml") + "klusterlet/klusterlet-registration-deployment.yaml") if err != nil { _, _, _ = helpers.UpdateKlusterletStatus(ctx, n.klusterletClient, klusterletName, helpers.UpdateKlusterletConditionFn(metav1.Condition{ Type: klusterletApplied, Status: metav1.ConditionFalse, Reason: "KlusterletApplyFailed", @@ -344,10 +354,14 @@ func (n *klusterletController) sync(ctx context.Context, controllerContext facto klusterlet.Status.Generations, klusterlet.Spec.NodePlacement, func(name string) ([]byte, error) { - return assets.MustCreateAssetFromTemplate(name, bindata.MustAsset(filepath.Join("", name)), config).Data, nil + template, err := manifests.KlusterletManifestFiles.ReadFile(name) + if err != nil { + return nil, err + } + return assets.MustCreateAssetFromTemplate(name, template, config).Data, nil }, controllerContext.Recorder(), - "manifests/klusterlet/klusterlet-work-deployment.yaml") + "klusterlet/klusterlet-work-deployment.yaml") if err != nil { _, _, _ = helpers.UpdateKlusterletStatus(ctx, n.klusterletClient, klusterletName, helpers.UpdateKlusterletConditionFn(metav1.Condition{ Type: klusterletApplied, Status: metav1.ConditionFalse, Reason: "KlusterletApplyFailed", @@ -414,7 +428,11 @@ func (n *klusterletController) cleanUp(ctx context.Context, controllerContext fa n.apiExtensionClient, nil, func(name string) ([]byte, error) { - return assets.MustCreateAssetFromTemplate(name, bindata.MustAsset(filepath.Join("", name)), config).Data, nil + template, err := manifests.KlusterletManifestFiles.ReadFile(name) + if err != nil { + return nil, err + } + return assets.MustCreateAssetFromTemplate(name, template, config).Data, nil }, file, ) @@ -434,7 +452,11 @@ func (n *klusterletController) cleanUp(ctx context.Context, controllerContext fa nil, nil, func(name string) ([]byte, error) { - return assets.MustCreateAssetFromTemplate(name, kube111bindata.MustAsset(filepath.Join("", name)), config).Data, nil + template, err := manifests.Klusterlet111ManifestFiles.ReadFile(name) + if err != nil { + return nil, err + } + return assets.MustCreateAssetFromTemplate(name, template, config).Data, nil }, file, ) @@ -472,7 +494,11 @@ func (n *klusterletController) cleanUp(ctx context.Context, controllerContext fa n.apiExtensionClient, nil, func(name string) ([]byte, error) { - return assets.MustCreateAssetFromTemplate(name, bindata.MustAsset(filepath.Join("", name)), config).Data, nil + template, err := manifests.KlusterletManifestFiles.ReadFile(name) + if err != nil { + return nil, err + } + return assets.MustCreateAssetFromTemplate(name, template, config).Data, nil }, file, ) diff --git a/pkg/operators/klusterlet/kube111bindata/bindata.go b/pkg/operators/klusterlet/kube111bindata/bindata.go deleted file mode 100644 index e1cf82517..000000000 --- a/pkg/operators/klusterlet/kube111bindata/bindata.go +++ /dev/null @@ -1,268 +0,0 @@ -// Code generated for package kube111bindata by go-bindata DO NOT EDIT. (@generated) -// sources: -// manifests/klusterletkube111/klusterlet-registration-operator-clusterrolebinding.yaml -// manifests/klusterletkube111/klusterlet-work-clusterrolebinding.yaml -package kube111bindata - -import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time" -) - -type asset struct { - bytes []byte - info os.FileInfo -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -// Name return file name -func (fi bindataFileInfo) Name() string { - return fi.name -} - -// Size return file size -func (fi bindataFileInfo) Size() int64 { - return fi.size -} - -// Mode return file mode -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} - -// Mode return file modify time -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} - -// IsDir return file whether a directory -func (fi bindataFileInfo) IsDir() bool { - return fi.mode&os.ModeDir != 0 -} - -// Sys return file is sys mode -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -var _manifestsKlusterletkube111KlusterletRegistrationOperatorClusterrolebindingYaml = []byte(`# Create the cluster rolebinding so klusterlet can deploy others -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: open-cluster-management:{{ .KlusterletName }}-registration-operator:operator-kube111 -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: cluster-admin -subjects: - - kind: ServiceAccount - name: klusterlet - namespace: {{ .OperatorNamespace }} -`) - -func manifestsKlusterletkube111KlusterletRegistrationOperatorClusterrolebindingYamlBytes() ([]byte, error) { - return _manifestsKlusterletkube111KlusterletRegistrationOperatorClusterrolebindingYaml, nil -} - -func manifestsKlusterletkube111KlusterletRegistrationOperatorClusterrolebindingYaml() (*asset, error) { - bytes, err := manifestsKlusterletkube111KlusterletRegistrationOperatorClusterrolebindingYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterletkube111/klusterlet-registration-operator-clusterrolebinding.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _manifestsKlusterletkube111KlusterletWorkClusterrolebindingYaml = []byte(`# create this clusterrolebinding so work agent is able to create any clusterrole -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: open-cluster-management:{{ .KlusterletName }}-work:agent-kube111 -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: cluster-admin -subjects: - - kind: ServiceAccount - name: {{ .KlusterletName }}-work-sa - namespace: {{ .KlusterletNamespace }} -`) - -func manifestsKlusterletkube111KlusterletWorkClusterrolebindingYamlBytes() ([]byte, error) { - return _manifestsKlusterletkube111KlusterletWorkClusterrolebindingYaml, nil -} - -func manifestsKlusterletkube111KlusterletWorkClusterrolebindingYaml() (*asset, error) { - bytes, err := manifestsKlusterletkube111KlusterletWorkClusterrolebindingYamlBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "manifests/klusterletkube111/klusterlet-work-clusterrolebinding.yaml", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %s not found", name) -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %s not found", name) -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ - "manifests/klusterletkube111/klusterlet-registration-operator-clusterrolebinding.yaml": manifestsKlusterletkube111KlusterletRegistrationOperatorClusterrolebindingYaml, - "manifests/klusterletkube111/klusterlet-work-clusterrolebinding.yaml": manifestsKlusterletkube111KlusterletWorkClusterrolebindingYaml, -} - -// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} - -var _bintree = &bintree{nil, map[string]*bintree{ - "manifests": {nil, map[string]*bintree{ - "klusterletkube111": {nil, map[string]*bintree{ - "klusterlet-registration-operator-clusterrolebinding.yaml": {manifestsKlusterletkube111KlusterletRegistrationOperatorClusterrolebindingYaml, map[string]*bintree{}}, - "klusterlet-work-clusterrolebinding.yaml": {manifestsKlusterletkube111KlusterletWorkClusterrolebindingYaml, map[string]*bintree{}}, - }}, - }}, -}} - -// RestoreAsset restores an asset under the given directory -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil -} - -// RestoreAssets restores an asset under the given directory recursively -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) -} diff --git a/vendor/github.com/go-bindata/go-bindata/.gitignore b/vendor/github.com/go-bindata/go-bindata/.gitignore deleted file mode 100644 index b9abe353d..000000000 --- a/vendor/github.com/go-bindata/go-bindata/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Goland project files -.idea/ -*.iml diff --git a/vendor/github.com/go-bindata/go-bindata/CONTRIBUTING.md b/vendor/github.com/go-bindata/go-bindata/CONTRIBUTING.md deleted file mode 100644 index e0732f54e..000000000 --- a/vendor/github.com/go-bindata/go-bindata/CONTRIBUTING.md +++ /dev/null @@ -1,79 +0,0 @@ -## Contribution guidelines. - -So you wish to contribute to this project? Fantastic! -Here are a few guidelines to help you do this in a -streamlined fashion. - - -## Bug reports - -When supplying a bug report, please consider the following guidelines. -These serve to make it easier for us to address the issue and find a solution. -Most of these are pretty self-evident, but sometimes it is still necessary -to reiterate them. - -* Be clear in the way you express the problem. Use simple language and - just enough of it to clearly define the issue. Not everyone is a native - English speaker. And while most can handle themselves pretty well, - it helps to stay away from more esoteric vocabulary. - - Be patient with non-native English speakers. If their bug reports - or comments are hard to understand, just ask for clarification. - Do not start guessing at their meaning, as this may just lead to - more confusion and misunderstandings. -* Clearly define any information which is relevant to the problem. - This includes library versions, operating system and any other - external dependencies which may be needed. -* Where applicable, provide a step-by-step listing of the way to - reproduce the problem. Make sure this is the simplest possible - way to do so. Omit any and all unneccesary steps, because they may - just complicate our understanding of the real problem. - If need be, create a whole new code project on your local machine, - which specifically tries to create the problem you are running into; - nothing more, nothing less. - - Include this program in the bug report. It often suffices to paste - the code in a [Gist](https://gist.github.com) or on the - [Go playground](http://play.golang.org). -* If possible, provide us with a listing of the steps you have already - undertaken to solve the problem. This can save us a great deal of - wasted time, trying out solutions you have already covered. - - -## Pull requests - -Bug reports are great. Supplying fixes to bugs is even better. -When submitting a pull request, the following guidelines are -good to keep in mind: - -* `go fmt`: **Always** run your code through `go fmt`, before - committing it. Code has to be readable by many different - people. And the only way this will be as painless as possible, - is if we all stick to the same code style. - - Some of our projects may have automated build-servers hooked up - to commit hooks. These will vet any submitted code and determine - if it meets a set of properties. One of which is code formatting. - These servers will outright deny a submission which has not been - run through `go fmt`, even if the code itself is correct. - - We try to maintain a zero-tolerance policy on this matter, - because consistently formatted code makes life a great deal - easier for everyone involved. -* Commit log messages: When committing changes, do so often and - clearly -- Even if you have changed only 1 character in a code - comment. This means that commit log messages should clearly state - exactly what the change does and why. If it fixes a known issue, - then mention the issue number in the commit log. E.g.: - - > Fixes return value for `foo/boo.Baz()` to be consistent with - > the rest of the API. This addresses issue #32 - - Do not pile a lot of unrelated changes into a single commit. - Pick and choose only those changes for a single commit, which are - directly related. We would much rather see a hundred commits - saying nothing but `"Runs go fmt"` in between any real fixes - than have these style changes embedded in those real fixes. - It creates a lot of noise when trying to review code. - - diff --git a/vendor/github.com/go-bindata/go-bindata/LICENSE b/vendor/github.com/go-bindata/go-bindata/LICENSE deleted file mode 100644 index c07a9311f..000000000 --- a/vendor/github.com/go-bindata/go-bindata/LICENSE +++ /dev/null @@ -1,3 +0,0 @@ -This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -license. Its contents can be found at: -http://creativecommons.org/publicdomain/zero/1.0 diff --git a/vendor/github.com/go-bindata/go-bindata/Makefile b/vendor/github.com/go-bindata/go-bindata/Makefile deleted file mode 100644 index 84b661cb2..000000000 --- a/vendor/github.com/go-bindata/go-bindata/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -all: - make -C testdata diff --git a/vendor/github.com/go-bindata/go-bindata/README.md b/vendor/github.com/go-bindata/go-bindata/README.md deleted file mode 100644 index 155350532..000000000 --- a/vendor/github.com/go-bindata/go-bindata/README.md +++ /dev/null @@ -1,199 +0,0 @@ -## bindata - -[![Go Report Card](https://goreportcard.com/badge/github.com/go-bindata/bindata)](https://goreportcard.com/report/github.com/go-bindata/bindata) - -This package converts any file into managable Go source code. Useful for -embedding binary data into a go program. The file data is optionally gzip -compressed before being converted to a raw byte slice. - -It comes with a command line tool in the `go-bindata` sub directory. -This tool offers a set of command line options, used to customize the -output being generated. - - -### Installation - -To install the library and command line program, use the following: - - go get -u github.com/go-bindata/go-bindata/... - - -### Usage - -Conversion is done on one or more sets of files. They are all embedded in a new -Go source file, along with a table of contents and an `Asset` function, -which allows quick access to the asset, based on its name. - -The simplest invocation generates a `bindata.go` file in the current -working directory. It includes all assets from the `data` directory. - - $ go-bindata data/ - -To include all input sub-directories recursively, use the elipsis postfix -as defined for Go import paths. Otherwise it will only consider assets in the -input directory itself. - - $ go-bindata data/... - -To specify the name of the output file being generated, we use the following: - - $ go-bindata -o myfile.go data/ - -Multiple input directories can be specified if necessary. - - $ go-bindata dir1/... /path/to/dir2/... dir3 - - -The following paragraphs detail some of the command line options which can be -supplied to `go-bindata`. Refer to the `testdata/out` directory for various -output examples from the assets in `testdata/in`. Each example uses different -command line options. - -To ignore files, pass in regexes using -ignore, for example: - - $ go-bindata -ignore=\\.gitignore data/... - -### Accessing an asset - -To access asset data, we use the `Asset(string) ([]byte, error)` function which -is included in the generated output. - - data, err := Asset("pub/style/foo.css") - if err != nil { - // Asset was not found. - } - - // use asset data - - -### Debug vs Release builds - -When invoking the program with the `-debug` flag, the generated code does -not actually include the asset data. Instead, it generates function stubs -which load the data from the original file on disk. The asset API remains -identical between debug and release builds, so your code will not have to -change. - -This is useful during development when you expect the assets to change often. -The host application using these assets uses the same API in both cases and -will not have to care where the actual data comes from. - -An example is a Go webserver with some embedded, static web content like -HTML, JS and CSS files. While developing it, you do not want to rebuild the -whole server and restart it every time you make a change to a bit of -javascript. You just want to build and launch the server once. Then just press -refresh in the browser to see those changes. Embedding the assets with the -`debug` flag allows you to do just that. When you are finished developing and -ready for deployment, just re-invoke `go-bindata` without the `-debug` flag. -It will now embed the latest version of the assets. - - -### Lower memory footprint - -Using the `-nomemcopy` flag, will alter the way the output file is generated. -It will employ a hack that allows us to read the file data directly from -the compiled program's `.rodata` section. This ensures that when we call -call our generated function, we omit unnecessary memcopies. - -The downside of this, is that it requires dependencies on the `reflect` and -`unsafe` packages. These may be restricted on platforms like AppEngine and -thus prevent you from using this mode. - -Another disadvantage is that the byte slice we create, is strictly read-only. -For most use-cases this is not a problem, but if you ever try to alter the -returned byte slice, a runtime panic is thrown. Use this mode only on target -platforms where memory constraints are an issue. - -The default behaviour is to use the old code generation method. This -prevents the two previously mentioned issues, but will employ at least one -extra memcopy and thus increase memory requirements. - -For instance, consider the following two examples: - -This would be the default mode, using an extra memcopy but gives a safe -implementation without dependencies on `reflect` and `unsafe`: - -```go -func myfile() []byte { - return []byte{0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a} -} -``` - -Here is the same functionality, but uses the `.rodata` hack. -The byte slice returned from this example can not be written to without -generating a runtime error. - -```go -var _myfile = "\x89\x50\x4e\x47\x0d\x0a\x1a" - -func myfile() []byte { - var empty [0]byte - sx := (*reflect.StringHeader)(unsafe.Pointer(&_myfile)) - b := empty[:] - bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bx.Data = sx.Data - bx.Len = len(_myfile) - bx.Cap = bx.Len - return b -} -``` - - -### Optional compression - -When the `-nocompress` flag is given, the supplied resource is *not* GZIP -compressed before being turned into Go code. The data should still be accessed -through a function call, so nothing changes in the usage of the generated file. - -This feature is useful if you do not care for compression, or the supplied -resource is already compressed. Doing it again would not add any value and may -even increase the size of the data. - -The default behaviour of the program is to use compression. - - -### Path prefix stripping - -The keys used in the `_bindata` map, are the same as the input file name -passed to `go-bindata`. This includes the path. In most cases, this is not -desireable, as it puts potentially sensitive information in your code base. -For this purpose, the tool supplies another command line flag `-prefix`. -This accepts a portion of a path name, which should be stripped off from -the map keys and function names. - -For example, running without the `-prefix` flag, we get: - - $ go-bindata /path/to/templates/ - - _bindata["/path/to/templates/foo.html"] = path_to_templates_foo_html - -Running with the `-prefix` flag, we get: - - $ go-bindata -prefix "/path/to/" /path/to/templates/ - - _bindata["templates/foo.html"] = templates_foo_html - - -### Build tags - -With the optional `-tags` flag, you can specify any go build tags that -must be fulfilled for the output file to be included in a build. This -is useful when including binary data in multiple formats, where the desired -format is specified at build time with the appropriate tags. - -The tags are appended to a `// +build` line in the beginning of the output file -and must follow the build tags syntax specified by the go tool. - -### Serve assets with `net/http` - -With the `-fs` flag, `go-bindata` will add an `AssetFile()` method returning an `http.FileSystem` interface: - - $ go-bindata -fs -prefix "static/" static/ - -Use `-prefix` flag to strip first level dir, then in your `net/http` router, you can use `AssetFile()` with `http.FileServer()` like: - -```go -mux := http.NewServeMux() -mux.Handle("/static", http.FileServer(AssetFile())) -http.ListenAndServe(":8080", mux) -``` diff --git a/vendor/github.com/go-bindata/go-bindata/_config.yml b/vendor/github.com/go-bindata/go-bindata/_config.yml deleted file mode 100644 index c4192631f..000000000 --- a/vendor/github.com/go-bindata/go-bindata/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-cayman \ No newline at end of file diff --git a/vendor/github.com/go-bindata/go-bindata/asset.go b/vendor/github.com/go-bindata/go-bindata/asset.go deleted file mode 100644 index 95b6b94f3..000000000 --- a/vendor/github.com/go-bindata/go-bindata/asset.go +++ /dev/null @@ -1,12 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -// Asset holds information about a single asset to be processed. -type Asset struct { - Path string // Full file path. - Name string // Key used in TOC -- name by which asset is referenced. - Func string // Function name for the procedure returning the asset contents. -} diff --git a/vendor/github.com/go-bindata/go-bindata/bytewriter.go b/vendor/github.com/go-bindata/go-bindata/bytewriter.go deleted file mode 100644 index 05d6d6780..000000000 --- a/vendor/github.com/go-bindata/go-bindata/bytewriter.go +++ /dev/null @@ -1,44 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "fmt" - "io" -) - -var ( - newline = []byte{'\n'} - dataindent = []byte{'\t', '\t'} - space = []byte{' '} -) - -type ByteWriter struct { - io.Writer - c int -} - -func (w *ByteWriter) Write(p []byte) (n int, err error) { - if len(p) == 0 { - return - } - - for n = range p { - if w.c%12 == 0 { - w.Writer.Write(newline) - w.Writer.Write(dataindent) - w.c = 0 - } else { - w.Writer.Write(space) - } - - fmt.Fprintf(w.Writer, "0x%02x,", p[n]) - w.c++ - } - - n++ - - return -} diff --git a/vendor/github.com/go-bindata/go-bindata/config.go b/vendor/github.com/go-bindata/go-bindata/config.go deleted file mode 100644 index 471c32f1b..000000000 --- a/vendor/github.com/go-bindata/go-bindata/config.go +++ /dev/null @@ -1,208 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "fmt" - "os" - "path/filepath" - "regexp" -) - -// InputConfig defines options on a asset directory to be convert. -type InputConfig struct { - // Path defines a directory containing asset files to be included - // in the generated output. - Path string - - // Recusive defines whether subdirectories of Path - // should be recursively included in the conversion. - Recursive bool -} - -// Config defines a set of options for the asset conversion. -type Config struct { - // Name of the package to use. Defaults to 'main'. - Package string - - // Tags specify a set of optional build tags, which should be - // included in the generated output. The tags are appended to a - // `// +build` line in the beginning of the output file - // and must follow the build tags syntax specified by the go tool. - Tags string - - // Input defines the directory path, containing all asset files as - // well as whether to recursively process assets in any sub directories. - Input []InputConfig - - // Output defines the output file for the generated code. - // If left empty, this defaults to 'bindata.go' in the current - // working directory. - Output string - - // Prefix defines a path prefix which should be stripped from all - // file names when generating the keys in the table of contents. - // For example, running without the `-prefix` flag, we get: - // - // $ go-bindata /path/to/templates - // go_bindata["/path/to/templates/foo.html"] = _path_to_templates_foo_html - // - // Running with the `-prefix` flag, we get: - // - // $ go-bindata -prefix "/path/to/" /path/to/templates/foo.html - // go_bindata["templates/foo.html"] = templates_foo_html - Prefix string - - // NoMemCopy will alter the way the output file is generated. - // - // It will employ a hack that allows us to read the file data directly from - // the compiled program's `.rodata` section. This ensures that when we call - // call our generated function, we omit unnecessary mem copies. - // - // The downside of this, is that it requires dependencies on the `reflect` and - // `unsafe` packages. These may be restricted on platforms like AppEngine and - // thus prevent you from using this mode. - // - // Another disadvantage is that the byte slice we create, is strictly read-only. - // For most use-cases this is not a problem, but if you ever try to alter the - // returned byte slice, a runtime panic is thrown. Use this mode only on target - // platforms where memory constraints are an issue. - // - // The default behaviour is to use the old code generation method. This - // prevents the two previously mentioned issues, but will employ at least one - // extra memcopy and thus increase memory requirements. - // - // For instance, consider the following two examples: - // - // This would be the default mode, using an extra memcopy but gives a safe - // implementation without dependencies on `reflect` and `unsafe`: - // - // func myfile() []byte { - // return []byte{0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a} - // } - // - // Here is the same functionality, but uses the `.rodata` hack. - // The byte slice returned from this example can not be written to without - // generating a runtime error. - // - // var _myfile = "\x89\x50\x4e\x47\x0d\x0a\x1a" - // - // func myfile() []byte { - // var empty [0]byte - // sx := (*reflect.StringHeader)(unsafe.Pointer(&_myfile)) - // b := empty[:] - // bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - // bx.Data = sx.Data - // bx.Len = len(_myfile) - // bx.Cap = bx.Len - // return b - // } - NoMemCopy bool - - // NoCompress means the assets are /not/ GZIP compressed before being turned - // into Go code. The generated function will automatically unzip - // the file data when called. Defaults to false. - NoCompress bool - - // HttpFileSystem means whether generate return http.FileSystem interface - // instance's function.When true,will generate relate code. - HttpFileSystem bool - - // Perform a debug build. This generates an asset file, which - // loads the asset contents directly from disk at their original - // location, instead of embedding the contents in the code. - // - // This is mostly useful if you anticipate that the assets are - // going to change during your development cycle. You will always - // want your code to access the latest version of the asset. - // Only in release mode, will the assets actually be embedded - // in the code. The default behaviour is Release mode. - Debug bool - - // Perform a dev build, which is nearly identical to the debug option. The - // only difference is that instead of absolute file paths in generated code, - // it expects a variable, `rootDir`, to be set in the generated code's - // package (the author needs to do this manually), which it then prepends to - // an asset's name to construct the file path on disk. - // - // This is mainly so you can push the generated code file to a shared - // repository. - Dev bool - - // When true, size, mode and modtime are not preserved from files - NoMetadata bool - // When nonzero, use this as mode for all files. - Mode uint - // When nonzero, use this as unix timestamp for all files. - ModTime int64 - - // Ignores any filenames matching the regex pattern specified, e.g. - // path/to/file.ext will ignore only that file, or \\.gitignore - // will match any .gitignore file. - // - // This parameter can be provided multiple times. - Ignore []*regexp.Regexp -} - -// NewConfig returns a default configuration struct. -func NewConfig() *Config { - c := new(Config) - c.Package = "main" - c.NoMemCopy = false - c.NoCompress = false - c.HttpFileSystem = false - c.Debug = false - c.Output = "./bindata.go" - c.Ignore = make([]*regexp.Regexp, 0) - return c -} - -// validate ensures the config has sane values. -// Part of which means checking if certain file/directory paths exist. -func (c *Config) validate() error { - if len(c.Package) == 0 { - return fmt.Errorf("Missing package name") - } - - for _, input := range c.Input { - _, err := os.Lstat(input.Path) - if err != nil { - return fmt.Errorf("Failed to stat input path '%s': %v", input.Path, err) - } - } - - if len(c.Output) == 0 { - cwd, err := os.Getwd() - if err != nil { - return fmt.Errorf("Unable to determine current working directory.") - } - - c.Output = filepath.Join(cwd, "bindata.go") - } - - stat, err := os.Lstat(c.Output) - if err != nil { - if !os.IsNotExist(err) { - return fmt.Errorf("Output path: %v", err) - } - - // File does not exist. This is fine, just make - // sure the directory it is to be in exists. - dir, _ := filepath.Split(c.Output) - if dir != "" { - err = os.MkdirAll(dir, 0744) - - if err != nil { - return fmt.Errorf("Create output directory: %v", err) - } - } - } - - if stat != nil && stat.IsDir() { - return fmt.Errorf("Output path is a directory.") - } - - return nil -} diff --git a/vendor/github.com/go-bindata/go-bindata/convert.go b/vendor/github.com/go-bindata/go-bindata/convert.go deleted file mode 100644 index 8660ee9f4..000000000 --- a/vendor/github.com/go-bindata/go-bindata/convert.go +++ /dev/null @@ -1,261 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "bufio" - "fmt" - "os" - "path/filepath" - "regexp" - "sort" - "strings" - "unicode" -) - -// Translate reads assets from an input directory, converts them -// to Go code and writes new files to the output specified -// in the given configuration. -func Translate(c *Config) error { - var toc []Asset - - // Ensure our configuration has sane values. - err := c.validate() - if err != nil { - return err - } - - var knownFuncs = make(map[string]int) - var visitedPaths = make(map[string]bool) - // Locate all the assets. - for _, input := range c.Input { - err = findFiles(input.Path, c.Prefix, input.Recursive, &toc, c.Ignore, knownFuncs, visitedPaths) - if err != nil { - return err - } - } - - // Create output file. - fd, err := os.Create(c.Output) - if err != nil { - return err - } - - defer fd.Close() - - // Create a buffered writer for better performance. - bfd := bufio.NewWriter(fd) - defer bfd.Flush() - - // Write the header. This makes e.g. Github ignore diffs in generated files. - if _, err = fmt.Fprintf(bfd, "// Code generated for package %s by go-bindata DO NOT EDIT. (@generated)\n", c.Package); err != nil { - return err - } - if _, err = fmt.Fprint(bfd, "// sources:\n"); err != nil { - return err - } - - wd, err := os.Getwd() - if err != nil { - return err - } - - for _, asset := range toc { - relative, _ := filepath.Rel(wd, asset.Path) - if _, err = fmt.Fprintf(bfd, "// %s\n", filepath.ToSlash(relative)); err != nil { - return err - } - } - //if _, err = fmt.Fprint(bfd, "// DO NOT EDIT!\n\n"); err != nil { - // return err - //} - - // Write build tags, if applicable. - if len(c.Tags) > 0 { - if _, err = fmt.Fprintf(bfd, "// +build %s\n\n", c.Tags); err != nil { - return err - } - } - - // Write package declaration. - _, err = fmt.Fprintf(bfd, "package %s\n\n", c.Package) - if err != nil { - return err - } - - // Write assets. - if c.Debug || c.Dev { - err = writeDebug(bfd, c, toc) - } else { - err = writeRelease(bfd, c, toc) - } - - if err != nil { - return err - } - - // Write table of contents - if err := writeTOC(bfd, toc); err != nil { - return err - } - // Write hierarchical tree of assets - if err := writeTOCTree(bfd, toc); err != nil { - return err - } - - // Write restore procedure - return writeRestore(bfd) -} - -// ByName implements sort.Interface for []os.FileInfo based on Name() -type ByName []os.FileInfo - -func (v ByName) Len() int { return len(v) } -func (v ByName) Swap(i, j int) { v[i], v[j] = v[j], v[i] } -func (v ByName) Less(i, j int) bool { return v[i].Name() < v[j].Name() } - -// findFiles recursively finds all the file paths in the given directory tree. -// They are added to the given map as keys. Values will be safe function names -// for each file, which will be used when generating the output code. -func findFiles(dir, prefix string, recursive bool, toc *[]Asset, ignore []*regexp.Regexp, knownFuncs map[string]int, visitedPaths map[string]bool) error { - dirpath := dir - if len(prefix) > 0 { - dirpath, _ = filepath.Abs(dirpath) - prefix, _ = filepath.Abs(prefix) - prefix = filepath.ToSlash(prefix) - } - - fi, err := os.Stat(dirpath) - if err != nil { - return err - } - - var list []os.FileInfo - - if !fi.IsDir() { - dirpath = filepath.Dir(dirpath) - list = []os.FileInfo{fi} - } else { - visitedPaths[dirpath] = true - fd, err := os.Open(dirpath) - if err != nil { - return err - } - - defer fd.Close() - - list, err = fd.Readdir(0) - if err != nil { - return err - } - - // Sort to make output stable between invocations - sort.Sort(ByName(list)) - } - - for _, file := range list { - var asset Asset - asset.Path = filepath.Join(dirpath, file.Name()) - asset.Name = filepath.ToSlash(asset.Path) - - ignoring := false - for _, re := range ignore { - if re.MatchString(asset.Path) { - ignoring = true - break - } - } - if ignoring { - continue - } - - if file.IsDir() { - if recursive { - recursivePath := filepath.Join(dir, file.Name()) - visitedPaths[asset.Path] = true - findFiles(recursivePath, prefix, recursive, toc, ignore, knownFuncs, visitedPaths) - } - continue - } else if file.Mode()&os.ModeSymlink == os.ModeSymlink { - var linkPath string - if linkPath, err = os.Readlink(asset.Path); err != nil { - return err - } - if !filepath.IsAbs(linkPath) { - if linkPath, err = filepath.Abs(dirpath + "/" + linkPath); err != nil { - return err - } - } - if _, ok := visitedPaths[linkPath]; !ok { - visitedPaths[linkPath] = true - findFiles(asset.Path, prefix, recursive, toc, ignore, knownFuncs, visitedPaths) - } - continue - } - - if strings.HasPrefix(asset.Name, prefix) { - asset.Name = asset.Name[len(prefix):] - } else { - asset.Name = filepath.Join(dir, file.Name()) - } - - // If we have a leading slash, get rid of it. - if len(asset.Name) > 0 && asset.Name[0] == '/' { - asset.Name = asset.Name[1:] - } - - // This shouldn't happen. - if len(asset.Name) == 0 { - return fmt.Errorf("Invalid file: %v", asset.Path) - } - - asset.Func = safeFunctionName(asset.Name, knownFuncs) - asset.Path, _ = filepath.Abs(asset.Path) - *toc = append(*toc, asset) - } - - return nil -} - -var regFuncName = regexp.MustCompile(`[^a-zA-Z0-9_]`) - -// safeFunctionName converts the given name into a name -// which qualifies as a valid function identifier. It -// also compares against a known list of functions to -// prevent conflict based on name translation. -func safeFunctionName(name string, knownFuncs map[string]int) string { - var inBytes, outBytes []byte - var toUpper bool - - name = strings.ToLower(name) - inBytes = []byte(name) - - for i := 0; i < len(inBytes); i++ { - if regFuncName.Match([]byte{inBytes[i]}) { - toUpper = true - } else if toUpper { - outBytes = append(outBytes, []byte(strings.ToUpper(string(inBytes[i])))...) - toUpper = false - } else { - outBytes = append(outBytes, inBytes[i]) - } - } - - name = string(outBytes) - - // Identifier can't start with a digit. - if unicode.IsDigit(rune(name[0])) { - name = "_" + name - } - - if num, ok := knownFuncs[name]; ok { - knownFuncs[name] = num + 1 - name = fmt.Sprintf("%s%d", name, num) - } else { - knownFuncs[name] = 2 - } - - return name -} diff --git a/vendor/github.com/go-bindata/go-bindata/debug.go b/vendor/github.com/go-bindata/go-bindata/debug.go deleted file mode 100644 index edb3270d6..000000000 --- a/vendor/github.com/go-bindata/go-bindata/debug.go +++ /dev/null @@ -1,108 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "fmt" - "io" -) - -// writeDebug writes the debug code file. -func writeDebug(w io.Writer, c *Config, toc []Asset) error { - err := writeDebugHeader(w, c) - if err != nil { - return err - } - - err = writeAssetFS(w, c) - if err != nil { - return err - } - - for i := range toc { - err = writeDebugAsset(w, c, &toc[i]) - if err != nil { - return err - } - } - - return nil -} - -// writeDebugHeader writes output file headers. -// This targets debug builds. -func writeDebugHeader(w io.Writer, c *Config) error { - var header string - - if c.HttpFileSystem { - header = `import ( - "bytes" - "net/http" - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time"` - } else { - header = `import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings"` - } - - _, err := fmt.Fprintf(w, `%s -) - -// bindataRead reads the given file from disk. It returns an error on failure. -func bindataRead(path, name string) ([]byte, error) { - buf, err := ioutil.ReadFile(path) - if err != nil { - err = fmt.Errorf("Error reading asset %%s at %%s: %%v", name, path, err) - } - return buf, err -} - -type asset struct { - bytes []byte - info os.FileInfo -} - -`, header) - return err -} - -// writeDebugAsset write a debug entry for the given asset. -// A debug entry is simply a function which reads the asset from -// the original file (e.g.: from disk). -func writeDebugAsset(w io.Writer, c *Config, asset *Asset) error { - pathExpr := fmt.Sprintf("%q", asset.Path) - if c.Dev { - pathExpr = fmt.Sprintf("filepath.Join(rootDir, %q)", asset.Name) - } - - _, err := fmt.Fprintf(w, `// %s reads file data from disk. It returns an error on failure. -func %s() (*asset, error) { - path := %s - name := %q - bytes, err := bindataRead(path, name) - if err != nil { - return nil, err - } - - fi, err := os.Stat(path) - if err != nil { - err = fmt.Errorf("Error reading asset info %%s at %%s: %%v", name, path, err) - } - - a := &asset{bytes: bytes, info: fi} - return a, err -} - -`, asset.Func, asset.Func, pathExpr, asset.Name) - return err -} diff --git a/vendor/github.com/go-bindata/go-bindata/doc.go b/vendor/github.com/go-bindata/go-bindata/doc.go deleted file mode 100644 index 09ead1e3b..000000000 --- a/vendor/github.com/go-bindata/go-bindata/doc.go +++ /dev/null @@ -1,129 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -/* -bindata converts any file into managable Go source code. Useful for -embedding binary data into a go program. The file data is optionally gzip -compressed before being converted to a raw byte slice. - -The following paragraphs cover some of the customization options -which can be specified in the Config struct, which must be passed into -the Translate() call. - - -Debug vs Release builds - -When used with the `Debug` option, the generated code does not actually include -the asset data. Instead, it generates function stubs which load the data from -the original file on disk. The asset API remains identical between debug and -release builds, so your code will not have to change. - -This is useful during development when you expect the assets to change often. -The host application using these assets uses the same API in both cases and -will not have to care where the actual data comes from. - -An example is a Go webserver with some embedded, static web content like -HTML, JS and CSS files. While developing it, you do not want to rebuild the -whole server and restart it every time you make a change to a bit of -javascript. You just want to build and launch the server once. Then just press -refresh in the browser to see those changes. Embedding the assets with the -`debug` flag allows you to do just that. When you are finished developing and -ready for deployment, just re-invoke `go-bindata` without the `-debug` flag. -It will now embed the latest version of the assets. - - -Lower memory footprint - -The `NoMemCopy` option will alter the way the output file is generated. -It will employ a hack that allows us to read the file data directly from -the compiled program's `.rodata` section. This ensures that when we call -call our generated function, we omit unnecessary memcopies. - -The downside of this, is that it requires dependencies on the `reflect` and -`unsafe` packages. These may be restricted on platforms like AppEngine and -thus prevent you from using this mode. - -Another disadvantage is that the byte slice we create, is strictly read-only. -For most use-cases this is not a problem, but if you ever try to alter the -returned byte slice, a runtime panic is thrown. Use this mode only on target -platforms where memory constraints are an issue. - -The default behaviour is to use the old code generation method. This -prevents the two previously mentioned issues, but will employ at least one -extra memcopy and thus increase memory requirements. - -For instance, consider the following two examples: - -This would be the default mode, using an extra memcopy but gives a safe -implementation without dependencies on `reflect` and `unsafe`: - - func myfile() []byte { - return []byte{0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a} - } - -Here is the same functionality, but uses the `.rodata` hack. -The byte slice returned from this example can not be written to without -generating a runtime error. - - var _myfile = "\x89\x50\x4e\x47\x0d\x0a\x1a" - - func myfile() []byte { - var empty [0]byte - sx := (*reflect.StringHeader)(unsafe.Pointer(&_myfile)) - b := empty[:] - bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bx.Data = sx.Data - bx.Len = len(_myfile) - bx.Cap = bx.Len - return b - } - - -Optional compression - -The NoCompress option indicates that the supplied assets are *not* GZIP -compressed before being turned into Go code. The data should still be accessed -through a function call, so nothing changes in the API. - -This feature is useful if you do not care for compression, or the supplied -resource is already compressed. Doing it again would not add any value and may -even increase the size of the data. - -The default behaviour of the program is to use compression. - - -Path prefix stripping - -The keys used in the `_bindata` map are the same as the input file name -passed to `go-bindata`. This includes the path. In most cases, this is not -desireable, as it puts potentially sensitive information in your code base. -For this purpose, the tool supplies another command line flag `-prefix`. -This accepts a portion of a path name, which should be stripped off from -the map keys and function names. - -For example, running without the `-prefix` flag, we get: - - $ go-bindata /path/to/templates/ - - _bindata["/path/to/templates/foo.html"] = path_to_templates_foo_html - -Running with the `-prefix` flag, we get: - - $ go-bindata -prefix "/path/to/" /path/to/templates/ - - _bindata["templates/foo.html"] = templates_foo_html - - -Build tags - -With the optional Tags field, you can specify any go build tags that -must be fulfilled for the output file to be included in a build. This -is useful when including binary data in multiple formats, where the desired -format is specified at build time with the appropriate tags. - -The tags are appended to a `// +build` line in the beginning of the output file -and must follow the build tags syntax specified by the go tool. - -*/ -package bindata diff --git a/vendor/github.com/go-bindata/go-bindata/file.go b/vendor/github.com/go-bindata/go-bindata/file.go deleted file mode 100644 index 8c83926c8..000000000 --- a/vendor/github.com/go-bindata/go-bindata/file.go +++ /dev/null @@ -1,102 +0,0 @@ -package bindata - -import ( - "fmt" - "io" -) - -func writeAssetFS(w io.Writer, c *Config) error { - if !c.HttpFileSystem { - return nil - } - - _, err := fmt.Fprintf(w, ` -type assetFile struct { - *bytes.Reader - name string - childInfos []os.FileInfo - childInfoOffset int -} - -type assetOperator struct{} - -// Open implement http.FileSystem interface -func (f *assetOperator) Open(name string) (http.File, error) { - var err error - if len(name) > 0 && name[0] == '/' { - name = name[1:] - } - content, err := Asset(name) - if err == nil { - return &assetFile{name: name, Reader: bytes.NewReader(content)}, nil - } - children, err := AssetDir(name) - if err == nil { - childInfos := make([]os.FileInfo, 0, len(children)) - for _, child := range children { - childPath := filepath.Join(name, child) - info, errInfo := AssetInfo(filepath.Join(name, child)) - if errInfo == nil { - childInfos = append(childInfos, info) - } else { - childInfos = append(childInfos, newDirFileInfo(childPath)) - } - } - return &assetFile{name: name, childInfos: childInfos}, nil - } else { - // If the error is not found, return an error that will - // result in a 404 error. Otherwise the server returns - // a 500 error for files not found. - if strings.Contains(err.Error(), "not found") { - return nil, os.ErrNotExist - } - return nil, err - } -} - -// Close no need do anything -func (f *assetFile) Close() error { - return nil -} - -// Readdir read dir's children file info -func (f *assetFile) Readdir(count int) ([]os.FileInfo, error) { - if len(f.childInfos) == 0 { - return nil, os.ErrNotExist - } - if count <= 0 { - return f.childInfos, nil - } - if f.childInfoOffset+count > len(f.childInfos) { - count = len(f.childInfos) - f.childInfoOffset - } - offset := f.childInfoOffset - f.childInfoOffset += count - return f.childInfos[offset : offset+count], nil -} - -// Stat read file info from asset item -func (f *assetFile) Stat() (os.FileInfo, error) { - if len(f.childInfos) != 0 { - return newDirFileInfo(f.name), nil - } - return AssetInfo(f.name) -} - -// newDirFileInfo return default dir file info -func newDirFileInfo(name string) os.FileInfo { - return &bindataFileInfo{ - name: name, - size: 0, - mode: os.FileMode(2147484068), // equal os.FileMode(0644)|os.ModeDir - modTime: time.Time{}} -} - -// AssetFile return a http.FileSystem instance that data backend by asset -func AssetFile() http.FileSystem { - return &assetOperator{} -} - -`) - return err -} diff --git a/vendor/github.com/go-bindata/go-bindata/go-bindata/.gitignore b/vendor/github.com/go-bindata/go-bindata/go-bindata/.gitignore deleted file mode 100644 index 099edf6f9..000000000 --- a/vendor/github.com/go-bindata/go-bindata/go-bindata/.gitignore +++ /dev/null @@ -1 +0,0 @@ -go-bindata diff --git a/vendor/github.com/go-bindata/go-bindata/go-bindata/AppendSliceValue.go b/vendor/github.com/go-bindata/go-bindata/go-bindata/AppendSliceValue.go deleted file mode 100644 index f5da49596..000000000 --- a/vendor/github.com/go-bindata/go-bindata/go-bindata/AppendSliceValue.go +++ /dev/null @@ -1,22 +0,0 @@ -package main - -import "strings" - -// borrowed from https://github.com/hashicorp/serf/blob/master/command/agent/flag_slice_value.go - -// AppendSliceValue implements the flag.Value interface and allows multiple -// calls to the same variable to append a list. -type AppendSliceValue []string - -func (s *AppendSliceValue) String() string { - return strings.Join(*s, ",") -} - -func (s *AppendSliceValue) Set(value string) error { - if *s == nil { - *s = make([]string, 0, 1) - } - - *s = append(*s, value) - return nil -} diff --git a/vendor/github.com/go-bindata/go-bindata/go-bindata/main.go b/vendor/github.com/go-bindata/go-bindata/go-bindata/main.go deleted file mode 100644 index f0155a5d0..000000000 --- a/vendor/github.com/go-bindata/go-bindata/go-bindata/main.go +++ /dev/null @@ -1,108 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package main - -import ( - "flag" - "fmt" - "os" - "path/filepath" - "regexp" - "strings" - - "github.com/go-bindata/go-bindata" -) - -func main() { - cfg := parseArgs() - err := bindata.Translate(cfg) - - if err != nil { - fmt.Fprintf(os.Stderr, "bindata: %v\n", err) - os.Exit(1) - } -} - -// parseArgs create s a new, filled configuration instance -// by reading and parsing command line options. -// -// This function exits the program with an error, if -// any of the command line options are incorrect. -func parseArgs() *bindata.Config { - var version bool - - c := bindata.NewConfig() - - flag.Usage = func() { - fmt.Printf("Usage: %s [options] \n\n", os.Args[0]) - flag.PrintDefaults() - } - - flag.BoolVar(&c.Debug, "debug", c.Debug, "Do not embed the assets, but provide the embedding API. Contents will still be loaded from disk.") - flag.BoolVar(&c.Dev, "dev", c.Dev, "Similar to debug, but does not emit absolute paths. Expects a rootDir variable to already exist in the generated code's package.") - flag.StringVar(&c.Tags, "tags", c.Tags, "Optional set of build tags to include.") - flag.StringVar(&c.Prefix, "prefix", c.Prefix, "Optional path prefix to strip off asset names.") - flag.StringVar(&c.Package, "pkg", c.Package, "Package name to use in the generated code.") - flag.BoolVar(&c.NoMemCopy, "nomemcopy", c.NoMemCopy, "Use a .rodata hack to get rid of unnecessary memcopies. Refer to the documentation to see what implications this carries.") - flag.BoolVar(&c.NoCompress, "nocompress", c.NoCompress, "Assets will *not* be GZIP compressed when this flag is specified.") - flag.BoolVar(&c.NoMetadata, "nometadata", c.NoMetadata, "Assets will not preserve size, mode, and modtime info.") - flag.BoolVar(&c.HttpFileSystem, "fs", c.HttpFileSystem, "Whether generate instance http.FileSystem interface code.") - flag.UintVar(&c.Mode, "mode", c.Mode, "Optional file mode override for all files.") - flag.Int64Var(&c.ModTime, "modtime", c.ModTime, "Optional modification unix timestamp override for all files.") - flag.StringVar(&c.Output, "o", c.Output, "Optional name of the output file to be generated.") - flag.BoolVar(&version, "version", false, "Displays version information.") - - ignore := make([]string, 0) - flag.Var((*AppendSliceValue)(&ignore), "ignore", "Regex pattern to ignore") - - flag.Parse() - - patterns := make([]*regexp.Regexp, 0) - for _, pattern := range ignore { - patterns = append(patterns, regexp.MustCompile(pattern)) - } - c.Ignore = patterns - - if version { - fmt.Printf("%s\n", Version()) - os.Exit(0) - } - - // Make sure we have input paths. - if flag.NArg() == 0 { - fmt.Fprintf(os.Stderr, "Missing \n\n") - flag.Usage() - os.Exit(1) - } - - // Create input configurations. - c.Input = make([]bindata.InputConfig, flag.NArg()) - for i := range c.Input { - c.Input[i] = parseInput(flag.Arg(i)) - } - - return c -} - -// parseRecursive determines whether the given path has a recrusive indicator and -// returns a new path with the recursive indicator chopped off if it does. -// -// ex: -// /path/to/foo/... -> (/path/to/foo, true) -// /path/to/bar -> (/path/to/bar, false) -func parseInput(path string) bindata.InputConfig { - if strings.HasSuffix(path, "/...") { - return bindata.InputConfig{ - Path: filepath.Clean(path[:len(path)-4]), - Recursive: true, - } - } else { - return bindata.InputConfig{ - Path: filepath.Clean(path), - Recursive: false, - } - } - -} diff --git a/vendor/github.com/go-bindata/go-bindata/go-bindata/version.go b/vendor/github.com/go-bindata/go-bindata/go-bindata/version.go deleted file mode 100644 index 5a4cfb794..000000000 --- a/vendor/github.com/go-bindata/go-bindata/go-bindata/version.go +++ /dev/null @@ -1,31 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package main - -import ( - "fmt" - "runtime" -) - -const ( - AppName = "go-bindata" - AppVersionMajor = 3 - AppVersionMinor = 1 -) - -// revision part of the program version. -// This will be set automatically at build time like so: -// -// go build -ldflags "-X main.AppVersionRev `date -u +%s`" -var AppVersionRev string - -func Version() string { - if len(AppVersionRev) == 0 { - AppVersionRev = "2" - } - - return fmt.Sprintf("%s %d.%d.%s (Go runtime %s).\nCopyright (c) 2010-2013, Jim Teeuwen.", - AppName, AppVersionMajor, AppVersionMinor, AppVersionRev, runtime.Version()) -} diff --git a/vendor/github.com/go-bindata/go-bindata/release.go b/vendor/github.com/go-bindata/go-bindata/release.go deleted file mode 100644 index d1bef160f..000000000 --- a/vendor/github.com/go-bindata/go-bindata/release.go +++ /dev/null @@ -1,473 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "io/ioutil" - "os" - "unicode/utf8" -) - -// writeRelease writes the release code file. -func writeRelease(w io.Writer, c *Config, toc []Asset) error { - err := writeReleaseHeader(w, c) - if err != nil { - return err - } - - err = writeAssetFS(w, c) - if err != nil { - return err - } - - for i := range toc { - err = writeReleaseAsset(w, c, &toc[i]) - if err != nil { - return err - } - } - - return nil -} - -// writeReleaseHeader writes output file headers. -// This targets release builds. -func writeReleaseHeader(w io.Writer, c *Config) error { - var err error - if c.NoCompress { - if c.NoMemCopy { - err = header_uncompressed_nomemcopy(w, c) - } else { - err = header_uncompressed_memcopy(w, c) - } - } else { - if c.NoMemCopy { - err = header_compressed_nomemcopy(w, c) - } else { - err = header_compressed_memcopy(w, c) - } - } - if err != nil { - return err - } - return header_release_common(w) -} - -// writeReleaseAsset write a release entry for the given asset. -// A release entry is a function which embeds and returns -// the file's byte content. -func writeReleaseAsset(w io.Writer, c *Config, asset *Asset) error { - fd, err := os.Open(asset.Path) - if err != nil { - return err - } - - defer fd.Close() - - if c.NoCompress { - if c.NoMemCopy { - err = uncompressed_nomemcopy(w, asset, fd) - } else { - err = uncompressed_memcopy(w, asset, fd) - } - } else { - if c.NoMemCopy { - err = compressed_nomemcopy(w, asset, fd) - } else { - err = compressed_memcopy(w, asset, fd) - } - } - if err != nil { - return err - } - return asset_release_common(w, c, asset) -} - -// sanitize prepares a valid UTF-8 string as a raw string constant. -// Based on https://code.google.com/p/go/source/browse/godoc/static/makestatic.go?repo=tools -func sanitize(b []byte) []byte { - // Replace ` with `+"`"+` - b = bytes.Replace(b, []byte("`"), []byte("`+\"`\"+`"), -1) - - // Replace BOM with `+"\xEF\xBB\xBF"+` - // (A BOM is valid UTF-8 but not permitted in Go source files. - // I wouldn't bother handling this, but for some insane reason - // jquery.js has a BOM somewhere in the middle.) - return bytes.Replace(b, []byte("\xEF\xBB\xBF"), []byte("`+\"\\xEF\\xBB\\xBF\"+`"), -1) -} - -func header_compressed_nomemcopy(w io.Writer, c *Config) error { - var header string - - if c.HttpFileSystem { - header = `import ( - "bytes" - "compress/gzip" - "fmt" - "net/http" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time"` - } else { - header = `import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time"` - } - - _, err := fmt.Fprintf(w, `%s -) - -func bindataRead(data, name string) ([]byte, error) { - gz, err := gzip.NewReader(strings.NewReader(data)) - if err != nil { - return nil, fmt.Errorf("Read %%q: %%v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - clErr := gz.Close() - - if err != nil { - return nil, fmt.Errorf("Read %%q: %%v", name, err) - } - if clErr != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -`, header) - return err -} - -func header_compressed_memcopy(w io.Writer, c *Config) error { - var header string - - if c.HttpFileSystem { - header = `import ( - "bytes" - "compress/gzip" - "fmt" - "net/http" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time"` - } else { - header = `import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time"` - } - - _, err := fmt.Fprintf(w, `%s -) - -func bindataRead(data []byte, name string) ([]byte, error) { - gz, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - return nil, fmt.Errorf("Read %%q: %%v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - clErr := gz.Close() - - if err != nil { - return nil, fmt.Errorf("Read %%q: %%v", name, err) - } - if clErr != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -`, header) - return err -} - -func header_uncompressed_nomemcopy(w io.Writer, c *Config) error { - var header string - - if c.HttpFileSystem { - header = `import ( - "bytes" - "fmt" - "net/http" - "io/ioutil" - "os" - "path/filepath" - "reflect" - "strings" - "time" - "unsafe"` - } else { - header = `import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "reflect" - "strings" - "time" - "unsafe"` - } - - _, err := fmt.Fprintf(w, `%s -) - -func bindataRead(data, name string) ([]byte, error) { - var empty [0]byte - sx := (*reflect.StringHeader)(unsafe.Pointer(&data)) - b := empty[:] - bx := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - bx.Data = sx.Data - bx.Len = len(data) - bx.Cap = bx.Len - return b, nil -} - -`, header) - return err -} - -func header_uncompressed_memcopy(w io.Writer, c *Config) error { - var header string - - if c.HttpFileSystem { - header = `import ( - "bytes" - "fmt" - "net/http" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time"` - } else { - header = `import ( - "fmt" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time"` - } - - _, err := fmt.Fprintf(w, `%s -) -`, header) - return err -} - -func header_release_common(w io.Writer) error { - _, err := fmt.Fprintf(w, `type asset struct { - bytes []byte - info os.FileInfo -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -// Name return file name -func (fi bindataFileInfo) Name() string { - return fi.name -} - -// Size return file size -func (fi bindataFileInfo) Size() int64 { - return fi.size -} - -// Mode return file mode -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} - -// Mode return file modify time -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} - -// IsDir return file whether a directory -func (fi bindataFileInfo) IsDir() bool { - return fi.mode&os.ModeDir != 0 -} - -// Sys return file is sys mode -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -`) - return err -} - -func compressed_nomemcopy(w io.Writer, asset *Asset, r io.Reader) error { - _, err := fmt.Fprintf(w, `var _%s = "`, asset.Func) - if err != nil { - return err - } - - gz := gzip.NewWriter(&StringWriter{Writer: w}) - _, err = io.Copy(gz, r) - gz.Close() - - if err != nil { - return err - } - - _, err = fmt.Fprintf(w, `" - -func %sBytes() ([]byte, error) { - return bindataRead( - _%s, - %q, - ) -} - -`, asset.Func, asset.Func, asset.Name) - return err -} - -func compressed_memcopy(w io.Writer, asset *Asset, r io.Reader) error { - _, err := fmt.Fprintf(w, `var _%s = []byte("`, asset.Func) - if err != nil { - return err - } - - gz := gzip.NewWriter(&StringWriter{Writer: w}) - _, err = io.Copy(gz, r) - gz.Close() - - if err != nil { - return err - } - - _, err = fmt.Fprintf(w, `") - -func %sBytes() ([]byte, error) { - return bindataRead( - _%s, - %q, - ) -} - -`, asset.Func, asset.Func, asset.Name) - return err -} - -func uncompressed_nomemcopy(w io.Writer, asset *Asset, r io.Reader) error { - _, err := fmt.Fprintf(w, `var _%s = "`, asset.Func) - if err != nil { - return err - } - - _, err = io.Copy(&StringWriter{Writer: w}, r) - if err != nil { - return err - } - - _, err = fmt.Fprintf(w, `" - -func %sBytes() ([]byte, error) { - return bindataRead( - _%s, - %q, - ) -} - -`, asset.Func, asset.Func, asset.Name) - return err -} - -func uncompressed_memcopy(w io.Writer, asset *Asset, r io.Reader) error { - _, err := fmt.Fprintf(w, `var _%s = []byte(`, asset.Func) - if err != nil { - return err - } - - b, err := ioutil.ReadAll(r) - if err != nil { - return err - } - if utf8.Valid(b) && !bytes.Contains(b, []byte{0}) { - fmt.Fprintf(w, "`%s`", sanitize(b)) - } else { - fmt.Fprintf(w, "%+q", b) - } - - _, err = fmt.Fprintf(w, `) - -func %sBytes() ([]byte, error) { - return _%s, nil -} - -`, asset.Func, asset.Func) - return err -} - -func asset_release_common(w io.Writer, c *Config, asset *Asset) error { - fi, err := os.Stat(asset.Path) - if err != nil { - return err - } - - mode := uint(fi.Mode()) - modTime := fi.ModTime().Unix() - size := fi.Size() - if c.NoMetadata { - mode = 0 - modTime = 0 - size = 0 - } - if c.Mode > 0 { - mode = uint(os.ModePerm) & c.Mode - } - if c.ModTime > 0 { - modTime = c.ModTime - } - _, err = fmt.Fprintf(w, `func %s() (*asset, error) { - bytes, err := %sBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: %q, size: %d, mode: os.FileMode(%d), modTime: time.Unix(%d, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -`, asset.Func, asset.Func, asset.Name, size, mode, modTime) - return err -} diff --git a/vendor/github.com/go-bindata/go-bindata/restore.go b/vendor/github.com/go-bindata/go-bindata/restore.go deleted file mode 100644 index 268ec7464..000000000 --- a/vendor/github.com/go-bindata/go-bindata/restore.go +++ /dev/null @@ -1,62 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "fmt" - "io" -) - -func writeRestore(w io.Writer) error { - _, err := fmt.Fprintf(w, ` -// RestoreAsset restores an asset under the given directory -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil -} - -// RestoreAssets restores an asset under the given directory recursively -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) -} -`) - return err -} diff --git a/vendor/github.com/go-bindata/go-bindata/stringwriter.go b/vendor/github.com/go-bindata/go-bindata/stringwriter.go deleted file mode 100644 index 77daa04cb..000000000 --- a/vendor/github.com/go-bindata/go-bindata/stringwriter.go +++ /dev/null @@ -1,36 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "io" -) - -const lowerHex = "0123456789abcdef" - -type StringWriter struct { - io.Writer - c int -} - -func (w *StringWriter) Write(p []byte) (n int, err error) { - if len(p) == 0 { - return - } - - buf := []byte(`\x00`) - var b byte - - for n, b = range p { - buf[2] = lowerHex[b/16] - buf[3] = lowerHex[b%16] - w.Writer.Write(buf) - w.c++ - } - - n++ - - return -} diff --git a/vendor/github.com/go-bindata/go-bindata/toc.go b/vendor/github.com/go-bindata/go-bindata/toc.go deleted file mode 100644 index be4a01654..000000000 --- a/vendor/github.com/go-bindata/go-bindata/toc.go +++ /dev/null @@ -1,288 +0,0 @@ -// This work is subject to the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication -// license. Its contents can be found at: -// http://creativecommons.org/publicdomain/zero/1.0/ - -package bindata - -import ( - "fmt" - "io" - "sort" - "strings" -) - -type assetTree struct { - Asset Asset - Children map[string]*assetTree -} - -func newAssetTree() *assetTree { - tree := &assetTree{} - tree.Children = make(map[string]*assetTree) - return tree -} - -func (node *assetTree) child(name string) *assetTree { - rv, ok := node.Children[name] - if !ok { - rv = newAssetTree() - node.Children[name] = rv - } - return rv -} - -func (root *assetTree) Add(route []string, asset Asset) { - for _, name := range route { - root = root.child(name) - } - root.Asset = asset -} - -func ident(w io.Writer, n int) { - for i := 0; i < n; i++ { - w.Write([]byte{'\t'}) - } -} - -func (root *assetTree) funcOrNil() string { - if root.Asset.Func == "" { - return "nil" - } else { - return root.Asset.Func - } -} - -func getFillerSize(tokenIndex int, lengths []int, nident int) int { - var ( - curlen int = lengths[tokenIndex] - maxlen int = 0 - substart int = 0 - subend int = 0 - spacediff int = 0 - ) - - if curlen > 0 { - substart = tokenIndex - for (substart-1) >= 0 && lengths[substart-1] > 0 { - substart -= 1 - } - - subend = tokenIndex - for (subend+1) < len(lengths) && lengths[subend+1] > 0 { - subend += 1 - } - - var candidate int - for j := substart; j <= subend; j += 1 { - candidate = lengths[j] - if candidate > maxlen { - maxlen = candidate - } - } - - spacediff = maxlen - curlen - } - - return spacediff -} - -func (root *assetTree) writeGoMap(w io.Writer, nident int) { - fmt.Fprintf(w, "&bintree{%s, map[string]*bintree{", root.funcOrNil()) - - if len(root.Children) > 0 { - io.WriteString(w, "\n") - - // Sort to make output stable between invocations - filenames := make([]string, len(root.Children)) - hasChildren := make(map[string]bool) - i := 0 - for filename, node := range root.Children { - filenames[i] = filename - hasChildren[filename] = len(node.Children) > 0 - i++ - } - sort.Strings(filenames) - - lengths := make([]int, len(root.Children)) - for i, filename := range filenames { - if hasChildren[filename] { - lengths[i] = 0 - } else { - lengths[i] = len(filename) - } - } - - for i, p := range filenames { - ident(w, nident+1) - filler := strings.Repeat(" ", getFillerSize(i, lengths, nident)) - fmt.Fprintf(w, `"%s": %s`, p, filler) - root.Children[p].writeGoMap(w, nident+1) - } - ident(w, nident) - } - - io.WriteString(w, "}}") - if nident > 0 { - io.WriteString(w, ",") - } - io.WriteString(w, "\n") -} - -func (root *assetTree) WriteAsGoMap(w io.Writer) error { - _, err := fmt.Fprint(w, `type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} - -var _bintree = `) - root.writeGoMap(w, 0) - return err -} - -func writeTOCTree(w io.Writer, toc []Asset) error { - _, err := fmt.Fprintf(w, `// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %%s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %%s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -`) - if err != nil { - return err - } - tree := newAssetTree() - for i := range toc { - pathList := strings.Split(toc[i].Name, "/") - tree.Add(pathList, toc[i]) - } - return tree.WriteAsGoMap(w) -} - -// writeTOC writes the table of contents file. -func writeTOC(w io.Writer, toc []Asset) error { - err := writeTOCHeader(w) - if err != nil { - return err - } - - var maxlen = 0 - for i := range toc { - l := len(toc[i].Name) - if l > maxlen { - maxlen = l - } - } - - for i := range toc { - err = writeTOCAsset(w, &toc[i], maxlen) - if err != nil { - return err - } - } - - return writeTOCFooter(w) -} - -// writeTOCHeader writes the table of contents file header. -func writeTOCHeader(w io.Writer) error { - _, err := fmt.Fprintf(w, `// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %%s can't read by error: %%v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %%s not found", name) -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %%s can't read by error: %%v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %%s not found", name) -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ -`) - return err -} - -// writeTOCAsset write a TOC entry for the given asset. -func writeTOCAsset(w io.Writer, asset *Asset, maxlen int) error { - spacediff := maxlen - len(asset.Name) - filler := strings.Repeat(" ", spacediff) - - _, err := fmt.Fprintf(w, "\t%q: %s%s,\n", asset.Name, filler, asset.Func) - return err -} - -// writeTOCFooter writes the table of contents file footer. -func writeTOCFooter(w io.Writer) error { - _, err := fmt.Fprintf(w, `} - -`) - return err -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 4d039df5c..9b2e8b81a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -29,10 +29,6 @@ github.com/evanphx/json-patch github.com/fsnotify/fsnotify # github.com/ghodss/yaml v1.0.0 github.com/ghodss/yaml -# github.com/go-bindata/go-bindata v3.1.2+incompatible -## explicit -github.com/go-bindata/go-bindata -github.com/go-bindata/go-bindata/go-bindata # github.com/go-logr/logr v0.4.0 github.com/go-logr/logr # github.com/go-logr/zapr v0.2.0 @@ -982,7 +978,7 @@ k8s.io/utils/net k8s.io/utils/path k8s.io/utils/pointer k8s.io/utils/trace -# open-cluster-management.io/api v0.0.0-20210907134339-b1a83afc26a3 +# open-cluster-management.io/api v0.0.0-20210908005819-815ac23c7308 ## explicit open-cluster-management.io/api/addon/v1alpha1 open-cluster-management.io/api/client/addon/clientset/versioned diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_03_clusters.open-cluster-management.io_placements.crd.yaml b/vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_03_clusters.open-cluster-management.io_placements.crd.yaml index 616e06fe4..f119d84c2 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_03_clusters.open-cluster-management.io_placements.crd.yaml +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/0000_03_clusters.open-cluster-management.io_placements.crd.yaml @@ -12,7 +12,17 @@ spec: scope: Namespaced preserveUnknownFields: false versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=="PlacementSatisfied")].status + name: Succeeded + type: string + - jsonPath: .status.conditions[?(@.type=="PlacementSatisfied")].reason + name: Reason + type: string + - jsonPath: .status.numberOfSelectedClusters + name: SelectedClusters + type: integer + name: v1alpha1 schema: openAPIV3Schema: description: "Placement defines a rule to select a set of ManagedClusters @@ -182,6 +192,57 @@ spec: type: object additionalProperties: type: string + prioritizerPolicy: + description: PrioritizerPolicy defines the policy of the prioritizers. + If this field is unset, then default prioritizer mode and configurations + are used. Referring to PrioritizerPolicy to see more description + about Mode and Configurations. + type: object + properties: + configurations: + type: array + items: + description: PrioritizerConfig represents the configuration + of prioritizer + type: object + required: + - name + properties: + name: + description: 'Name is the name of a prioritizer. Below are + the valid names: 1) Balance: balance the decisions among + the clusters. 2) Steady: ensure the existing decision + is stabilized. 3) ResourceRatioCPU & ResourceRatioMemory: + sort clusters based on the allocatable to capacity ratio. + 4) ResourceAllocatableCPU & ResourceAllocatableMemory: + sort clusters based on the allocatable.' + type: string + weight: + description: Weight defines the weight of prioritizer. The + value must be ranged in [0,10]. Each prioritizer will + calculate an integer score of a cluster in the range of + [-100, 100]. The final score of a cluster will be sum(weight + * prioritizer_score). A higher weight indicates that the + prioritizer weights more in the cluster selection, while + 0 weight indicate thats the prioritizer is disabled. + type: integer + format: int32 + default: 1 + maximum: 10 + minimum: 0 + mode: + description: Mode is either Exact, Additive, "" where "" is Additive + by default. In Additive mode, any prioritizer not explicitly + enumerated is enabled in its default Configurations, in which + Steady and Balance prioritizers have the weight of 1 while other + prioritizers have the weight of 0. Additive doesn't require + configuring all prioritizers. The default Configurations may + change in the future, and additional prioritization will happen. + In Exact mode, any prioritizer not explicitly enumerated is + weighted as zero. Exact requires knowing the full set of prioritizers + you want, but avoids behavior changes between releases. + type: string + default: Additive status: description: Status represents the current status of the Placement type: object @@ -262,16 +323,6 @@ spec: ManagedClusters type: integer format: int32 - additionalPrinterColumns: - - name: Succeeded - type: string - jsonPath: ".status.conditions[?(@.type==\"PlacementSatisfied\")].status" - - name: Reason - type: string - jsonPath: ".status.conditions[?(@.type==\"PlacementSatisfied\")].reason" - - name: SelectedClusters - type: integer - jsonPath: ".status.numberOfSelectedClusters" served: true storage: true subresources: diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/types.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/types.go index e19a7b5f2..789208987 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1alpha1/types.go +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/types.go @@ -233,6 +233,12 @@ type PlacementSpec struct { // Predicates represent a slice of predicates to select ManagedClusters. The predicates are ORed. // +optional Predicates []ClusterPredicate `json:"predicates,omitempty"` + + // PrioritizerPolicy defines the policy of the prioritizers. + // If this field is unset, then default prioritizer mode and configurations are used. + // Referring to PrioritizerPolicy to see more description about Mode and Configurations. + // +optional + PrioritizerPolicy PrioritizerPolicy `json:"prioritizerPolicy"` } // ClusterPredicate represents a predicate to select ManagedClusters. @@ -267,6 +273,55 @@ type ClusterClaimSelector struct { MatchExpressions []metav1.LabelSelectorRequirement `json:"matchExpressions,omitempty"` } +// PrioritizerPolicy represents the policy of prioritizer +type PrioritizerPolicy struct { + // Mode is either Exact, Additive, "" where "" is Additive by default. + // In Additive mode, any prioritizer not explicitly enumerated is enabled in its default Configurations, + // in which Steady and Balance prioritizers have the weight of 1 while other prioritizers have the weight of 0. + // Additive doesn't require configuring all prioritizers. The default Configurations may change in the future, + // and additional prioritization will happen. + // In Exact mode, any prioritizer not explicitly enumerated is weighted as zero. + // Exact requires knowing the full set of prioritizers you want, but avoids behavior changes between releases. + // +kubebuilder:default:=Additive + // +optional + Mode PrioritizerPolicyModeType `json:"mode,omitempty"` + + // +optional + Configurations []PrioritizerConfig `json:"configurations,omitempty"` +} + +// PrioritizerPolicyModeType represents the type of PrioritizerPolicy.Mode +type PrioritizerPolicyModeType string + +const ( + // Valid PrioritizerPolicyModeType value is Exact, Additive. + PrioritizerPolicyModeAdditive PrioritizerPolicyModeType = "Additive" + PrioritizerPolicyModeExact PrioritizerPolicyModeType = "Exact" +) + +// PrioritizerConfig represents the configuration of prioritizer +type PrioritizerConfig struct { + // Name is the name of a prioritizer. Below are the valid names: + // 1) Balance: balance the decisions among the clusters. + // 2) Steady: ensure the existing decision is stabilized. + // 3) ResourceRatioCPU & ResourceRatioMemory: sort clusters based on the allocatable to capacity ratio. + // 4) ResourceAllocatableCPU & ResourceAllocatableMemory: sort clusters based on the allocatable. + // +kubebuilder:validation:Required + // +required + Name string `json:"name"` + + // Weight defines the weight of prioritizer. The value must be ranged in [0,10]. + // Each prioritizer will calculate an integer score of a cluster in the range of [-100, 100]. + // The final score of a cluster will be sum(weight * prioritizer_score). + // A higher weight indicates that the prioritizer weights more in the cluster selection, + // while 0 weight indicate thats the prioritizer is disabled. + // +kubebuilder:validation:Minimum:=0 + // +kubebuilder:validation:Maximum:=10 + // +kubebuilder:default:=1 + // +optional + Weight int32 `json:"weight,omitempty"` +} + type PlacementStatus struct { // NumberOfSelectedClusters represents the number of selected ManagedClusters // +optional diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.deepcopy.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.deepcopy.go index 7344a96e6..b39e35467 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.deepcopy.go @@ -497,6 +497,7 @@ func (in *PlacementSpec) DeepCopyInto(out *PlacementSpec) { (*in)[i].DeepCopyInto(&(*out)[i]) } } + in.PrioritizerPolicy.DeepCopyInto(&out.PrioritizerPolicy) return } @@ -532,3 +533,40 @@ func (in *PlacementStatus) DeepCopy() *PlacementStatus { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrioritizerConfig) DeepCopyInto(out *PrioritizerConfig) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrioritizerConfig. +func (in *PrioritizerConfig) DeepCopy() *PrioritizerConfig { + if in == nil { + return nil + } + out := new(PrioritizerConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PrioritizerPolicy) DeepCopyInto(out *PrioritizerPolicy) { + *out = *in + if in.Configurations != nil { + in, out := &in.Configurations, &out.Configurations + *out = make([]PrioritizerConfig, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PrioritizerPolicy. +func (in *PrioritizerPolicy) DeepCopy() *PrioritizerPolicy { + if in == nil { + return nil + } + out := new(PrioritizerPolicy) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go b/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go index 79653cb61..52c79b5ae 100644 --- a/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/vendor/open-cluster-management.io/api/cluster/v1alpha1/zz_generated.swagger_doc_generated.go @@ -190,10 +190,11 @@ func (PlacementList) SwaggerDoc() map[string]string { } var map_PlacementSpec = map[string]string{ - "": "PlacementSpec defines the attributes of Placement. An empty PlacementSpec selects all ManagedClusters from the ManagedClusterSets bound to the placement namespace. The containing fields are ANDed.", - "clusterSets": "ClusterSets represent the ManagedClusterSets from which the ManagedClusters are selected. If the slice is empty, ManagedClusters will be selected from the ManagedClusterSets bound to the placement namespace, otherwise ManagedClusters will be selected from the intersection of this slice and the ManagedClusterSets bound to the placement namespace.", - "numberOfClusters": "NumberOfClusters represents the desired number of ManagedClusters to be selected which meet the placement requirements. 1) If not specified, all ManagedClusters which meet the placement requirements (including ClusterSets,\n and Predicates) will be selected;\n2) Otherwise if the nubmer of ManagedClusters meet the placement requirements is larger than\n NumberOfClusters, a random subset with desired number of ManagedClusters will be selected;\n3) If the nubmer of ManagedClusters meet the placement requirements is equal to NumberOfClusters,\n all of them will be selected;\n4) If the nubmer of ManagedClusters meet the placement requirements is less than NumberOfClusters,\n all of them will be selected, and the status of condition `PlacementConditionSatisfied` will be\n set to false;", - "predicates": "Predicates represent a slice of predicates to select ManagedClusters. The predicates are ORed.", + "": "PlacementSpec defines the attributes of Placement. An empty PlacementSpec selects all ManagedClusters from the ManagedClusterSets bound to the placement namespace. The containing fields are ANDed.", + "clusterSets": "ClusterSets represent the ManagedClusterSets from which the ManagedClusters are selected. If the slice is empty, ManagedClusters will be selected from the ManagedClusterSets bound to the placement namespace, otherwise ManagedClusters will be selected from the intersection of this slice and the ManagedClusterSets bound to the placement namespace.", + "numberOfClusters": "NumberOfClusters represents the desired number of ManagedClusters to be selected which meet the placement requirements. 1) If not specified, all ManagedClusters which meet the placement requirements (including ClusterSets,\n and Predicates) will be selected;\n2) Otherwise if the nubmer of ManagedClusters meet the placement requirements is larger than\n NumberOfClusters, a random subset with desired number of ManagedClusters will be selected;\n3) If the nubmer of ManagedClusters meet the placement requirements is equal to NumberOfClusters,\n all of them will be selected;\n4) If the nubmer of ManagedClusters meet the placement requirements is less than NumberOfClusters,\n all of them will be selected, and the status of condition `PlacementConditionSatisfied` will be\n set to false;", + "predicates": "Predicates represent a slice of predicates to select ManagedClusters. The predicates are ORed.", + "prioritizerPolicy": "PrioritizerPolicy defines the policy of the prioritizers. If this field is unset, then default prioritizer mode and configurations are used. Referring to PrioritizerPolicy to see more description about Mode and Configurations.", } func (PlacementSpec) SwaggerDoc() map[string]string { @@ -209,4 +210,23 @@ func (PlacementStatus) SwaggerDoc() map[string]string { return map_PlacementStatus } +var map_PrioritizerConfig = map[string]string{ + "": "PrioritizerConfig represents the configuration of prioritizer", + "name": "Name is the name of a prioritizer. Below are the valid names: 1) Balance: balance the decisions among the clusters. 2) Steady: ensure the existing decision is stabilized. 3) ResourceRatioCPU & ResourceRatioMemory: sort clusters based on the allocatable to capacity ratio. 4) ResourceAllocatableCPU & ResourceAllocatableMemory: sort clusters based on the allocatable.", + "weight": "Weight defines the weight of prioritizer. The value must be ranged in [0,10]. Each prioritizer will calculate an integer score of a cluster in the range of [-100, 100]. The final score of a cluster will be sum(weight * prioritizer_score). A higher weight indicates that the prioritizer weights more in the cluster selection, while 0 weight indicate thats the prioritizer is disabled.", +} + +func (PrioritizerConfig) SwaggerDoc() map[string]string { + return map_PrioritizerConfig +} + +var map_PrioritizerPolicy = map[string]string{ + "": "PrioritizerPolicy represents the policy of prioritizer", + "mode": "Mode is either Exact, Additive, \"\" where \"\" is Additive by default. In Additive mode, any prioritizer not explicitly enumerated is enabled in its default Configurations, in which Steady and Balance prioritizers have the weight of 1 while other prioritizers have the weight of 0. Additive doesn't require configuring all prioritizers. The default Configurations may change in the future, and additional prioritization will happen. In Exact mode, any prioritizer not explicitly enumerated is weighted as zero. Exact requires knowing the full set of prioritizers you want, but avoids behavior changes between releases.", +} + +func (PrioritizerPolicy) SwaggerDoc() map[string]string { + return map_PrioritizerPolicy +} + // AUTO-GENERATED FUNCTIONS END HERE