Skip to content

Commit 1b1bd69

Browse files
authored
Merge pull request #100 from polycube-network/pr/fix_pcn_k8s
Fix pcn k8s
2 parents 5fb842b + 7176fa4 commit 1b1bd69

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/services/pcn-k8sfilter/datamodel/k8sfilter.yang

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ module k8sfilter {
2222
enum INTERNAL { description "Connected to LBRP"; }
2323
}
2424
mandatory true;
25-
config false;
25+
config true;
26+
polycube-base:init-only-config;
2627
description "...";
2728
}
2829
}

src/services/pcn-k8switch/src/K8switch.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ K8switch::K8switch(const std::string name, const K8switchJsonObject &conf)
3434
doSetVirtualClientSubnet(conf.getVirtualClientSubnet());
3535

3636
// reload code a single time
37-
reloadConfig();
37+
add_program(getFlags() + k8switch_code, 0);
3838

3939
addServiceList(conf.getService());
4040
addPortsList(conf.getPorts());
@@ -170,7 +170,7 @@ void K8switch::doSetVirtualClientSubnet(const std::string &value) {
170170
virtual_client_cidr_ = value;
171171
}
172172

173-
void K8switch::reloadConfig() {
173+
std::string K8switch::getFlags() {
174174
std::string flags;
175175

176176
// ports
@@ -197,6 +197,13 @@ void K8switch::reloadConfig() {
197197
"#define CLIENT_SUBNET " + std::to_string(htonl(client_subnet_)) + "\n";
198198
flags += "#define VIRTUAL_CLIENT_SUBNET " +
199199
std::to_string(htonl(virtual_client_subnet_)) + "\n";
200+
logger()->debug("flags is {}", flags);
201+
202+
return flags;
203+
}
204+
205+
void K8switch::reloadConfig() {
206+
std::string flags(getFlags());
200207

201208
logger()->debug("Reloading code with flags port: {}", flags);
202209

src/services/pcn-k8switch/src/K8switch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ class K8switch : public polycube::service::Cube<Ports>,
143143
void cleanupSessionTable();
144144
uint32_t timestampToAge(const uint64_t timestamp);
145145
void tick();
146+
std::string getFlags();
146147

147148
std::unique_ptr<std::thread> tick_thread;
148149
bool stop_;

0 commit comments

Comments
 (0)