├── .github └── workflows │ └── go.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── Makefile ├── README.md ├── analysis ├── register.go └── v1alpha1 │ ├── doc.go │ ├── register.go │ ├── types.go │ └── zz_generated.deepcopy.go ├── artifacts └── deploy │ ├── analysis.crane.io_analytics.yaml │ ├── analysis.crane.io_configsets.yaml │ ├── analysis.crane.io_recommendationrules.yaml │ ├── analysis.crane.io_recommendations.yaml │ ├── autoscaling.crane.io_effectivehorizontalpodautoscalers.yaml │ ├── autoscaling.crane.io_effectiveverticalpodautoscalers.yaml │ ├── autoscaling.crane.io_substitutes.yaml │ ├── co2e.crane.io_cloudcarbonfootprints.yaml │ ├── ensurance.crane.io_avoidanceactions.yaml │ ├── ensurance.crane.io_nodeqoss.yaml │ ├── ensurance.crane.io_podqoss.yaml │ ├── manifests.yaml │ ├── prediction.crane.io_clusternodepredictions.yaml │ ├── prediction.crane.io_nodepredictions.yaml │ ├── prediction.crane.io_podgrouppredictions.yaml │ ├── prediction.crane.io_timeseriespredictions.yaml │ └── topology.crane.io_noderesourcetopologies.yaml ├── autoscaling ├── register.go └── v1alpha1 │ ├── doc.go │ ├── ehpa_types.go │ ├── evpa_types.go │ ├── register.go │ └── zz_generated.deepcopy.go ├── co2e ├── register.go └── v1alpha1 │ ├── doc.go │ ├── register.go │ ├── types.go │ ├── types_test.go │ └── zz_generated.deepcopy.go ├── docs ├── images │ └── qosensurancepolicy-model-detail-withcomment-en.png └── proposals │ └── 20211103qos-ensurance-policy-api-definition.md ├── ensurance ├── register.go └── v1alpha1 │ ├── doc.go │ ├── register.go │ ├── types.go │ └── zz_generated.deepcopy.go ├── go.mod ├── go.sum ├── hack ├── boilerplate │ └── boilerplate.go.txt ├── docker.sh ├── generate-proto.sh ├── protoc.sh ├── tools │ └── tools.go ├── update-all.sh ├── update-codegen.sh ├── update-crdgen.sh ├── update-gen-proto.sh ├── util.sh ├── verify-all.sh ├── verify-codegen.sh ├── verify-crdgen.sh └── verify-staticcheck.sh ├── pkg └── generated │ ├── clientset │ └── versioned │ │ ├── clientset.go │ │ ├── doc.go │ │ ├── fake │ │ ├── clientset_generated.go │ │ ├── doc.go │ │ └── register.go │ │ ├── scheme │ │ ├── doc.go │ │ └── register.go │ │ └── typed │ │ ├── analysis │ │ └── v1alpha1 │ │ │ ├── analysis_client.go │ │ │ ├── analytics.go │ │ │ ├── configset.go │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_analysis_client.go │ │ │ ├── fake_analytics.go │ │ │ ├── fake_configset.go │ │ │ ├── fake_recommendation.go │ │ │ └── fake_recommendationrule.go │ │ │ ├── generated_expansion.go │ │ │ ├── recommendation.go │ │ │ └── recommendationrule.go │ │ ├── autoscaling │ │ └── v1alpha1 │ │ │ ├── autoscaling_client.go │ │ │ ├── doc.go │ │ │ ├── effectivehorizontalpodautoscaler.go │ │ │ ├── effectiveverticalpodautoscaler.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_autoscaling_client.go │ │ │ ├── fake_effectivehorizontalpodautoscaler.go │ │ │ ├── fake_effectiveverticalpodautoscaler.go │ │ │ └── fake_substitute.go │ │ │ ├── generated_expansion.go │ │ │ └── substitute.go │ │ ├── co2e │ │ └── v1alpha1 │ │ │ ├── cloudcarbonfootprint.go │ │ │ ├── co2e_client.go │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_cloudcarbonfootprint.go │ │ │ └── fake_co2e_client.go │ │ │ └── generated_expansion.go │ │ ├── ensurance │ │ └── v1alpha1 │ │ │ ├── avoidanceaction.go │ │ │ ├── doc.go │ │ │ ├── ensurance_client.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_avoidanceaction.go │ │ │ ├── fake_ensurance_client.go │ │ │ ├── fake_nodeqos.go │ │ │ └── fake_podqos.go │ │ │ ├── generated_expansion.go │ │ │ ├── nodeqos.go │ │ │ └── podqos.go │ │ ├── prediction │ │ └── v1alpha1 │ │ │ ├── clusternodeprediction.go │ │ │ ├── doc.go │ │ │ ├── fake │ │ │ ├── doc.go │ │ │ ├── fake_clusternodeprediction.go │ │ │ ├── fake_prediction_client.go │ │ │ └── fake_timeseriesprediction.go │ │ │ ├── generated_expansion.go │ │ │ ├── prediction_client.go │ │ │ └── timeseriesprediction.go │ │ └── topology │ │ └── v1alpha1 │ │ ├── doc.go │ │ ├── fake │ │ ├── doc.go │ │ ├── fake_noderesourcetopology.go │ │ └── fake_topology_client.go │ │ ├── generated_expansion.go │ │ ├── noderesourcetopology.go │ │ └── topology_client.go │ ├── informers │ └── externalversions │ │ ├── analysis │ │ ├── interface.go │ │ └── v1alpha1 │ │ │ ├── analytics.go │ │ │ ├── configset.go │ │ │ ├── interface.go │ │ │ ├── recommendation.go │ │ │ └── recommendationrule.go │ │ ├── autoscaling │ │ ├── interface.go │ │ └── v1alpha1 │ │ │ ├── effectivehorizontalpodautoscaler.go │ │ │ ├── effectiveverticalpodautoscaler.go │ │ │ ├── interface.go │ │ │ └── substitute.go │ │ ├── co2e │ │ ├── interface.go │ │ └── v1alpha1 │ │ │ ├── cloudcarbonfootprint.go │ │ │ └── interface.go │ │ ├── ensurance │ │ ├── interface.go │ │ └── v1alpha1 │ │ │ ├── avoidanceaction.go │ │ │ ├── interface.go │ │ │ ├── nodeqos.go │ │ │ └── podqos.go │ │ ├── factory.go │ │ ├── generic.go │ │ ├── internalinterfaces │ │ └── factory_interfaces.go │ │ ├── prediction │ │ ├── interface.go │ │ └── v1alpha1 │ │ │ ├── clusternodeprediction.go │ │ │ ├── interface.go │ │ │ └── timeseriesprediction.go │ │ └── topology │ │ ├── interface.go │ │ └── v1alpha1 │ │ ├── interface.go │ │ └── noderesourcetopology.go │ ├── listers │ ├── analysis │ │ └── v1alpha1 │ │ │ ├── analytics.go │ │ │ ├── configset.go │ │ │ ├── expansion_generated.go │ │ │ ├── recommendation.go │ │ │ └── recommendationrule.go │ ├── autoscaling │ │ └── v1alpha1 │ │ │ ├── effectivehorizontalpodautoscaler.go │ │ │ ├── effectiveverticalpodautoscaler.go │ │ │ ├── expansion_generated.go │ │ │ └── substitute.go │ ├── co2e │ │ └── v1alpha1 │ │ │ ├── cloudcarbonfootprint.go │ │ │ └── expansion_generated.go │ ├── ensurance │ │ └── v1alpha1 │ │ │ ├── avoidanceaction.go │ │ │ ├── expansion_generated.go │ │ │ ├── nodeqos.go │ │ │ └── podqos.go │ ├── prediction │ │ └── v1alpha1 │ │ │ ├── clusternodeprediction.go │ │ │ ├── expansion_generated.go │ │ │ └── timeseriesprediction.go │ └── topology │ │ └── v1alpha1 │ │ ├── expansion_generated.go │ │ └── noderesourcetopology.go │ └── openapi │ └── zz_generated.openapi.go ├── prediction └── v1alpha1 │ ├── doc.go │ ├── register.go │ ├── types.go │ └── zz_generated.deepcopy.go └── topology └── v1alpha1 ├── const.go ├── doc.go ├── register.go ├── types.go ├── well_known_annotations.go ├── well_known_labels.go └── zz_generated.deepcopy.go /.github/workflows/go.yml: -------------------------------------------------------------------------------- 1 | name: Go 2 | 3 | on: [pull_request, push] 4 | 5 | 6 | jobs: 7 | 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | 13 | - name: Set up Go 14 | uses: actions/setup-go@v2 15 | with: 16 | go-version: 1.17 17 | 18 | - name: Remove old artifacts 19 | run: rm -rf artifacts/deploy 20 | 21 | - name: Build 22 | run: make all 23 | 24 | - name: Concat artifacts yaml 25 | if: ${{ github.event_name == 'push' }} 26 | run: | 27 | echo ${GITHUB_REF##*/} 28 | for i in artifacts/deploy/*; do cat $i >> artifacts/deploy/all.yaml; done; 29 | 30 | - id: git-branch 31 | if: ${{ github.event_name == 'push' }} 32 | run: | 33 | echo "::set-output name=git-branch::$(echo ${GITHUB_REF##*/} | tr '[A-Z]' '[a-z]')" 34 | 35 | - name: Publish to Dist Branch 36 | if: ${{ github.event_name == 'push' }} 37 | uses: JamesIves/github-pages-deploy-action@v4 38 | with: 39 | branch: dist 40 | folder: artifacts/deploy 41 | target-folder: ${{steps.git-branch.outputs.git-branch}} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, built with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | # IDE 15 | .idea 16 | 17 | # Dependency directories (remove the comment below to include it) 18 | vendor/ 19 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | GOOS ?= $(shell go env GOOS) 2 | SOURCES := $(shell find . -type f -name '*.go') 3 | 4 | # Git information 5 | GIT_VERSION ?= $(shell git describe --tags --dirty) 6 | GIT_COMMIT_HASH ?= $(shell git rev-parse HEAD) 7 | GIT_TREESTATE = "clean" 8 | GIT_DIFF = $(shell git diff --quiet >/dev/null 2>&1; if [ $$? -eq 1 ]; then echo "1"; fi) 9 | ifeq ($(GIT_DIFF), 1) 10 | GIT_TREESTATE = "dirty" 11 | endif 12 | BUILDDATE = $(shell date -u +'%Y-%m-%dT%H:%M:%SZ') 13 | 14 | LDFLAGS := "-X github.com/gocrane/api/pkg/version.gitVersion=$(GIT_VERSION) \ 15 | -X github.com/gocrane/api/pkg/version.gitCommit=$(GIT_COMMIT_HASH) \ 16 | -X github.com/gocrane/api/pkg/version.gitTreeState=$(GIT_TREESTATE) \ 17 | -X github.com/gocrane/api/pkg/version.buildDate=$(BUILDDATE)" 18 | 19 | # Images management 20 | REGISTRY?="ccr.ccs.tencentyun.com/kube-orm" 21 | REGISTRY_USER_NAME?="" 22 | REGISTRY_PASSWORD?="" 23 | REGISTRY_SERVER_ADDRESS?="ccr.ccs.tencentyun.com" 24 | 25 | # Set your version by env or using latest tags from git 26 | VERSION?="" 27 | ifeq ($(VERSION), "") 28 | LATEST_TAG=$(shell git describe --tags) 29 | ifeq ($(LATEST_TAG),) 30 | # Forked repo may not sync tags from upstream, so give it a default tag to make CI happy. 31 | VERSION="unknown" 32 | else 33 | VERSION=$(LATEST_TAG) 34 | endif 35 | endif 36 | 37 | 38 | clean: 39 | rm -rf output 40 | 41 | # Run go fmt against code 42 | fmt: 43 | go fmt ./pkg/... ./analysis/... ./autoscaling/... ./prediction/... ./ensurance/... ./topology/... 44 | 45 | # Run go vet against code 46 | vet: 47 | go vet ./pkg/... ./analysis/... ./autoscaling/... ./prediction/... ./ensurance/... ./topology/... 48 | 49 | test: 50 | go test --race --v ./pkg/... 51 | 52 | 53 | .PHONY: update 54 | update: fmt vet 55 | hack/update-all.sh 56 | 57 | .PHONY: verify 58 | verify: 59 | hack/verify-all.sh 60 | 61 | .PHONY: staticcheck 62 | staticcheck: 63 | hack/verify-staticcheck.sh 64 | 65 | .PHONY: all 66 | all: 67 | hack/update-all.sh && hack/verify-all.sh 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Core API of Crane 2 | core api of crane. 3 | 4 | 5 | 6 | # DEV GUIDE 7 | clone the project to your $GOPATH. following command will generate crd yamls and files in the project directory. 8 | ``` 9 | make update 10 | make verify 11 | ``` 12 | 13 | 14 | # INSTALL CRD 15 | ``` 16 | 17 | # install crd 18 | kubectl create -f artifacts/deploy/ 19 | 20 | ``` 21 | 22 | # INSTALL CRD ONLINE 23 | 24 | You can find other versions base on the branch or tags in dist branch. 25 | 26 | [Click here to view the early version.](https://fastly.jsdelivr.net/gh/gocrane/api@dist/) 27 | 28 | ```bash 29 | 30 | kubectl create -f https://raw.githubusercontent.com/gocrane/api/dist/main/all.yaml 31 | 32 | ``` -------------------------------------------------------------------------------- /analysis/register.go: -------------------------------------------------------------------------------- 1 | package analysis 2 | 3 | // GroupName is the group name used in this package 4 | const ( 5 | GroupName = "analysis.crane.io" 6 | ) 7 | -------------------------------------------------------------------------------- /analysis/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // Package v1alpha1 is the v1alpha1 version of the analysis API. 2 | // +k8s:deepcopy-gen=package,register 3 | // +groupName=analysis.crane.io 4 | package v1alpha1 5 | -------------------------------------------------------------------------------- /analysis/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | "github.com/gocrane/api/analysis" 5 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 6 | "k8s.io/apimachinery/pkg/runtime" 7 | "k8s.io/apimachinery/pkg/runtime/schema" 8 | ) 9 | 10 | // SchemeGroupVersion is group version used to register these objects 11 | var SchemeGroupVersion = schema.GroupVersion{Group: analysis.GroupName, Version: "v1alpha1"} 12 | 13 | // Kind takes an unqualified kind and returns a Group qualified GroupKind 14 | func Kind(kind string) schema.GroupKind { 15 | return SchemeGroupVersion.WithKind(kind).GroupKind() 16 | } 17 | 18 | // Resource takes an unqualified resource and returns a Group qualified GroupResource 19 | func Resource(resource string) schema.GroupResource { 20 | return SchemeGroupVersion.WithResource(resource).GroupResource() 21 | } 22 | 23 | var ( 24 | // SchemeBuilder initializes a scheme builder 25 | SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) 26 | // AddToScheme is a global function that registers this API group & version to a scheme 27 | AddToScheme = SchemeBuilder.AddToScheme 28 | ) 29 | 30 | // Adds the list of known types to Scheme. 31 | func addKnownTypes(scheme *runtime.Scheme) error { 32 | scheme.AddKnownTypes(SchemeGroupVersion, 33 | &Recommendation{}, 34 | &RecommendationList{}, 35 | &Analytics{}, 36 | &AnalyticsList{}, 37 | &RecommendationRule{}, 38 | &RecommendationRuleList{}, 39 | ) 40 | metav1.AddToGroupVersion(scheme, SchemeGroupVersion) 41 | return nil 42 | } 43 | -------------------------------------------------------------------------------- /artifacts/deploy/analysis.crane.io_configsets.yaml: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | controller-gen.kubebuilder.io/version: v0.7.0 8 | creationTimestamp: null 9 | name: configsets.analysis.crane.io 10 | spec: 11 | group: analysis.crane.io 12 | names: 13 | kind: ConfigSet 14 | listKind: ConfigSetList 15 | plural: configsets 16 | shortNames: 17 | - cs 18 | singular: configset 19 | scope: Namespaced 20 | versions: 21 | - name: v1alpha1 22 | schema: 23 | openAPIV3Schema: 24 | description: ConfigSet represents the configuration set for recommendation. 25 | properties: 26 | apiVersion: 27 | description: 'APIVersion defines the versioned schema of this representation 28 | of an object. Servers should convert recognized schemas to the latest 29 | internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' 30 | type: string 31 | configs: 32 | items: 33 | properties: 34 | properties: 35 | additionalProperties: 36 | type: string 37 | type: object 38 | targets: 39 | items: 40 | properties: 41 | kind: 42 | type: string 43 | name: 44 | type: string 45 | namespace: 46 | type: string 47 | type: object 48 | type: array 49 | type: object 50 | type: array 51 | kind: 52 | description: 'Kind is a string value representing the REST resource this 53 | object represents. Servers may infer this from the endpoint the client 54 | submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' 55 | type: string 56 | metadata: 57 | type: object 58 | type: object 59 | served: true 60 | storage: true 61 | status: 62 | acceptedNames: 63 | kind: "" 64 | plural: "" 65 | conditions: [] 66 | storedVersions: [] 67 | -------------------------------------------------------------------------------- /artifacts/deploy/autoscaling.crane.io_substitutes.yaml: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | controller-gen.kubebuilder.io/version: v0.7.0 8 | creationTimestamp: null 9 | name: substitutes.autoscaling.crane.io 10 | spec: 11 | group: autoscaling.crane.io 12 | names: 13 | kind: Substitute 14 | listKind: SubstituteList 15 | plural: substitutes 16 | shortNames: 17 | - subs 18 | singular: substitute 19 | scope: Namespaced 20 | versions: 21 | - additionalPrinterColumns: 22 | - description: The replicas presents the dryRun result. 23 | jsonPath: .status.replicas 24 | name: REPLICAS 25 | type: integer 26 | - description: CreationTimestamp is a timestamp representing the server time when 27 | this object was created. 28 | jsonPath: .metadata.creationTimestamp 29 | name: AGE 30 | type: date 31 | name: v1alpha1 32 | schema: 33 | openAPIV3Schema: 34 | description: Substitute is the Schema for the Substitute API 35 | properties: 36 | apiVersion: 37 | description: 'APIVersion defines the versioned schema of this representation 38 | of an object. Servers should convert recognized schemas to the latest 39 | internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' 40 | type: string 41 | kind: 42 | description: 'Kind is a string value representing the REST resource this 43 | object represents. Servers may infer this from the endpoint the client 44 | submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' 45 | type: string 46 | metadata: 47 | type: object 48 | spec: 49 | description: SubstituteSpec defines the desired spec of Substitute 50 | properties: 51 | replicas: 52 | description: Replicas is used by presents dryRun replicas for SubstituteTargetRef. 53 | format: int32 54 | type: integer 55 | substituteTargetRef: 56 | description: SubstituteTargetRef is the reference to the workload 57 | that should be Substituted. 58 | properties: 59 | apiVersion: 60 | description: API version of the referent 61 | type: string 62 | kind: 63 | description: 'Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds"' 64 | type: string 65 | name: 66 | description: 'Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names' 67 | type: string 68 | required: 69 | - kind 70 | - name 71 | type: object 72 | required: 73 | - substituteTargetRef 74 | type: object 75 | status: 76 | description: SubstituteStatus defines the status of Substitute 77 | properties: 78 | labelSelector: 79 | description: LabelSelector is label selectors that is sync with SubstituteTargetRef's 80 | labelSelector which used by HPA. 81 | type: string 82 | replicas: 83 | description: Replicas is used by presents dryRun replicas for SubstituteTargetRef. 84 | status.replicas should be equal to spec.replicas. 85 | format: int32 86 | type: integer 87 | type: object 88 | type: object 89 | served: true 90 | storage: true 91 | subresources: 92 | scale: 93 | labelSelectorPath: .status.labelSelector 94 | specReplicasPath: .spec.replicas 95 | statusReplicasPath: .status.replicas 96 | status: {} 97 | status: 98 | acceptedNames: 99 | kind: "" 100 | plural: "" 101 | conditions: [] 102 | storedVersions: [] 103 | -------------------------------------------------------------------------------- /artifacts/deploy/ensurance.crane.io_avoidanceactions.yaml: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | apiVersion: apiextensions.k8s.io/v1 4 | kind: CustomResourceDefinition 5 | metadata: 6 | annotations: 7 | controller-gen.kubebuilder.io/version: v0.7.0 8 | creationTimestamp: null 9 | name: avoidanceactions.ensurance.crane.io 10 | spec: 11 | group: ensurance.crane.io 12 | names: 13 | kind: AvoidanceAction 14 | listKind: AvoidanceActionList 15 | plural: avoidanceactions 16 | shortNames: 17 | - avoid 18 | singular: avoidanceaction 19 | scope: Cluster 20 | versions: 21 | - name: v1alpha1 22 | schema: 23 | openAPIV3Schema: 24 | description: AvoidanceAction defines Avoidance action 25 | properties: 26 | apiVersion: 27 | description: 'APIVersion defines the versioned schema of this representation 28 | of an object. Servers should convert recognized schemas to the latest 29 | internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' 30 | type: string 31 | kind: 32 | description: 'Kind is a string value representing the REST resource this 33 | object represents. Servers may infer this from the endpoint the client 34 | submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' 35 | type: string 36 | metadata: 37 | type: object 38 | spec: 39 | properties: 40 | coolDownSeconds: 41 | default: 300 42 | description: CoolDownSeconds is the seconds for cool down when do 43 | avoidance. Defaults to 300. Minimum value is 1. 44 | format: int32 45 | type: integer 46 | description: 47 | description: Description is an arbitrary string that usually provides 48 | guidelines on when this action should be used. 49 | maxLength: 1024 50 | type: string 51 | eviction: 52 | description: Eviction describes the eviction action 53 | properties: 54 | terminationGracePeriodSeconds: 55 | description: TerminationGracePeriodSeconds is the duration in 56 | seconds the pod needs to terminate gracefully. May be decreased 57 | in delete request. If this value is nil, the pod's terminationGracePeriodSeconds 58 | will be used. Otherwise, this value overrides the value provided 59 | by the pod spec. Value must be non-negative integer. The value 60 | zero indicates delete immediately. 61 | format: int32 62 | type: integer 63 | type: object 64 | throttle: 65 | description: Throttle describes the throttling action 66 | properties: 67 | cpuThrottle: 68 | properties: 69 | minCPURatio: 70 | description: 'MinCPURatio is the min of cpu ratio for low 71 | level pods, for example: the pod limit is 4096, ratio is 72 | 10, the minimum is 409. MinCPURatio range [0,100]' 73 | format: int32 74 | maximum: 100 75 | minimum: 0 76 | type: integer 77 | stepCPURatio: 78 | description: StepCPURatio is the step of cpu share and limit 79 | for once down-size. StepCPURatio range [0,100] 80 | format: int32 81 | maximum: 100 82 | minimum: 0 83 | type: integer 84 | type: object 85 | memoryThrottle: 86 | properties: 87 | forceGC: 88 | description: ForceGC means force gc page cache for pods with 89 | low priority 90 | type: boolean 91 | type: object 92 | type: object 93 | type: object 94 | status: 95 | description: AvoidanceActionStatus defines the desired status of AvoidanceAction 96 | type: object 97 | required: 98 | - spec 99 | type: object 100 | served: true 101 | storage: true 102 | status: 103 | acceptedNames: 104 | kind: "" 105 | plural: "" 106 | conditions: [] 107 | storedVersions: [] 108 | -------------------------------------------------------------------------------- /artifacts/deploy/manifests.yaml: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | apiVersion: admissionregistration.k8s.io/v1 4 | kind: MutatingWebhookConfiguration 5 | metadata: 6 | creationTimestamp: null 7 | name: mutating-webhook-configuration 8 | webhooks: 9 | - admissionReviewVersions: 10 | - v1 11 | clientConfig: 12 | service: 13 | name: webhook-service 14 | namespace: system 15 | path: /mutate-podgroupprediction 16 | failurePolicy: Fail 17 | name: prediction.crane.io_podgrouppredictions_webhook 18 | rules: 19 | - apiGroups: 20 | - prediction.crane.io 21 | apiVersions: 22 | - v1alpha1 23 | operations: 24 | - CREATE 25 | - UPDATE 26 | resources: 27 | - podgrouppredictions 28 | sideEffects: None 29 | 30 | --- 31 | apiVersion: admissionregistration.k8s.io/v1 32 | kind: ValidatingWebhookConfiguration 33 | metadata: 34 | creationTimestamp: null 35 | name: validating-webhook-configuration 36 | webhooks: 37 | - admissionReviewVersions: 38 | - v1 39 | clientConfig: 40 | service: 41 | name: webhook-service 42 | namespace: system 43 | path: /validate-podgroupprediction 44 | failurePolicy: Fail 45 | name: prediction.crane.io_podgrouppredictions_webhook 46 | rules: 47 | - apiGroups: 48 | - prediction.crane.io 49 | apiVersions: 50 | - v1 51 | operations: 52 | - CREATE 53 | - UPDATE 54 | resources: 55 | - podgrouppredictions 56 | sideEffects: None 57 | -------------------------------------------------------------------------------- /autoscaling/register.go: -------------------------------------------------------------------------------- 1 | package autoscaling 2 | 3 | // GroupName is the group name used in this package 4 | const ( 5 | GroupName = "autoscaling.crane.io" 6 | ) 7 | -------------------------------------------------------------------------------- /autoscaling/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // Package v1alpha1 is the v1alpha1 version of the autoscaling API. 2 | // +k8s:deepcopy-gen=package,register 3 | // +groupName=autoscaling.crane.io 4 | package v1alpha1 5 | -------------------------------------------------------------------------------- /autoscaling/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | "k8s.io/apimachinery/pkg/runtime" 6 | "k8s.io/apimachinery/pkg/runtime/schema" 7 | ) 8 | 9 | // GroupName specifies the group name used to register the objects. 10 | const GroupName = "autoscaling.crane.io" 11 | 12 | // GroupVersion specifies the group and the version used to register the objects. 13 | var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha1"} 14 | 15 | // SchemeGroupVersion is group version used to register these objects 16 | // Deprecated: use GroupVersion instead. 17 | var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} 18 | 19 | // Resource takes an unqualified resource and returns a Group qualified GroupResource 20 | func Resource(resource string) schema.GroupResource { 21 | return SchemeGroupVersion.WithResource(resource).GroupResource() 22 | } 23 | 24 | var ( 25 | // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. 26 | SchemeBuilder runtime.SchemeBuilder 27 | localSchemeBuilder = &SchemeBuilder 28 | // Depreciated: use Install instead 29 | AddToScheme = localSchemeBuilder.AddToScheme 30 | Install = localSchemeBuilder.AddToScheme 31 | ) 32 | 33 | func init() { 34 | // We only register manually written functions here. The registration of the 35 | // generated functions takes place in the generated files. The separation 36 | // makes the code compile even when the generated files are missing. 37 | localSchemeBuilder.Register(addKnownTypes) 38 | } 39 | 40 | // Adds the list of known types to Scheme. 41 | func addKnownTypes(scheme *runtime.Scheme) error { 42 | scheme.AddKnownTypes(SchemeGroupVersion, 43 | &EffectiveHorizontalPodAutoscaler{}, 44 | &EffectiveHorizontalPodAutoscalerList{}, 45 | &Substitute{}, 46 | &SubstituteList{}, 47 | &EffectiveVerticalPodAutoscaler{}, 48 | &EffectiveVerticalPodAutoscalerList{}, 49 | ) 50 | // AddToGroupVersion allows the serialization of client types like ListOptions. 51 | v1.AddToGroupVersion(scheme, SchemeGroupVersion) 52 | return nil 53 | } 54 | -------------------------------------------------------------------------------- /co2e/register.go: -------------------------------------------------------------------------------- 1 | package ensurance 2 | 3 | // GroupName is the group name used in this package 4 | const ( 5 | GroupName = "co2e.crane.io" 6 | ) 7 | -------------------------------------------------------------------------------- /co2e/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // Package v1alpha1 is the v1alpha1 version of the crane API. 2 | // +k8s:deepcopy-gen=package,register 3 | // +groupName=co2e.crane.io 4 | package v1alpha1 5 | -------------------------------------------------------------------------------- /co2e/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | "k8s.io/apimachinery/pkg/runtime" 6 | "k8s.io/apimachinery/pkg/runtime/schema" 7 | ) 8 | 9 | // GroupName specifies the group name used to register the objects. 10 | const GroupName = "co2e.crane.io" 11 | 12 | // GroupVersion specifies the group and the version used to register the objects. 13 | var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha1"} 14 | 15 | // SchemeGroupVersion is group version used to register these objects 16 | // Deprecated: use GroupVersion instead. 17 | var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} 18 | 19 | // Resource takes an unqualified resource and returns a Group qualified GroupResource 20 | func Resource(resource string) schema.GroupResource { 21 | return SchemeGroupVersion.WithResource(resource).GroupResource() 22 | } 23 | 24 | var ( 25 | // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. 26 | localSchemeBuilder = &SchemeBuilder 27 | SchemeBuilder runtime.SchemeBuilder 28 | // Depreciated: use Install instead 29 | AddToScheme = localSchemeBuilder.AddToScheme 30 | Install = localSchemeBuilder.AddToScheme 31 | ) 32 | 33 | func init() { 34 | // We only register manually written functions here. The registration of the 35 | // generated functions takes place in the generated files. The separation 36 | // makes the code compile even when the generated files are missing. 37 | localSchemeBuilder.Register(addKnownTypes) 38 | } 39 | 40 | // Adds the list of known types to Scheme. 41 | func addKnownTypes(scheme *runtime.Scheme) error { 42 | scheme.AddKnownTypes(SchemeGroupVersion, 43 | &CloudCarbonFootprint{}, 44 | &CloudCarbonFootprintList{}, 45 | ) 46 | 47 | // AddToGroupVersion allows the serialization of client types like ListOptions. 48 | v1.AddToGroupVersion(scheme, SchemeGroupVersion) 49 | return nil 50 | } 51 | -------------------------------------------------------------------------------- /co2e/v1alpha1/types.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | ) 6 | 7 | const ( 8 | ProviderManual = "Manual" 9 | ) 10 | 11 | type ComputeConfig struct { 12 | // when there are various types of compute server, node selector selects the targets 13 | NodeSelector *metav1.LabelSelector `json:"nodeSelector,omitempty"` 14 | // power when cpu is idle 15 | MinWattsPerCPU string `json:"minWattsPerCPU,omitempty"` 16 | // power when cpu utilization is 100% 17 | MaxWattsPerCPU string `json:"maxWattsPerCPU,omitempty"` 18 | // sometimes it's hard to measure memory, storage, and networking energy consumption 19 | // CPUEnergyConsumptionRatio can be defined to specify the percentage of cpu energy consumption vs all IT equipments consumption 20 | CPUEnergyConsumptionRatio string `json:"cpuEnergyConsumptionRatio,omitempty"` 21 | // power of per BG memory 22 | MemoryWattsPerGB string `json:"memoryWattsPerGB,omitempty"` 23 | } 24 | 25 | type StorageConfig struct { 26 | // storage class, e.g. cephfs 27 | StorageClass string `json:"storageClass,omitempty"` 28 | // power per TB for the class 29 | WattsPerTB string `json:"wattsPerTB,omitempty"` 30 | } 31 | 32 | type NetworkingConfig struct { 33 | // networking class, e.g. golden, server, bronze, which define different redundancies of networking links, and has different energy consumption 34 | NetworkingClass string `json:"storageClass,omitempty"` 35 | // power per GB for the class 36 | WattsPerGB string `json:"wattsPerGB,omitempty"` 37 | } 38 | 39 | type CloudCarbonFootprintSpec struct { 40 | // Provider is the provider of the ccf, when provider is manual, all the properties of ccf would be configured manually 41 | // when a cloud provider exposes query API, a cloud provider controller can query cloud api and fill the properties automatically 42 | Provider string `json:"provider,omitempty"` 43 | // region of the datacenter, e.g. shanghai 44 | Region string `json:"region,omitempty"` 45 | // availability zone of the datacenter, e.g. shanghai-az01 46 | Zone string `json:"zone,omitempty"` 47 | // locality holds more information of location, e.g. ap/china/shanghai/az01/floor3 48 | Locality string `json:"locality,omitempty"` 49 | // power usage effectiveness = IT equipment energy usage / total facility energy usage 50 | PUE string `json:"pue,omitempty"` 51 | // emission factor of the data center, unit is tCO2/MWh, the average emission factor of China is 0.5810 52 | EmissionFactor string `json:"emissionFactor,omitempty"` 53 | // compute power infos 54 | // when there are multiple node types in the cluster, define multiple compute configs 55 | ComputeConfig []*ComputeConfig `json:"computeConfig,omitempty"` 56 | // storage power info 57 | StorageConfig []*StorageConfig `json:"storageConfig,omitempty"` 58 | // networking power info 59 | NetworkingConfig []*NetworkingConfig `json:"networkingConfig,omitempty"` 60 | } 61 | 62 | type CloudCarbonFootprintStatus struct { 63 | Conditions []metav1.Condition `json:"condition,omitempty"` 64 | } 65 | 66 | // +genclient 67 | // +genclient:nonNamespaced 68 | // +kubebuilder:resource:scope=Cluster,shortName=ccf,path=cloudcarbonfootprints 69 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 70 | 71 | // CloudCarbonFootprint defines carbon footprint configuration of a datacenter 72 | type CloudCarbonFootprint struct { 73 | metav1.TypeMeta `json:",inline"` 74 | metav1.ObjectMeta `json:"metadata,omitempty"` 75 | 76 | Spec CloudCarbonFootprintSpec `json:"spec,omitempty"` 77 | Status CloudCarbonFootprintStatus `json:"status,omitempty"` 78 | } 79 | 80 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 81 | 82 | // CloudCarbonFootprintList contains a list of PodQOS 83 | type CloudCarbonFootprintList struct { 84 | metav1.TypeMeta `json:",inline"` 85 | metav1.ListMeta `json:"metadata"` 86 | 87 | Items []CloudCarbonFootprint `json:"items"` 88 | } 89 | -------------------------------------------------------------------------------- /co2e/v1alpha1/types_test.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | "time" 7 | 8 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 9 | "k8s.io/apimachinery/pkg/util/json" 10 | ) 11 | 12 | func TestCCF(t *testing.T) { 13 | carbonFootprint := CloudCarbonFootprint{ 14 | TypeMeta: v1.TypeMeta{ 15 | Kind: "PowerUsageEffectiveness", 16 | APIVersion: "co2e.gocrane.io/v1alpha1", 17 | }, 18 | ObjectMeta: v1.ObjectMeta{ 19 | Name: "carbonFootprint-shanghai-dc", 20 | }, 21 | Spec: CloudCarbonFootprintSpec{ 22 | Provider: ProviderManual, 23 | Region: "shanghai", 24 | Zone: "china-shanghai-az01", 25 | Locality: "AP/China/Shanghai/AZ01", 26 | PUE: "1.5", 27 | EmissionFactor: "0.5810", 28 | ComputeConfig: []*ComputeConfig{ 29 | { 30 | NodeSelector: &v1.LabelSelector{ 31 | MatchLabels: map[string]string{"topology.kubernetes.io/zone": "shanghai-zone-01"}, 32 | }, 33 | MinWattsPerCPU: "0.743", 34 | MaxWattsPerCPU: "3.84", 35 | MemoryWattsPerGB: "0.65", 36 | }, 37 | }, 38 | StorageConfig: []*StorageConfig{ 39 | { 40 | StorageClass: "cloudBlockDevice", 41 | WattsPerTB: "1.2", 42 | }, 43 | }, 44 | NetworkingConfig: []*NetworkingConfig{ 45 | { 46 | NetworkingClass: "golden", 47 | WattsPerGB: "0.65", 48 | }, 49 | }, 50 | }, 51 | Status: CloudCarbonFootprintStatus{ 52 | Conditions: []v1.Condition{ 53 | { 54 | Type: "Synced", 55 | LastTransitionTime: v1.Time{ 56 | Time: time.Now(), 57 | }, 58 | Reason: "carbon footprint synced", 59 | Status: "True", 60 | Message: "carbon footprint synced", 61 | }, 62 | }, 63 | }, 64 | } 65 | cfStr, _ := json.Marshal(carbonFootprint) 66 | fmt.Println(string(cfStr)) 67 | } 68 | -------------------------------------------------------------------------------- /docs/images/qosensurancepolicy-model-detail-withcomment-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gocrane/api/fef1b667b52d01c3f2ca0b47b6c5821e19a54151/docs/images/qosensurancepolicy-model-detail-withcomment-en.png -------------------------------------------------------------------------------- /docs/proposals/20211103qos-ensurance-policy-api-definition.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Proposal Template 3 | authors: 4 | - "@devinyan" 5 | reviewers: 6 | - "@AAA" 7 | creation-date: 2021-11-03 8 | last-updated: 2021-11-03 9 | status: implementable 10 | --- 11 | 12 | # Title 13 | - Quality Probe And Ensurance API Introduction 14 | 15 | ## Table of Contents 16 | - [Quality Probe And Ensurance API Introduction](#Quality Probe And Ensurance API Introduction) 17 | - [Table of Contents](#table-of-contents) 18 | - [Summary](#Summary) 19 | - [API Define](#API Definition) 20 | 21 | ## Summary 22 | 23 | QosEnsurancePolicy model use active detect the quality of the service and the load of the node to find the high level services's quality be effected. 24 | If the high level service's quality be effected, we suppress and evict low level services to ensurance the high level service as far as possible. 25 | 26 | ## API Definition 27 | QosEnsurancePolicy model's api definition is show as the follow graph. 28 | 29 | ![QosEnsurancePolicyModelDetailWithcommentEn](../images/qosensurancepolicy-model-detail-withcomment-en.png) 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /ensurance/register.go: -------------------------------------------------------------------------------- 1 | package ensurance 2 | 3 | // GroupName is the group name used in this package 4 | const ( 5 | GroupName = "ensurance.crane.io" 6 | ) 7 | -------------------------------------------------------------------------------- /ensurance/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // Package v1alpha1 is the v1alpha1 version of the crane API. 2 | // +k8s:deepcopy-gen=package,register 3 | // +groupName=ensurance.crane.io 4 | package v1alpha1 5 | -------------------------------------------------------------------------------- /ensurance/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | "k8s.io/apimachinery/pkg/runtime" 6 | "k8s.io/apimachinery/pkg/runtime/schema" 7 | ) 8 | 9 | // GroupName specifies the group name used to register the objects. 10 | const GroupName = "ensurance.crane.io" 11 | 12 | // GroupVersion specifies the group and the version used to register the objects. 13 | var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha1"} 14 | 15 | // SchemeGroupVersion is group version used to register these objects 16 | // Deprecated: use GroupVersion instead. 17 | var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} 18 | 19 | // Resource takes an unqualified resource and returns a Group qualified GroupResource 20 | func Resource(resource string) schema.GroupResource { 21 | return SchemeGroupVersion.WithResource(resource).GroupResource() 22 | } 23 | 24 | var ( 25 | // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. 26 | SchemeBuilder runtime.SchemeBuilder 27 | localSchemeBuilder = &SchemeBuilder 28 | // Depreciated: use Install instead 29 | AddToScheme = localSchemeBuilder.AddToScheme 30 | Install = localSchemeBuilder.AddToScheme 31 | ) 32 | 33 | func init() { 34 | // We only register manually written functions here. The registration of the 35 | // generated functions takes place in the generated files. The separation 36 | // makes the code compile even when the generated files are missing. 37 | localSchemeBuilder.Register(addKnownTypes) 38 | } 39 | 40 | // Adds the list of known types to Scheme. 41 | func addKnownTypes(scheme *runtime.Scheme) error { 42 | scheme.AddKnownTypes(SchemeGroupVersion, 43 | &NodeQOS{}, 44 | &NodeQOSList{}, 45 | &PodQOS{}, 46 | &PodQOSList{}, 47 | &AvoidanceAction{}, 48 | &AvoidanceActionList{}, 49 | ) 50 | 51 | // AddToGroupVersion allows the serialization of client types like ListOptions. 52 | v1.AddToGroupVersion(scheme, SchemeGroupVersion) 53 | return nil 54 | } 55 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/gocrane/api 2 | 3 | go 1.16 4 | 5 | require ( 6 | github.com/onsi/ginkgo v1.16.5 7 | github.com/onsi/gomega v1.15.0 // indirect 8 | golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2 // indirect 9 | google.golang.org/appengine v1.6.7 // indirect 10 | k8s.io/api v0.22.3 11 | k8s.io/apimachinery v0.22.3 12 | k8s.io/autoscaler/vertical-pod-autoscaler v0.10.0 13 | k8s.io/client-go v0.22.3 14 | k8s.io/code-generator v0.22.3 15 | k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e 16 | k8s.io/metrics v0.22.1 17 | 18 | ) 19 | -------------------------------------------------------------------------------- /hack/boilerplate/boilerplate.go.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gocrane/api/fef1b667b52d01c3f2ca0b47b6c5821e19a54151/hack/boilerplate/boilerplate.go.txt -------------------------------------------------------------------------------- /hack/docker.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | # This script holds docker related functions. 8 | 9 | REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 10 | REGISTRY=${REGISTRY:-"ccr.ccs.tencentyun.com/kube-orm"} 11 | VERSION=${VERSION:="unknown"} 12 | 13 | function build_images() { 14 | local target="$1" 15 | docker build -t ${REGISTRY}/${target}:${VERSION} -f ${REPO_ROOT}/deploy/docker/${target}/Dockerfile ${REPO_ROOT} 16 | } 17 | 18 | build_images $@ 19 | -------------------------------------------------------------------------------- /hack/generate-proto.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | # Use `hack/generate-proto.sh` to generate proto files. 8 | 9 | export GOPATH=$(go env GOPATH | awk -F ':' '{print $1}') 10 | export PATH=$PATH:$GOPATH/bin 11 | 12 | GO111MODULE=on go install golang.org/x/tools/cmd/goimports 13 | GO111MODULE=on go install k8s.io/code-generator/cmd/go-to-protobuf 14 | GO111MODULE=on go install github.com/gogo/protobuf/protoc-gen-gogo 15 | 16 | PACKAGES=( 17 | github.com/gocrane/api/prediction/v1alpha1 18 | github.com/gocrane/api/ensurance/v1alpha1 19 | ) 20 | 21 | APIMACHINERY_PKGS=( 22 | +k8s.io/apimachinery/pkg/util/intstr 23 | +k8s.io/apimachinery/pkg/api/resource 24 | +k8s.io/apimachinery/pkg/runtime/schema 25 | +k8s.io/apimachinery/pkg/runtime 26 | k8s.io/apimachinery/pkg/apis/meta/v1 27 | k8s.io/api/core/v1 28 | ) 29 | 30 | ${GOPATH}/bin/go-to-protobuf \ 31 | --go-header-file=./hack/boilerplate/boilerplate.go.txt \ 32 | --apimachinery-packages=$(IFS=, ; echo "${APIMACHINERY_PKGS[*]}") \ 33 | --packages=$(IFS=, ; echo "${PACKAGES[*]}") \ 34 | --proto-import ./vendor \ 35 | --proto-import ./third_party/protobuf/ 36 | 37 | # The `go-to-protobuf` tool will modify all import proto files in vendor, so we should use go mod vendor to prevent. 38 | go mod vendor 39 | 40 | SERVICE_PROTO_FILES=$(find . -name "service.proto") 41 | 42 | for file in ${SERVICE_PROTO_FILES[*]}; do 43 | protoc \ 44 | --proto_path=. \ 45 | --proto_path=./vendor \ 46 | --gogo_out=plugins=grpc:. \ 47 | $file 48 | done 49 | -------------------------------------------------------------------------------- /hack/protoc.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2017 The Kubernetes Authors. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -o errexit 18 | set -o nounset 19 | set -o pipefail 20 | 21 | # The root of the build/dist directory 22 | KUBE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)" 23 | 24 | # Generates $1/api.pb.go from the protobuf file $1/api.proto 25 | # and formats it correctly 26 | # $1: Full path to the directory where the api.proto file is 27 | function kube::protoc::generate_proto() { 28 | 29 | go install github.com/gogo/protobuf/protoc-gen-gogo 30 | 31 | 32 | kube::protoc::check_protoc 33 | 34 | local package=${1} 35 | kube::protoc::protoc "${package}" 36 | kube::protoc::format "${package}" 37 | } 38 | 39 | # Checks that the current protoc version is at least version 3.0.0-beta1 40 | # exit 1 if it's not the case 41 | function kube::protoc::check_protoc() { 42 | if [[ -z "$(which protoc)" || "$(protoc --version)" != "libprotoc 3."* ]]; then 43 | echo "Generating protobuf requires protoc 3.0.0-beta1 or newer. Please download and" 44 | echo "install the platform appropriate Protobuf package for your OS: " 45 | echo 46 | echo " https://github.com/google/protobuf/releases" 47 | echo 48 | echo "WARNING: Protobuf changes are not being validated" 49 | exit 1 50 | fi 51 | } 52 | 53 | # Generates $1/api.pb.go from the protobuf file $1/api.proto 54 | # $1: Full path to the directory where the api.proto file is 55 | function kube::protoc::protoc() { 56 | local package=${1} 57 | gogopath=$(dirname "$(which protoc-gen-gogo)") 58 | 59 | PATH="${gogopath}:${PATH}" protoc \ 60 | --proto_path="${package}" \ 61 | --gogo_out=plugins=grpc:"${package}" "${package}/api.proto" 62 | } 63 | 64 | # Formats $1/api.pb.go, adds the boilerplate comments and run gofmt on it 65 | # $1: Full path to the directory where the api.proto file is 66 | function kube::protoc::format() { 67 | local package=${1} 68 | 69 | # Update boilerplate for the generated file. 70 | cat hack/boilerplate/boilerplate.go.txt "${package}/api.pb.go" > tmpfile && mv tmpfile "${package}/api.pb.go" 71 | 72 | # Run gofmt to clean up the generated code. 73 | gofmt -l -s -w "${package}/api.pb.go" 74 | } 75 | 76 | # Compares the contents of $1 and $2 77 | # Echo's $3 in case of error and exits 1 78 | function kube::protoc::diff() { 79 | local ret=0 80 | diff -I "gzipped FileDescriptorProto" -I "0x" -Naupr "${1}" "${2}" || ret=$? 81 | if [[ ${ret} -ne 0 ]]; then 82 | echo "${3}" 83 | exit 1 84 | fi 85 | } 86 | -------------------------------------------------------------------------------- /hack/tools/tools.go: -------------------------------------------------------------------------------- 1 | // +build tools 2 | 3 | package tools 4 | 5 | import ( 6 | _ "github.com/onsi/ginkgo/ginkgo" 7 | _ "k8s.io/code-generator" 8 | ) 9 | -------------------------------------------------------------------------------- /hack/update-all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 8 | 9 | bash "$REPO_ROOT/hack/update-codegen.sh" 10 | bash "$REPO_ROOT/hack/update-crdgen.sh" 11 | #bash "$REPO_ROOT/hack/update-gen-proto.sh" -------------------------------------------------------------------------------- /hack/update-codegen.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | # For all commands, the working directory is the parent directory(repo root). 8 | REPO_ROOT=$(git rev-parse --show-toplevel) 9 | cd "${REPO_ROOT}" 10 | 11 | SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 12 | echo $SCRIPT_ROOT 13 | CODEGEN_PKG=${CODEGEN_PKG:-$( 14 | cd "${SCRIPT_ROOT}" 15 | go mod vendor 16 | ls -d -1 ./vendor/k8s.io/code-generator 17 | )} 18 | 19 | bash "${CODEGEN_PKG}"/generate-groups.sh "client,lister,informer" \ 20 | github.com/gocrane/api/pkg/generated \ 21 | github.com/gocrane/api \ 22 | "autoscaling:v1alpha1 ensurance:v1alpha1 prediction:v1alpha1 analysis:v1alpha1 topology:v1alpha1 co2e:v1alpha1" \ 23 | --output-base "$SCRIPT_ROOT" \ 24 | --go-header-file "${SCRIPT_ROOT}/hack/boilerplate/boilerplate.go.txt" \ 25 | --plural-exceptions "Analytics:Analytics" 26 | 27 | bash "${CODEGEN_PKG}"/generate-groups.sh "deepcopy" \ 28 | github.com/gocrane/api/pkg/generated \ 29 | github.com/gocrane/api \ 30 | "autoscaling:v1alpha1 ensurance:v1alpha1 prediction:v1alpha1 analysis:v1alpha1 topology:v1alpha1 co2e:v1alpha1" \ 31 | --output-base "$SCRIPT_ROOT" \ 32 | --go-header-file "${SCRIPT_ROOT}/hack/boilerplate/boilerplate.go.txt" 33 | 34 | cp -r $SCRIPT_ROOT/github.com/gocrane/api/* $SCRIPT_ROOT 35 | 36 | rm -rf $SCRIPT_ROOT/github.com 37 | 38 | KUBE_OPENAPI_PKG=`go list -mod=readonly -m -f '{{.Dir}}' k8s.io/kube-openapi` 39 | 40 | go run ${KUBE_OPENAPI_PKG}/cmd/openapi-gen/openapi-gen.go --logtostderr \ 41 | -i k8s.io/metrics/pkg/apis/custom_metrics,k8s.io/metrics/pkg/apis/custom_metrics/v1beta1,k8s.io/metrics/pkg/apis/custom_metrics/v1beta2,k8s.io/metrics/pkg/apis/external_metrics,k8s.io/metrics/pkg/apis/external_metrics/v1beta1,k8s.io/metrics/pkg/apis/metrics,k8s.io/metrics/pkg/apis/metrics/v1beta1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/api/resource,k8s.io/apimachinery/pkg/version,k8s.io/api/core/v1 \ 42 | --build-tag autogenerated \ 43 | -h ./hack/boilerplate/boilerplate.go.txt \ 44 | -p ./pkg/generated/openapi \ 45 | -O zz_generated.openapi \ 46 | -o ./ \ 47 | -r /dev/null -------------------------------------------------------------------------------- /hack/update-crdgen.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | CONTROLLER_GEN_PKG="sigs.k8s.io/controller-tools/cmd/controller-gen" 8 | CONTROLLER_GEN_VER="v0.7.0" 9 | 10 | source hack/util.sh 11 | 12 | echo "Generating with controller-gen" 13 | util::install_tools ${CONTROLLER_GEN_PKG} ${CONTROLLER_GEN_VER} >/dev/null 2>&1 14 | controller-gen crd paths=./prediction/... output:crd:dir=./artifacts/deploy 15 | controller-gen crd paths=./autoscaling/... output:crd:dir=./artifacts/deploy 16 | controller-gen crd paths=./ensurance/... output:crd:dir=./artifacts/deploy 17 | controller-gen crd paths=./analysis/... output:crd:dir=./artifacts/deploy 18 | controller-gen crd paths=./topology/... output:crd:dir=./artifacts/deploy 19 | controller-gen crd paths=./co2e/... output:crd:dir=./artifacts/deploy 20 | 21 | controller-gen webhook paths=./prediction/... output:webhook:dir=./artifacts/deploy 22 | controller-gen webhook paths=./autoscaling/... output:webhook:dir=./artifacts/deploy 23 | controller-gen webhook paths=./ensurance/... output:webhook:dir=./artifacts/deploy 24 | controller-gen webhook paths=./analysis/... output:webhook:dir=./artifacts/deploy 25 | controller-gen webhook paths=./topology/... output:webhook:dir=./artifacts/deploy 26 | controller-gen webhook paths=./co2e/... output:webhook:dir=./artifacts/deploy 27 | 28 | -------------------------------------------------------------------------------- /hack/update-gen-proto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | # This script generates `*/api.pb.go` from the protobuf file `*/api.proto`. 5 | # Example: 6 | # kube::protoc::generate_proto "${PREDICTION_V1}" 7 | 8 | set -o errexit 9 | set -o nounset 10 | set -o pipefail 11 | 12 | ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd -P)" 13 | PREDICTION_V1="${ROOT}/prediction/v1alpha1" 14 | ENSURANCE_V1="${ROOT}/ensurance/v1alpha1" 15 | 16 | source "${ROOT}/hack/protoc.sh" 17 | kube::protoc::generate_proto "${PREDICTION_V1}" 18 | kube::protoc::generate_proto "${ENSURANCE_V1}" -------------------------------------------------------------------------------- /hack/util.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | # This script holds common bash variables and utility functions. 8 | 9 | # This function installs a Go tools by 'go get' command. 10 | # Parameters: 11 | # - $1: package name, such as "sigs.k8s.io/controllers-tools/cmd/controllers-gen" 12 | # - $2: package version, such as "v0.4.1" 13 | # Note: 14 | # Since 'go get' command will resolve and add dependencies to current module, that may update 'go.mod' and 'go.sum' file. 15 | # So we use a temporary directory to install the tools. 16 | function util::install_tools() { 17 | local package="$1" 18 | local version="$2" 19 | 20 | temp_path=$(mktemp -d) 21 | pushd "${temp_path}" >/dev/null 22 | GO111MODULE=on go install "${package}"@"${version}" 23 | GOPATH=$(go env GOPATH | awk -F ':' '{print $1}') 24 | export PATH=$PATH:$GOPATH/bin 25 | popd >/dev/null 26 | rm -rf "${temp_path}" 27 | } -------------------------------------------------------------------------------- /hack/verify-all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 8 | 9 | bash "$REPO_ROOT/hack/verify-codegen.sh" 10 | bash "$REPO_ROOT/hack/verify-crdgen.sh" 11 | bash "$REPO_ROOT/hack/verify-staticcheck.sh" -------------------------------------------------------------------------------- /hack/verify-codegen.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 8 | 9 | DIFFROOT="${SCRIPT_ROOT}/pkg" 10 | TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/pkg" 11 | _tmp="${SCRIPT_ROOT}/_tmp" 12 | 13 | cleanup() { 14 | rm -rf "${_tmp}" 15 | } 16 | trap "cleanup" EXIT SIGINT 17 | 18 | cleanup 19 | 20 | mkdir -p "${TMP_DIFFROOT}" 21 | cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}" 22 | 23 | bash "${SCRIPT_ROOT}/hack/update-codegen.sh" 24 | echo "diffing ${DIFFROOT} against freshly generated codegen" 25 | ret=0 26 | diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$? 27 | cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}" 28 | if [[ $ret -eq 0 ]] 29 | then 30 | echo "${DIFFROOT} up to date." 31 | else 32 | echo "${DIFFROOT} is out of date. Please run hack/update-codegen.sh" 33 | exit 1 34 | fi 35 | -------------------------------------------------------------------------------- /hack/verify-crdgen.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 8 | 9 | DIFFROOT="${SCRIPT_ROOT}/pkg" 10 | TMP_DIFFROOT="${SCRIPT_ROOT}/_tmp/pkg" 11 | _tmp="${SCRIPT_ROOT}/_tmp" 12 | 13 | cleanup() { 14 | rm -rf "${_tmp}" 15 | } 16 | trap "cleanup" EXIT SIGINT 17 | 18 | cleanup 19 | 20 | mkdir -p "${TMP_DIFFROOT}" 21 | cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}" 22 | 23 | bash "${SCRIPT_ROOT}/hack/update-crdgen.sh" 24 | echo "diffing ${DIFFROOT} against freshly generated files" 25 | 26 | ret=0 27 | 28 | diff -Naupr "${DIFFROOT}" "${TMP_DIFFROOT}" || ret=$? 29 | cp -a "${TMP_DIFFROOT}"/* "${DIFFROOT}" 30 | if [[ $ret -eq 0 ]] 31 | then 32 | echo "${DIFFROOT} up to date." 33 | else 34 | echo "${DIFFROOT} is out of date. Please run hack/update-crdgen.sh" 35 | exit 1 36 | fi 37 | -------------------------------------------------------------------------------- /hack/verify-staticcheck.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. 7 | GOLANGCI_LINT_PKG="github.com/golangci/golangci-lint/cmd/golangci-lint" 8 | GOLANGCI_LINT_VER="v1.43.0" 9 | cd "${REPO_ROOT}" 10 | source "hack/util.sh" 11 | util::install_tools ${GOLANGCI_LINT_PKG} ${GOLANGCI_LINT_VER} 12 | if golangci-lint run --timeout=20m; then 13 | echo 'Congratulations! All Go source files have passed staticcheck.' 14 | else 15 | echo # print one empty line, separate from warning messages. 16 | echo 'Please review the above warnings.' 17 | echo 'If the above warnings do not make sense, feel free to file an issue.' 18 | exit 1 19 | fi 20 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // This package has the automatically generated clientset. 4 | package versioned 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/fake/clientset_generated.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package fake 4 | 5 | import ( 6 | clientset "github.com/gocrane/api/pkg/generated/clientset/versioned" 7 | analysisv1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/analysis/v1alpha1" 8 | fakeanalysisv1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/analysis/v1alpha1/fake" 9 | autoscalingv1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/autoscaling/v1alpha1" 10 | fakeautoscalingv1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/autoscaling/v1alpha1/fake" 11 | co2ev1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/co2e/v1alpha1" 12 | fakeco2ev1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/co2e/v1alpha1/fake" 13 | ensurancev1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/ensurance/v1alpha1" 14 | fakeensurancev1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/ensurance/v1alpha1/fake" 15 | predictionv1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/prediction/v1alpha1" 16 | fakepredictionv1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/prediction/v1alpha1/fake" 17 | topologyv1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/topology/v1alpha1" 18 | faketopologyv1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/topology/v1alpha1/fake" 19 | "k8s.io/apimachinery/pkg/runtime" 20 | "k8s.io/apimachinery/pkg/watch" 21 | "k8s.io/client-go/discovery" 22 | fakediscovery "k8s.io/client-go/discovery/fake" 23 | "k8s.io/client-go/testing" 24 | ) 25 | 26 | // NewSimpleClientset returns a clientset that will respond with the provided objects. 27 | // It's backed by a very simple object tracker that processes creates, updates and deletions as-is, 28 | // without applying any validations and/or defaults. It shouldn't be considered a replacement 29 | // for a real clientset and is mostly useful in simple unit tests. 30 | func NewSimpleClientset(objects ...runtime.Object) *Clientset { 31 | o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder()) 32 | for _, obj := range objects { 33 | if err := o.Add(obj); err != nil { 34 | panic(err) 35 | } 36 | } 37 | 38 | cs := &Clientset{tracker: o} 39 | cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake} 40 | cs.AddReactor("*", "*", testing.ObjectReaction(o)) 41 | cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { 42 | gvr := action.GetResource() 43 | ns := action.GetNamespace() 44 | watch, err := o.Watch(gvr, ns) 45 | if err != nil { 46 | return false, nil, err 47 | } 48 | return true, watch, nil 49 | }) 50 | 51 | return cs 52 | } 53 | 54 | // Clientset implements clientset.Interface. Meant to be embedded into a 55 | // struct to get a default implementation. This makes faking out just the method 56 | // you want to test easier. 57 | type Clientset struct { 58 | testing.Fake 59 | discovery *fakediscovery.FakeDiscovery 60 | tracker testing.ObjectTracker 61 | } 62 | 63 | func (c *Clientset) Discovery() discovery.DiscoveryInterface { 64 | return c.discovery 65 | } 66 | 67 | func (c *Clientset) Tracker() testing.ObjectTracker { 68 | return c.tracker 69 | } 70 | 71 | var ( 72 | _ clientset.Interface = &Clientset{} 73 | _ testing.FakeClient = &Clientset{} 74 | ) 75 | 76 | // AnalysisV1alpha1 retrieves the AnalysisV1alpha1Client 77 | func (c *Clientset) AnalysisV1alpha1() analysisv1alpha1.AnalysisV1alpha1Interface { 78 | return &fakeanalysisv1alpha1.FakeAnalysisV1alpha1{Fake: &c.Fake} 79 | } 80 | 81 | // AutoscalingV1alpha1 retrieves the AutoscalingV1alpha1Client 82 | func (c *Clientset) AutoscalingV1alpha1() autoscalingv1alpha1.AutoscalingV1alpha1Interface { 83 | return &fakeautoscalingv1alpha1.FakeAutoscalingV1alpha1{Fake: &c.Fake} 84 | } 85 | 86 | // Co2eV1alpha1 retrieves the Co2eV1alpha1Client 87 | func (c *Clientset) Co2eV1alpha1() co2ev1alpha1.Co2eV1alpha1Interface { 88 | return &fakeco2ev1alpha1.FakeCo2eV1alpha1{Fake: &c.Fake} 89 | } 90 | 91 | // EnsuranceV1alpha1 retrieves the EnsuranceV1alpha1Client 92 | func (c *Clientset) EnsuranceV1alpha1() ensurancev1alpha1.EnsuranceV1alpha1Interface { 93 | return &fakeensurancev1alpha1.FakeEnsuranceV1alpha1{Fake: &c.Fake} 94 | } 95 | 96 | // PredictionV1alpha1 retrieves the PredictionV1alpha1Client 97 | func (c *Clientset) PredictionV1alpha1() predictionv1alpha1.PredictionV1alpha1Interface { 98 | return &fakepredictionv1alpha1.FakePredictionV1alpha1{Fake: &c.Fake} 99 | } 100 | 101 | // TopologyV1alpha1 retrieves the TopologyV1alpha1Client 102 | func (c *Clientset) TopologyV1alpha1() topologyv1alpha1.TopologyV1alpha1Interface { 103 | return &faketopologyv1alpha1.FakeTopologyV1alpha1{Fake: &c.Fake} 104 | } 105 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/fake/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // This package has the automatically generated fake clientset. 4 | package fake 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/fake/register.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package fake 4 | 5 | import ( 6 | analysisv1alpha1 "github.com/gocrane/api/analysis/v1alpha1" 7 | autoscalingv1alpha1 "github.com/gocrane/api/autoscaling/v1alpha1" 8 | co2ev1alpha1 "github.com/gocrane/api/co2e/v1alpha1" 9 | ensurancev1alpha1 "github.com/gocrane/api/ensurance/v1alpha1" 10 | predictionv1alpha1 "github.com/gocrane/api/prediction/v1alpha1" 11 | topologyv1alpha1 "github.com/gocrane/api/topology/v1alpha1" 12 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 13 | runtime "k8s.io/apimachinery/pkg/runtime" 14 | schema "k8s.io/apimachinery/pkg/runtime/schema" 15 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 16 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 17 | ) 18 | 19 | var scheme = runtime.NewScheme() 20 | var codecs = serializer.NewCodecFactory(scheme) 21 | 22 | var localSchemeBuilder = runtime.SchemeBuilder{ 23 | analysisv1alpha1.AddToScheme, 24 | autoscalingv1alpha1.AddToScheme, 25 | co2ev1alpha1.AddToScheme, 26 | ensurancev1alpha1.AddToScheme, 27 | predictionv1alpha1.AddToScheme, 28 | topologyv1alpha1.AddToScheme, 29 | } 30 | 31 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 32 | // of clientsets, like in: 33 | // 34 | // import ( 35 | // "k8s.io/client-go/kubernetes" 36 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 37 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 38 | // ) 39 | // 40 | // kclientset, _ := kubernetes.NewForConfig(c) 41 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 42 | // 43 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 44 | // correctly. 45 | var AddToScheme = localSchemeBuilder.AddToScheme 46 | 47 | func init() { 48 | v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"}) 49 | utilruntime.Must(AddToScheme(scheme)) 50 | } 51 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/scheme/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // This package contains the scheme of the automatically generated clientset. 4 | package scheme 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/scheme/register.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package scheme 4 | 5 | import ( 6 | analysisv1alpha1 "github.com/gocrane/api/analysis/v1alpha1" 7 | autoscalingv1alpha1 "github.com/gocrane/api/autoscaling/v1alpha1" 8 | co2ev1alpha1 "github.com/gocrane/api/co2e/v1alpha1" 9 | ensurancev1alpha1 "github.com/gocrane/api/ensurance/v1alpha1" 10 | predictionv1alpha1 "github.com/gocrane/api/prediction/v1alpha1" 11 | topologyv1alpha1 "github.com/gocrane/api/topology/v1alpha1" 12 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 13 | runtime "k8s.io/apimachinery/pkg/runtime" 14 | schema "k8s.io/apimachinery/pkg/runtime/schema" 15 | serializer "k8s.io/apimachinery/pkg/runtime/serializer" 16 | utilruntime "k8s.io/apimachinery/pkg/util/runtime" 17 | ) 18 | 19 | var Scheme = runtime.NewScheme() 20 | var Codecs = serializer.NewCodecFactory(Scheme) 21 | var ParameterCodec = runtime.NewParameterCodec(Scheme) 22 | var localSchemeBuilder = runtime.SchemeBuilder{ 23 | analysisv1alpha1.AddToScheme, 24 | autoscalingv1alpha1.AddToScheme, 25 | co2ev1alpha1.AddToScheme, 26 | ensurancev1alpha1.AddToScheme, 27 | predictionv1alpha1.AddToScheme, 28 | topologyv1alpha1.AddToScheme, 29 | } 30 | 31 | // AddToScheme adds all types of this clientset into the given scheme. This allows composition 32 | // of clientsets, like in: 33 | // 34 | // import ( 35 | // "k8s.io/client-go/kubernetes" 36 | // clientsetscheme "k8s.io/client-go/kubernetes/scheme" 37 | // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" 38 | // ) 39 | // 40 | // kclientset, _ := kubernetes.NewForConfig(c) 41 | // _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) 42 | // 43 | // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types 44 | // correctly. 45 | var AddToScheme = localSchemeBuilder.AddToScheme 46 | 47 | func init() { 48 | v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) 49 | utilruntime.Must(AddToScheme(Scheme)) 50 | } 51 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/analysis/v1alpha1/analysis_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/analysis/v1alpha1" 7 | "github.com/gocrane/api/pkg/generated/clientset/versioned/scheme" 8 | rest "k8s.io/client-go/rest" 9 | ) 10 | 11 | type AnalysisV1alpha1Interface interface { 12 | RESTClient() rest.Interface 13 | AnalyticsGetter 14 | ConfigSetsGetter 15 | RecommendationsGetter 16 | RecommendationRulesGetter 17 | } 18 | 19 | // AnalysisV1alpha1Client is used to interact with features provided by the analysis.crane.io group. 20 | type AnalysisV1alpha1Client struct { 21 | restClient rest.Interface 22 | } 23 | 24 | func (c *AnalysisV1alpha1Client) Analytics(namespace string) AnalyticsInterface { 25 | return newAnalytics(c, namespace) 26 | } 27 | 28 | func (c *AnalysisV1alpha1Client) ConfigSets(namespace string) ConfigSetInterface { 29 | return newConfigSets(c, namespace) 30 | } 31 | 32 | func (c *AnalysisV1alpha1Client) Recommendations(namespace string) RecommendationInterface { 33 | return newRecommendations(c, namespace) 34 | } 35 | 36 | func (c *AnalysisV1alpha1Client) RecommendationRules() RecommendationRuleInterface { 37 | return newRecommendationRules(c) 38 | } 39 | 40 | // NewForConfig creates a new AnalysisV1alpha1Client for the given config. 41 | func NewForConfig(c *rest.Config) (*AnalysisV1alpha1Client, error) { 42 | config := *c 43 | if err := setConfigDefaults(&config); err != nil { 44 | return nil, err 45 | } 46 | client, err := rest.RESTClientFor(&config) 47 | if err != nil { 48 | return nil, err 49 | } 50 | return &AnalysisV1alpha1Client{client}, nil 51 | } 52 | 53 | // NewForConfigOrDie creates a new AnalysisV1alpha1Client for the given config and 54 | // panics if there is an error in the config. 55 | func NewForConfigOrDie(c *rest.Config) *AnalysisV1alpha1Client { 56 | client, err := NewForConfig(c) 57 | if err != nil { 58 | panic(err) 59 | } 60 | return client 61 | } 62 | 63 | // New creates a new AnalysisV1alpha1Client for the given RESTClient. 64 | func New(c rest.Interface) *AnalysisV1alpha1Client { 65 | return &AnalysisV1alpha1Client{c} 66 | } 67 | 68 | func setConfigDefaults(config *rest.Config) error { 69 | gv := v1alpha1.SchemeGroupVersion 70 | config.GroupVersion = &gv 71 | config.APIPath = "/apis" 72 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 73 | 74 | if config.UserAgent == "" { 75 | config.UserAgent = rest.DefaultKubernetesUserAgent() 76 | } 77 | 78 | return nil 79 | } 80 | 81 | // RESTClient returns a RESTClient that is used to communicate 82 | // with API server by this client implementation. 83 | func (c *AnalysisV1alpha1Client) RESTClient() rest.Interface { 84 | if c == nil { 85 | return nil 86 | } 87 | return c.restClient 88 | } 89 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/analysis/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // This package has the automatically generated typed clients. 4 | package v1alpha1 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/analysis/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // Package fake has the automatically generated clients. 4 | package fake 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/analysis/v1alpha1/fake/fake_analysis_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package fake 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/analysis/v1alpha1" 7 | rest "k8s.io/client-go/rest" 8 | testing "k8s.io/client-go/testing" 9 | ) 10 | 11 | type FakeAnalysisV1alpha1 struct { 12 | *testing.Fake 13 | } 14 | 15 | func (c *FakeAnalysisV1alpha1) Analytics(namespace string) v1alpha1.AnalyticsInterface { 16 | return &FakeAnalytics{c, namespace} 17 | } 18 | 19 | func (c *FakeAnalysisV1alpha1) ConfigSets(namespace string) v1alpha1.ConfigSetInterface { 20 | return &FakeConfigSets{c, namespace} 21 | } 22 | 23 | func (c *FakeAnalysisV1alpha1) Recommendations(namespace string) v1alpha1.RecommendationInterface { 24 | return &FakeRecommendations{c, namespace} 25 | } 26 | 27 | func (c *FakeAnalysisV1alpha1) RecommendationRules() v1alpha1.RecommendationRuleInterface { 28 | return &FakeRecommendationRules{c} 29 | } 30 | 31 | // RESTClient returns a RESTClient that is used to communicate 32 | // with API server by this client implementation. 33 | func (c *FakeAnalysisV1alpha1) RESTClient() rest.Interface { 34 | var ret *rest.RESTClient 35 | return ret 36 | } 37 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/analysis/v1alpha1/fake/fake_configset.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package fake 4 | 5 | import ( 6 | "context" 7 | 8 | v1alpha1 "github.com/gocrane/api/analysis/v1alpha1" 9 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 10 | labels "k8s.io/apimachinery/pkg/labels" 11 | schema "k8s.io/apimachinery/pkg/runtime/schema" 12 | types "k8s.io/apimachinery/pkg/types" 13 | watch "k8s.io/apimachinery/pkg/watch" 14 | testing "k8s.io/client-go/testing" 15 | ) 16 | 17 | // FakeConfigSets implements ConfigSetInterface 18 | type FakeConfigSets struct { 19 | Fake *FakeAnalysisV1alpha1 20 | ns string 21 | } 22 | 23 | var configsetsResource = schema.GroupVersionResource{Group: "analysis.crane.io", Version: "v1alpha1", Resource: "configsets"} 24 | 25 | var configsetsKind = schema.GroupVersionKind{Group: "analysis.crane.io", Version: "v1alpha1", Kind: "ConfigSet"} 26 | 27 | // Get takes name of the configSet, and returns the corresponding configSet object, and an error if there is any. 28 | func (c *FakeConfigSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ConfigSet, err error) { 29 | obj, err := c.Fake. 30 | Invokes(testing.NewGetAction(configsetsResource, c.ns, name), &v1alpha1.ConfigSet{}) 31 | 32 | if obj == nil { 33 | return nil, err 34 | } 35 | return obj.(*v1alpha1.ConfigSet), err 36 | } 37 | 38 | // List takes label and field selectors, and returns the list of ConfigSets that match those selectors. 39 | func (c *FakeConfigSets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ConfigSetList, err error) { 40 | obj, err := c.Fake. 41 | Invokes(testing.NewListAction(configsetsResource, configsetsKind, c.ns, opts), &v1alpha1.ConfigSetList{}) 42 | 43 | if obj == nil { 44 | return nil, err 45 | } 46 | 47 | label, _, _ := testing.ExtractFromListOptions(opts) 48 | if label == nil { 49 | label = labels.Everything() 50 | } 51 | list := &v1alpha1.ConfigSetList{ListMeta: obj.(*v1alpha1.ConfigSetList).ListMeta} 52 | for _, item := range obj.(*v1alpha1.ConfigSetList).Items { 53 | if label.Matches(labels.Set(item.Labels)) { 54 | list.Items = append(list.Items, item) 55 | } 56 | } 57 | return list, err 58 | } 59 | 60 | // Watch returns a watch.Interface that watches the requested configSets. 61 | func (c *FakeConfigSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { 62 | return c.Fake. 63 | InvokesWatch(testing.NewWatchAction(configsetsResource, c.ns, opts)) 64 | 65 | } 66 | 67 | // Create takes the representation of a configSet and creates it. Returns the server's representation of the configSet, and an error, if there is any. 68 | func (c *FakeConfigSets) Create(ctx context.Context, configSet *v1alpha1.ConfigSet, opts v1.CreateOptions) (result *v1alpha1.ConfigSet, err error) { 69 | obj, err := c.Fake. 70 | Invokes(testing.NewCreateAction(configsetsResource, c.ns, configSet), &v1alpha1.ConfigSet{}) 71 | 72 | if obj == nil { 73 | return nil, err 74 | } 75 | return obj.(*v1alpha1.ConfigSet), err 76 | } 77 | 78 | // Update takes the representation of a configSet and updates it. Returns the server's representation of the configSet, and an error, if there is any. 79 | func (c *FakeConfigSets) Update(ctx context.Context, configSet *v1alpha1.ConfigSet, opts v1.UpdateOptions) (result *v1alpha1.ConfigSet, err error) { 80 | obj, err := c.Fake. 81 | Invokes(testing.NewUpdateAction(configsetsResource, c.ns, configSet), &v1alpha1.ConfigSet{}) 82 | 83 | if obj == nil { 84 | return nil, err 85 | } 86 | return obj.(*v1alpha1.ConfigSet), err 87 | } 88 | 89 | // Delete takes name of the configSet and deletes it. Returns an error if one occurs. 90 | func (c *FakeConfigSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { 91 | _, err := c.Fake. 92 | Invokes(testing.NewDeleteAction(configsetsResource, c.ns, name), &v1alpha1.ConfigSet{}) 93 | 94 | return err 95 | } 96 | 97 | // DeleteCollection deletes a collection of objects. 98 | func (c *FakeConfigSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { 99 | action := testing.NewDeleteCollectionAction(configsetsResource, c.ns, listOpts) 100 | 101 | _, err := c.Fake.Invokes(action, &v1alpha1.ConfigSetList{}) 102 | return err 103 | } 104 | 105 | // Patch applies the patch and returns the patched configSet. 106 | func (c *FakeConfigSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ConfigSet, err error) { 107 | obj, err := c.Fake. 108 | Invokes(testing.NewPatchSubresourceAction(configsetsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ConfigSet{}) 109 | 110 | if obj == nil { 111 | return nil, err 112 | } 113 | return obj.(*v1alpha1.ConfigSet), err 114 | } 115 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/analysis/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | type AnalyticsExpansion interface{} 6 | 7 | type ConfigSetExpansion interface{} 8 | 9 | type RecommendationExpansion interface{} 10 | 11 | type RecommendationRuleExpansion interface{} 12 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/autoscaling/v1alpha1/autoscaling_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/autoscaling/v1alpha1" 7 | "github.com/gocrane/api/pkg/generated/clientset/versioned/scheme" 8 | rest "k8s.io/client-go/rest" 9 | ) 10 | 11 | type AutoscalingV1alpha1Interface interface { 12 | RESTClient() rest.Interface 13 | EffectiveHorizontalPodAutoscalersGetter 14 | EffectiveVerticalPodAutoscalersGetter 15 | SubstitutesGetter 16 | } 17 | 18 | // AutoscalingV1alpha1Client is used to interact with features provided by the autoscaling.crane.io group. 19 | type AutoscalingV1alpha1Client struct { 20 | restClient rest.Interface 21 | } 22 | 23 | func (c *AutoscalingV1alpha1Client) EffectiveHorizontalPodAutoscalers(namespace string) EffectiveHorizontalPodAutoscalerInterface { 24 | return newEffectiveHorizontalPodAutoscalers(c, namespace) 25 | } 26 | 27 | func (c *AutoscalingV1alpha1Client) EffectiveVerticalPodAutoscalers(namespace string) EffectiveVerticalPodAutoscalerInterface { 28 | return newEffectiveVerticalPodAutoscalers(c, namespace) 29 | } 30 | 31 | func (c *AutoscalingV1alpha1Client) Substitutes(namespace string) SubstituteInterface { 32 | return newSubstitutes(c, namespace) 33 | } 34 | 35 | // NewForConfig creates a new AutoscalingV1alpha1Client for the given config. 36 | func NewForConfig(c *rest.Config) (*AutoscalingV1alpha1Client, error) { 37 | config := *c 38 | if err := setConfigDefaults(&config); err != nil { 39 | return nil, err 40 | } 41 | client, err := rest.RESTClientFor(&config) 42 | if err != nil { 43 | return nil, err 44 | } 45 | return &AutoscalingV1alpha1Client{client}, nil 46 | } 47 | 48 | // NewForConfigOrDie creates a new AutoscalingV1alpha1Client for the given config and 49 | // panics if there is an error in the config. 50 | func NewForConfigOrDie(c *rest.Config) *AutoscalingV1alpha1Client { 51 | client, err := NewForConfig(c) 52 | if err != nil { 53 | panic(err) 54 | } 55 | return client 56 | } 57 | 58 | // New creates a new AutoscalingV1alpha1Client for the given RESTClient. 59 | func New(c rest.Interface) *AutoscalingV1alpha1Client { 60 | return &AutoscalingV1alpha1Client{c} 61 | } 62 | 63 | func setConfigDefaults(config *rest.Config) error { 64 | gv := v1alpha1.SchemeGroupVersion 65 | config.GroupVersion = &gv 66 | config.APIPath = "/apis" 67 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 68 | 69 | if config.UserAgent == "" { 70 | config.UserAgent = rest.DefaultKubernetesUserAgent() 71 | } 72 | 73 | return nil 74 | } 75 | 76 | // RESTClient returns a RESTClient that is used to communicate 77 | // with API server by this client implementation. 78 | func (c *AutoscalingV1alpha1Client) RESTClient() rest.Interface { 79 | if c == nil { 80 | return nil 81 | } 82 | return c.restClient 83 | } 84 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/autoscaling/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // This package has the automatically generated typed clients. 4 | package v1alpha1 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/autoscaling/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // Package fake has the automatically generated clients. 4 | package fake 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_autoscaling_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package fake 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/autoscaling/v1alpha1" 7 | rest "k8s.io/client-go/rest" 8 | testing "k8s.io/client-go/testing" 9 | ) 10 | 11 | type FakeAutoscalingV1alpha1 struct { 12 | *testing.Fake 13 | } 14 | 15 | func (c *FakeAutoscalingV1alpha1) EffectiveHorizontalPodAutoscalers(namespace string) v1alpha1.EffectiveHorizontalPodAutoscalerInterface { 16 | return &FakeEffectiveHorizontalPodAutoscalers{c, namespace} 17 | } 18 | 19 | func (c *FakeAutoscalingV1alpha1) EffectiveVerticalPodAutoscalers(namespace string) v1alpha1.EffectiveVerticalPodAutoscalerInterface { 20 | return &FakeEffectiveVerticalPodAutoscalers{c, namespace} 21 | } 22 | 23 | func (c *FakeAutoscalingV1alpha1) Substitutes(namespace string) v1alpha1.SubstituteInterface { 24 | return &FakeSubstitutes{c, namespace} 25 | } 26 | 27 | // RESTClient returns a RESTClient that is used to communicate 28 | // with API server by this client implementation. 29 | func (c *FakeAutoscalingV1alpha1) RESTClient() rest.Interface { 30 | var ret *rest.RESTClient 31 | return ret 32 | } 33 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/autoscaling/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | type EffectiveHorizontalPodAutoscalerExpansion interface{} 6 | 7 | type EffectiveVerticalPodAutoscalerExpansion interface{} 8 | 9 | type SubstituteExpansion interface{} 10 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/co2e/v1alpha1/co2e_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/co2e/v1alpha1" 7 | "github.com/gocrane/api/pkg/generated/clientset/versioned/scheme" 8 | rest "k8s.io/client-go/rest" 9 | ) 10 | 11 | type Co2eV1alpha1Interface interface { 12 | RESTClient() rest.Interface 13 | CloudCarbonFootprintsGetter 14 | } 15 | 16 | // Co2eV1alpha1Client is used to interact with features provided by the co2e.crane.io group. 17 | type Co2eV1alpha1Client struct { 18 | restClient rest.Interface 19 | } 20 | 21 | func (c *Co2eV1alpha1Client) CloudCarbonFootprints() CloudCarbonFootprintInterface { 22 | return newCloudCarbonFootprints(c) 23 | } 24 | 25 | // NewForConfig creates a new Co2eV1alpha1Client for the given config. 26 | func NewForConfig(c *rest.Config) (*Co2eV1alpha1Client, error) { 27 | config := *c 28 | if err := setConfigDefaults(&config); err != nil { 29 | return nil, err 30 | } 31 | client, err := rest.RESTClientFor(&config) 32 | if err != nil { 33 | return nil, err 34 | } 35 | return &Co2eV1alpha1Client{client}, nil 36 | } 37 | 38 | // NewForConfigOrDie creates a new Co2eV1alpha1Client for the given config and 39 | // panics if there is an error in the config. 40 | func NewForConfigOrDie(c *rest.Config) *Co2eV1alpha1Client { 41 | client, err := NewForConfig(c) 42 | if err != nil { 43 | panic(err) 44 | } 45 | return client 46 | } 47 | 48 | // New creates a new Co2eV1alpha1Client for the given RESTClient. 49 | func New(c rest.Interface) *Co2eV1alpha1Client { 50 | return &Co2eV1alpha1Client{c} 51 | } 52 | 53 | func setConfigDefaults(config *rest.Config) error { 54 | gv := v1alpha1.SchemeGroupVersion 55 | config.GroupVersion = &gv 56 | config.APIPath = "/apis" 57 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 58 | 59 | if config.UserAgent == "" { 60 | config.UserAgent = rest.DefaultKubernetesUserAgent() 61 | } 62 | 63 | return nil 64 | } 65 | 66 | // RESTClient returns a RESTClient that is used to communicate 67 | // with API server by this client implementation. 68 | func (c *Co2eV1alpha1Client) RESTClient() rest.Interface { 69 | if c == nil { 70 | return nil 71 | } 72 | return c.restClient 73 | } 74 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/co2e/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // This package has the automatically generated typed clients. 4 | package v1alpha1 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/co2e/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // Package fake has the automatically generated clients. 4 | package fake 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/co2e/v1alpha1/fake/fake_co2e_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package fake 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/co2e/v1alpha1" 7 | rest "k8s.io/client-go/rest" 8 | testing "k8s.io/client-go/testing" 9 | ) 10 | 11 | type FakeCo2eV1alpha1 struct { 12 | *testing.Fake 13 | } 14 | 15 | func (c *FakeCo2eV1alpha1) CloudCarbonFootprints() v1alpha1.CloudCarbonFootprintInterface { 16 | return &FakeCloudCarbonFootprints{c} 17 | } 18 | 19 | // RESTClient returns a RESTClient that is used to communicate 20 | // with API server by this client implementation. 21 | func (c *FakeCo2eV1alpha1) RESTClient() rest.Interface { 22 | var ret *rest.RESTClient 23 | return ret 24 | } 25 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/co2e/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | type CloudCarbonFootprintExpansion interface{} 6 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/ensurance/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // This package has the automatically generated typed clients. 4 | package v1alpha1 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/ensurance/v1alpha1/ensurance_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/ensurance/v1alpha1" 7 | "github.com/gocrane/api/pkg/generated/clientset/versioned/scheme" 8 | rest "k8s.io/client-go/rest" 9 | ) 10 | 11 | type EnsuranceV1alpha1Interface interface { 12 | RESTClient() rest.Interface 13 | AvoidanceActionsGetter 14 | NodeQOSsGetter 15 | PodQOSsGetter 16 | } 17 | 18 | // EnsuranceV1alpha1Client is used to interact with features provided by the ensurance.crane.io group. 19 | type EnsuranceV1alpha1Client struct { 20 | restClient rest.Interface 21 | } 22 | 23 | func (c *EnsuranceV1alpha1Client) AvoidanceActions() AvoidanceActionInterface { 24 | return newAvoidanceActions(c) 25 | } 26 | 27 | func (c *EnsuranceV1alpha1Client) NodeQOSs() NodeQOSInterface { 28 | return newNodeQOSs(c) 29 | } 30 | 31 | func (c *EnsuranceV1alpha1Client) PodQOSs() PodQOSInterface { 32 | return newPodQOSs(c) 33 | } 34 | 35 | // NewForConfig creates a new EnsuranceV1alpha1Client for the given config. 36 | func NewForConfig(c *rest.Config) (*EnsuranceV1alpha1Client, error) { 37 | config := *c 38 | if err := setConfigDefaults(&config); err != nil { 39 | return nil, err 40 | } 41 | client, err := rest.RESTClientFor(&config) 42 | if err != nil { 43 | return nil, err 44 | } 45 | return &EnsuranceV1alpha1Client{client}, nil 46 | } 47 | 48 | // NewForConfigOrDie creates a new EnsuranceV1alpha1Client for the given config and 49 | // panics if there is an error in the config. 50 | func NewForConfigOrDie(c *rest.Config) *EnsuranceV1alpha1Client { 51 | client, err := NewForConfig(c) 52 | if err != nil { 53 | panic(err) 54 | } 55 | return client 56 | } 57 | 58 | // New creates a new EnsuranceV1alpha1Client for the given RESTClient. 59 | func New(c rest.Interface) *EnsuranceV1alpha1Client { 60 | return &EnsuranceV1alpha1Client{c} 61 | } 62 | 63 | func setConfigDefaults(config *rest.Config) error { 64 | gv := v1alpha1.SchemeGroupVersion 65 | config.GroupVersion = &gv 66 | config.APIPath = "/apis" 67 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 68 | 69 | if config.UserAgent == "" { 70 | config.UserAgent = rest.DefaultKubernetesUserAgent() 71 | } 72 | 73 | return nil 74 | } 75 | 76 | // RESTClient returns a RESTClient that is used to communicate 77 | // with API server by this client implementation. 78 | func (c *EnsuranceV1alpha1Client) RESTClient() rest.Interface { 79 | if c == nil { 80 | return nil 81 | } 82 | return c.restClient 83 | } 84 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/ensurance/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // Package fake has the automatically generated clients. 4 | package fake 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/ensurance/v1alpha1/fake/fake_ensurance_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package fake 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/ensurance/v1alpha1" 7 | rest "k8s.io/client-go/rest" 8 | testing "k8s.io/client-go/testing" 9 | ) 10 | 11 | type FakeEnsuranceV1alpha1 struct { 12 | *testing.Fake 13 | } 14 | 15 | func (c *FakeEnsuranceV1alpha1) AvoidanceActions() v1alpha1.AvoidanceActionInterface { 16 | return &FakeAvoidanceActions{c} 17 | } 18 | 19 | func (c *FakeEnsuranceV1alpha1) NodeQOSs() v1alpha1.NodeQOSInterface { 20 | return &FakeNodeQOSs{c} 21 | } 22 | 23 | func (c *FakeEnsuranceV1alpha1) PodQOSs() v1alpha1.PodQOSInterface { 24 | return &FakePodQOSs{c} 25 | } 26 | 27 | // RESTClient returns a RESTClient that is used to communicate 28 | // with API server by this client implementation. 29 | func (c *FakeEnsuranceV1alpha1) RESTClient() rest.Interface { 30 | var ret *rest.RESTClient 31 | return ret 32 | } 33 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/ensurance/v1alpha1/fake/fake_podqos.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package fake 4 | 5 | import ( 6 | "context" 7 | 8 | v1alpha1 "github.com/gocrane/api/ensurance/v1alpha1" 9 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 10 | labels "k8s.io/apimachinery/pkg/labels" 11 | schema "k8s.io/apimachinery/pkg/runtime/schema" 12 | types "k8s.io/apimachinery/pkg/types" 13 | watch "k8s.io/apimachinery/pkg/watch" 14 | testing "k8s.io/client-go/testing" 15 | ) 16 | 17 | // FakePodQOSs implements PodQOSInterface 18 | type FakePodQOSs struct { 19 | Fake *FakeEnsuranceV1alpha1 20 | } 21 | 22 | var podqossResource = schema.GroupVersionResource{Group: "ensurance.crane.io", Version: "v1alpha1", Resource: "podqoss"} 23 | 24 | var podqossKind = schema.GroupVersionKind{Group: "ensurance.crane.io", Version: "v1alpha1", Kind: "PodQOS"} 25 | 26 | // Get takes name of the podQOS, and returns the corresponding podQOS object, and an error if there is any. 27 | func (c *FakePodQOSs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PodQOS, err error) { 28 | obj, err := c.Fake. 29 | Invokes(testing.NewRootGetAction(podqossResource, name), &v1alpha1.PodQOS{}) 30 | if obj == nil { 31 | return nil, err 32 | } 33 | return obj.(*v1alpha1.PodQOS), err 34 | } 35 | 36 | // List takes label and field selectors, and returns the list of PodQOSs that match those selectors. 37 | func (c *FakePodQOSs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PodQOSList, err error) { 38 | obj, err := c.Fake. 39 | Invokes(testing.NewRootListAction(podqossResource, podqossKind, opts), &v1alpha1.PodQOSList{}) 40 | if obj == nil { 41 | return nil, err 42 | } 43 | 44 | label, _, _ := testing.ExtractFromListOptions(opts) 45 | if label == nil { 46 | label = labels.Everything() 47 | } 48 | list := &v1alpha1.PodQOSList{ListMeta: obj.(*v1alpha1.PodQOSList).ListMeta} 49 | for _, item := range obj.(*v1alpha1.PodQOSList).Items { 50 | if label.Matches(labels.Set(item.Labels)) { 51 | list.Items = append(list.Items, item) 52 | } 53 | } 54 | return list, err 55 | } 56 | 57 | // Watch returns a watch.Interface that watches the requested podQOSs. 58 | func (c *FakePodQOSs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { 59 | return c.Fake. 60 | InvokesWatch(testing.NewRootWatchAction(podqossResource, opts)) 61 | } 62 | 63 | // Create takes the representation of a podQOS and creates it. Returns the server's representation of the podQOS, and an error, if there is any. 64 | func (c *FakePodQOSs) Create(ctx context.Context, podQOS *v1alpha1.PodQOS, opts v1.CreateOptions) (result *v1alpha1.PodQOS, err error) { 65 | obj, err := c.Fake. 66 | Invokes(testing.NewRootCreateAction(podqossResource, podQOS), &v1alpha1.PodQOS{}) 67 | if obj == nil { 68 | return nil, err 69 | } 70 | return obj.(*v1alpha1.PodQOS), err 71 | } 72 | 73 | // Update takes the representation of a podQOS and updates it. Returns the server's representation of the podQOS, and an error, if there is any. 74 | func (c *FakePodQOSs) Update(ctx context.Context, podQOS *v1alpha1.PodQOS, opts v1.UpdateOptions) (result *v1alpha1.PodQOS, err error) { 75 | obj, err := c.Fake. 76 | Invokes(testing.NewRootUpdateAction(podqossResource, podQOS), &v1alpha1.PodQOS{}) 77 | if obj == nil { 78 | return nil, err 79 | } 80 | return obj.(*v1alpha1.PodQOS), err 81 | } 82 | 83 | // UpdateStatus was generated because the type contains a Status member. 84 | // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). 85 | func (c *FakePodQOSs) UpdateStatus(ctx context.Context, podQOS *v1alpha1.PodQOS, opts v1.UpdateOptions) (*v1alpha1.PodQOS, error) { 86 | obj, err := c.Fake. 87 | Invokes(testing.NewRootUpdateSubresourceAction(podqossResource, "status", podQOS), &v1alpha1.PodQOS{}) 88 | if obj == nil { 89 | return nil, err 90 | } 91 | return obj.(*v1alpha1.PodQOS), err 92 | } 93 | 94 | // Delete takes name of the podQOS and deletes it. Returns an error if one occurs. 95 | func (c *FakePodQOSs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { 96 | _, err := c.Fake. 97 | Invokes(testing.NewRootDeleteAction(podqossResource, name), &v1alpha1.PodQOS{}) 98 | return err 99 | } 100 | 101 | // DeleteCollection deletes a collection of objects. 102 | func (c *FakePodQOSs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { 103 | action := testing.NewRootDeleteCollectionAction(podqossResource, listOpts) 104 | 105 | _, err := c.Fake.Invokes(action, &v1alpha1.PodQOSList{}) 106 | return err 107 | } 108 | 109 | // Patch applies the patch and returns the patched podQOS. 110 | func (c *FakePodQOSs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PodQOS, err error) { 111 | obj, err := c.Fake. 112 | Invokes(testing.NewRootPatchSubresourceAction(podqossResource, name, pt, data, subresources...), &v1alpha1.PodQOS{}) 113 | if obj == nil { 114 | return nil, err 115 | } 116 | return obj.(*v1alpha1.PodQOS), err 117 | } 118 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/ensurance/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | type AvoidanceActionExpansion interface{} 6 | 7 | type NodeQOSExpansion interface{} 8 | 9 | type PodQOSExpansion interface{} 10 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/prediction/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // This package has the automatically generated typed clients. 4 | package v1alpha1 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/prediction/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // Package fake has the automatically generated clients. 4 | package fake 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/prediction/v1alpha1/fake/fake_prediction_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package fake 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/prediction/v1alpha1" 7 | rest "k8s.io/client-go/rest" 8 | testing "k8s.io/client-go/testing" 9 | ) 10 | 11 | type FakePredictionV1alpha1 struct { 12 | *testing.Fake 13 | } 14 | 15 | func (c *FakePredictionV1alpha1) ClusterNodePredictions(namespace string) v1alpha1.ClusterNodePredictionInterface { 16 | return &FakeClusterNodePredictions{c, namespace} 17 | } 18 | 19 | func (c *FakePredictionV1alpha1) TimeSeriesPredictions(namespace string) v1alpha1.TimeSeriesPredictionInterface { 20 | return &FakeTimeSeriesPredictions{c, namespace} 21 | } 22 | 23 | // RESTClient returns a RESTClient that is used to communicate 24 | // with API server by this client implementation. 25 | func (c *FakePredictionV1alpha1) RESTClient() rest.Interface { 26 | var ret *rest.RESTClient 27 | return ret 28 | } 29 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/prediction/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | type ClusterNodePredictionExpansion interface{} 6 | 7 | type TimeSeriesPredictionExpansion interface{} 8 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/prediction/v1alpha1/prediction_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "github.com/gocrane/api/pkg/generated/clientset/versioned/scheme" 7 | v1alpha1 "github.com/gocrane/api/prediction/v1alpha1" 8 | rest "k8s.io/client-go/rest" 9 | ) 10 | 11 | type PredictionV1alpha1Interface interface { 12 | RESTClient() rest.Interface 13 | ClusterNodePredictionsGetter 14 | TimeSeriesPredictionsGetter 15 | } 16 | 17 | // PredictionV1alpha1Client is used to interact with features provided by the prediction.crane.io group. 18 | type PredictionV1alpha1Client struct { 19 | restClient rest.Interface 20 | } 21 | 22 | func (c *PredictionV1alpha1Client) ClusterNodePredictions(namespace string) ClusterNodePredictionInterface { 23 | return newClusterNodePredictions(c, namespace) 24 | } 25 | 26 | func (c *PredictionV1alpha1Client) TimeSeriesPredictions(namespace string) TimeSeriesPredictionInterface { 27 | return newTimeSeriesPredictions(c, namespace) 28 | } 29 | 30 | // NewForConfig creates a new PredictionV1alpha1Client for the given config. 31 | func NewForConfig(c *rest.Config) (*PredictionV1alpha1Client, error) { 32 | config := *c 33 | if err := setConfigDefaults(&config); err != nil { 34 | return nil, err 35 | } 36 | client, err := rest.RESTClientFor(&config) 37 | if err != nil { 38 | return nil, err 39 | } 40 | return &PredictionV1alpha1Client{client}, nil 41 | } 42 | 43 | // NewForConfigOrDie creates a new PredictionV1alpha1Client for the given config and 44 | // panics if there is an error in the config. 45 | func NewForConfigOrDie(c *rest.Config) *PredictionV1alpha1Client { 46 | client, err := NewForConfig(c) 47 | if err != nil { 48 | panic(err) 49 | } 50 | return client 51 | } 52 | 53 | // New creates a new PredictionV1alpha1Client for the given RESTClient. 54 | func New(c rest.Interface) *PredictionV1alpha1Client { 55 | return &PredictionV1alpha1Client{c} 56 | } 57 | 58 | func setConfigDefaults(config *rest.Config) error { 59 | gv := v1alpha1.SchemeGroupVersion 60 | config.GroupVersion = &gv 61 | config.APIPath = "/apis" 62 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 63 | 64 | if config.UserAgent == "" { 65 | config.UserAgent = rest.DefaultKubernetesUserAgent() 66 | } 67 | 68 | return nil 69 | } 70 | 71 | // RESTClient returns a RESTClient that is used to communicate 72 | // with API server by this client implementation. 73 | func (c *PredictionV1alpha1Client) RESTClient() rest.Interface { 74 | if c == nil { 75 | return nil 76 | } 77 | return c.restClient 78 | } 79 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/topology/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // This package has the automatically generated typed clients. 4 | package v1alpha1 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/topology/v1alpha1/fake/doc.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | // Package fake has the automatically generated clients. 4 | package fake 5 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/topology/v1alpha1/fake/fake_topology_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package fake 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/pkg/generated/clientset/versioned/typed/topology/v1alpha1" 7 | rest "k8s.io/client-go/rest" 8 | testing "k8s.io/client-go/testing" 9 | ) 10 | 11 | type FakeTopologyV1alpha1 struct { 12 | *testing.Fake 13 | } 14 | 15 | func (c *FakeTopologyV1alpha1) NodeResourceTopologies() v1alpha1.NodeResourceTopologyInterface { 16 | return &FakeNodeResourceTopologies{c} 17 | } 18 | 19 | // RESTClient returns a RESTClient that is used to communicate 20 | // with API server by this client implementation. 21 | func (c *FakeTopologyV1alpha1) RESTClient() rest.Interface { 22 | var ret *rest.RESTClient 23 | return ret 24 | } 25 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/topology/v1alpha1/generated_expansion.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | type NodeResourceTopologyExpansion interface{} 6 | -------------------------------------------------------------------------------- /pkg/generated/clientset/versioned/typed/topology/v1alpha1/topology_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by client-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "github.com/gocrane/api/pkg/generated/clientset/versioned/scheme" 7 | v1alpha1 "github.com/gocrane/api/topology/v1alpha1" 8 | rest "k8s.io/client-go/rest" 9 | ) 10 | 11 | type TopologyV1alpha1Interface interface { 12 | RESTClient() rest.Interface 13 | NodeResourceTopologiesGetter 14 | } 15 | 16 | // TopologyV1alpha1Client is used to interact with features provided by the topology.crane.io group. 17 | type TopologyV1alpha1Client struct { 18 | restClient rest.Interface 19 | } 20 | 21 | func (c *TopologyV1alpha1Client) NodeResourceTopologies() NodeResourceTopologyInterface { 22 | return newNodeResourceTopologies(c) 23 | } 24 | 25 | // NewForConfig creates a new TopologyV1alpha1Client for the given config. 26 | func NewForConfig(c *rest.Config) (*TopologyV1alpha1Client, error) { 27 | config := *c 28 | if err := setConfigDefaults(&config); err != nil { 29 | return nil, err 30 | } 31 | client, err := rest.RESTClientFor(&config) 32 | if err != nil { 33 | return nil, err 34 | } 35 | return &TopologyV1alpha1Client{client}, nil 36 | } 37 | 38 | // NewForConfigOrDie creates a new TopologyV1alpha1Client for the given config and 39 | // panics if there is an error in the config. 40 | func NewForConfigOrDie(c *rest.Config) *TopologyV1alpha1Client { 41 | client, err := NewForConfig(c) 42 | if err != nil { 43 | panic(err) 44 | } 45 | return client 46 | } 47 | 48 | // New creates a new TopologyV1alpha1Client for the given RESTClient. 49 | func New(c rest.Interface) *TopologyV1alpha1Client { 50 | return &TopologyV1alpha1Client{c} 51 | } 52 | 53 | func setConfigDefaults(config *rest.Config) error { 54 | gv := v1alpha1.SchemeGroupVersion 55 | config.GroupVersion = &gv 56 | config.APIPath = "/apis" 57 | config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() 58 | 59 | if config.UserAgent == "" { 60 | config.UserAgent = rest.DefaultKubernetesUserAgent() 61 | } 62 | 63 | return nil 64 | } 65 | 66 | // RESTClient returns a RESTClient that is used to communicate 67 | // with API server by this client implementation. 68 | func (c *TopologyV1alpha1Client) RESTClient() rest.Interface { 69 | if c == nil { 70 | return nil 71 | } 72 | return c.restClient 73 | } 74 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/analysis/interface.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package analysis 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/pkg/generated/informers/externalversions/analysis/v1alpha1" 7 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 8 | ) 9 | 10 | // Interface provides access to each of this group's versions. 11 | type Interface interface { 12 | // V1alpha1 provides access to shared informers for resources in V1alpha1. 13 | V1alpha1() v1alpha1.Interface 14 | } 15 | 16 | type group struct { 17 | factory internalinterfaces.SharedInformerFactory 18 | namespace string 19 | tweakListOptions internalinterfaces.TweakListOptionsFunc 20 | } 21 | 22 | // New returns a new Interface. 23 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 24 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 25 | } 26 | 27 | // V1alpha1 returns a new v1alpha1.Interface. 28 | func (g *group) V1alpha1() v1alpha1.Interface { 29 | return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) 30 | } 31 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/analysis/v1alpha1/analytics.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "context" 7 | time "time" 8 | 9 | analysisv1alpha1 "github.com/gocrane/api/analysis/v1alpha1" 10 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 11 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 12 | v1alpha1 "github.com/gocrane/api/pkg/generated/listers/analysis/v1alpha1" 13 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | runtime "k8s.io/apimachinery/pkg/runtime" 15 | watch "k8s.io/apimachinery/pkg/watch" 16 | cache "k8s.io/client-go/tools/cache" 17 | ) 18 | 19 | // AnalyticsInformer provides access to a shared informer and lister for 20 | // Analytics. 21 | type AnalyticsInformer interface { 22 | Informer() cache.SharedIndexInformer 23 | Lister() v1alpha1.AnalyticsLister 24 | } 25 | 26 | type analyticsInformer struct { 27 | factory internalinterfaces.SharedInformerFactory 28 | tweakListOptions internalinterfaces.TweakListOptionsFunc 29 | namespace string 30 | } 31 | 32 | // NewAnalyticsInformer constructs a new informer for Analytics type. 33 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 34 | // one. This reduces memory footprint and number of connections to the server. 35 | func NewAnalyticsInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 36 | return NewFilteredAnalyticsInformer(client, namespace, resyncPeriod, indexers, nil) 37 | } 38 | 39 | // NewFilteredAnalyticsInformer constructs a new informer for Analytics type. 40 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 41 | // one. This reduces memory footprint and number of connections to the server. 42 | func NewFilteredAnalyticsInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 43 | return cache.NewSharedIndexInformer( 44 | &cache.ListWatch{ 45 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 46 | if tweakListOptions != nil { 47 | tweakListOptions(&options) 48 | } 49 | return client.AnalysisV1alpha1().Analytics(namespace).List(context.TODO(), options) 50 | }, 51 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 52 | if tweakListOptions != nil { 53 | tweakListOptions(&options) 54 | } 55 | return client.AnalysisV1alpha1().Analytics(namespace).Watch(context.TODO(), options) 56 | }, 57 | }, 58 | &analysisv1alpha1.Analytics{}, 59 | resyncPeriod, 60 | indexers, 61 | ) 62 | } 63 | 64 | func (f *analyticsInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 65 | return NewFilteredAnalyticsInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 66 | } 67 | 68 | func (f *analyticsInformer) Informer() cache.SharedIndexInformer { 69 | return f.factory.InformerFor(&analysisv1alpha1.Analytics{}, f.defaultInformer) 70 | } 71 | 72 | func (f *analyticsInformer) Lister() v1alpha1.AnalyticsLister { 73 | return v1alpha1.NewAnalyticsLister(f.Informer().GetIndexer()) 74 | } 75 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/analysis/v1alpha1/configset.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "context" 7 | time "time" 8 | 9 | analysisv1alpha1 "github.com/gocrane/api/analysis/v1alpha1" 10 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 11 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 12 | v1alpha1 "github.com/gocrane/api/pkg/generated/listers/analysis/v1alpha1" 13 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | runtime "k8s.io/apimachinery/pkg/runtime" 15 | watch "k8s.io/apimachinery/pkg/watch" 16 | cache "k8s.io/client-go/tools/cache" 17 | ) 18 | 19 | // ConfigSetInformer provides access to a shared informer and lister for 20 | // ConfigSets. 21 | type ConfigSetInformer interface { 22 | Informer() cache.SharedIndexInformer 23 | Lister() v1alpha1.ConfigSetLister 24 | } 25 | 26 | type configSetInformer struct { 27 | factory internalinterfaces.SharedInformerFactory 28 | tweakListOptions internalinterfaces.TweakListOptionsFunc 29 | namespace string 30 | } 31 | 32 | // NewConfigSetInformer constructs a new informer for ConfigSet type. 33 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 34 | // one. This reduces memory footprint and number of connections to the server. 35 | func NewConfigSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 36 | return NewFilteredConfigSetInformer(client, namespace, resyncPeriod, indexers, nil) 37 | } 38 | 39 | // NewFilteredConfigSetInformer constructs a new informer for ConfigSet type. 40 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 41 | // one. This reduces memory footprint and number of connections to the server. 42 | func NewFilteredConfigSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 43 | return cache.NewSharedIndexInformer( 44 | &cache.ListWatch{ 45 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 46 | if tweakListOptions != nil { 47 | tweakListOptions(&options) 48 | } 49 | return client.AnalysisV1alpha1().ConfigSets(namespace).List(context.TODO(), options) 50 | }, 51 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 52 | if tweakListOptions != nil { 53 | tweakListOptions(&options) 54 | } 55 | return client.AnalysisV1alpha1().ConfigSets(namespace).Watch(context.TODO(), options) 56 | }, 57 | }, 58 | &analysisv1alpha1.ConfigSet{}, 59 | resyncPeriod, 60 | indexers, 61 | ) 62 | } 63 | 64 | func (f *configSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 65 | return NewFilteredConfigSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 66 | } 67 | 68 | func (f *configSetInformer) Informer() cache.SharedIndexInformer { 69 | return f.factory.InformerFor(&analysisv1alpha1.ConfigSet{}, f.defaultInformer) 70 | } 71 | 72 | func (f *configSetInformer) Lister() v1alpha1.ConfigSetLister { 73 | return v1alpha1.NewConfigSetLister(f.Informer().GetIndexer()) 74 | } 75 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/analysis/v1alpha1/interface.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 7 | ) 8 | 9 | // Interface provides access to all the informers in this group version. 10 | type Interface interface { 11 | // Analytics returns a AnalyticsInformer. 12 | Analytics() AnalyticsInformer 13 | // ConfigSets returns a ConfigSetInformer. 14 | ConfigSets() ConfigSetInformer 15 | // Recommendations returns a RecommendationInformer. 16 | Recommendations() RecommendationInformer 17 | // RecommendationRules returns a RecommendationRuleInformer. 18 | RecommendationRules() RecommendationRuleInformer 19 | } 20 | 21 | type version struct { 22 | factory internalinterfaces.SharedInformerFactory 23 | namespace string 24 | tweakListOptions internalinterfaces.TweakListOptionsFunc 25 | } 26 | 27 | // New returns a new Interface. 28 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 29 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 30 | } 31 | 32 | // Analytics returns a AnalyticsInformer. 33 | func (v *version) Analytics() AnalyticsInformer { 34 | return &analyticsInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 35 | } 36 | 37 | // ConfigSets returns a ConfigSetInformer. 38 | func (v *version) ConfigSets() ConfigSetInformer { 39 | return &configSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 40 | } 41 | 42 | // Recommendations returns a RecommendationInformer. 43 | func (v *version) Recommendations() RecommendationInformer { 44 | return &recommendationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 45 | } 46 | 47 | // RecommendationRules returns a RecommendationRuleInformer. 48 | func (v *version) RecommendationRules() RecommendationRuleInformer { 49 | return &recommendationRuleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} 50 | } 51 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/analysis/v1alpha1/recommendation.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "context" 7 | time "time" 8 | 9 | analysisv1alpha1 "github.com/gocrane/api/analysis/v1alpha1" 10 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 11 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 12 | v1alpha1 "github.com/gocrane/api/pkg/generated/listers/analysis/v1alpha1" 13 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | runtime "k8s.io/apimachinery/pkg/runtime" 15 | watch "k8s.io/apimachinery/pkg/watch" 16 | cache "k8s.io/client-go/tools/cache" 17 | ) 18 | 19 | // RecommendationInformer provides access to a shared informer and lister for 20 | // Recommendations. 21 | type RecommendationInformer interface { 22 | Informer() cache.SharedIndexInformer 23 | Lister() v1alpha1.RecommendationLister 24 | } 25 | 26 | type recommendationInformer struct { 27 | factory internalinterfaces.SharedInformerFactory 28 | tweakListOptions internalinterfaces.TweakListOptionsFunc 29 | namespace string 30 | } 31 | 32 | // NewRecommendationInformer constructs a new informer for Recommendation type. 33 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 34 | // one. This reduces memory footprint and number of connections to the server. 35 | func NewRecommendationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 36 | return NewFilteredRecommendationInformer(client, namespace, resyncPeriod, indexers, nil) 37 | } 38 | 39 | // NewFilteredRecommendationInformer constructs a new informer for Recommendation type. 40 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 41 | // one. This reduces memory footprint and number of connections to the server. 42 | func NewFilteredRecommendationInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 43 | return cache.NewSharedIndexInformer( 44 | &cache.ListWatch{ 45 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 46 | if tweakListOptions != nil { 47 | tweakListOptions(&options) 48 | } 49 | return client.AnalysisV1alpha1().Recommendations(namespace).List(context.TODO(), options) 50 | }, 51 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 52 | if tweakListOptions != nil { 53 | tweakListOptions(&options) 54 | } 55 | return client.AnalysisV1alpha1().Recommendations(namespace).Watch(context.TODO(), options) 56 | }, 57 | }, 58 | &analysisv1alpha1.Recommendation{}, 59 | resyncPeriod, 60 | indexers, 61 | ) 62 | } 63 | 64 | func (f *recommendationInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 65 | return NewFilteredRecommendationInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 66 | } 67 | 68 | func (f *recommendationInformer) Informer() cache.SharedIndexInformer { 69 | return f.factory.InformerFor(&analysisv1alpha1.Recommendation{}, f.defaultInformer) 70 | } 71 | 72 | func (f *recommendationInformer) Lister() v1alpha1.RecommendationLister { 73 | return v1alpha1.NewRecommendationLister(f.Informer().GetIndexer()) 74 | } 75 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/analysis/v1alpha1/recommendationrule.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "context" 7 | time "time" 8 | 9 | analysisv1alpha1 "github.com/gocrane/api/analysis/v1alpha1" 10 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 11 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 12 | v1alpha1 "github.com/gocrane/api/pkg/generated/listers/analysis/v1alpha1" 13 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | runtime "k8s.io/apimachinery/pkg/runtime" 15 | watch "k8s.io/apimachinery/pkg/watch" 16 | cache "k8s.io/client-go/tools/cache" 17 | ) 18 | 19 | // RecommendationRuleInformer provides access to a shared informer and lister for 20 | // RecommendationRules. 21 | type RecommendationRuleInformer interface { 22 | Informer() cache.SharedIndexInformer 23 | Lister() v1alpha1.RecommendationRuleLister 24 | } 25 | 26 | type recommendationRuleInformer struct { 27 | factory internalinterfaces.SharedInformerFactory 28 | tweakListOptions internalinterfaces.TweakListOptionsFunc 29 | } 30 | 31 | // NewRecommendationRuleInformer constructs a new informer for RecommendationRule type. 32 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 33 | // one. This reduces memory footprint and number of connections to the server. 34 | func NewRecommendationRuleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 35 | return NewFilteredRecommendationRuleInformer(client, resyncPeriod, indexers, nil) 36 | } 37 | 38 | // NewFilteredRecommendationRuleInformer constructs a new informer for RecommendationRule type. 39 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 40 | // one. This reduces memory footprint and number of connections to the server. 41 | func NewFilteredRecommendationRuleInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 42 | return cache.NewSharedIndexInformer( 43 | &cache.ListWatch{ 44 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 45 | if tweakListOptions != nil { 46 | tweakListOptions(&options) 47 | } 48 | return client.AnalysisV1alpha1().RecommendationRules().List(context.TODO(), options) 49 | }, 50 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 51 | if tweakListOptions != nil { 52 | tweakListOptions(&options) 53 | } 54 | return client.AnalysisV1alpha1().RecommendationRules().Watch(context.TODO(), options) 55 | }, 56 | }, 57 | &analysisv1alpha1.RecommendationRule{}, 58 | resyncPeriod, 59 | indexers, 60 | ) 61 | } 62 | 63 | func (f *recommendationRuleInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 64 | return NewFilteredRecommendationRuleInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 65 | } 66 | 67 | func (f *recommendationRuleInformer) Informer() cache.SharedIndexInformer { 68 | return f.factory.InformerFor(&analysisv1alpha1.RecommendationRule{}, f.defaultInformer) 69 | } 70 | 71 | func (f *recommendationRuleInformer) Lister() v1alpha1.RecommendationRuleLister { 72 | return v1alpha1.NewRecommendationRuleLister(f.Informer().GetIndexer()) 73 | } 74 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/autoscaling/interface.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package autoscaling 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/pkg/generated/informers/externalversions/autoscaling/v1alpha1" 7 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 8 | ) 9 | 10 | // Interface provides access to each of this group's versions. 11 | type Interface interface { 12 | // V1alpha1 provides access to shared informers for resources in V1alpha1. 13 | V1alpha1() v1alpha1.Interface 14 | } 15 | 16 | type group struct { 17 | factory internalinterfaces.SharedInformerFactory 18 | namespace string 19 | tweakListOptions internalinterfaces.TweakListOptionsFunc 20 | } 21 | 22 | // New returns a new Interface. 23 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 24 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 25 | } 26 | 27 | // V1alpha1 returns a new v1alpha1.Interface. 28 | func (g *group) V1alpha1() v1alpha1.Interface { 29 | return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) 30 | } 31 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/autoscaling/v1alpha1/effectivehorizontalpodautoscaler.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "context" 7 | time "time" 8 | 9 | autoscalingv1alpha1 "github.com/gocrane/api/autoscaling/v1alpha1" 10 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 11 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 12 | v1alpha1 "github.com/gocrane/api/pkg/generated/listers/autoscaling/v1alpha1" 13 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | runtime "k8s.io/apimachinery/pkg/runtime" 15 | watch "k8s.io/apimachinery/pkg/watch" 16 | cache "k8s.io/client-go/tools/cache" 17 | ) 18 | 19 | // EffectiveHorizontalPodAutoscalerInformer provides access to a shared informer and lister for 20 | // EffectiveHorizontalPodAutoscalers. 21 | type EffectiveHorizontalPodAutoscalerInformer interface { 22 | Informer() cache.SharedIndexInformer 23 | Lister() v1alpha1.EffectiveHorizontalPodAutoscalerLister 24 | } 25 | 26 | type effectiveHorizontalPodAutoscalerInformer struct { 27 | factory internalinterfaces.SharedInformerFactory 28 | tweakListOptions internalinterfaces.TweakListOptionsFunc 29 | namespace string 30 | } 31 | 32 | // NewEffectiveHorizontalPodAutoscalerInformer constructs a new informer for EffectiveHorizontalPodAutoscaler type. 33 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 34 | // one. This reduces memory footprint and number of connections to the server. 35 | func NewEffectiveHorizontalPodAutoscalerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 36 | return NewFilteredEffectiveHorizontalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) 37 | } 38 | 39 | // NewFilteredEffectiveHorizontalPodAutoscalerInformer constructs a new informer for EffectiveHorizontalPodAutoscaler type. 40 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 41 | // one. This reduces memory footprint and number of connections to the server. 42 | func NewFilteredEffectiveHorizontalPodAutoscalerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 43 | return cache.NewSharedIndexInformer( 44 | &cache.ListWatch{ 45 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 46 | if tweakListOptions != nil { 47 | tweakListOptions(&options) 48 | } 49 | return client.AutoscalingV1alpha1().EffectiveHorizontalPodAutoscalers(namespace).List(context.TODO(), options) 50 | }, 51 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 52 | if tweakListOptions != nil { 53 | tweakListOptions(&options) 54 | } 55 | return client.AutoscalingV1alpha1().EffectiveHorizontalPodAutoscalers(namespace).Watch(context.TODO(), options) 56 | }, 57 | }, 58 | &autoscalingv1alpha1.EffectiveHorizontalPodAutoscaler{}, 59 | resyncPeriod, 60 | indexers, 61 | ) 62 | } 63 | 64 | func (f *effectiveHorizontalPodAutoscalerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 65 | return NewFilteredEffectiveHorizontalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 66 | } 67 | 68 | func (f *effectiveHorizontalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { 69 | return f.factory.InformerFor(&autoscalingv1alpha1.EffectiveHorizontalPodAutoscaler{}, f.defaultInformer) 70 | } 71 | 72 | func (f *effectiveHorizontalPodAutoscalerInformer) Lister() v1alpha1.EffectiveHorizontalPodAutoscalerLister { 73 | return v1alpha1.NewEffectiveHorizontalPodAutoscalerLister(f.Informer().GetIndexer()) 74 | } 75 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/autoscaling/v1alpha1/effectiveverticalpodautoscaler.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "context" 7 | time "time" 8 | 9 | autoscalingv1alpha1 "github.com/gocrane/api/autoscaling/v1alpha1" 10 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 11 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 12 | v1alpha1 "github.com/gocrane/api/pkg/generated/listers/autoscaling/v1alpha1" 13 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | runtime "k8s.io/apimachinery/pkg/runtime" 15 | watch "k8s.io/apimachinery/pkg/watch" 16 | cache "k8s.io/client-go/tools/cache" 17 | ) 18 | 19 | // EffectiveVerticalPodAutoscalerInformer provides access to a shared informer and lister for 20 | // EffectiveVerticalPodAutoscalers. 21 | type EffectiveVerticalPodAutoscalerInformer interface { 22 | Informer() cache.SharedIndexInformer 23 | Lister() v1alpha1.EffectiveVerticalPodAutoscalerLister 24 | } 25 | 26 | type effectiveVerticalPodAutoscalerInformer struct { 27 | factory internalinterfaces.SharedInformerFactory 28 | tweakListOptions internalinterfaces.TweakListOptionsFunc 29 | namespace string 30 | } 31 | 32 | // NewEffectiveVerticalPodAutoscalerInformer constructs a new informer for EffectiveVerticalPodAutoscaler type. 33 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 34 | // one. This reduces memory footprint and number of connections to the server. 35 | func NewEffectiveVerticalPodAutoscalerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 36 | return NewFilteredEffectiveVerticalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) 37 | } 38 | 39 | // NewFilteredEffectiveVerticalPodAutoscalerInformer constructs a new informer for EffectiveVerticalPodAutoscaler type. 40 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 41 | // one. This reduces memory footprint and number of connections to the server. 42 | func NewFilteredEffectiveVerticalPodAutoscalerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 43 | return cache.NewSharedIndexInformer( 44 | &cache.ListWatch{ 45 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 46 | if tweakListOptions != nil { 47 | tweakListOptions(&options) 48 | } 49 | return client.AutoscalingV1alpha1().EffectiveVerticalPodAutoscalers(namespace).List(context.TODO(), options) 50 | }, 51 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 52 | if tweakListOptions != nil { 53 | tweakListOptions(&options) 54 | } 55 | return client.AutoscalingV1alpha1().EffectiveVerticalPodAutoscalers(namespace).Watch(context.TODO(), options) 56 | }, 57 | }, 58 | &autoscalingv1alpha1.EffectiveVerticalPodAutoscaler{}, 59 | resyncPeriod, 60 | indexers, 61 | ) 62 | } 63 | 64 | func (f *effectiveVerticalPodAutoscalerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 65 | return NewFilteredEffectiveVerticalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 66 | } 67 | 68 | func (f *effectiveVerticalPodAutoscalerInformer) Informer() cache.SharedIndexInformer { 69 | return f.factory.InformerFor(&autoscalingv1alpha1.EffectiveVerticalPodAutoscaler{}, f.defaultInformer) 70 | } 71 | 72 | func (f *effectiveVerticalPodAutoscalerInformer) Lister() v1alpha1.EffectiveVerticalPodAutoscalerLister { 73 | return v1alpha1.NewEffectiveVerticalPodAutoscalerLister(f.Informer().GetIndexer()) 74 | } 75 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/autoscaling/v1alpha1/interface.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 7 | ) 8 | 9 | // Interface provides access to all the informers in this group version. 10 | type Interface interface { 11 | // EffectiveHorizontalPodAutoscalers returns a EffectiveHorizontalPodAutoscalerInformer. 12 | EffectiveHorizontalPodAutoscalers() EffectiveHorizontalPodAutoscalerInformer 13 | // EffectiveVerticalPodAutoscalers returns a EffectiveVerticalPodAutoscalerInformer. 14 | EffectiveVerticalPodAutoscalers() EffectiveVerticalPodAutoscalerInformer 15 | // Substitutes returns a SubstituteInformer. 16 | Substitutes() SubstituteInformer 17 | } 18 | 19 | type version struct { 20 | factory internalinterfaces.SharedInformerFactory 21 | namespace string 22 | tweakListOptions internalinterfaces.TweakListOptionsFunc 23 | } 24 | 25 | // New returns a new Interface. 26 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 27 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 28 | } 29 | 30 | // EffectiveHorizontalPodAutoscalers returns a EffectiveHorizontalPodAutoscalerInformer. 31 | func (v *version) EffectiveHorizontalPodAutoscalers() EffectiveHorizontalPodAutoscalerInformer { 32 | return &effectiveHorizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 33 | } 34 | 35 | // EffectiveVerticalPodAutoscalers returns a EffectiveVerticalPodAutoscalerInformer. 36 | func (v *version) EffectiveVerticalPodAutoscalers() EffectiveVerticalPodAutoscalerInformer { 37 | return &effectiveVerticalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 38 | } 39 | 40 | // Substitutes returns a SubstituteInformer. 41 | func (v *version) Substitutes() SubstituteInformer { 42 | return &substituteInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 43 | } 44 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/autoscaling/v1alpha1/substitute.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "context" 7 | time "time" 8 | 9 | autoscalingv1alpha1 "github.com/gocrane/api/autoscaling/v1alpha1" 10 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 11 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 12 | v1alpha1 "github.com/gocrane/api/pkg/generated/listers/autoscaling/v1alpha1" 13 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | runtime "k8s.io/apimachinery/pkg/runtime" 15 | watch "k8s.io/apimachinery/pkg/watch" 16 | cache "k8s.io/client-go/tools/cache" 17 | ) 18 | 19 | // SubstituteInformer provides access to a shared informer and lister for 20 | // Substitutes. 21 | type SubstituteInformer interface { 22 | Informer() cache.SharedIndexInformer 23 | Lister() v1alpha1.SubstituteLister 24 | } 25 | 26 | type substituteInformer struct { 27 | factory internalinterfaces.SharedInformerFactory 28 | tweakListOptions internalinterfaces.TweakListOptionsFunc 29 | namespace string 30 | } 31 | 32 | // NewSubstituteInformer constructs a new informer for Substitute type. 33 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 34 | // one. This reduces memory footprint and number of connections to the server. 35 | func NewSubstituteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 36 | return NewFilteredSubstituteInformer(client, namespace, resyncPeriod, indexers, nil) 37 | } 38 | 39 | // NewFilteredSubstituteInformer constructs a new informer for Substitute type. 40 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 41 | // one. This reduces memory footprint and number of connections to the server. 42 | func NewFilteredSubstituteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 43 | return cache.NewSharedIndexInformer( 44 | &cache.ListWatch{ 45 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 46 | if tweakListOptions != nil { 47 | tweakListOptions(&options) 48 | } 49 | return client.AutoscalingV1alpha1().Substitutes(namespace).List(context.TODO(), options) 50 | }, 51 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 52 | if tweakListOptions != nil { 53 | tweakListOptions(&options) 54 | } 55 | return client.AutoscalingV1alpha1().Substitutes(namespace).Watch(context.TODO(), options) 56 | }, 57 | }, 58 | &autoscalingv1alpha1.Substitute{}, 59 | resyncPeriod, 60 | indexers, 61 | ) 62 | } 63 | 64 | func (f *substituteInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 65 | return NewFilteredSubstituteInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 66 | } 67 | 68 | func (f *substituteInformer) Informer() cache.SharedIndexInformer { 69 | return f.factory.InformerFor(&autoscalingv1alpha1.Substitute{}, f.defaultInformer) 70 | } 71 | 72 | func (f *substituteInformer) Lister() v1alpha1.SubstituteLister { 73 | return v1alpha1.NewSubstituteLister(f.Informer().GetIndexer()) 74 | } 75 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/co2e/interface.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package co2e 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/pkg/generated/informers/externalversions/co2e/v1alpha1" 7 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 8 | ) 9 | 10 | // Interface provides access to each of this group's versions. 11 | type Interface interface { 12 | // V1alpha1 provides access to shared informers for resources in V1alpha1. 13 | V1alpha1() v1alpha1.Interface 14 | } 15 | 16 | type group struct { 17 | factory internalinterfaces.SharedInformerFactory 18 | namespace string 19 | tweakListOptions internalinterfaces.TweakListOptionsFunc 20 | } 21 | 22 | // New returns a new Interface. 23 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 24 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 25 | } 26 | 27 | // V1alpha1 returns a new v1alpha1.Interface. 28 | func (g *group) V1alpha1() v1alpha1.Interface { 29 | return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) 30 | } 31 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/co2e/v1alpha1/cloudcarbonfootprint.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "context" 7 | time "time" 8 | 9 | co2ev1alpha1 "github.com/gocrane/api/co2e/v1alpha1" 10 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 11 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 12 | v1alpha1 "github.com/gocrane/api/pkg/generated/listers/co2e/v1alpha1" 13 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | runtime "k8s.io/apimachinery/pkg/runtime" 15 | watch "k8s.io/apimachinery/pkg/watch" 16 | cache "k8s.io/client-go/tools/cache" 17 | ) 18 | 19 | // CloudCarbonFootprintInformer provides access to a shared informer and lister for 20 | // CloudCarbonFootprints. 21 | type CloudCarbonFootprintInformer interface { 22 | Informer() cache.SharedIndexInformer 23 | Lister() v1alpha1.CloudCarbonFootprintLister 24 | } 25 | 26 | type cloudCarbonFootprintInformer struct { 27 | factory internalinterfaces.SharedInformerFactory 28 | tweakListOptions internalinterfaces.TweakListOptionsFunc 29 | } 30 | 31 | // NewCloudCarbonFootprintInformer constructs a new informer for CloudCarbonFootprint type. 32 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 33 | // one. This reduces memory footprint and number of connections to the server. 34 | func NewCloudCarbonFootprintInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 35 | return NewFilteredCloudCarbonFootprintInformer(client, resyncPeriod, indexers, nil) 36 | } 37 | 38 | // NewFilteredCloudCarbonFootprintInformer constructs a new informer for CloudCarbonFootprint type. 39 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 40 | // one. This reduces memory footprint and number of connections to the server. 41 | func NewFilteredCloudCarbonFootprintInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 42 | return cache.NewSharedIndexInformer( 43 | &cache.ListWatch{ 44 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 45 | if tweakListOptions != nil { 46 | tweakListOptions(&options) 47 | } 48 | return client.Co2eV1alpha1().CloudCarbonFootprints().List(context.TODO(), options) 49 | }, 50 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 51 | if tweakListOptions != nil { 52 | tweakListOptions(&options) 53 | } 54 | return client.Co2eV1alpha1().CloudCarbonFootprints().Watch(context.TODO(), options) 55 | }, 56 | }, 57 | &co2ev1alpha1.CloudCarbonFootprint{}, 58 | resyncPeriod, 59 | indexers, 60 | ) 61 | } 62 | 63 | func (f *cloudCarbonFootprintInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 64 | return NewFilteredCloudCarbonFootprintInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 65 | } 66 | 67 | func (f *cloudCarbonFootprintInformer) Informer() cache.SharedIndexInformer { 68 | return f.factory.InformerFor(&co2ev1alpha1.CloudCarbonFootprint{}, f.defaultInformer) 69 | } 70 | 71 | func (f *cloudCarbonFootprintInformer) Lister() v1alpha1.CloudCarbonFootprintLister { 72 | return v1alpha1.NewCloudCarbonFootprintLister(f.Informer().GetIndexer()) 73 | } 74 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/co2e/v1alpha1/interface.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 7 | ) 8 | 9 | // Interface provides access to all the informers in this group version. 10 | type Interface interface { 11 | // CloudCarbonFootprints returns a CloudCarbonFootprintInformer. 12 | CloudCarbonFootprints() CloudCarbonFootprintInformer 13 | } 14 | 15 | type version struct { 16 | factory internalinterfaces.SharedInformerFactory 17 | namespace string 18 | tweakListOptions internalinterfaces.TweakListOptionsFunc 19 | } 20 | 21 | // New returns a new Interface. 22 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 23 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 24 | } 25 | 26 | // CloudCarbonFootprints returns a CloudCarbonFootprintInformer. 27 | func (v *version) CloudCarbonFootprints() CloudCarbonFootprintInformer { 28 | return &cloudCarbonFootprintInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} 29 | } 30 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/ensurance/interface.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package ensurance 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/pkg/generated/informers/externalversions/ensurance/v1alpha1" 7 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 8 | ) 9 | 10 | // Interface provides access to each of this group's versions. 11 | type Interface interface { 12 | // V1alpha1 provides access to shared informers for resources in V1alpha1. 13 | V1alpha1() v1alpha1.Interface 14 | } 15 | 16 | type group struct { 17 | factory internalinterfaces.SharedInformerFactory 18 | namespace string 19 | tweakListOptions internalinterfaces.TweakListOptionsFunc 20 | } 21 | 22 | // New returns a new Interface. 23 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 24 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 25 | } 26 | 27 | // V1alpha1 returns a new v1alpha1.Interface. 28 | func (g *group) V1alpha1() v1alpha1.Interface { 29 | return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) 30 | } 31 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/ensurance/v1alpha1/avoidanceaction.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "context" 7 | time "time" 8 | 9 | ensurancev1alpha1 "github.com/gocrane/api/ensurance/v1alpha1" 10 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 11 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 12 | v1alpha1 "github.com/gocrane/api/pkg/generated/listers/ensurance/v1alpha1" 13 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | runtime "k8s.io/apimachinery/pkg/runtime" 15 | watch "k8s.io/apimachinery/pkg/watch" 16 | cache "k8s.io/client-go/tools/cache" 17 | ) 18 | 19 | // AvoidanceActionInformer provides access to a shared informer and lister for 20 | // AvoidanceActions. 21 | type AvoidanceActionInformer interface { 22 | Informer() cache.SharedIndexInformer 23 | Lister() v1alpha1.AvoidanceActionLister 24 | } 25 | 26 | type avoidanceActionInformer struct { 27 | factory internalinterfaces.SharedInformerFactory 28 | tweakListOptions internalinterfaces.TweakListOptionsFunc 29 | } 30 | 31 | // NewAvoidanceActionInformer constructs a new informer for AvoidanceAction type. 32 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 33 | // one. This reduces memory footprint and number of connections to the server. 34 | func NewAvoidanceActionInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 35 | return NewFilteredAvoidanceActionInformer(client, resyncPeriod, indexers, nil) 36 | } 37 | 38 | // NewFilteredAvoidanceActionInformer constructs a new informer for AvoidanceAction type. 39 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 40 | // one. This reduces memory footprint and number of connections to the server. 41 | func NewFilteredAvoidanceActionInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 42 | return cache.NewSharedIndexInformer( 43 | &cache.ListWatch{ 44 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 45 | if tweakListOptions != nil { 46 | tweakListOptions(&options) 47 | } 48 | return client.EnsuranceV1alpha1().AvoidanceActions().List(context.TODO(), options) 49 | }, 50 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 51 | if tweakListOptions != nil { 52 | tweakListOptions(&options) 53 | } 54 | return client.EnsuranceV1alpha1().AvoidanceActions().Watch(context.TODO(), options) 55 | }, 56 | }, 57 | &ensurancev1alpha1.AvoidanceAction{}, 58 | resyncPeriod, 59 | indexers, 60 | ) 61 | } 62 | 63 | func (f *avoidanceActionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 64 | return NewFilteredAvoidanceActionInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 65 | } 66 | 67 | func (f *avoidanceActionInformer) Informer() cache.SharedIndexInformer { 68 | return f.factory.InformerFor(&ensurancev1alpha1.AvoidanceAction{}, f.defaultInformer) 69 | } 70 | 71 | func (f *avoidanceActionInformer) Lister() v1alpha1.AvoidanceActionLister { 72 | return v1alpha1.NewAvoidanceActionLister(f.Informer().GetIndexer()) 73 | } 74 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/ensurance/v1alpha1/interface.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 7 | ) 8 | 9 | // Interface provides access to all the informers in this group version. 10 | type Interface interface { 11 | // AvoidanceActions returns a AvoidanceActionInformer. 12 | AvoidanceActions() AvoidanceActionInformer 13 | // NodeQOSs returns a NodeQOSInformer. 14 | NodeQOSs() NodeQOSInformer 15 | // PodQOSs returns a PodQOSInformer. 16 | PodQOSs() PodQOSInformer 17 | } 18 | 19 | type version struct { 20 | factory internalinterfaces.SharedInformerFactory 21 | namespace string 22 | tweakListOptions internalinterfaces.TweakListOptionsFunc 23 | } 24 | 25 | // New returns a new Interface. 26 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 27 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 28 | } 29 | 30 | // AvoidanceActions returns a AvoidanceActionInformer. 31 | func (v *version) AvoidanceActions() AvoidanceActionInformer { 32 | return &avoidanceActionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} 33 | } 34 | 35 | // NodeQOSs returns a NodeQOSInformer. 36 | func (v *version) NodeQOSs() NodeQOSInformer { 37 | return &nodeQOSInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} 38 | } 39 | 40 | // PodQOSs returns a PodQOSInformer. 41 | func (v *version) PodQOSs() PodQOSInformer { 42 | return &podQOSInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} 43 | } 44 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/ensurance/v1alpha1/nodeqos.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "context" 7 | time "time" 8 | 9 | ensurancev1alpha1 "github.com/gocrane/api/ensurance/v1alpha1" 10 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 11 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 12 | v1alpha1 "github.com/gocrane/api/pkg/generated/listers/ensurance/v1alpha1" 13 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | runtime "k8s.io/apimachinery/pkg/runtime" 15 | watch "k8s.io/apimachinery/pkg/watch" 16 | cache "k8s.io/client-go/tools/cache" 17 | ) 18 | 19 | // NodeQOSInformer provides access to a shared informer and lister for 20 | // NodeQOSs. 21 | type NodeQOSInformer interface { 22 | Informer() cache.SharedIndexInformer 23 | Lister() v1alpha1.NodeQOSLister 24 | } 25 | 26 | type nodeQOSInformer struct { 27 | factory internalinterfaces.SharedInformerFactory 28 | tweakListOptions internalinterfaces.TweakListOptionsFunc 29 | } 30 | 31 | // NewNodeQOSInformer constructs a new informer for NodeQOS type. 32 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 33 | // one. This reduces memory footprint and number of connections to the server. 34 | func NewNodeQOSInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 35 | return NewFilteredNodeQOSInformer(client, resyncPeriod, indexers, nil) 36 | } 37 | 38 | // NewFilteredNodeQOSInformer constructs a new informer for NodeQOS type. 39 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 40 | // one. This reduces memory footprint and number of connections to the server. 41 | func NewFilteredNodeQOSInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 42 | return cache.NewSharedIndexInformer( 43 | &cache.ListWatch{ 44 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 45 | if tweakListOptions != nil { 46 | tweakListOptions(&options) 47 | } 48 | return client.EnsuranceV1alpha1().NodeQOSs().List(context.TODO(), options) 49 | }, 50 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 51 | if tweakListOptions != nil { 52 | tweakListOptions(&options) 53 | } 54 | return client.EnsuranceV1alpha1().NodeQOSs().Watch(context.TODO(), options) 55 | }, 56 | }, 57 | &ensurancev1alpha1.NodeQOS{}, 58 | resyncPeriod, 59 | indexers, 60 | ) 61 | } 62 | 63 | func (f *nodeQOSInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 64 | return NewFilteredNodeQOSInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 65 | } 66 | 67 | func (f *nodeQOSInformer) Informer() cache.SharedIndexInformer { 68 | return f.factory.InformerFor(&ensurancev1alpha1.NodeQOS{}, f.defaultInformer) 69 | } 70 | 71 | func (f *nodeQOSInformer) Lister() v1alpha1.NodeQOSLister { 72 | return v1alpha1.NewNodeQOSLister(f.Informer().GetIndexer()) 73 | } 74 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/ensurance/v1alpha1/podqos.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "context" 7 | time "time" 8 | 9 | ensurancev1alpha1 "github.com/gocrane/api/ensurance/v1alpha1" 10 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 11 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 12 | v1alpha1 "github.com/gocrane/api/pkg/generated/listers/ensurance/v1alpha1" 13 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | runtime "k8s.io/apimachinery/pkg/runtime" 15 | watch "k8s.io/apimachinery/pkg/watch" 16 | cache "k8s.io/client-go/tools/cache" 17 | ) 18 | 19 | // PodQOSInformer provides access to a shared informer and lister for 20 | // PodQOSs. 21 | type PodQOSInformer interface { 22 | Informer() cache.SharedIndexInformer 23 | Lister() v1alpha1.PodQOSLister 24 | } 25 | 26 | type podQOSInformer struct { 27 | factory internalinterfaces.SharedInformerFactory 28 | tweakListOptions internalinterfaces.TweakListOptionsFunc 29 | } 30 | 31 | // NewPodQOSInformer constructs a new informer for PodQOS type. 32 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 33 | // one. This reduces memory footprint and number of connections to the server. 34 | func NewPodQOSInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 35 | return NewFilteredPodQOSInformer(client, resyncPeriod, indexers, nil) 36 | } 37 | 38 | // NewFilteredPodQOSInformer constructs a new informer for PodQOS type. 39 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 40 | // one. This reduces memory footprint and number of connections to the server. 41 | func NewFilteredPodQOSInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 42 | return cache.NewSharedIndexInformer( 43 | &cache.ListWatch{ 44 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 45 | if tweakListOptions != nil { 46 | tweakListOptions(&options) 47 | } 48 | return client.EnsuranceV1alpha1().PodQOSs().List(context.TODO(), options) 49 | }, 50 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 51 | if tweakListOptions != nil { 52 | tweakListOptions(&options) 53 | } 54 | return client.EnsuranceV1alpha1().PodQOSs().Watch(context.TODO(), options) 55 | }, 56 | }, 57 | &ensurancev1alpha1.PodQOS{}, 58 | resyncPeriod, 59 | indexers, 60 | ) 61 | } 62 | 63 | func (f *podQOSInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 64 | return NewFilteredPodQOSInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 65 | } 66 | 67 | func (f *podQOSInformer) Informer() cache.SharedIndexInformer { 68 | return f.factory.InformerFor(&ensurancev1alpha1.PodQOS{}, f.defaultInformer) 69 | } 70 | 71 | func (f *podQOSInformer) Lister() v1alpha1.PodQOSLister { 72 | return v1alpha1.NewPodQOSLister(f.Informer().GetIndexer()) 73 | } 74 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/generic.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package externalversions 4 | 5 | import ( 6 | "fmt" 7 | 8 | v1alpha1 "github.com/gocrane/api/analysis/v1alpha1" 9 | autoscalingv1alpha1 "github.com/gocrane/api/autoscaling/v1alpha1" 10 | co2ev1alpha1 "github.com/gocrane/api/co2e/v1alpha1" 11 | ensurancev1alpha1 "github.com/gocrane/api/ensurance/v1alpha1" 12 | predictionv1alpha1 "github.com/gocrane/api/prediction/v1alpha1" 13 | topologyv1alpha1 "github.com/gocrane/api/topology/v1alpha1" 14 | schema "k8s.io/apimachinery/pkg/runtime/schema" 15 | cache "k8s.io/client-go/tools/cache" 16 | ) 17 | 18 | // GenericInformer is type of SharedIndexInformer which will locate and delegate to other 19 | // sharedInformers based on type 20 | type GenericInformer interface { 21 | Informer() cache.SharedIndexInformer 22 | Lister() cache.GenericLister 23 | } 24 | 25 | type genericInformer struct { 26 | informer cache.SharedIndexInformer 27 | resource schema.GroupResource 28 | } 29 | 30 | // Informer returns the SharedIndexInformer. 31 | func (f *genericInformer) Informer() cache.SharedIndexInformer { 32 | return f.informer 33 | } 34 | 35 | // Lister returns the GenericLister. 36 | func (f *genericInformer) Lister() cache.GenericLister { 37 | return cache.NewGenericLister(f.Informer().GetIndexer(), f.resource) 38 | } 39 | 40 | // ForResource gives generic access to a shared informer of the matching type 41 | // TODO extend this to unknown resources with a client pool 42 | func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { 43 | switch resource { 44 | // Group=analysis.crane.io, Version=v1alpha1 45 | case v1alpha1.SchemeGroupVersion.WithResource("analytics"): 46 | return &genericInformer{resource: resource.GroupResource(), informer: f.Analysis().V1alpha1().Analytics().Informer()}, nil 47 | case v1alpha1.SchemeGroupVersion.WithResource("configsets"): 48 | return &genericInformer{resource: resource.GroupResource(), informer: f.Analysis().V1alpha1().ConfigSets().Informer()}, nil 49 | case v1alpha1.SchemeGroupVersion.WithResource("recommendations"): 50 | return &genericInformer{resource: resource.GroupResource(), informer: f.Analysis().V1alpha1().Recommendations().Informer()}, nil 51 | case v1alpha1.SchemeGroupVersion.WithResource("recommendationrules"): 52 | return &genericInformer{resource: resource.GroupResource(), informer: f.Analysis().V1alpha1().RecommendationRules().Informer()}, nil 53 | 54 | // Group=autoscaling.crane.io, Version=v1alpha1 55 | case autoscalingv1alpha1.SchemeGroupVersion.WithResource("effectivehorizontalpodautoscalers"): 56 | return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1alpha1().EffectiveHorizontalPodAutoscalers().Informer()}, nil 57 | case autoscalingv1alpha1.SchemeGroupVersion.WithResource("effectiveverticalpodautoscalers"): 58 | return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1alpha1().EffectiveVerticalPodAutoscalers().Informer()}, nil 59 | case autoscalingv1alpha1.SchemeGroupVersion.WithResource("substitutes"): 60 | return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1alpha1().Substitutes().Informer()}, nil 61 | 62 | // Group=co2e.crane.io, Version=v1alpha1 63 | case co2ev1alpha1.SchemeGroupVersion.WithResource("cloudcarbonfootprints"): 64 | return &genericInformer{resource: resource.GroupResource(), informer: f.Co2e().V1alpha1().CloudCarbonFootprints().Informer()}, nil 65 | 66 | // Group=ensurance.crane.io, Version=v1alpha1 67 | case ensurancev1alpha1.SchemeGroupVersion.WithResource("avoidanceactions"): 68 | return &genericInformer{resource: resource.GroupResource(), informer: f.Ensurance().V1alpha1().AvoidanceActions().Informer()}, nil 69 | case ensurancev1alpha1.SchemeGroupVersion.WithResource("nodeqoss"): 70 | return &genericInformer{resource: resource.GroupResource(), informer: f.Ensurance().V1alpha1().NodeQOSs().Informer()}, nil 71 | case ensurancev1alpha1.SchemeGroupVersion.WithResource("podqoss"): 72 | return &genericInformer{resource: resource.GroupResource(), informer: f.Ensurance().V1alpha1().PodQOSs().Informer()}, nil 73 | 74 | // Group=prediction.crane.io, Version=v1alpha1 75 | case predictionv1alpha1.SchemeGroupVersion.WithResource("clusternodepredictions"): 76 | return &genericInformer{resource: resource.GroupResource(), informer: f.Prediction().V1alpha1().ClusterNodePredictions().Informer()}, nil 77 | case predictionv1alpha1.SchemeGroupVersion.WithResource("timeseriespredictions"): 78 | return &genericInformer{resource: resource.GroupResource(), informer: f.Prediction().V1alpha1().TimeSeriesPredictions().Informer()}, nil 79 | 80 | // Group=topology.crane.io, Version=v1alpha1 81 | case topologyv1alpha1.SchemeGroupVersion.WithResource("noderesourcetopologies"): 82 | return &genericInformer{resource: resource.GroupResource(), informer: f.Topology().V1alpha1().NodeResourceTopologies().Informer()}, nil 83 | 84 | } 85 | 86 | return nil, fmt.Errorf("no informer found for %v", resource) 87 | } 88 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/internalinterfaces/factory_interfaces.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package internalinterfaces 4 | 5 | import ( 6 | time "time" 7 | 8 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 9 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 10 | runtime "k8s.io/apimachinery/pkg/runtime" 11 | cache "k8s.io/client-go/tools/cache" 12 | ) 13 | 14 | // NewInformerFunc takes versioned.Interface and time.Duration to return a SharedIndexInformer. 15 | type NewInformerFunc func(versioned.Interface, time.Duration) cache.SharedIndexInformer 16 | 17 | // SharedInformerFactory a small interface to allow for adding an informer without an import cycle 18 | type SharedInformerFactory interface { 19 | Start(stopCh <-chan struct{}) 20 | InformerFor(obj runtime.Object, newFunc NewInformerFunc) cache.SharedIndexInformer 21 | } 22 | 23 | // TweakListOptionsFunc is a function that transforms a v1.ListOptions. 24 | type TweakListOptionsFunc func(*v1.ListOptions) 25 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/prediction/interface.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package prediction 4 | 5 | import ( 6 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 7 | v1alpha1 "github.com/gocrane/api/pkg/generated/informers/externalversions/prediction/v1alpha1" 8 | ) 9 | 10 | // Interface provides access to each of this group's versions. 11 | type Interface interface { 12 | // V1alpha1 provides access to shared informers for resources in V1alpha1. 13 | V1alpha1() v1alpha1.Interface 14 | } 15 | 16 | type group struct { 17 | factory internalinterfaces.SharedInformerFactory 18 | namespace string 19 | tweakListOptions internalinterfaces.TweakListOptionsFunc 20 | } 21 | 22 | // New returns a new Interface. 23 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 24 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 25 | } 26 | 27 | // V1alpha1 returns a new v1alpha1.Interface. 28 | func (g *group) V1alpha1() v1alpha1.Interface { 29 | return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) 30 | } 31 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/prediction/v1alpha1/clusternodeprediction.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "context" 7 | time "time" 8 | 9 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 10 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 11 | v1alpha1 "github.com/gocrane/api/pkg/generated/listers/prediction/v1alpha1" 12 | predictionv1alpha1 "github.com/gocrane/api/prediction/v1alpha1" 13 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | runtime "k8s.io/apimachinery/pkg/runtime" 15 | watch "k8s.io/apimachinery/pkg/watch" 16 | cache "k8s.io/client-go/tools/cache" 17 | ) 18 | 19 | // ClusterNodePredictionInformer provides access to a shared informer and lister for 20 | // ClusterNodePredictions. 21 | type ClusterNodePredictionInformer interface { 22 | Informer() cache.SharedIndexInformer 23 | Lister() v1alpha1.ClusterNodePredictionLister 24 | } 25 | 26 | type clusterNodePredictionInformer struct { 27 | factory internalinterfaces.SharedInformerFactory 28 | tweakListOptions internalinterfaces.TweakListOptionsFunc 29 | namespace string 30 | } 31 | 32 | // NewClusterNodePredictionInformer constructs a new informer for ClusterNodePrediction type. 33 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 34 | // one. This reduces memory footprint and number of connections to the server. 35 | func NewClusterNodePredictionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 36 | return NewFilteredClusterNodePredictionInformer(client, namespace, resyncPeriod, indexers, nil) 37 | } 38 | 39 | // NewFilteredClusterNodePredictionInformer constructs a new informer for ClusterNodePrediction type. 40 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 41 | // one. This reduces memory footprint and number of connections to the server. 42 | func NewFilteredClusterNodePredictionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 43 | return cache.NewSharedIndexInformer( 44 | &cache.ListWatch{ 45 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 46 | if tweakListOptions != nil { 47 | tweakListOptions(&options) 48 | } 49 | return client.PredictionV1alpha1().ClusterNodePredictions(namespace).List(context.TODO(), options) 50 | }, 51 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 52 | if tweakListOptions != nil { 53 | tweakListOptions(&options) 54 | } 55 | return client.PredictionV1alpha1().ClusterNodePredictions(namespace).Watch(context.TODO(), options) 56 | }, 57 | }, 58 | &predictionv1alpha1.ClusterNodePrediction{}, 59 | resyncPeriod, 60 | indexers, 61 | ) 62 | } 63 | 64 | func (f *clusterNodePredictionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 65 | return NewFilteredClusterNodePredictionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 66 | } 67 | 68 | func (f *clusterNodePredictionInformer) Informer() cache.SharedIndexInformer { 69 | return f.factory.InformerFor(&predictionv1alpha1.ClusterNodePrediction{}, f.defaultInformer) 70 | } 71 | 72 | func (f *clusterNodePredictionInformer) Lister() v1alpha1.ClusterNodePredictionLister { 73 | return v1alpha1.NewClusterNodePredictionLister(f.Informer().GetIndexer()) 74 | } 75 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/prediction/v1alpha1/interface.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 7 | ) 8 | 9 | // Interface provides access to all the informers in this group version. 10 | type Interface interface { 11 | // ClusterNodePredictions returns a ClusterNodePredictionInformer. 12 | ClusterNodePredictions() ClusterNodePredictionInformer 13 | // TimeSeriesPredictions returns a TimeSeriesPredictionInformer. 14 | TimeSeriesPredictions() TimeSeriesPredictionInformer 15 | } 16 | 17 | type version struct { 18 | factory internalinterfaces.SharedInformerFactory 19 | namespace string 20 | tweakListOptions internalinterfaces.TweakListOptionsFunc 21 | } 22 | 23 | // New returns a new Interface. 24 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 25 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 26 | } 27 | 28 | // ClusterNodePredictions returns a ClusterNodePredictionInformer. 29 | func (v *version) ClusterNodePredictions() ClusterNodePredictionInformer { 30 | return &clusterNodePredictionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 31 | } 32 | 33 | // TimeSeriesPredictions returns a TimeSeriesPredictionInformer. 34 | func (v *version) TimeSeriesPredictions() TimeSeriesPredictionInformer { 35 | return &timeSeriesPredictionInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} 36 | } 37 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/prediction/v1alpha1/timeseriesprediction.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "context" 7 | time "time" 8 | 9 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 10 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 11 | v1alpha1 "github.com/gocrane/api/pkg/generated/listers/prediction/v1alpha1" 12 | predictionv1alpha1 "github.com/gocrane/api/prediction/v1alpha1" 13 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | runtime "k8s.io/apimachinery/pkg/runtime" 15 | watch "k8s.io/apimachinery/pkg/watch" 16 | cache "k8s.io/client-go/tools/cache" 17 | ) 18 | 19 | // TimeSeriesPredictionInformer provides access to a shared informer and lister for 20 | // TimeSeriesPredictions. 21 | type TimeSeriesPredictionInformer interface { 22 | Informer() cache.SharedIndexInformer 23 | Lister() v1alpha1.TimeSeriesPredictionLister 24 | } 25 | 26 | type timeSeriesPredictionInformer struct { 27 | factory internalinterfaces.SharedInformerFactory 28 | tweakListOptions internalinterfaces.TweakListOptionsFunc 29 | namespace string 30 | } 31 | 32 | // NewTimeSeriesPredictionInformer constructs a new informer for TimeSeriesPrediction type. 33 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 34 | // one. This reduces memory footprint and number of connections to the server. 35 | func NewTimeSeriesPredictionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 36 | return NewFilteredTimeSeriesPredictionInformer(client, namespace, resyncPeriod, indexers, nil) 37 | } 38 | 39 | // NewFilteredTimeSeriesPredictionInformer constructs a new informer for TimeSeriesPrediction type. 40 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 41 | // one. This reduces memory footprint and number of connections to the server. 42 | func NewFilteredTimeSeriesPredictionInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 43 | return cache.NewSharedIndexInformer( 44 | &cache.ListWatch{ 45 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 46 | if tweakListOptions != nil { 47 | tweakListOptions(&options) 48 | } 49 | return client.PredictionV1alpha1().TimeSeriesPredictions(namespace).List(context.TODO(), options) 50 | }, 51 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 52 | if tweakListOptions != nil { 53 | tweakListOptions(&options) 54 | } 55 | return client.PredictionV1alpha1().TimeSeriesPredictions(namespace).Watch(context.TODO(), options) 56 | }, 57 | }, 58 | &predictionv1alpha1.TimeSeriesPrediction{}, 59 | resyncPeriod, 60 | indexers, 61 | ) 62 | } 63 | 64 | func (f *timeSeriesPredictionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 65 | return NewFilteredTimeSeriesPredictionInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 66 | } 67 | 68 | func (f *timeSeriesPredictionInformer) Informer() cache.SharedIndexInformer { 69 | return f.factory.InformerFor(&predictionv1alpha1.TimeSeriesPrediction{}, f.defaultInformer) 70 | } 71 | 72 | func (f *timeSeriesPredictionInformer) Lister() v1alpha1.TimeSeriesPredictionLister { 73 | return v1alpha1.NewTimeSeriesPredictionLister(f.Informer().GetIndexer()) 74 | } 75 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/topology/interface.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package topology 4 | 5 | import ( 6 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 7 | v1alpha1 "github.com/gocrane/api/pkg/generated/informers/externalversions/topology/v1alpha1" 8 | ) 9 | 10 | // Interface provides access to each of this group's versions. 11 | type Interface interface { 12 | // V1alpha1 provides access to shared informers for resources in V1alpha1. 13 | V1alpha1() v1alpha1.Interface 14 | } 15 | 16 | type group struct { 17 | factory internalinterfaces.SharedInformerFactory 18 | namespace string 19 | tweakListOptions internalinterfaces.TweakListOptionsFunc 20 | } 21 | 22 | // New returns a new Interface. 23 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 24 | return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 25 | } 26 | 27 | // V1alpha1 returns a new v1alpha1.Interface. 28 | func (g *group) V1alpha1() v1alpha1.Interface { 29 | return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) 30 | } 31 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/topology/v1alpha1/interface.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 7 | ) 8 | 9 | // Interface provides access to all the informers in this group version. 10 | type Interface interface { 11 | // NodeResourceTopologies returns a NodeResourceTopologyInformer. 12 | NodeResourceTopologies() NodeResourceTopologyInformer 13 | } 14 | 15 | type version struct { 16 | factory internalinterfaces.SharedInformerFactory 17 | namespace string 18 | tweakListOptions internalinterfaces.TweakListOptionsFunc 19 | } 20 | 21 | // New returns a new Interface. 22 | func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { 23 | return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} 24 | } 25 | 26 | // NodeResourceTopologies returns a NodeResourceTopologyInformer. 27 | func (v *version) NodeResourceTopologies() NodeResourceTopologyInformer { 28 | return &nodeResourceTopologyInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} 29 | } 30 | -------------------------------------------------------------------------------- /pkg/generated/informers/externalversions/topology/v1alpha1/noderesourcetopology.go: -------------------------------------------------------------------------------- 1 | // Code generated by informer-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | "context" 7 | time "time" 8 | 9 | versioned "github.com/gocrane/api/pkg/generated/clientset/versioned" 10 | internalinterfaces "github.com/gocrane/api/pkg/generated/informers/externalversions/internalinterfaces" 11 | v1alpha1 "github.com/gocrane/api/pkg/generated/listers/topology/v1alpha1" 12 | topologyv1alpha1 "github.com/gocrane/api/topology/v1alpha1" 13 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 14 | runtime "k8s.io/apimachinery/pkg/runtime" 15 | watch "k8s.io/apimachinery/pkg/watch" 16 | cache "k8s.io/client-go/tools/cache" 17 | ) 18 | 19 | // NodeResourceTopologyInformer provides access to a shared informer and lister for 20 | // NodeResourceTopologies. 21 | type NodeResourceTopologyInformer interface { 22 | Informer() cache.SharedIndexInformer 23 | Lister() v1alpha1.NodeResourceTopologyLister 24 | } 25 | 26 | type nodeResourceTopologyInformer struct { 27 | factory internalinterfaces.SharedInformerFactory 28 | tweakListOptions internalinterfaces.TweakListOptionsFunc 29 | } 30 | 31 | // NewNodeResourceTopologyInformer constructs a new informer for NodeResourceTopology type. 32 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 33 | // one. This reduces memory footprint and number of connections to the server. 34 | func NewNodeResourceTopologyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { 35 | return NewFilteredNodeResourceTopologyInformer(client, resyncPeriod, indexers, nil) 36 | } 37 | 38 | // NewFilteredNodeResourceTopologyInformer constructs a new informer for NodeResourceTopology type. 39 | // Always prefer using an informer factory to get a shared informer instead of getting an independent 40 | // one. This reduces memory footprint and number of connections to the server. 41 | func NewFilteredNodeResourceTopologyInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { 42 | return cache.NewSharedIndexInformer( 43 | &cache.ListWatch{ 44 | ListFunc: func(options v1.ListOptions) (runtime.Object, error) { 45 | if tweakListOptions != nil { 46 | tweakListOptions(&options) 47 | } 48 | return client.TopologyV1alpha1().NodeResourceTopologies().List(context.TODO(), options) 49 | }, 50 | WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { 51 | if tweakListOptions != nil { 52 | tweakListOptions(&options) 53 | } 54 | return client.TopologyV1alpha1().NodeResourceTopologies().Watch(context.TODO(), options) 55 | }, 56 | }, 57 | &topologyv1alpha1.NodeResourceTopology{}, 58 | resyncPeriod, 59 | indexers, 60 | ) 61 | } 62 | 63 | func (f *nodeResourceTopologyInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { 64 | return NewFilteredNodeResourceTopologyInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) 65 | } 66 | 67 | func (f *nodeResourceTopologyInformer) Informer() cache.SharedIndexInformer { 68 | return f.factory.InformerFor(&topologyv1alpha1.NodeResourceTopology{}, f.defaultInformer) 69 | } 70 | 71 | func (f *nodeResourceTopologyInformer) Lister() v1alpha1.NodeResourceTopologyLister { 72 | return v1alpha1.NewNodeResourceTopologyLister(f.Informer().GetIndexer()) 73 | } 74 | -------------------------------------------------------------------------------- /pkg/generated/listers/analysis/v1alpha1/analytics.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/analysis/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | "k8s.io/apimachinery/pkg/labels" 9 | "k8s.io/client-go/tools/cache" 10 | ) 11 | 12 | // AnalyticsLister helps list Analytics. 13 | // All objects returned here must be treated as read-only. 14 | type AnalyticsLister interface { 15 | // List lists all Analytics in the indexer. 16 | // Objects returned here must be treated as read-only. 17 | List(selector labels.Selector) (ret []*v1alpha1.Analytics, err error) 18 | // Analytics returns an object that can list and get Analytics. 19 | Analytics(namespace string) AnalyticsNamespaceLister 20 | AnalyticsListerExpansion 21 | } 22 | 23 | // analyticsLister implements the AnalyticsLister interface. 24 | type analyticsLister struct { 25 | indexer cache.Indexer 26 | } 27 | 28 | // NewAnalyticsLister returns a new AnalyticsLister. 29 | func NewAnalyticsLister(indexer cache.Indexer) AnalyticsLister { 30 | return &analyticsLister{indexer: indexer} 31 | } 32 | 33 | // List lists all Analytics in the indexer. 34 | func (s *analyticsLister) List(selector labels.Selector) (ret []*v1alpha1.Analytics, err error) { 35 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 36 | ret = append(ret, m.(*v1alpha1.Analytics)) 37 | }) 38 | return ret, err 39 | } 40 | 41 | // Analytics returns an object that can list and get Analytics. 42 | func (s *analyticsLister) Analytics(namespace string) AnalyticsNamespaceLister { 43 | return analyticsNamespaceLister{indexer: s.indexer, namespace: namespace} 44 | } 45 | 46 | // AnalyticsNamespaceLister helps list and get Analytics. 47 | // All objects returned here must be treated as read-only. 48 | type AnalyticsNamespaceLister interface { 49 | // List lists all Analytics in the indexer for a given namespace. 50 | // Objects returned here must be treated as read-only. 51 | List(selector labels.Selector) (ret []*v1alpha1.Analytics, err error) 52 | // Get retrieves the Analytics from the indexer for a given namespace and name. 53 | // Objects returned here must be treated as read-only. 54 | Get(name string) (*v1alpha1.Analytics, error) 55 | AnalyticsNamespaceListerExpansion 56 | } 57 | 58 | // analyticsNamespaceLister implements the AnalyticsNamespaceLister 59 | // interface. 60 | type analyticsNamespaceLister struct { 61 | indexer cache.Indexer 62 | namespace string 63 | } 64 | 65 | // List lists all Analytics in the indexer for a given namespace. 66 | func (s analyticsNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Analytics, err error) { 67 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { 68 | ret = append(ret, m.(*v1alpha1.Analytics)) 69 | }) 70 | return ret, err 71 | } 72 | 73 | // Get retrieves the Analytics from the indexer for a given namespace and name. 74 | func (s analyticsNamespaceLister) Get(name string) (*v1alpha1.Analytics, error) { 75 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) 76 | if err != nil { 77 | return nil, err 78 | } 79 | if !exists { 80 | return nil, errors.NewNotFound(v1alpha1.Resource("analytics"), name) 81 | } 82 | return obj.(*v1alpha1.Analytics), nil 83 | } 84 | -------------------------------------------------------------------------------- /pkg/generated/listers/analysis/v1alpha1/configset.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/analysis/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | "k8s.io/apimachinery/pkg/labels" 9 | "k8s.io/client-go/tools/cache" 10 | ) 11 | 12 | // ConfigSetLister helps list ConfigSets. 13 | // All objects returned here must be treated as read-only. 14 | type ConfigSetLister interface { 15 | // List lists all ConfigSets in the indexer. 16 | // Objects returned here must be treated as read-only. 17 | List(selector labels.Selector) (ret []*v1alpha1.ConfigSet, err error) 18 | // ConfigSets returns an object that can list and get ConfigSets. 19 | ConfigSets(namespace string) ConfigSetNamespaceLister 20 | ConfigSetListerExpansion 21 | } 22 | 23 | // configSetLister implements the ConfigSetLister interface. 24 | type configSetLister struct { 25 | indexer cache.Indexer 26 | } 27 | 28 | // NewConfigSetLister returns a new ConfigSetLister. 29 | func NewConfigSetLister(indexer cache.Indexer) ConfigSetLister { 30 | return &configSetLister{indexer: indexer} 31 | } 32 | 33 | // List lists all ConfigSets in the indexer. 34 | func (s *configSetLister) List(selector labels.Selector) (ret []*v1alpha1.ConfigSet, err error) { 35 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 36 | ret = append(ret, m.(*v1alpha1.ConfigSet)) 37 | }) 38 | return ret, err 39 | } 40 | 41 | // ConfigSets returns an object that can list and get ConfigSets. 42 | func (s *configSetLister) ConfigSets(namespace string) ConfigSetNamespaceLister { 43 | return configSetNamespaceLister{indexer: s.indexer, namespace: namespace} 44 | } 45 | 46 | // ConfigSetNamespaceLister helps list and get ConfigSets. 47 | // All objects returned here must be treated as read-only. 48 | type ConfigSetNamespaceLister interface { 49 | // List lists all ConfigSets in the indexer for a given namespace. 50 | // Objects returned here must be treated as read-only. 51 | List(selector labels.Selector) (ret []*v1alpha1.ConfigSet, err error) 52 | // Get retrieves the ConfigSet from the indexer for a given namespace and name. 53 | // Objects returned here must be treated as read-only. 54 | Get(name string) (*v1alpha1.ConfigSet, error) 55 | ConfigSetNamespaceListerExpansion 56 | } 57 | 58 | // configSetNamespaceLister implements the ConfigSetNamespaceLister 59 | // interface. 60 | type configSetNamespaceLister struct { 61 | indexer cache.Indexer 62 | namespace string 63 | } 64 | 65 | // List lists all ConfigSets in the indexer for a given namespace. 66 | func (s configSetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ConfigSet, err error) { 67 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { 68 | ret = append(ret, m.(*v1alpha1.ConfigSet)) 69 | }) 70 | return ret, err 71 | } 72 | 73 | // Get retrieves the ConfigSet from the indexer for a given namespace and name. 74 | func (s configSetNamespaceLister) Get(name string) (*v1alpha1.ConfigSet, error) { 75 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) 76 | if err != nil { 77 | return nil, err 78 | } 79 | if !exists { 80 | return nil, errors.NewNotFound(v1alpha1.Resource("configset"), name) 81 | } 82 | return obj.(*v1alpha1.ConfigSet), nil 83 | } 84 | -------------------------------------------------------------------------------- /pkg/generated/listers/analysis/v1alpha1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | // AnalyticsListerExpansion allows custom methods to be added to 6 | // AnalyticsLister. 7 | type AnalyticsListerExpansion interface{} 8 | 9 | // AnalyticsNamespaceListerExpansion allows custom methods to be added to 10 | // AnalyticsNamespaceLister. 11 | type AnalyticsNamespaceListerExpansion interface{} 12 | 13 | // ConfigSetListerExpansion allows custom methods to be added to 14 | // ConfigSetLister. 15 | type ConfigSetListerExpansion interface{} 16 | 17 | // ConfigSetNamespaceListerExpansion allows custom methods to be added to 18 | // ConfigSetNamespaceLister. 19 | type ConfigSetNamespaceListerExpansion interface{} 20 | 21 | // RecommendationListerExpansion allows custom methods to be added to 22 | // RecommendationLister. 23 | type RecommendationListerExpansion interface{} 24 | 25 | // RecommendationNamespaceListerExpansion allows custom methods to be added to 26 | // RecommendationNamespaceLister. 27 | type RecommendationNamespaceListerExpansion interface{} 28 | 29 | // RecommendationRuleListerExpansion allows custom methods to be added to 30 | // RecommendationRuleLister. 31 | type RecommendationRuleListerExpansion interface{} 32 | -------------------------------------------------------------------------------- /pkg/generated/listers/analysis/v1alpha1/recommendation.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/analysis/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | "k8s.io/apimachinery/pkg/labels" 9 | "k8s.io/client-go/tools/cache" 10 | ) 11 | 12 | // RecommendationLister helps list Recommendations. 13 | // All objects returned here must be treated as read-only. 14 | type RecommendationLister interface { 15 | // List lists all Recommendations in the indexer. 16 | // Objects returned here must be treated as read-only. 17 | List(selector labels.Selector) (ret []*v1alpha1.Recommendation, err error) 18 | // Recommendations returns an object that can list and get Recommendations. 19 | Recommendations(namespace string) RecommendationNamespaceLister 20 | RecommendationListerExpansion 21 | } 22 | 23 | // recommendationLister implements the RecommendationLister interface. 24 | type recommendationLister struct { 25 | indexer cache.Indexer 26 | } 27 | 28 | // NewRecommendationLister returns a new RecommendationLister. 29 | func NewRecommendationLister(indexer cache.Indexer) RecommendationLister { 30 | return &recommendationLister{indexer: indexer} 31 | } 32 | 33 | // List lists all Recommendations in the indexer. 34 | func (s *recommendationLister) List(selector labels.Selector) (ret []*v1alpha1.Recommendation, err error) { 35 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 36 | ret = append(ret, m.(*v1alpha1.Recommendation)) 37 | }) 38 | return ret, err 39 | } 40 | 41 | // Recommendations returns an object that can list and get Recommendations. 42 | func (s *recommendationLister) Recommendations(namespace string) RecommendationNamespaceLister { 43 | return recommendationNamespaceLister{indexer: s.indexer, namespace: namespace} 44 | } 45 | 46 | // RecommendationNamespaceLister helps list and get Recommendations. 47 | // All objects returned here must be treated as read-only. 48 | type RecommendationNamespaceLister interface { 49 | // List lists all Recommendations in the indexer for a given namespace. 50 | // Objects returned here must be treated as read-only. 51 | List(selector labels.Selector) (ret []*v1alpha1.Recommendation, err error) 52 | // Get retrieves the Recommendation from the indexer for a given namespace and name. 53 | // Objects returned here must be treated as read-only. 54 | Get(name string) (*v1alpha1.Recommendation, error) 55 | RecommendationNamespaceListerExpansion 56 | } 57 | 58 | // recommendationNamespaceLister implements the RecommendationNamespaceLister 59 | // interface. 60 | type recommendationNamespaceLister struct { 61 | indexer cache.Indexer 62 | namespace string 63 | } 64 | 65 | // List lists all Recommendations in the indexer for a given namespace. 66 | func (s recommendationNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Recommendation, err error) { 67 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { 68 | ret = append(ret, m.(*v1alpha1.Recommendation)) 69 | }) 70 | return ret, err 71 | } 72 | 73 | // Get retrieves the Recommendation from the indexer for a given namespace and name. 74 | func (s recommendationNamespaceLister) Get(name string) (*v1alpha1.Recommendation, error) { 75 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) 76 | if err != nil { 77 | return nil, err 78 | } 79 | if !exists { 80 | return nil, errors.NewNotFound(v1alpha1.Resource("recommendation"), name) 81 | } 82 | return obj.(*v1alpha1.Recommendation), nil 83 | } 84 | -------------------------------------------------------------------------------- /pkg/generated/listers/analysis/v1alpha1/recommendationrule.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/analysis/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | "k8s.io/apimachinery/pkg/labels" 9 | "k8s.io/client-go/tools/cache" 10 | ) 11 | 12 | // RecommendationRuleLister helps list RecommendationRules. 13 | // All objects returned here must be treated as read-only. 14 | type RecommendationRuleLister interface { 15 | // List lists all RecommendationRules in the indexer. 16 | // Objects returned here must be treated as read-only. 17 | List(selector labels.Selector) (ret []*v1alpha1.RecommendationRule, err error) 18 | // Get retrieves the RecommendationRule from the index for a given name. 19 | // Objects returned here must be treated as read-only. 20 | Get(name string) (*v1alpha1.RecommendationRule, error) 21 | RecommendationRuleListerExpansion 22 | } 23 | 24 | // recommendationRuleLister implements the RecommendationRuleLister interface. 25 | type recommendationRuleLister struct { 26 | indexer cache.Indexer 27 | } 28 | 29 | // NewRecommendationRuleLister returns a new RecommendationRuleLister. 30 | func NewRecommendationRuleLister(indexer cache.Indexer) RecommendationRuleLister { 31 | return &recommendationRuleLister{indexer: indexer} 32 | } 33 | 34 | // List lists all RecommendationRules in the indexer. 35 | func (s *recommendationRuleLister) List(selector labels.Selector) (ret []*v1alpha1.RecommendationRule, err error) { 36 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 37 | ret = append(ret, m.(*v1alpha1.RecommendationRule)) 38 | }) 39 | return ret, err 40 | } 41 | 42 | // Get retrieves the RecommendationRule from the index for a given name. 43 | func (s *recommendationRuleLister) Get(name string) (*v1alpha1.RecommendationRule, error) { 44 | obj, exists, err := s.indexer.GetByKey(name) 45 | if err != nil { 46 | return nil, err 47 | } 48 | if !exists { 49 | return nil, errors.NewNotFound(v1alpha1.Resource("recommendationrule"), name) 50 | } 51 | return obj.(*v1alpha1.RecommendationRule), nil 52 | } 53 | -------------------------------------------------------------------------------- /pkg/generated/listers/autoscaling/v1alpha1/effectivehorizontalpodautoscaler.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/autoscaling/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | "k8s.io/apimachinery/pkg/labels" 9 | "k8s.io/client-go/tools/cache" 10 | ) 11 | 12 | // EffectiveHorizontalPodAutoscalerLister helps list EffectiveHorizontalPodAutoscalers. 13 | // All objects returned here must be treated as read-only. 14 | type EffectiveHorizontalPodAutoscalerLister interface { 15 | // List lists all EffectiveHorizontalPodAutoscalers in the indexer. 16 | // Objects returned here must be treated as read-only. 17 | List(selector labels.Selector) (ret []*v1alpha1.EffectiveHorizontalPodAutoscaler, err error) 18 | // EffectiveHorizontalPodAutoscalers returns an object that can list and get EffectiveHorizontalPodAutoscalers. 19 | EffectiveHorizontalPodAutoscalers(namespace string) EffectiveHorizontalPodAutoscalerNamespaceLister 20 | EffectiveHorizontalPodAutoscalerListerExpansion 21 | } 22 | 23 | // effectiveHorizontalPodAutoscalerLister implements the EffectiveHorizontalPodAutoscalerLister interface. 24 | type effectiveHorizontalPodAutoscalerLister struct { 25 | indexer cache.Indexer 26 | } 27 | 28 | // NewEffectiveHorizontalPodAutoscalerLister returns a new EffectiveHorizontalPodAutoscalerLister. 29 | func NewEffectiveHorizontalPodAutoscalerLister(indexer cache.Indexer) EffectiveHorizontalPodAutoscalerLister { 30 | return &effectiveHorizontalPodAutoscalerLister{indexer: indexer} 31 | } 32 | 33 | // List lists all EffectiveHorizontalPodAutoscalers in the indexer. 34 | func (s *effectiveHorizontalPodAutoscalerLister) List(selector labels.Selector) (ret []*v1alpha1.EffectiveHorizontalPodAutoscaler, err error) { 35 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 36 | ret = append(ret, m.(*v1alpha1.EffectiveHorizontalPodAutoscaler)) 37 | }) 38 | return ret, err 39 | } 40 | 41 | // EffectiveHorizontalPodAutoscalers returns an object that can list and get EffectiveHorizontalPodAutoscalers. 42 | func (s *effectiveHorizontalPodAutoscalerLister) EffectiveHorizontalPodAutoscalers(namespace string) EffectiveHorizontalPodAutoscalerNamespaceLister { 43 | return effectiveHorizontalPodAutoscalerNamespaceLister{indexer: s.indexer, namespace: namespace} 44 | } 45 | 46 | // EffectiveHorizontalPodAutoscalerNamespaceLister helps list and get EffectiveHorizontalPodAutoscalers. 47 | // All objects returned here must be treated as read-only. 48 | type EffectiveHorizontalPodAutoscalerNamespaceLister interface { 49 | // List lists all EffectiveHorizontalPodAutoscalers in the indexer for a given namespace. 50 | // Objects returned here must be treated as read-only. 51 | List(selector labels.Selector) (ret []*v1alpha1.EffectiveHorizontalPodAutoscaler, err error) 52 | // Get retrieves the EffectiveHorizontalPodAutoscaler from the indexer for a given namespace and name. 53 | // Objects returned here must be treated as read-only. 54 | Get(name string) (*v1alpha1.EffectiveHorizontalPodAutoscaler, error) 55 | EffectiveHorizontalPodAutoscalerNamespaceListerExpansion 56 | } 57 | 58 | // effectiveHorizontalPodAutoscalerNamespaceLister implements the EffectiveHorizontalPodAutoscalerNamespaceLister 59 | // interface. 60 | type effectiveHorizontalPodAutoscalerNamespaceLister struct { 61 | indexer cache.Indexer 62 | namespace string 63 | } 64 | 65 | // List lists all EffectiveHorizontalPodAutoscalers in the indexer for a given namespace. 66 | func (s effectiveHorizontalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.EffectiveHorizontalPodAutoscaler, err error) { 67 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { 68 | ret = append(ret, m.(*v1alpha1.EffectiveHorizontalPodAutoscaler)) 69 | }) 70 | return ret, err 71 | } 72 | 73 | // Get retrieves the EffectiveHorizontalPodAutoscaler from the indexer for a given namespace and name. 74 | func (s effectiveHorizontalPodAutoscalerNamespaceLister) Get(name string) (*v1alpha1.EffectiveHorizontalPodAutoscaler, error) { 75 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) 76 | if err != nil { 77 | return nil, err 78 | } 79 | if !exists { 80 | return nil, errors.NewNotFound(v1alpha1.Resource("effectivehorizontalpodautoscaler"), name) 81 | } 82 | return obj.(*v1alpha1.EffectiveHorizontalPodAutoscaler), nil 83 | } 84 | -------------------------------------------------------------------------------- /pkg/generated/listers/autoscaling/v1alpha1/effectiveverticalpodautoscaler.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/autoscaling/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | "k8s.io/apimachinery/pkg/labels" 9 | "k8s.io/client-go/tools/cache" 10 | ) 11 | 12 | // EffectiveVerticalPodAutoscalerLister helps list EffectiveVerticalPodAutoscalers. 13 | // All objects returned here must be treated as read-only. 14 | type EffectiveVerticalPodAutoscalerLister interface { 15 | // List lists all EffectiveVerticalPodAutoscalers in the indexer. 16 | // Objects returned here must be treated as read-only. 17 | List(selector labels.Selector) (ret []*v1alpha1.EffectiveVerticalPodAutoscaler, err error) 18 | // EffectiveVerticalPodAutoscalers returns an object that can list and get EffectiveVerticalPodAutoscalers. 19 | EffectiveVerticalPodAutoscalers(namespace string) EffectiveVerticalPodAutoscalerNamespaceLister 20 | EffectiveVerticalPodAutoscalerListerExpansion 21 | } 22 | 23 | // effectiveVerticalPodAutoscalerLister implements the EffectiveVerticalPodAutoscalerLister interface. 24 | type effectiveVerticalPodAutoscalerLister struct { 25 | indexer cache.Indexer 26 | } 27 | 28 | // NewEffectiveVerticalPodAutoscalerLister returns a new EffectiveVerticalPodAutoscalerLister. 29 | func NewEffectiveVerticalPodAutoscalerLister(indexer cache.Indexer) EffectiveVerticalPodAutoscalerLister { 30 | return &effectiveVerticalPodAutoscalerLister{indexer: indexer} 31 | } 32 | 33 | // List lists all EffectiveVerticalPodAutoscalers in the indexer. 34 | func (s *effectiveVerticalPodAutoscalerLister) List(selector labels.Selector) (ret []*v1alpha1.EffectiveVerticalPodAutoscaler, err error) { 35 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 36 | ret = append(ret, m.(*v1alpha1.EffectiveVerticalPodAutoscaler)) 37 | }) 38 | return ret, err 39 | } 40 | 41 | // EffectiveVerticalPodAutoscalers returns an object that can list and get EffectiveVerticalPodAutoscalers. 42 | func (s *effectiveVerticalPodAutoscalerLister) EffectiveVerticalPodAutoscalers(namespace string) EffectiveVerticalPodAutoscalerNamespaceLister { 43 | return effectiveVerticalPodAutoscalerNamespaceLister{indexer: s.indexer, namespace: namespace} 44 | } 45 | 46 | // EffectiveVerticalPodAutoscalerNamespaceLister helps list and get EffectiveVerticalPodAutoscalers. 47 | // All objects returned here must be treated as read-only. 48 | type EffectiveVerticalPodAutoscalerNamespaceLister interface { 49 | // List lists all EffectiveVerticalPodAutoscalers in the indexer for a given namespace. 50 | // Objects returned here must be treated as read-only. 51 | List(selector labels.Selector) (ret []*v1alpha1.EffectiveVerticalPodAutoscaler, err error) 52 | // Get retrieves the EffectiveVerticalPodAutoscaler from the indexer for a given namespace and name. 53 | // Objects returned here must be treated as read-only. 54 | Get(name string) (*v1alpha1.EffectiveVerticalPodAutoscaler, error) 55 | EffectiveVerticalPodAutoscalerNamespaceListerExpansion 56 | } 57 | 58 | // effectiveVerticalPodAutoscalerNamespaceLister implements the EffectiveVerticalPodAutoscalerNamespaceLister 59 | // interface. 60 | type effectiveVerticalPodAutoscalerNamespaceLister struct { 61 | indexer cache.Indexer 62 | namespace string 63 | } 64 | 65 | // List lists all EffectiveVerticalPodAutoscalers in the indexer for a given namespace. 66 | func (s effectiveVerticalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.EffectiveVerticalPodAutoscaler, err error) { 67 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { 68 | ret = append(ret, m.(*v1alpha1.EffectiveVerticalPodAutoscaler)) 69 | }) 70 | return ret, err 71 | } 72 | 73 | // Get retrieves the EffectiveVerticalPodAutoscaler from the indexer for a given namespace and name. 74 | func (s effectiveVerticalPodAutoscalerNamespaceLister) Get(name string) (*v1alpha1.EffectiveVerticalPodAutoscaler, error) { 75 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) 76 | if err != nil { 77 | return nil, err 78 | } 79 | if !exists { 80 | return nil, errors.NewNotFound(v1alpha1.Resource("effectiveverticalpodautoscaler"), name) 81 | } 82 | return obj.(*v1alpha1.EffectiveVerticalPodAutoscaler), nil 83 | } 84 | -------------------------------------------------------------------------------- /pkg/generated/listers/autoscaling/v1alpha1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | // EffectiveHorizontalPodAutoscalerListerExpansion allows custom methods to be added to 6 | // EffectiveHorizontalPodAutoscalerLister. 7 | type EffectiveHorizontalPodAutoscalerListerExpansion interface{} 8 | 9 | // EffectiveHorizontalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to 10 | // EffectiveHorizontalPodAutoscalerNamespaceLister. 11 | type EffectiveHorizontalPodAutoscalerNamespaceListerExpansion interface{} 12 | 13 | // EffectiveVerticalPodAutoscalerListerExpansion allows custom methods to be added to 14 | // EffectiveVerticalPodAutoscalerLister. 15 | type EffectiveVerticalPodAutoscalerListerExpansion interface{} 16 | 17 | // EffectiveVerticalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to 18 | // EffectiveVerticalPodAutoscalerNamespaceLister. 19 | type EffectiveVerticalPodAutoscalerNamespaceListerExpansion interface{} 20 | 21 | // SubstituteListerExpansion allows custom methods to be added to 22 | // SubstituteLister. 23 | type SubstituteListerExpansion interface{} 24 | 25 | // SubstituteNamespaceListerExpansion allows custom methods to be added to 26 | // SubstituteNamespaceLister. 27 | type SubstituteNamespaceListerExpansion interface{} 28 | -------------------------------------------------------------------------------- /pkg/generated/listers/autoscaling/v1alpha1/substitute.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/autoscaling/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | "k8s.io/apimachinery/pkg/labels" 9 | "k8s.io/client-go/tools/cache" 10 | ) 11 | 12 | // SubstituteLister helps list Substitutes. 13 | // All objects returned here must be treated as read-only. 14 | type SubstituteLister interface { 15 | // List lists all Substitutes in the indexer. 16 | // Objects returned here must be treated as read-only. 17 | List(selector labels.Selector) (ret []*v1alpha1.Substitute, err error) 18 | // Substitutes returns an object that can list and get Substitutes. 19 | Substitutes(namespace string) SubstituteNamespaceLister 20 | SubstituteListerExpansion 21 | } 22 | 23 | // substituteLister implements the SubstituteLister interface. 24 | type substituteLister struct { 25 | indexer cache.Indexer 26 | } 27 | 28 | // NewSubstituteLister returns a new SubstituteLister. 29 | func NewSubstituteLister(indexer cache.Indexer) SubstituteLister { 30 | return &substituteLister{indexer: indexer} 31 | } 32 | 33 | // List lists all Substitutes in the indexer. 34 | func (s *substituteLister) List(selector labels.Selector) (ret []*v1alpha1.Substitute, err error) { 35 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 36 | ret = append(ret, m.(*v1alpha1.Substitute)) 37 | }) 38 | return ret, err 39 | } 40 | 41 | // Substitutes returns an object that can list and get Substitutes. 42 | func (s *substituteLister) Substitutes(namespace string) SubstituteNamespaceLister { 43 | return substituteNamespaceLister{indexer: s.indexer, namespace: namespace} 44 | } 45 | 46 | // SubstituteNamespaceLister helps list and get Substitutes. 47 | // All objects returned here must be treated as read-only. 48 | type SubstituteNamespaceLister interface { 49 | // List lists all Substitutes in the indexer for a given namespace. 50 | // Objects returned here must be treated as read-only. 51 | List(selector labels.Selector) (ret []*v1alpha1.Substitute, err error) 52 | // Get retrieves the Substitute from the indexer for a given namespace and name. 53 | // Objects returned here must be treated as read-only. 54 | Get(name string) (*v1alpha1.Substitute, error) 55 | SubstituteNamespaceListerExpansion 56 | } 57 | 58 | // substituteNamespaceLister implements the SubstituteNamespaceLister 59 | // interface. 60 | type substituteNamespaceLister struct { 61 | indexer cache.Indexer 62 | namespace string 63 | } 64 | 65 | // List lists all Substitutes in the indexer for a given namespace. 66 | func (s substituteNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Substitute, err error) { 67 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { 68 | ret = append(ret, m.(*v1alpha1.Substitute)) 69 | }) 70 | return ret, err 71 | } 72 | 73 | // Get retrieves the Substitute from the indexer for a given namespace and name. 74 | func (s substituteNamespaceLister) Get(name string) (*v1alpha1.Substitute, error) { 75 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) 76 | if err != nil { 77 | return nil, err 78 | } 79 | if !exists { 80 | return nil, errors.NewNotFound(v1alpha1.Resource("substitute"), name) 81 | } 82 | return obj.(*v1alpha1.Substitute), nil 83 | } 84 | -------------------------------------------------------------------------------- /pkg/generated/listers/co2e/v1alpha1/cloudcarbonfootprint.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/co2e/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | "k8s.io/apimachinery/pkg/labels" 9 | "k8s.io/client-go/tools/cache" 10 | ) 11 | 12 | // CloudCarbonFootprintLister helps list CloudCarbonFootprints. 13 | // All objects returned here must be treated as read-only. 14 | type CloudCarbonFootprintLister interface { 15 | // List lists all CloudCarbonFootprints in the indexer. 16 | // Objects returned here must be treated as read-only. 17 | List(selector labels.Selector) (ret []*v1alpha1.CloudCarbonFootprint, err error) 18 | // Get retrieves the CloudCarbonFootprint from the index for a given name. 19 | // Objects returned here must be treated as read-only. 20 | Get(name string) (*v1alpha1.CloudCarbonFootprint, error) 21 | CloudCarbonFootprintListerExpansion 22 | } 23 | 24 | // cloudCarbonFootprintLister implements the CloudCarbonFootprintLister interface. 25 | type cloudCarbonFootprintLister struct { 26 | indexer cache.Indexer 27 | } 28 | 29 | // NewCloudCarbonFootprintLister returns a new CloudCarbonFootprintLister. 30 | func NewCloudCarbonFootprintLister(indexer cache.Indexer) CloudCarbonFootprintLister { 31 | return &cloudCarbonFootprintLister{indexer: indexer} 32 | } 33 | 34 | // List lists all CloudCarbonFootprints in the indexer. 35 | func (s *cloudCarbonFootprintLister) List(selector labels.Selector) (ret []*v1alpha1.CloudCarbonFootprint, err error) { 36 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 37 | ret = append(ret, m.(*v1alpha1.CloudCarbonFootprint)) 38 | }) 39 | return ret, err 40 | } 41 | 42 | // Get retrieves the CloudCarbonFootprint from the index for a given name. 43 | func (s *cloudCarbonFootprintLister) Get(name string) (*v1alpha1.CloudCarbonFootprint, error) { 44 | obj, exists, err := s.indexer.GetByKey(name) 45 | if err != nil { 46 | return nil, err 47 | } 48 | if !exists { 49 | return nil, errors.NewNotFound(v1alpha1.Resource("cloudcarbonfootprint"), name) 50 | } 51 | return obj.(*v1alpha1.CloudCarbonFootprint), nil 52 | } 53 | -------------------------------------------------------------------------------- /pkg/generated/listers/co2e/v1alpha1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | // CloudCarbonFootprintListerExpansion allows custom methods to be added to 6 | // CloudCarbonFootprintLister. 7 | type CloudCarbonFootprintListerExpansion interface{} 8 | -------------------------------------------------------------------------------- /pkg/generated/listers/ensurance/v1alpha1/avoidanceaction.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/ensurance/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | "k8s.io/apimachinery/pkg/labels" 9 | "k8s.io/client-go/tools/cache" 10 | ) 11 | 12 | // AvoidanceActionLister helps list AvoidanceActions. 13 | // All objects returned here must be treated as read-only. 14 | type AvoidanceActionLister interface { 15 | // List lists all AvoidanceActions in the indexer. 16 | // Objects returned here must be treated as read-only. 17 | List(selector labels.Selector) (ret []*v1alpha1.AvoidanceAction, err error) 18 | // Get retrieves the AvoidanceAction from the index for a given name. 19 | // Objects returned here must be treated as read-only. 20 | Get(name string) (*v1alpha1.AvoidanceAction, error) 21 | AvoidanceActionListerExpansion 22 | } 23 | 24 | // avoidanceActionLister implements the AvoidanceActionLister interface. 25 | type avoidanceActionLister struct { 26 | indexer cache.Indexer 27 | } 28 | 29 | // NewAvoidanceActionLister returns a new AvoidanceActionLister. 30 | func NewAvoidanceActionLister(indexer cache.Indexer) AvoidanceActionLister { 31 | return &avoidanceActionLister{indexer: indexer} 32 | } 33 | 34 | // List lists all AvoidanceActions in the indexer. 35 | func (s *avoidanceActionLister) List(selector labels.Selector) (ret []*v1alpha1.AvoidanceAction, err error) { 36 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 37 | ret = append(ret, m.(*v1alpha1.AvoidanceAction)) 38 | }) 39 | return ret, err 40 | } 41 | 42 | // Get retrieves the AvoidanceAction from the index for a given name. 43 | func (s *avoidanceActionLister) Get(name string) (*v1alpha1.AvoidanceAction, error) { 44 | obj, exists, err := s.indexer.GetByKey(name) 45 | if err != nil { 46 | return nil, err 47 | } 48 | if !exists { 49 | return nil, errors.NewNotFound(v1alpha1.Resource("avoidanceaction"), name) 50 | } 51 | return obj.(*v1alpha1.AvoidanceAction), nil 52 | } 53 | -------------------------------------------------------------------------------- /pkg/generated/listers/ensurance/v1alpha1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | // AvoidanceActionListerExpansion allows custom methods to be added to 6 | // AvoidanceActionLister. 7 | type AvoidanceActionListerExpansion interface{} 8 | 9 | // NodeQOSListerExpansion allows custom methods to be added to 10 | // NodeQOSLister. 11 | type NodeQOSListerExpansion interface{} 12 | 13 | // PodQOSListerExpansion allows custom methods to be added to 14 | // PodQOSLister. 15 | type PodQOSListerExpansion interface{} 16 | -------------------------------------------------------------------------------- /pkg/generated/listers/ensurance/v1alpha1/nodeqos.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/ensurance/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | "k8s.io/apimachinery/pkg/labels" 9 | "k8s.io/client-go/tools/cache" 10 | ) 11 | 12 | // NodeQOSLister helps list NodeQOSs. 13 | // All objects returned here must be treated as read-only. 14 | type NodeQOSLister interface { 15 | // List lists all NodeQOSs in the indexer. 16 | // Objects returned here must be treated as read-only. 17 | List(selector labels.Selector) (ret []*v1alpha1.NodeQOS, err error) 18 | // Get retrieves the NodeQOS from the index for a given name. 19 | // Objects returned here must be treated as read-only. 20 | Get(name string) (*v1alpha1.NodeQOS, error) 21 | NodeQOSListerExpansion 22 | } 23 | 24 | // nodeQOSLister implements the NodeQOSLister interface. 25 | type nodeQOSLister struct { 26 | indexer cache.Indexer 27 | } 28 | 29 | // NewNodeQOSLister returns a new NodeQOSLister. 30 | func NewNodeQOSLister(indexer cache.Indexer) NodeQOSLister { 31 | return &nodeQOSLister{indexer: indexer} 32 | } 33 | 34 | // List lists all NodeQOSs in the indexer. 35 | func (s *nodeQOSLister) List(selector labels.Selector) (ret []*v1alpha1.NodeQOS, err error) { 36 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 37 | ret = append(ret, m.(*v1alpha1.NodeQOS)) 38 | }) 39 | return ret, err 40 | } 41 | 42 | // Get retrieves the NodeQOS from the index for a given name. 43 | func (s *nodeQOSLister) Get(name string) (*v1alpha1.NodeQOS, error) { 44 | obj, exists, err := s.indexer.GetByKey(name) 45 | if err != nil { 46 | return nil, err 47 | } 48 | if !exists { 49 | return nil, errors.NewNotFound(v1alpha1.Resource("nodeqos"), name) 50 | } 51 | return obj.(*v1alpha1.NodeQOS), nil 52 | } 53 | -------------------------------------------------------------------------------- /pkg/generated/listers/ensurance/v1alpha1/podqos.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/ensurance/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | "k8s.io/apimachinery/pkg/labels" 9 | "k8s.io/client-go/tools/cache" 10 | ) 11 | 12 | // PodQOSLister helps list PodQOSs. 13 | // All objects returned here must be treated as read-only. 14 | type PodQOSLister interface { 15 | // List lists all PodQOSs in the indexer. 16 | // Objects returned here must be treated as read-only. 17 | List(selector labels.Selector) (ret []*v1alpha1.PodQOS, err error) 18 | // Get retrieves the PodQOS from the index for a given name. 19 | // Objects returned here must be treated as read-only. 20 | Get(name string) (*v1alpha1.PodQOS, error) 21 | PodQOSListerExpansion 22 | } 23 | 24 | // podQOSLister implements the PodQOSLister interface. 25 | type podQOSLister struct { 26 | indexer cache.Indexer 27 | } 28 | 29 | // NewPodQOSLister returns a new PodQOSLister. 30 | func NewPodQOSLister(indexer cache.Indexer) PodQOSLister { 31 | return &podQOSLister{indexer: indexer} 32 | } 33 | 34 | // List lists all PodQOSs in the indexer. 35 | func (s *podQOSLister) List(selector labels.Selector) (ret []*v1alpha1.PodQOS, err error) { 36 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 37 | ret = append(ret, m.(*v1alpha1.PodQOS)) 38 | }) 39 | return ret, err 40 | } 41 | 42 | // Get retrieves the PodQOS from the index for a given name. 43 | func (s *podQOSLister) Get(name string) (*v1alpha1.PodQOS, error) { 44 | obj, exists, err := s.indexer.GetByKey(name) 45 | if err != nil { 46 | return nil, err 47 | } 48 | if !exists { 49 | return nil, errors.NewNotFound(v1alpha1.Resource("podqos"), name) 50 | } 51 | return obj.(*v1alpha1.PodQOS), nil 52 | } 53 | -------------------------------------------------------------------------------- /pkg/generated/listers/prediction/v1alpha1/clusternodeprediction.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/prediction/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | "k8s.io/apimachinery/pkg/labels" 9 | "k8s.io/client-go/tools/cache" 10 | ) 11 | 12 | // ClusterNodePredictionLister helps list ClusterNodePredictions. 13 | // All objects returned here must be treated as read-only. 14 | type ClusterNodePredictionLister interface { 15 | // List lists all ClusterNodePredictions in the indexer. 16 | // Objects returned here must be treated as read-only. 17 | List(selector labels.Selector) (ret []*v1alpha1.ClusterNodePrediction, err error) 18 | // ClusterNodePredictions returns an object that can list and get ClusterNodePredictions. 19 | ClusterNodePredictions(namespace string) ClusterNodePredictionNamespaceLister 20 | ClusterNodePredictionListerExpansion 21 | } 22 | 23 | // clusterNodePredictionLister implements the ClusterNodePredictionLister interface. 24 | type clusterNodePredictionLister struct { 25 | indexer cache.Indexer 26 | } 27 | 28 | // NewClusterNodePredictionLister returns a new ClusterNodePredictionLister. 29 | func NewClusterNodePredictionLister(indexer cache.Indexer) ClusterNodePredictionLister { 30 | return &clusterNodePredictionLister{indexer: indexer} 31 | } 32 | 33 | // List lists all ClusterNodePredictions in the indexer. 34 | func (s *clusterNodePredictionLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterNodePrediction, err error) { 35 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 36 | ret = append(ret, m.(*v1alpha1.ClusterNodePrediction)) 37 | }) 38 | return ret, err 39 | } 40 | 41 | // ClusterNodePredictions returns an object that can list and get ClusterNodePredictions. 42 | func (s *clusterNodePredictionLister) ClusterNodePredictions(namespace string) ClusterNodePredictionNamespaceLister { 43 | return clusterNodePredictionNamespaceLister{indexer: s.indexer, namespace: namespace} 44 | } 45 | 46 | // ClusterNodePredictionNamespaceLister helps list and get ClusterNodePredictions. 47 | // All objects returned here must be treated as read-only. 48 | type ClusterNodePredictionNamespaceLister interface { 49 | // List lists all ClusterNodePredictions in the indexer for a given namespace. 50 | // Objects returned here must be treated as read-only. 51 | List(selector labels.Selector) (ret []*v1alpha1.ClusterNodePrediction, err error) 52 | // Get retrieves the ClusterNodePrediction from the indexer for a given namespace and name. 53 | // Objects returned here must be treated as read-only. 54 | Get(name string) (*v1alpha1.ClusterNodePrediction, error) 55 | ClusterNodePredictionNamespaceListerExpansion 56 | } 57 | 58 | // clusterNodePredictionNamespaceLister implements the ClusterNodePredictionNamespaceLister 59 | // interface. 60 | type clusterNodePredictionNamespaceLister struct { 61 | indexer cache.Indexer 62 | namespace string 63 | } 64 | 65 | // List lists all ClusterNodePredictions in the indexer for a given namespace. 66 | func (s clusterNodePredictionNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ClusterNodePrediction, err error) { 67 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { 68 | ret = append(ret, m.(*v1alpha1.ClusterNodePrediction)) 69 | }) 70 | return ret, err 71 | } 72 | 73 | // Get retrieves the ClusterNodePrediction from the indexer for a given namespace and name. 74 | func (s clusterNodePredictionNamespaceLister) Get(name string) (*v1alpha1.ClusterNodePrediction, error) { 75 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) 76 | if err != nil { 77 | return nil, err 78 | } 79 | if !exists { 80 | return nil, errors.NewNotFound(v1alpha1.Resource("clusternodeprediction"), name) 81 | } 82 | return obj.(*v1alpha1.ClusterNodePrediction), nil 83 | } 84 | -------------------------------------------------------------------------------- /pkg/generated/listers/prediction/v1alpha1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | // ClusterNodePredictionListerExpansion allows custom methods to be added to 6 | // ClusterNodePredictionLister. 7 | type ClusterNodePredictionListerExpansion interface{} 8 | 9 | // ClusterNodePredictionNamespaceListerExpansion allows custom methods to be added to 10 | // ClusterNodePredictionNamespaceLister. 11 | type ClusterNodePredictionNamespaceListerExpansion interface{} 12 | 13 | // TimeSeriesPredictionListerExpansion allows custom methods to be added to 14 | // TimeSeriesPredictionLister. 15 | type TimeSeriesPredictionListerExpansion interface{} 16 | 17 | // TimeSeriesPredictionNamespaceListerExpansion allows custom methods to be added to 18 | // TimeSeriesPredictionNamespaceLister. 19 | type TimeSeriesPredictionNamespaceListerExpansion interface{} 20 | -------------------------------------------------------------------------------- /pkg/generated/listers/prediction/v1alpha1/timeseriesprediction.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/prediction/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | "k8s.io/apimachinery/pkg/labels" 9 | "k8s.io/client-go/tools/cache" 10 | ) 11 | 12 | // TimeSeriesPredictionLister helps list TimeSeriesPredictions. 13 | // All objects returned here must be treated as read-only. 14 | type TimeSeriesPredictionLister interface { 15 | // List lists all TimeSeriesPredictions in the indexer. 16 | // Objects returned here must be treated as read-only. 17 | List(selector labels.Selector) (ret []*v1alpha1.TimeSeriesPrediction, err error) 18 | // TimeSeriesPredictions returns an object that can list and get TimeSeriesPredictions. 19 | TimeSeriesPredictions(namespace string) TimeSeriesPredictionNamespaceLister 20 | TimeSeriesPredictionListerExpansion 21 | } 22 | 23 | // timeSeriesPredictionLister implements the TimeSeriesPredictionLister interface. 24 | type timeSeriesPredictionLister struct { 25 | indexer cache.Indexer 26 | } 27 | 28 | // NewTimeSeriesPredictionLister returns a new TimeSeriesPredictionLister. 29 | func NewTimeSeriesPredictionLister(indexer cache.Indexer) TimeSeriesPredictionLister { 30 | return &timeSeriesPredictionLister{indexer: indexer} 31 | } 32 | 33 | // List lists all TimeSeriesPredictions in the indexer. 34 | func (s *timeSeriesPredictionLister) List(selector labels.Selector) (ret []*v1alpha1.TimeSeriesPrediction, err error) { 35 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 36 | ret = append(ret, m.(*v1alpha1.TimeSeriesPrediction)) 37 | }) 38 | return ret, err 39 | } 40 | 41 | // TimeSeriesPredictions returns an object that can list and get TimeSeriesPredictions. 42 | func (s *timeSeriesPredictionLister) TimeSeriesPredictions(namespace string) TimeSeriesPredictionNamespaceLister { 43 | return timeSeriesPredictionNamespaceLister{indexer: s.indexer, namespace: namespace} 44 | } 45 | 46 | // TimeSeriesPredictionNamespaceLister helps list and get TimeSeriesPredictions. 47 | // All objects returned here must be treated as read-only. 48 | type TimeSeriesPredictionNamespaceLister interface { 49 | // List lists all TimeSeriesPredictions in the indexer for a given namespace. 50 | // Objects returned here must be treated as read-only. 51 | List(selector labels.Selector) (ret []*v1alpha1.TimeSeriesPrediction, err error) 52 | // Get retrieves the TimeSeriesPrediction from the indexer for a given namespace and name. 53 | // Objects returned here must be treated as read-only. 54 | Get(name string) (*v1alpha1.TimeSeriesPrediction, error) 55 | TimeSeriesPredictionNamespaceListerExpansion 56 | } 57 | 58 | // timeSeriesPredictionNamespaceLister implements the TimeSeriesPredictionNamespaceLister 59 | // interface. 60 | type timeSeriesPredictionNamespaceLister struct { 61 | indexer cache.Indexer 62 | namespace string 63 | } 64 | 65 | // List lists all TimeSeriesPredictions in the indexer for a given namespace. 66 | func (s timeSeriesPredictionNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.TimeSeriesPrediction, err error) { 67 | err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { 68 | ret = append(ret, m.(*v1alpha1.TimeSeriesPrediction)) 69 | }) 70 | return ret, err 71 | } 72 | 73 | // Get retrieves the TimeSeriesPrediction from the indexer for a given namespace and name. 74 | func (s timeSeriesPredictionNamespaceLister) Get(name string) (*v1alpha1.TimeSeriesPrediction, error) { 75 | obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) 76 | if err != nil { 77 | return nil, err 78 | } 79 | if !exists { 80 | return nil, errors.NewNotFound(v1alpha1.Resource("timeseriesprediction"), name) 81 | } 82 | return obj.(*v1alpha1.TimeSeriesPrediction), nil 83 | } 84 | -------------------------------------------------------------------------------- /pkg/generated/listers/topology/v1alpha1/expansion_generated.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | // NodeResourceTopologyListerExpansion allows custom methods to be added to 6 | // NodeResourceTopologyLister. 7 | type NodeResourceTopologyListerExpansion interface{} 8 | -------------------------------------------------------------------------------- /pkg/generated/listers/topology/v1alpha1/noderesourcetopology.go: -------------------------------------------------------------------------------- 1 | // Code generated by lister-gen. DO NOT EDIT. 2 | 3 | package v1alpha1 4 | 5 | import ( 6 | v1alpha1 "github.com/gocrane/api/topology/v1alpha1" 7 | "k8s.io/apimachinery/pkg/api/errors" 8 | "k8s.io/apimachinery/pkg/labels" 9 | "k8s.io/client-go/tools/cache" 10 | ) 11 | 12 | // NodeResourceTopologyLister helps list NodeResourceTopologies. 13 | // All objects returned here must be treated as read-only. 14 | type NodeResourceTopologyLister interface { 15 | // List lists all NodeResourceTopologies in the indexer. 16 | // Objects returned here must be treated as read-only. 17 | List(selector labels.Selector) (ret []*v1alpha1.NodeResourceTopology, err error) 18 | // Get retrieves the NodeResourceTopology from the index for a given name. 19 | // Objects returned here must be treated as read-only. 20 | Get(name string) (*v1alpha1.NodeResourceTopology, error) 21 | NodeResourceTopologyListerExpansion 22 | } 23 | 24 | // nodeResourceTopologyLister implements the NodeResourceTopologyLister interface. 25 | type nodeResourceTopologyLister struct { 26 | indexer cache.Indexer 27 | } 28 | 29 | // NewNodeResourceTopologyLister returns a new NodeResourceTopologyLister. 30 | func NewNodeResourceTopologyLister(indexer cache.Indexer) NodeResourceTopologyLister { 31 | return &nodeResourceTopologyLister{indexer: indexer} 32 | } 33 | 34 | // List lists all NodeResourceTopologies in the indexer. 35 | func (s *nodeResourceTopologyLister) List(selector labels.Selector) (ret []*v1alpha1.NodeResourceTopology, err error) { 36 | err = cache.ListAll(s.indexer, selector, func(m interface{}) { 37 | ret = append(ret, m.(*v1alpha1.NodeResourceTopology)) 38 | }) 39 | return ret, err 40 | } 41 | 42 | // Get retrieves the NodeResourceTopology from the index for a given name. 43 | func (s *nodeResourceTopologyLister) Get(name string) (*v1alpha1.NodeResourceTopology, error) { 44 | obj, exists, err := s.indexer.GetByKey(name) 45 | if err != nil { 46 | return nil, err 47 | } 48 | if !exists { 49 | return nil, errors.NewNotFound(v1alpha1.Resource("noderesourcetopology"), name) 50 | } 51 | return obj.(*v1alpha1.NodeResourceTopology), nil 52 | } 53 | -------------------------------------------------------------------------------- /prediction/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // Package v1alpha1 is the v1alpha1 version of the crane API. 2 | // +k8s:deepcopy-gen=package,register 3 | // +groupName=prediction.crane.io 4 | package v1alpha1 5 | -------------------------------------------------------------------------------- /prediction/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | "k8s.io/apimachinery/pkg/runtime" 6 | "k8s.io/apimachinery/pkg/runtime/schema" 7 | ) 8 | 9 | // GroupName specifies the group name used to register the objects. 10 | const GroupName = "prediction.crane.io" 11 | 12 | // GroupVersion specifies the group and the version used to register the objects. 13 | var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha1"} 14 | 15 | // SchemeGroupVersion is group version used to register these objects 16 | // Deprecated: use GroupVersion instead. 17 | var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} 18 | 19 | // Resource takes an unqualified resource and returns a Group qualified GroupResource 20 | func Resource(resource string) schema.GroupResource { 21 | return SchemeGroupVersion.WithResource(resource).GroupResource() 22 | } 23 | 24 | var ( 25 | // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. 26 | SchemeBuilder runtime.SchemeBuilder 27 | localSchemeBuilder = &SchemeBuilder 28 | // Depreciated: use Install instead 29 | AddToScheme = localSchemeBuilder.AddToScheme 30 | Install = localSchemeBuilder.AddToScheme 31 | ) 32 | 33 | func init() { 34 | // We only register manually written functions here. The registration of the 35 | // generated functions takes place in the generated files. The separation 36 | // makes the code compile even when the generated files are missing. 37 | localSchemeBuilder.Register(addKnownTypes) 38 | } 39 | 40 | // Adds the list of known types to Scheme. 41 | func addKnownTypes(scheme *runtime.Scheme) error { 42 | scheme.AddKnownTypes(SchemeGroupVersion, 43 | &TimeSeriesPrediction{}, 44 | &TimeSeriesPredictionList{}, 45 | &ClusterNodePrediction{}, 46 | &ClusterNodePredictionList{}, 47 | ) 48 | // AddToGroupVersion allows the serialization of client types like ListOptions. 49 | v1.AddToGroupVersion(scheme, SchemeGroupVersion) 50 | return nil 51 | } 52 | -------------------------------------------------------------------------------- /topology/v1alpha1/const.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | const ( 4 | // ReservedSystemCPUsAttributes is the attributes key represent system reserved cpus 5 | ReservedSystemCPUsAttributes = "go.crane.io/reserved-system-cpus" 6 | ) 7 | -------------------------------------------------------------------------------- /topology/v1alpha1/doc.go: -------------------------------------------------------------------------------- 1 | // Package v1alpha1 is the v1alpha1 version of the crane API. 2 | // +k8s:deepcopy-gen=package,register 3 | // +groupName=topology.crane.io 4 | package v1alpha1 5 | -------------------------------------------------------------------------------- /topology/v1alpha1/register.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | import ( 4 | v1 "k8s.io/apimachinery/pkg/apis/meta/v1" 5 | "k8s.io/apimachinery/pkg/runtime" 6 | "k8s.io/apimachinery/pkg/runtime/schema" 7 | ) 8 | 9 | // GroupName specifies the group name used to register the objects. 10 | const GroupName = "topology.crane.io" 11 | 12 | // GroupVersion specifies the group and the version used to register the objects. 13 | var GroupVersion = v1.GroupVersion{Group: GroupName, Version: "v1alpha1"} 14 | 15 | // SchemeGroupVersion is group version used to register these objects 16 | // Deprecated: use GroupVersion instead. 17 | var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} 18 | 19 | // Resource takes an unqualified resource and returns a Group qualified GroupResource 20 | func Resource(resource string) schema.GroupResource { 21 | return SchemeGroupVersion.WithResource(resource).GroupResource() 22 | } 23 | 24 | var ( 25 | // localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. 26 | SchemeBuilder runtime.SchemeBuilder 27 | localSchemeBuilder = &SchemeBuilder 28 | // Depreciated: use Install instead 29 | AddToScheme = localSchemeBuilder.AddToScheme 30 | Install = localSchemeBuilder.AddToScheme 31 | ) 32 | 33 | func init() { 34 | // We only register manually written functions here. The registration of the 35 | // generated functions takes place in the generated files. The separation 36 | // makes the code compile even when the generated files are missing. 37 | localSchemeBuilder.Register(addKnownTypes) 38 | } 39 | 40 | // Adds the list of known types to Scheme. 41 | func addKnownTypes(scheme *runtime.Scheme) error { 42 | scheme.AddKnownTypes(SchemeGroupVersion, 43 | &NodeResourceTopology{}, 44 | &NodeResourceTopologyList{}, 45 | ) 46 | // AddToGroupVersion allows the serialization of client types like ListOptions. 47 | v1.AddToGroupVersion(scheme, SchemeGroupVersion) 48 | return nil 49 | } 50 | -------------------------------------------------------------------------------- /topology/v1alpha1/well_known_annotations.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | const ( 4 | // AnnotationPodCPUPolicyKey is the pod annotation key of cpu-policy. 5 | AnnotationPodCPUPolicyKey = "topology.crane.io/cpu-policy" 6 | 7 | // AnnotationPodTopologyAwarenessKey is the pod annotation key of topology-awareness. 8 | AnnotationPodTopologyAwarenessKey = "topology.crane.io/topology-awareness" 9 | 10 | // AnnotationPodTopologyResultKey is the pod scheduling annotation key of topology-result. 11 | AnnotationPodTopologyResultKey = "topology.crane.io/topology-result" 12 | 13 | // AnnotationPodExcludeReservedCPUs is the pod annotation key of exclude reserved cpus 14 | AnnotationPodExcludeReservedCPUs = "topology.crane.io/exclude-reserved-cpus" 15 | ) 16 | 17 | const ( 18 | // AnnotationPodCPUPolicyNone specifies none cpu policy. If specified, pod 19 | // will use the default CPUSet. 20 | AnnotationPodCPUPolicyNone = "none" 21 | 22 | // AnnotationPodCPUPolicyExclusive specifies exclusive cpu policy. If specified, 23 | // pod will never share CPUSet with others. 24 | AnnotationPodCPUPolicyExclusive = "exclusive" 25 | 26 | // AnnotationPodCPUPolicyNUMA specifies NUMA cpu policy. If specified, pod 27 | // will use the default CPUSet which belongs to single NUMA node. 28 | AnnotationPodCPUPolicyNUMA = "numa" 29 | 30 | // AnnotationPodCPUPolicyImmovable specifies immovable cpu policy. If specified, 31 | // pod will use part of the default CPUSet to avoid uncertain context switch. 32 | AnnotationPodCPUPolicyImmovable = "immovable" 33 | ) 34 | -------------------------------------------------------------------------------- /topology/v1alpha1/well_known_labels.go: -------------------------------------------------------------------------------- 1 | package v1alpha1 2 | 3 | const ( 4 | // LabelNodeTopologyAwarenessKey is the node label key of topology-awareness. 5 | // This label is used to determine the default topology awareness policy of 6 | // a node when pod does not specify topology-awareness. 7 | LabelNodeTopologyAwarenessKey = "topology.crane.io/topology-awareness" 8 | ) 9 | --------------------------------------------------------------------------------