Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix calico-tigera installation problems #639

Merged
merged 2 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ The above parameters are:
* `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)
* `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/).
* `CNI_PROVIDER`: The CNI network to install. Set this value to `weave`, `flannel`, `calico` or `cilium`.
* `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`
* `CNI_PROVIDER_VERSION` The CNI version to use. `calico`, `calico-tigera`, and `cilium` providers use this variable to reference the correct deployment file. Current version `cilium` is `1.4.3`, calico is `3.18`, calico-tigera is `3.26.0`
* `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.
* `ETCD_IP`: The IP each etcd member listens on. We recommend passing the fact for the interface to be used by the cluster.
* `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.
Expand Down
4 changes: 2 additions & 2 deletions manifests/kube_addons.pp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
'calico-tigera': {
if $cni_network_preinstall {
exec { 'Install cni network (preinstall)':
command => ['kubectl', 'apply', '-f', $cni_network_preinstall],
command => ['kubectl', 'create', '-f', $cni_network_preinstall],
onlyif => $exec_onlyif,
unless => 'kubectl -n tigera-operator get deployments | egrep "^tigera-operator"',
environment => $env,
Expand Down Expand Up @@ -110,7 +110,7 @@
}
'flannel': {
exec { 'Install cni network provider':
command => ['kubectl', 'apply', '-f', $cni_network_provider],
command => ['kubectl', 'create', '-f', $cni_network_provider],
onlyif => $exec_onlyif,
unless => 'kubectl -n kube-flannel get daemonset | egrep "^kube-flannel"',
environment => $env,
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/kube_addons_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
when 'calico-tigera'
it {
expect(subject).to contain_exec('Install cni network (preinstall)').with({
command: ['kubectl', 'apply', '-f', 'https://foo.test/tigera-operator'],
command: ['kubectl', 'create', '-f', 'https://foo.test/tigera-operator'],
onlyif: 'kubectl get nodes'
})
}
Expand All @@ -86,7 +86,7 @@
expect(subject).to contain_exec('Install cni network provider').with(
{
onlyif: ['kubectl get nodes'],
command: ['kubectl', 'apply', '-f', "https://#{provider}.test"],
command: ['kubectl', 'create', '-f', "https://#{provider}.test"],
unless: ['kubectl -n kube-flannel get daemonset | egrep "^kube-flannel"']
},
)
Expand Down
2 changes: 1 addition & 1 deletion tooling/kube_tool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def self.parse_args
o.string '-v', '--version', 'The Kubernetes version to install', default: ENV.fetch('VERSION', nil)
o.string '-r', '--container_runtime', 'The container runtime to use. This can only be "docker" or "cri_containerd"', default: ENV.fetch('CONTAINER_RUNTIME', nil)
o.string '-c', '--cni_provider', 'The networking provider to use, flannel, weave, calico, calico-tigera or cilium are supported', default: ENV.fetch('CNI_PROVIDER', nil)
o.string '-p', '--cni_provider_version', 'The networking provider version to use, calico and cilium will use this to reference the correct deployment download link',
o.string '-p', '--cni_provider_version', 'The networking provider version to use, calico, calico-tigera, and cilium will use this to reference the correct deployment download link',
default: ENV.fetch('CNI_PROVIDER_VERSION', nil)
o.string '-t', '--etcd_ip', 'The IP address etcd will listen on', default: ENV.fetch('ETCD_IP', nil)
o.string '-i', '--etcd_initial_cluster', 'The list of servers in the etcd cluster', default: ENV.fetch('ETCD_INITIAL_CLUSTER', nil)
Expand Down
4 changes: 2 additions & 2 deletions tooling/kube_tool/other_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def self.create(opts)
cni_network_provider = "https://docs.projectcalico.org/archive/v#{opts[:cni_provider_version]}/manifests/calico.yaml"
cni_pod_cidr = '192.168.0.0/16'
when 'calico-tigera'
cni_network_preinstall = 'https://docs.projectcalico.org/manifests/tigera-operator.yaml'
cni_network_provider = 'https://docs.projectcalico.org/manifests/custom-resources.yaml'
cni_network_preinstall = "https://raw.githubusercontent.com/projectcalico/calico/v#{opts[:cni_provider_version]}/manifests/tigera-operator.yaml"
cni_network_provider = "https://raw.githubusercontent.com/projectcalico/calico/v#{opts[:cni_provider_version]}/manifests/custom-resources.yaml"
cni_pod_cidr = '192.168.0.0/16'
when 'cilium'
cni_pod_cidr = '10.244.0.0/16'
Expand Down