Files
ubicloud/rhizome/kubernetes/bin/ubicni
Eren Başak 583168feb2 Move CNI logic to lib and improve tests
CNI class is moved to lib folder and the class is only
instantiated and called. All the function and functionalities
are properly tested.

Moved gen_mac and mac_to_ipv6_link_local functions to
rhizome/common/lib because vm_setup.rb and CNI uses these
functions. Duplicate definition of this function is removed from CNI

Co-authored-by: Eren Başak <eren@ubicloud.com>
Co-authored-by: mohi-kalantari <mohi.kalantari1@gmail.com>
2025-02-04 08:56:06 +01:00

19 lines
423 B
Ruby
Executable File

#!/bin/env ruby
# frozen_string_literal: true
require_relative "../lib/ubi_cni"
require "json"
require "logger"
logger = Logger.new("/opt/cni/bin/cni_plugin.log")
logger.level = Logger::INFO
begin
cni = UbiCNI.new JSON.parse($stdin.read), logger
cni.run
rescue => e
logger.fatal "Unexpected error: #{e.message}, #{e.backtrace}"
puts JSON.generate({code: 999, msg: "Unexpected error: #{e.message}"})
exit 1
end