crd-client-go

command module
v0.3.3-1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

README

CRD-client-go

crd-client-go defines and implements the custom types used by FogAtlas in terms of k8s Custom Resource Definition (CRD). Once defined the types, it generates the corresponding API using k8s code generator (see below).

FogAtlas CRDs definition and API

Types in FogAtlas are defined starting from the following domain models: the first one models a distributed infrastructure while the second models an application as a graph of vertices (microservices) and edges (dataflows).

Infrastructure model infrastructure model

Application model application model

Federated application model federated application model

From these models the CRD definition are derived.

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

  • fogatlas.fbk.eu_dynamicnode.yaml: used only by the provisioning phase. Currently not used.
  • fogatlas.fbk.eu_externalendpoint.yaml: defines an external endpoint (sensor, camera or external service).
  • fogatlas.fbk.eu_fadepl.yaml: defines a so called FogAtlas deployment (FADepl) that models a cloud native application.
  • fogatlas.fbk.eu_fedfaapp.yaml: extension of FADepl for federated multi-clusters. Not used at the moment.
  • fogatlas.fbk.eu_region.yaml: defines a region interconnected by a Link.
  • fogatlas.fbk.eu_link.yaml: defines a network link between two Regions.

The file types.go defines programmatically the aforementioned CRDs.

How to define or change CRDs

  1. Write/Update these three files in pkg/apis/<api-group>/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_region.yaml
kubectl apply -f fogatlas.fbk.eu_link.yaml
kubectl apply -f fogatlas.fbk.eu_externalendpoint.yaml
kubectl apply -f fogatlas.fbk.eu_fadepl.yaml
kubectl apply -f fogatlas.fbk.eu_ffedfaapp.yaml

License

Copyright 2019 FBK CREATE-NET

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/fogatlas/v1alpha1
Package v1alpha1 is the v1alpha1 version of the API.
Package v1alpha1 is the v1alpha1 version of the 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/fogatlas/v1alpha1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
generated/clientset/versioned/typed/fogatlas/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