A Golang Core api of crane

Core API of Crane

core api of crane.

DEV GUIDE

clone the project to your $GOPATH. following command will generate crd yamls and files in the project directory.

make update
make verify

INSTALL CRD


# install crd
kubectl create -f artifacts/deploy/

Owner
Crane
Cloud Resource Analytics and Economics
Crane
Comments
  • Add adoption type to recommendation

    Add adoption type to recommendation

    Provide a way to let recommendation take effect.

    • when set to AdoptionTypeStatus, recommendation value only present on recommendation.status.recommendationValue
    • when set to AdoptionTypeStatusAndAnnotation, recommendation value only present on recommendation.status.recommendationValue and target object's annotation
    • when set to AdoptionTypeAuto, recommendation value not only in status and annotation, it will apply to target's spec. If recommendation is Once , the value will apply to object once, if it is Periodical, the value will apply to object in every turn.
  • Add CRD recommendationRule

    Add CRD recommendationRule

    RecommendationRule defines how to select resource for recommendation. We want to simplify the usage for Analytics.

    This is a sample yaml for workload recommendation:

    apiVersion: analysis.crane.io/v1alpha1
    kind: RecommendationRule
    metadata:
      name: workload
    spec:
      runInterval: 1h                            # 每小时运行一次
      resourceSelectors:                    # 资源的信息
        - kind: Deployment
          apiVersion: apps/v1
      namespaceSelector:
         any: true                                  # 扫描所有namespace
      recommenders:                         # 使用 Workload的副本和资源推荐器
        - name: WorkloadReplicas
        - name: WorkloadResource
    

    This is a sample yaml for service recommendation:

    apiVersion: analysis.crane.io/v1alpha1
    kind: RecommendationRule
    metadata:
      name: workload
    spec:
      runInterval: 1h                            # 每小时运行一次
      resourceSelectors:                    # 资源的信息
        - kind: Service
          apiVersion: apps/v1
      namespaceSelector:
         any: true                                  # 扫描所有namespace
      recommenders:                         # 使用 闲置 Service 推荐器
        - name: LBService
    

    recommenders is referring to RecommenderConfiguration Recommender's type

  • Refine ensurance api

    Refine ensurance api

    • Optimize some comment style
    • Use Selector and TerminationGracePeriodSeconds to following k8s style
    • Use corev1.HttpGet to define how to action a http request
  • refine analysis api

    refine analysis api

    1.replace autoscalingapi.CrossVersionObjectReference because we don't want to introduce autoscaling in analysis 2.rename Type to AnalysisType since this field is used by both Analytics and Recommendation 3.add struct CompletionStrategy to indicate how to complete an Analytics or Recommendation 4.add type AdoptionStrategy to indicate how to adopt a recommendation to target 5.add related time status 6. use LastSuccessfulTime refering to k8s Job api

    User create a Analytics with CompletionStrategy once, crane will auto-gen related Recommendation with CompletionStrategy once

    Question 1: How to know the recommendation is done ? if LastSuccessfulTime + period > now || LastSuccessfulTime == nil then doRecommend else

    Question 2: What if user change CompletionStrategy for Analytics ? if Analytics's CompletionStrategy is changed, it will trigger updating for recommendation and do reconcile.

    Question 3: If we have a Periodical Analytics, how to trigger a Analytics or a Recommendation right now? It's simple, just create another object with Once CompletionStrategy.

  • main branch make update error

    main branch make update error

    how to slove this ?

    make update
    go fmt ./pkg/... ./analysis/... ./autoscaling/... ./prediction/... ./ensurance/... ./topology/...
    go vet ./pkg/... ./analysis/... ./autoscaling/... ./prediction/... ./ensurance/... ./topology/...
    hack/update-all.sh
    hack/../hack/..
    without -mod=vendor, directory /root/golang/api/vendor/k8s.io/code-generator/cmd/defaulter-gen has no package path
    without -mod=vendor, directory /root/golang/api/vendor/k8s.io/code-generator/cmd/client-gen has no package path
    without -mod=vendor, directory /root/golang/api/vendor/k8s.io/code-generator/cmd/lister-gen has no package path
    without -mod=vendor, directory /root/golang/api/vendor/k8s.io/code-generator/cmd/informer-gen has no package path
    without -mod=vendor, directory /root/golang/api/vendor/k8s.io/code-generator/cmd/deepcopy-gen has no package path
    make: *** [update] Error 1
    

    my dir

     ll
    total 12
    drwxr-xr-x. 14 root root 4096 Dec 12 10:38 api
    drwxr-xr-x. 13 root root 4096 Dec 11 20:59 crane
    -rw-r--r--.  1 root root   33 Dec 11 21:14 go.work
    
    cat go.work 
    
    go 1.19
    
    use (
            ./api
            ./crane
    )
    
Microsoft Graph SDK for Go - Core Library

Microsoft Graph Core SDK for Go Get started with the Microsoft Graph Core SDK for Go by integrating the Microsoft Graph API into your Go application!

Dec 28, 2022
Simple-Weather-API - Simple weather api app created using golang and Open Weather API key
Simple-Weather-API - Simple weather api app created using golang and Open Weather API key

Simple Weather API Simple weather api app created using golang and Open Weather

Feb 6, 2022
An API client for the Notion API implemented in Golang

An API client for the Notion API implemented in Golang

Dec 30, 2022
A API scanner written in GOLANG to scan files recursively and look for API keys and IDs.

GO FIND APIS _____ ____ ______ _____ _ _ _____ _____ _____ _____ / ____|/ __ \ | ____|_ _| \ | | __ \ /\ | __ \_

Oct 25, 2021
Arweave-api - Arweave API implementation in golang

Arweave API Go implementation of the Arweave API Todo A list of endpoints that a

Jan 16, 2022
Reservationbox-api - Reservationbox Api with golang
Reservationbox-api - Reservationbox Api with golang

reservationbox-api How to set up application Cloning git on this link : https://

Jan 30, 2022
Go api infra - Infrastructure for making api on golang so easy

Go Infra Api Infrastructre methods and types for make api simple Response abstra

Jun 18, 2022
A GoLang wrapper for Politics & War's API. Forego the hassle of accessing the API directly!

A GoLang wrapper for Politics & War's API. Forego the hassle of accessing the API directly!

Mar 5, 2022
Golang API for Whatsapp API MultiDevice version
Golang API for Whatsapp API MultiDevice version

Go Whatsapp API Multi Device Version Required Mac OS: brew install vips export C

Jan 3, 2023
Awb-kh-api - AWB KH API WITH GOLANG

AWB KH API Da die vorhandene API des Abfallwirtschaftsbetriebs in Bad Kreuznach

Feb 11, 2022
Go library for accessing the MyAnimeList API: http://myanimelist.net/modules.php?go=api

go-myanimelist go-myanimelist is a Go client library for accessing the MyAnimeList API. Project Status The MyAnimeList API has been stable for years a

Sep 28, 2022
Go client for the YNAB API. Unofficial. It covers 100% of the resources made available by the YNAB API.

YNAB API Go Library This is an UNOFFICIAL Go client for the YNAB API. It covers 100% of the resources made available by the YNAB API. Installation go

Oct 6, 2022
lambda-go-api-proxy makes it easy to port APIs written with Go frameworks such as Gin to AWS Lambda and Amazon API Gateway.

aws-lambda-go-api-proxy makes it easy to run Golang APIs written with frameworks such as Gin with AWS Lambda and Amazon API Gateway.

Jan 6, 2023
The NVD API is an unofficial Go wrapper around the NVD API.

NVD API The NVD API is an unofficial Go wrapper around the NVD API. Supports: CVE CPE How to use The following shows how to basically use the wrapper

Jan 7, 2023
go-whatsapp-rest-API is a Go library for the WhatsApp web which use Swagger as api interface

go-whatsapp-rest-API go-whatsapp-rest-API is a Go library for the WhatsApp web which use Swagger as api interface Multi-devices (MD) Support. This ver

Dec 15, 2022
A Wrapper Client for Google Spreadsheet API (Sheets API)

Senmai A Wrapper Client for Google Spreadsheet API (Sheets API) PREPARATION Service Account and Key File Create a service account on Google Cloud Plat

Nov 5, 2021
💾 Wolke API is the API behind Wolke image storage and processing aswell as user management

?? Wolke API Wolke API is the API behind Wolke image storage and processing aswell as user management Deploying To deploy Wolke Bot you'll need podman

Dec 21, 2021
Upcoming mobiles api (UpMob API)

upcoming_mobiles_api (UpMob API) UpMob API scraps 91mobiles.com to get devices i

Dec 21, 2021
Api-product - A basic REST-ish API that allows you to perform CRUD operations for Products

Description A basic REST-ish API that allows you to perform CRUD operations for

Jan 3, 2022