Skip to content

Commit e05eff1

Browse files
authored
Merge pull request #446 from cncf/cluster_api_bug
[Platform] Proof of Concept - Scalability test: Test if Cluster API is enabled on the platform and manages a node #328
2 parents b3d81a2 + d01a0c6 commit e05eff1

File tree

1 file changed

+60
-60
lines changed

1 file changed

+60
-60
lines changed

spec/platform/cluster_api_spec.cr

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -15,67 +15,67 @@ describe "Cluster API" do
1515
cluster_api_dir = "#{current_dir}/#{TOOLS_DIR}/cluster-api"
1616
`kubectl delete -f #{cluster_api_dir}/capd.yaml`
1717
`clusterctl delete --all --include-crd --include-namespace --config #{cluster_api_dir}/clusterctl.yaml`
18-
# `rm -rf #{current_dir}/#{TOOLS_DIR}/cluster-api`
18+
`rm -rf #{current_dir}/#{TOOLS_DIR}/cluster-api`
1919
end
2020

21-
# it "'clusterapi_enabled' test works" do
22-
# begin
23-
# # `./tools/cluster-api-dev-setup/spec_mock_cluster_api_spec_commands.sh`
24-
# current_dir = FileUtils.pwd
25-
# cluster_api_dir = "#{current_dir}/#{TOOLS_DIR}/cluster-api";
26-
# unless Dir.exists?(cluster_api_dir)
27-
# `git clone https://github.com/kubernetes-sigs/cluster-api --depth 1 --branch v0.3.9 "#{cluster_api_dir}"`
28-
# end
29-
# FileUtils.cd(cluster_api_dir)
30-
# File.write("clusterctl-settings.json",
31-
# <<-EOF
32-
# {"providers": ["cluster-api","bootstrap-kubeadm","control-plane-kubeadm", "infrastructure-docker"]}
33-
# EOF
34-
# )
35-
# `./cmd/clusterctl/hack/local-overrides.py`
36-
# File.write("clusterctl.yaml",
37-
# <<-EOF
38-
# providers:
39-
# - name: docker
40-
# url: #{Path["~"].expand(home: true)}/.cluster-api/overrides/infrastructure-docker/v0.3.0/infrastructure-components.yaml
41-
# type: InfrastructureProvider
42-
# EOF
43-
# )
44-
#
45-
#
46-
# test = `clusterctl init --core cluster-api:v0.3.0 --bootstrap kubeadm:v0.3.0 --control-plane kubeadm:v0.3.0 --infrastructure docker:v0.3.0 --config #{FileUtils.pwd}/clusterctl.yaml`
47-
# puts test
48-
#
49-
# $?.success?.should be_true
50-
#
51-
#
52-
# ## TODO: wait here for crds to be created if needed
53-
# create_capd_response =`
54-
# CNI_RESOURCES="$(cat test/e2e/data/cni/kindnet/kindnet.yaml)" \
55-
# DOCKER_POD_CIDRS="192.168.0.0/16" \
56-
# DOCKER_SERVICE_CIDRS="172.17.0.0/16" \
57-
# DOCKER_SERVICE_DOMAIN="cluster.local" \
58-
# clusterctl config cluster capd --kubernetes-version v1.17.5 \
59-
# --from ./test/e2e/data/infrastructure-docker/cluster-template.yaml \
60-
# --target-namespace default \
61-
# --control-plane-machine-count=1 \
62-
# --worker-machine-count=2
63-
# `
64-
#
65-
# LOGGING.info create_capd_response
66-
#
67-
# File.write("capd.yaml", create_capd_response)
68-
#
69-
# CNFManager.wait_for_install_by_apply("capd.yaml")
70-
#
71-
# LOGGING.info `kubectl apply -f capd.yaml`
72-
#
73-
# ensure
74-
# FileUtils.cd("#{current_dir}")
75-
# response_s = `./cnf-conformance clusterapi_enabled poc`
76-
# LOGGING.info response_s
77-
# (/Cluster API is enabled/ =~ response_s).should_not be_nil
78-
# end
79-
# end
21+
it "'clusterapi_enabled' test works" do
22+
begin
23+
# `./tools/cluster-api-dev-setup/spec_mock_cluster_api_spec_commands.sh`
24+
current_dir = FileUtils.pwd
25+
cluster_api_dir = "#{current_dir}/#{TOOLS_DIR}/cluster-api";
26+
unless Dir.exists?(cluster_api_dir)
27+
`git clone https://github.com/kubernetes-sigs/cluster-api --depth 1 --branch v0.3.10 "#{cluster_api_dir}"`
28+
end
29+
FileUtils.cd(cluster_api_dir)
30+
File.write("clusterctl-settings.json",
31+
<<-EOF
32+
{"providers": ["cluster-api","bootstrap-kubeadm","control-plane-kubeadm", "infrastructure-docker"]}
33+
EOF
34+
)
35+
`./cmd/clusterctl/hack/create-local-repository.py`
36+
File.write("clusterctl.yaml",
37+
<<-EOF
38+
providers:
39+
- name: docker
40+
url: #{Path["~"].expand(home: true)}/.cluster-api/dev-repository/infrastructure-docker/v0.3.8/infrastructure-components.yaml
41+
type: InfrastructureProvider
42+
EOF
43+
)
44+
45+
46+
test = `clusterctl init --core cluster-api:v0.3.8 --bootstrap kubeadm:v0.3.8 --control-plane kubeadm:v0.3.8 --infrastructure docker:v0.3.8 --config #{FileUtils.pwd}/clusterctl.yaml`
47+
puts test
48+
49+
$?.success?.should be_true
50+
51+
52+
## TODO: wait here for crds to be created if needed
53+
create_capd_response =`
54+
CNI_RESOURCES="$(cat test/e2e/data/cni/kindnet/kindnet.yaml)" \
55+
DOCKER_POD_CIDRS="192.168.0.0/16" \
56+
DOCKER_SERVICE_CIDRS="172.17.0.0/16" \
57+
DOCKER_SERVICE_DOMAIN="cluster.local" \
58+
clusterctl config cluster capd --kubernetes-version v1.17.5 \
59+
--from https://github.com/kubernetes-sigs/cluster-api/blob/v0.3.9/test/e2e/data/infrastructure-docker/cluster-template.yaml \
60+
--target-namespace default \
61+
--control-plane-machine-count=1 \
62+
--worker-machine-count=2
63+
`
64+
65+
LOGGING.info create_capd_response
66+
67+
File.write("capd.yaml", create_capd_response)
68+
69+
CNFManager.wait_for_install_by_apply("capd.yaml")
70+
71+
LOGGING.info `kubectl apply -f capd.yaml`
72+
73+
ensure
74+
FileUtils.cd("#{current_dir}")
75+
response_s = `./cnf-conformance clusterapi_enabled poc`
76+
LOGGING.info response_s
77+
(/Cluster API is enabled/ =~ response_s).should_not be_nil
78+
end
79+
end
8080
end
8181

0 commit comments

Comments
 (0)