Skip to content

Commit 2d90a35

Browse files
Merge pull request #511 from treydock/fix-calico
Support both standard Calico and Calico Tigera
2 parents a612c1d + fdde6e2 commit 2d90a35

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ The above parameters are:
6464
* `VERSION`: The version of Kubernetes to deploy. Must follow X.Y.Z format. ([Check kubeadm regex rule](https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/util/version.go#L43) for more information)
6565
* `CONTAINER_RUNTIME`: The container runtime Kubernetes uses. Set this value to `docker` (officially supported) or `cri_containerd`. Advanced Kubernetes users can use `cri_containerd`, however this requires an increased understanding of Kubernetes, specifically when running applications in a HA cluster. To run a HA cluster and access your applications, an external load balancer is required in front of your cluster. Setting this up is beyond the scope of this module. For more information, see the Kubernetes [documentation](https://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/).
6666
* `CNI_PROVIDER`: The CNI network to install. Set this value to `weave`, `flannel`, `calico` or `cilium`.
67-
* `CNI_PROVIDER_VERSION` The CNI version to use. `cilium` uses this variable to reference the correct deployment file. Current version `cilium` is `1.4.3`
67+
* `CNI_PROVIDER_VERSION` The CNI version to use. `calico` and `cilium` uses this variable to reference the correct deployment file. Current version `cilium` is `1.4.3`, calico is `3.18`
6868
* `ETCD_INITIAL_CLUSTER`: The server hostnames and IPs in the form of `hostname:ip`. When in production, include three, five, or seven nodes for etcd.
6969
* `ETCD_IP`: The IP each etcd member listens on. We recommend passing the fact for the interface to be used by the cluster.
7070
* `KUBE_API_ADVERTISE_ADDRESS`: The IP each etcd/apiserver instance uses on each controller. We recommend passing the fact for the interface to be used by the cluster.

manifests/kube_addons.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
}
3636

3737
if $cni_network_provider {
38-
if $cni_provider == 'calico' {
38+
if $cni_provider == 'calico-tigera' {
3939
if $cni_network_preinstall {
4040
$shellsafe_preinstall = shell_escape($cni_network_preinstall)
4141
exec { 'Install cni network (preinstall)':
@@ -72,7 +72,7 @@
7272
exec { 'Install cni network provider':
7373
command => "kubectl apply -f ${shellsafe_provider}",
7474
onlyif => 'kubectl get nodes',
75-
unless => "kubectl -n kube-system get daemonset | egrep '(flannel|weave|cilium)'",
75+
unless => "kubectl -n kube-system get daemonset | egrep '(flannel|weave|calico-node|cilium)'",
7676
environment => $env,
7777
}
7878
}

spec/classes/kube_addons_spec.rb

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
context 'with cni_provider => calico' do
4141
let(:params) do {
4242
'controller' => true,
43-
'cni_network_preinstall' => 'https://foo.test/tigera-operator',
4443
'cni_network_provider' => 'https://foo.test',
4544
'cni_provider' => 'calico',
4645
'install_dashboard' => false,
@@ -50,6 +49,26 @@
5049
}
5150
end
5251

52+
it { should contain_exec('Install cni network provider')}
53+
54+
it { should_not contain_exec('Install cni network (preinstall)')}
55+
it { should_not contain_file('/etc/kubernetes/calico-installation.yaml')}
56+
it { should_not contain_file_line('Configure calico ipPools.cidr')}
57+
end
58+
59+
context 'with cni_provider => calico-tigera' do
60+
let(:params) do {
61+
'controller' => true,
62+
'cni_network_preinstall' => 'https://foo.test/tigera-operator',
63+
'cni_network_provider' => 'https://foo.test',
64+
'cni_provider' => 'calico-tigera',
65+
'install_dashboard' => false,
66+
'dashboard_version' => 'v1.10.1',
67+
'kubernetes_version' => '1.10.2',
68+
'node_name' => 'foo',
69+
}
70+
end
71+
5372
it { should contain_exec('Install cni network (preinstall)')}
5473
it { should contain_file('/etc/kubernetes/calico-installation.yaml')}
5574
it { should contain_file_line('Configure calico ipPools.cidr')}

tooling/kube_tool.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
opts.on('-c', '--cni-provider cni-provider', 'the networking provider to use, flannel, weave, calico or cilium are supported') do |cni_provider|
3434
options[:cni_provider] = cni_provider;
3535
end
36-
opts.on('-p', '--cni-provider-version [cni_provider_version]', 'the networking provider version to use, cilium will use this to reference the correct deployment download link') do |cni_provider_version|
36+
opts.on('-p', '--cni-provider-version [cni_provider_version]', 'the networking provider version to use, calico and cilium will use this to reference the correct deployment download link') do |cni_provider_version|
3737
options[:cni_provider_version] = cni_provider_version;
3838
end
3939

tooling/kube_tool/other_params.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ def OtherParams.create(os, version, container_runtime, cni_provider, cni_provide
2828
cni_network_provider = 'https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml'
2929
cni_pod_cidr = '10.244.0.0/16'
3030
elsif cni_provider.match('calico')
31+
cni_network_provider = "https://docs.projectcalico.org/archive/#{cni_provider_version}/manifests/calico.yaml"
32+
cni_pod_cidr = '192.168.0.0/16'
33+
elsif cni_provider.match('calico-tigera')
3134
cni_network_preinstall = "https://docs.projectcalico.org/manifests/tigera-operator.yaml"
3235
cni_network_provider = "https://docs.projectcalico.org/manifests/custom-resources.yaml"
3336
cni_pod_cidr = '192.168.0.0/16'

0 commit comments

Comments
 (0)