Skip to content

Commit

Permalink
f-145: Adapt code to cilium 1.16
Browse files Browse the repository at this point in the history
Signed-off-by: Aleix Ramírez <[email protected]>
  • Loading branch information
aleixrm committed Dec 11, 2024
1 parent dd7abcd commit e8c4768
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
7 changes: 4 additions & 3 deletions appliances/OneKE/cilium.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def configure_cilium(manifest_dir = K8S_MANIFEST_DIR, endpoint = ONEAPP_K8S_CONT
namespace: kube-system
spec:
valuesContent: |-
kubeProxyReplacement: strict
kubeProxyReplacement: true
k8sServiceHost: "#{ep.host}"
k8sServicePort: #{ep.port}
cni:
Expand All @@ -39,14 +39,15 @@ def configure_cilium(manifest_dir = K8S_MANIFEST_DIR, endpoint = ONEAPP_K8S_CONT
name: default
namespace: kube-system
spec:
cidrs: {}
blocks: {}
allowFirstLastIPs: "No"
MANIFEST

unless ONEAPP_K8S_CILIUM_RANGES.empty?
ip_address_pool = documents.find do |doc|
doc['kind'] == 'CiliumLoadBalancerIPPool' && doc.dig('metadata', 'name') == 'default'
end
ip_address_pool['spec']['cidrs'] = extract_cilium_ranges.map do |item|
ip_address_pool['spec']['blocks'] = extract_cilium_ranges.map do |item|
{ 'cidr' => item.join('/') }
end
end
Expand Down
15 changes: 9 additions & 6 deletions appliances/OneKE/cilium_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
namespace: kube-system
spec:
valuesContent: |-
kubeProxyReplacement: strict
kubeProxyReplacement: true
k8sServiceHost: "192.168.150.86"
k8sServicePort: 6443
cni:
Expand All @@ -64,7 +64,8 @@
name: default
namespace: kube-system
spec:
cidrs: {}
blocks: {}
allowFirstLastIPs: "No"
MANIFEST
Dir.mktmpdir do |temp_dir|
configure_cilium temp_dir
Expand All @@ -86,7 +87,7 @@
namespace: kube-system
spec:
valuesContent: |-
kubeProxyReplacement: strict
kubeProxyReplacement: true
k8sServiceHost: "192.168.150.86"
k8sServicePort: 6443
cni:
Expand All @@ -101,9 +102,10 @@
name: default
namespace: kube-system
spec:
cidrs:
blocks:
- cidr: 192.168.150.128/25
- cidr: 10.11.12.0/24
allowFirstLastIPs: "No"
MANIFEST
Dir.mktmpdir do |temp_dir|
configure_cilium temp_dir
Expand All @@ -122,7 +124,7 @@
namespace: kube-system
spec:
valuesContent: |-
kubeProxyReplacement: strict
kubeProxyReplacement: true
k8sServiceHost: "192.168.150.86"
k8sServicePort: 6443
cni:
Expand All @@ -137,9 +139,10 @@
name: default
namespace: kube-system
spec:
cidrs:
blocks:
- cidr: 192.168.150.128/25
- cidr: 10.11.12.0/24
allowFirstLastIPs: "No"
MANIFEST
stub_const 'ONEAPP_K8S_CNI_PLUGIN', 'cilium'
stub_const 'ONEAPP_K8S_CNI_CONFIG', Base64.encode64(manifest)
Expand Down

0 comments on commit e8c4768

Please sign in to comment.