fads-client

command module
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

README

FADSReq CRD

This repository defines the K8s Custom Resource Definition (CRD) used by FogAtlas in order to impose requirements and thresholds on application metrics and to execute re-scheduling actions once those thresholds are violated. FADS stands for FogAtlas Dynamic Scheduling.

FADSReq CRD definition and API

Types are defined starting from the following domain models:

FADSReq model FADSReq model

A FADSReq refers to one or more TargetResource (Pod, Deployment or FADepl) and is related to one or more TargetMetric that are monitored in order to verify if the threshold is violated (MetricsEvalautionExpression). Once threshold is violated, the configured SuggestedAction are executed.

In the folder crd_definitions you can find (in yaml format) the CRDs that extend the k8s resources.

The file types.go defines programmatically the CRDs.

How to define or change CRDs

  1. Write/Update these three files in pkg/apis/fads/v1alpha1
    • doc.go where global generation tags are defined
    • types.go where custom types are defined
    • register.go where custom types are registered to the k8s API
  2. Use ./hack/update-codegen.sh script to generate the code. This step needs:
    go get k8s.io/code-generator
    go get k8s.io/apimachinery
    
  3. Use ./hack/gen_crd.sh to generate the corresponding crd. This step needs:
    go get sigs.k8s.io/controller-tools/cmd/controller-gen
    

The steps 1-3 can be executed with a convenient Makefile tag.

How to install CRDs

In order to install the defined CRD on a k8s cluster, just do the following:

cd crd-definitions
kubectl apply -f fogatlas.fbk.eu_fadsreqs.yaml

Test

The file main.go provides an example on how to call both k8s vanilla API and FADS API. You need a k8s cluster where the CRDs are loaded and where some instances of them are defined. Moreover, if you don't access the cluster as k8s admin, you might need additional RBAC setup.

The syntax to launch the main.go is as follows:

go run main.go --kubeconfig=<kube config path> --loglevel=<log level>

where kube config path is the path of the k8s configuration file to access the cluster and log level is the level of the log (use "trace").

License

Copyright 2023 Fondazione Bruno Kessler

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License here.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
apis/fads/v1alpha1
Package v1alpha1 is the v1alpha1 version of the Fadsreq API.
Package v1alpha1 is the v1alpha1 version of the Fadsreq API.
generated/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
generated/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
generated/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
generated/clientset/versioned/typed/fads/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
generated/clientset/versioned/typed/fads/v1alpha1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL