Skip to content

Commit

Permalink
Build & Helm doc
Browse files Browse the repository at this point in the history
  • Loading branch information
cannarelladev committed Oct 17, 2023
1 parent 4eca1dd commit d94b656
Show file tree
Hide file tree
Showing 3 changed files with 290 additions and 0 deletions.
139 changes: 139 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Build Pipeline
on:
push:
tags:
- 'v*'
branches:
- main

# repository_dispatch:
# types:
# - test-command
# - build-command

jobs:
configure:
name: Preliminary configuration
runs-on: ubuntu-latest
outputs:
commit-ref: ${{ steps.configure.outputs.commit-ref }}
repo-suffix: ${{ steps.configure.outputs.repo-suffix }}
master: ${{ steps.configure.outputs.master }}
repo-name: ${{ steps.configure.outputs.repo-name }}
architectures: ${{ steps.configure.outputs.architectures }}
pr-number: ${{ steps.configure.outputs.pr-number }}
steps:
- name: Get the version
id: get_version
run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT
if: startsWith(github.ref, 'refs/tags/v')
- name: Configure
id: configure
run: |
# The ref of the commit to checkout (do not use the merge commit if repository dispatch)
if [ "${{ github.event_name }}" == "repository_dispatch" ]; then
echo "master=false" >> $GITHUB_OUTPUT
echo "architectures=linux/amd64" >> $GITHUB_OUTPUT
echo "commit-ref=${{ github.event.client_payload.pull_request.head.sha }}" >> $GITHUB_OUTPUT
echo "pr-number=${{ github.event.client_payload.github.payload.issue.number }}" >> $GITHUB_OUTPUT
elif [ "${{ steps.get_version.outputs.VERSION }}" != "" ]; then
echo "master=false" >> $GITHUB_OUTPUT
echo "architectures=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
echo "commit-ref=${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_OUTPUT
else
echo "master=true" >> $GITHUB_OUTPUT
echo "architectures=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
echo "commit-ref=${{ github.sha }}" >> $GITHUB_OUTPUT
fi
# The suffix to append to the repository name if not triggered by a push for a release
([[ "${{ steps.get_version.outputs.VERSION }}" == "" ]] && \
echo "repo-suffix=-ci" ||
echo "repo-suffix=") >> $GITHUB_OUTPUT
if [ "${{ github.event_name }}" != "repository_dispatch" ]; then
echo "repo-name=${{ github.repository }}" >> $GITHUB_OUTPUT
else
echo "repo-name=${{ github.event.client_payload.github.payload.repository.full_name }}" >> $GITHUB_OUTPUT
fi
# Since we are using a repository-dispatch event, we have to explicitly set a run check. We initialize it to a "pending" state.
# - uses: octokit/[email protected]
# name: "Initialize run check to 'pending (For PR-only)"
# with:
# route: POST /repos/${{ github.repository }}/statuses/${{ steps.configure.outputs.commit-ref }}
# state: "pending"
# description: "Component build status"
# context: "Components building"
# target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# if: ${{ github.event_name == 'repository_dispatch' }}

build:
runs-on: ubuntu-latest
needs: configure
strategy:
fail-fast: false
matrix:
component:
- rear-manager
- rear-controller
- local-resource-manager
steps:
- name: Set up QEMU
uses: docker/[email protected]
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Check out code
uses: actions/checkout@v4
with:
ref: "${{ needs.configure.outputs.commit-ref }}"
repository: "${{ needs.configure.outputs.repo-name }}"
persist-credentials: false
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-${{ matrix.component }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.component }}-buildx-
- name: Login to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Configure the build-push-action dockerfile path
id: dockerfile
run: |
([[ -d "build/${{ matrix.component }}" ]] && \
echo "path=build/${{ matrix.component }}/Dockerfile" || \
echo "path=build/common/Dockerfile") >> $GITHUB_OUTPUT
- name: Build (and Publish) ${{ matrix.component }} image
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ needs.configure.outputs.architectures }}
tags: |
ghcr.io/${{ github.repository_owner }}/${{ matrix.component }}${{ needs.configure.outputs.repo-suffix }}:latest
ghcr.io/${{ github.repository_owner }}/${{ matrix.component }}${{ needs.configure.outputs.repo-suffix }}:${{ needs.configure.outputs.commit-ref }}
push: true
file: ${{ steps.dockerfile.outputs.path }}
build-args: |
COMPONENT=${{ matrix.component }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
# This ugly bit is necessary if you don't want your cache to grow forever
# till it hits GitHub's limit of 5GB.
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
81 changes: 81 additions & 0 deletions .github/workflows/check_artifacts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Check Generated Artifacts
on:
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
generated-artifacts:
name: Check Generated Artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: "${{ github.event.pull_request.head.sha }}"
persist-credentials: false

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Run the automatic generation
working-directory: ./
run: |
make generate
- name: Gather the differences
id: git-diff
run: |
# Ensure new files are also considered in the diff
git add --intent-to-add .
output=$(git diff | head -n 100)
exit_code=$([ "${output}" ] && echo 1 || echo 0)
# Required to correctly manage multi-line outputs
output="${output//'%'/'%25'}"
output="${output//$'\n'/'%0A'}"
output="${output//$'\r'/'%0D'}"
# Store the different as step output
echo "diff=${output}" >> $GITHUB_OUTPUT
# Trigger a failure in case the diff is not empty
exit ${exit_code}
- name: Log the error if the diff is not empty (in case the comment cannot be generated)
run: |
echo "The generated artifacts appear to be out-of-date."
echo
echo "Here it is an excerpt of the diff:"
echo "${{ steps.git-diff.outputs.diff }}"
if: failure()

- name: Issue a comment in case the diff is not empty
uses: peter-evans/create-or-update-comment@v3
with:
token: ${{ secrets.CI_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
The generated artifacts appear to be out-of-date.
Please, ensure you are using the correct version of the generators (eg. `controller-gen`) and re-run:
```
make generate
```
<details>
<summary>Here it is an excerpt of the diff:</summary>
```diff
${{ steps.git-diff.outputs.diff }}
```
</details>
reactions: confused
if: |
github.event_name != 'push' && failure() &&
github.event.pull_request.head.repo.full_name == github.repository
70 changes: 70 additions & 0 deletions deployments/node/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Fluidos

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square)

A Helm chart for Fluidos Node

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| common.affinity | object | `{}` | Affinity for all fluidos-node pods |
| common.extraArgs | list | `[]` | Extra arguments for all fluidos-node pods |
| common.nodeSelector | object | `{}` | NodeSelector for all fluidos-node pods |
| common.tolerations | list | `[]` | Tolerations for all fluidos-node pods |
| localResourceManager.config.flavour.cpuMin | string | `"0"` | The minimum number of CPUs that can be requested to purchase a flavour. |
| localResourceManager.config.flavour.cpuStep | string | `"1000m"` | The CPU step that must be respected when requesting a flavour through a Flavour Selector. |
| localResourceManager.config.flavour.memoryMin | string | `"0"` | The minimum amount of memory that can be requested to purchase a flavour. |
| localResourceManager.config.flavour.memoryStep | string | `"100Mi"` | The memory step that must be respected when requesting a flavour through a Flavour Selector. |
| localResourceManager.config.nodeResourceLabel | string | `"node-role.fluidos.eu/resources"` | Label used to identify the nodes from which resources are collected. |
| localResourceManager.config.resourceType | string | `"k8s-fluidos"` | This flag defines the resource type of the generated flavours. |
| localResourceManager.imageName | string | `"cannarelladev/local-resource-manager"` | |
| localResourceManager.pod.annotations | object | `{}` | Annotations for the local-resource-manager pod. |
| localResourceManager.pod.extraArgs | list | `[]` | Extra arguments for the local-resource-manager pod. |
| localResourceManager.pod.labels | object | `{}` | Labels for the local-resource-manager pod. |
| localResourceManager.pod.resources | object | `{"limits":{},"requests":{}}` | Resource requests and limits (https://kubernetes.io/docs/user-guide/compute-resources/) for the local-resource-manager pod. |
| localResourceManager.replicas | int | `1` | The number of REAR Controller, which can be increased for active/passive high availability. |
| networkManager.configMaps.nodeIdentity.domain | string | `"fluidos.eu"` | The domain name of the FLUIDOS closed domani: It represents for instance the Enterprise and it is used to generate the FQDN of the owned FLUIDOS Nodes |
| networkManager.configMaps.nodeIdentity.ip | string | `nil` | The IP address of the FLUIDOS Node. It can be public or private, depending on the network configuration and it corresponds to the IP address to reach the Network Manager from the outside of the cluster. |
| networkManager.configMaps.nodeIdentity.name | string | `"fluidos-network-manager-identity"` | The name of the ConfigMap containing the FLUIDOS Node identity info. |
| networkManager.configMaps.nodeIdentity.nodeID | string | `nil` | The NodeID is a UUID that identifies the FLUIDOS Node. It is used to generate the FQDN of the owned FLUIDOS Nodes and it is unique in the FLUIDOS closed domain |
| networkManager.configMaps.providers.default | string | `nil` | The IP List of SuperNodes separated by commas. |
| networkManager.configMaps.providers.local | string | `"192.168.0.1,192.168.0.2,192.168.0.3"` | The IP List of Local knwon FLUIDOS Nodes separated by commas. |
| networkManager.configMaps.providers.name | string | `"fluidos-network-manager-config"` | The name of the ConfigMap containing the list of the FLUIDOS Providers and the default FLUIDOS Provider (SuperNode or Catalogue). |
| networkManager.configMaps.providers.remote | string | `nil` | The IP List of Remote known FLUIDOS Nodes separated by commas. |
| networkManager.imageName | string | `"ghcr.io/fluidos/network-manager"` | |
| networkManager.pod.annotations | object | `{}` | Annotations for the network-manager pod. |
| networkManager.pod.extraArgs | list | `[]` | Extra arguments for the network-manager pod. |
| networkManager.pod.labels | object | `{}` | Labels for the network-manager pod. |
| networkManager.pod.resources | object | `{"limits":{},"requests":{}}` | Resource requests and limits (https://kubernetes.io/docs/user-guide/compute-resources/) for the network-manager pod. |
| networkManager.replicas | int | `1` | The number of Network Manager, which can be increased for active/passive high availability. |
| pullPolicy | string | `"IfNotPresent"` | The pullPolicy for fluidos-node pods. |
| rearController.imageName | string | `"cannarelladev/rear-controller"` | |
| rearController.pod.annotations | object | `{}` | Annotations for the rear-controller pod. |
| rearController.pod.extraArgs | list | `[]` | Extra arguments for the rear-controller pod. |
| rearController.pod.labels | object | `{}` | Labels for the rear-controller pod. |
| rearController.pod.resources | object | `{"limits":{},"requests":{}}` | Resource requests and limits (https://kubernetes.io/docs/user-guide/compute-resources/) for the rear-controller pod. |
| rearController.replicas | int | `1` | The number of REAR Controller, which can be increased for active/passive high availability. |
| rearController.service.gateway.annotations | object | `{}` | Annotations for the REAR gateway service. |
| rearController.service.gateway.labels | object | `{}` | Labels for the REAR gateway service. |
| rearController.service.gateway.loadBalancer | object | `{"ip":""}` | Options valid if service type is LoadBalancer. |
| rearController.service.gateway.loadBalancer.ip | string | `""` | Override the IP here if service type is LoadBalancer and you want to use a specific IP address, e.g., because you want a static LB. |
| rearController.service.gateway.name | string | `"gateway"` | |
| rearController.service.gateway.nodePort | object | `{"port":""}` | Options valid if service type is NodePort. |
| rearController.service.gateway.nodePort.port | string | `""` | Force the port used by the NodePort service. |
| rearController.service.gateway.port | int | `3004` | The port used by the rear-controller to expose the REAR Gateway. |
| rearController.service.gateway.targetPort | int | `3004` | The target port used by the REAR Gateway service. |
| rearController.service.gateway.type | string | `"NodePort"` | Kubernetes service to be used to expose the REAR gateway. |
| rearController.service.grpc.annotations | object | `{}` | Annotations for the gRPC service. |
| rearController.service.grpc.labels | object | `{}` | Labels for the gRPC service. |
| rearController.service.grpc.name | string | `"grpc"` | |
| rearController.service.grpc.port | int | `2710` | The gRPC port used by Liqo to connect with the Gateway of the rear-controller to obtain the Contract resources for a given consumer ClusterID. |
| rearController.service.grpc.targetPort | int | `2710` | The target port used by the gRPC service. |
| rearController.service.grpc.type | string | `"ClusterIP"` | Kubernetes service used to expose the gRPC Server to liqo. |
| rearManager.imageName | string | `"cannarelladev/rear-manager"` | |
| rearManager.pod.annotations | object | `{}` | Annotations for the rear-manager pod. |
| rearManager.pod.extraArgs | list | `[]` | Extra arguments for the rear-manager pod. |
| rearManager.pod.labels | object | `{}` | Labels for the rear-manager pod. |
| rearManager.pod.resources | object | `{"limits":{},"requests":{}}` | Resource requests and limits (https://kubernetes.io/docs/user-guide/compute-resources/) for the rear-manager pod. |
| rearManager.replicas | int | `1` | The number of REAR Manager, which can be increased for active/passive high availability. |
| tag | string | `"v0.1"` | Images' tag to select a development version of fluidos-node instead of a release |

0 comments on commit d94b656

Please sign in to comment.