Skip to content

Commit

Permalink
refactoring polycube-network#2
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoops committed Dec 28, 2021
1 parent bceefdf commit ee637a4
Show file tree
Hide file tree
Showing 24 changed files with 663 additions and 692 deletions.
52 changes: 0 additions & 52 deletions src/services/pcn-k8sdispatcher/cmake/LoadFileAsVariable.cmake

This file was deleted.

108 changes: 53 additions & 55 deletions src/services/pcn-k8sdispatcher/datamodel/k8sdispatcher.yang
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
module k8sdispatcher {
yang-version 1.1;
namespace "http://polycube.network/k8sdispatcher";
prefix "k8sdispatcher";
yang-version 1.1;
namespace "http://polycube.network/k8sdispatcher";
prefix "k8sdispatcher";

import polycube-base { prefix "polycube-base"; }
import polycube-standard-base { prefix "polycube-standard-base"; }
import polycube-base { prefix "polycube-base"; }
import polycube-standard-base { prefix "polycube-standard-base"; }

import ietf-inet-types { prefix "inet"; }
import ietf-inet-types { prefix "inet"; }

organization "Polycube open source project";
description "YANG data model for the Polycube dispatcher for Kubernetes";
organization "Polycube open source project";
description "YANG data model for the Polycube K8s Dispatcher";

polycube-base:service-description "Kubernetes k8sdispatcher Service";
polycube-base:service-version "2.0.0";
polycube-base:service-name "k8sdispatcher";
polycube-base:service-min-kernel-version "4.14.0";
polycube-base:service-description "K8s Dispatcher Service";
polycube-base:service-version "2.0.0";
polycube-base:service-name "k8sdispatcher";
polycube-base:service-min-kernel-version "4.14.0";

uses "polycube-standard-base:standard-base-yang-module" {
augment ports {
leaf type {
type enumeration {
enum BACKEND { description "Port connected to cni topology"; }
enum FRONTEND { description "Port connected to NIC"; }
uses "polycube-standard-base:standard-base-yang-module" {
augment ports {
leaf type {
type enumeration {
enum BACKEND { description "Port connected to cni topology"; }
enum FRONTEND { description "Port connected to NIC"; }
}
mandatory true;
description "Type of the k8sdispatcher port (e.g. BACKEND or FRONTEND)";
}
leaf ip {
type inet:ipv4-address;
description "IP address of the node interface (only for FRONTEND port)";
polycube-base:cli-example "10.10.1.1";
}
}
mandatory true;
description "Type of the k8sdispatcher port (e.g. BACKEND or FRONTEND)";
}
leaf ip {
}

leaf internal-src-ip {
type inet:ipv4-address;
description "IP address of the node interface (only for FRONTEND port)";
description "Internal src ip used for services with externalTrafficPolicy=CLUSTER";
polycube-base:cli-example "10.10.1.1";
}
mandatory true;
}
}

leaf internal-src-ip {
type inet:ipv4-address;
description "Internal src ip used for services with externaltrafficpolicy=cluster";
polycube-base:cli-example "10.10.1.1";
mandatory true;
}

list natting-rule {
list natting-rule {
key "internal-src internal-dst internal-sport internal-dport proto";

leaf internal-src {
Expand Down Expand Up @@ -74,14 +74,14 @@ module k8sdispatcher {
}
}

list nodeport-rule {
key "nodeport-port proto";
leaf internal-src {
type inet:ipv4-address;
description "Source IP address";
}
leaf nodeport-port {
list nodeport-rule {
key "port proto";

leaf name {
type string;
description "An optional name for the NodePort rule";
}
leaf port {
type inet:port-number;
description "Destination L4 port number";
}
Expand All @@ -90,22 +90,20 @@ module k8sdispatcher {
description "L4 protocol";
}
leaf service-type {
type enumeration {
enum CLUSTER { description "Cluster wide service"; }
enum LOCAL { description "Local service"; }
type enumeration {
enum CLUSTER { description "Cluster wide service"; }
enum LOCAL { description "Local service"; }
}
mandatory true;
description "Denotes if this Service desires to route external traffic to node-local or cluster-wide endpoint";
}
mandatory true;
description "Denotes if this Service desires to route external traffic to node-local or cluster-wide endpoint";
}
}

leaf nodeport-range {
type string;
description "Port range used for NodePort services";
default "30000-32767";
polycube-base:cli-example "30000-32767";
}


leaf nodeport-range {
type string;
description "Port range used for NodePort services";
default "30000-32767";
polycube-base:cli-example "30000-32767";
}
}

6 changes: 3 additions & 3 deletions src/services/pcn-k8sdispatcher/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ aux_source_directory(base BASE_SOURCES)
include_directories(serializer)

if (NOT DEFINED POLYCUBE_STANDALONE_SERVICE OR POLYCUBE_STANDALONE_SERVICE)
find_package(PkgConfig REQUIRED)
pkg_check_modules(POLYCUBE libpolycube)
include_directories(${POLYCUBE_INCLUDE_DIRS})
find_package(PkgConfig REQUIRED)
pkg_check_modules(POLYCUBE libpolycube)
include_directories(${POLYCUBE_INCLUDE_DIRS})
endif (NOT DEFINED POLYCUBE_STANDALONE_SERVICE OR POLYCUBE_STANDALONE_SERVICE)

# Needed to load files as variables
Expand Down
Loading

0 comments on commit ee637a4

Please sign in to comment.