mirror of https://github.com/kubernetes/kops.git
Add a create cluster integration test for openstack
Fix various openstack nprs. Also add create cluster integration test
This commit is contained in:
parent
ce4257d0ce
commit
01590c03b0
|
@ -64,6 +64,11 @@ func TestCreateClusterHetzner(t *testing.T) {
|
|||
runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/minimal_hetzner", "v1alpha2")
|
||||
}
|
||||
|
||||
func TestCreateClusterOpenStack(t *testing.T) {
|
||||
t.Setenv("OS_REGION_NAME", "us-test1")
|
||||
runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/ha_openstack", "v1alpha2")
|
||||
}
|
||||
|
||||
// TestCreateClusterCilium runs kops with the cilium networking flags
|
||||
func TestCreateClusterCilium(t *testing.T) {
|
||||
runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/cilium-eni", "v1alpha2")
|
||||
|
@ -191,6 +196,7 @@ func runCreateClusterIntegrationTest(t *testing.T, srcDir string, version string
|
|||
|
||||
h.SetupMockAWS()
|
||||
h.SetupMockGCE()
|
||||
testutils.SetupMockOpenstack()
|
||||
|
||||
cloudTags := map[string]string{}
|
||||
awsCloud, _ := awsup.NewAWSCloud("us-test-1", cloudTags)
|
||||
|
|
|
@ -72,10 +72,9 @@ func SetDefaults_ClusterSpec(obj *ClusterSpec) {
|
|||
obj.LegacyAPI.LoadBalancer.Type = LoadBalancerTypePublic
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if obj.LegacyAPI.LoadBalancer != nil && obj.LegacyAPI.LoadBalancer.Class == "" && obj.LegacyCloudProvider == "aws" {
|
||||
obj.LegacyAPI.LoadBalancer.Class = LoadBalancerClassClassic
|
||||
if obj.LegacyAPI.LoadBalancer != nil && obj.LegacyAPI.LoadBalancer.Class == "" && obj.LegacyCloudProvider == "aws" {
|
||||
obj.LegacyAPI.LoadBalancer.Class = LoadBalancerClassClassic
|
||||
}
|
||||
}
|
||||
|
||||
if obj.Authorization == nil {
|
||||
|
|
|
@ -0,0 +1,141 @@
|
|||
apiVersion: kops.k8s.io/v1alpha2
|
||||
kind: Cluster
|
||||
metadata:
|
||||
creationTimestamp: "2017-01-01T00:00:00Z"
|
||||
name: minimal.k8s.local
|
||||
spec:
|
||||
authorization:
|
||||
rbac: {}
|
||||
channel: stable
|
||||
cloudConfig:
|
||||
openstack:
|
||||
blockStorage:
|
||||
bs-version: v3
|
||||
ignore-volume-az: false
|
||||
monitor:
|
||||
delay: 15s
|
||||
maxRetries: 3
|
||||
timeout: 10s
|
||||
router:
|
||||
externalNetwork: ""
|
||||
cloudProvider: openstack
|
||||
configBase: memfs://tests/minimal.k8s.local
|
||||
etcdClusters:
|
||||
- cpuRequest: 200m
|
||||
etcdMembers:
|
||||
- instanceGroup: control-plane-us-test1-1
|
||||
name: etcd-1
|
||||
- instanceGroup: control-plane-us-test1-2
|
||||
name: etcd-2
|
||||
- instanceGroup: control-plane-us-test1-3
|
||||
name: etcd-3
|
||||
memoryRequest: 100Mi
|
||||
name: main
|
||||
- cpuRequest: 100m
|
||||
etcdMembers:
|
||||
- instanceGroup: control-plane-us-test1-1
|
||||
name: etcd-1
|
||||
- instanceGroup: control-plane-us-test1-2
|
||||
name: etcd-2
|
||||
- instanceGroup: control-plane-us-test1-3
|
||||
name: etcd-3
|
||||
memoryRequest: 100Mi
|
||||
name: events
|
||||
iam:
|
||||
allowContainerRegistry: true
|
||||
legacy: false
|
||||
kubelet:
|
||||
anonymousAuth: false
|
||||
kubernetesApiAccess:
|
||||
- 0.0.0.0/0
|
||||
- ::/0
|
||||
kubernetesVersion: v1.25.0
|
||||
networkCIDR: 10.0.0.0/16
|
||||
networking:
|
||||
cni: {}
|
||||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
sshAccess:
|
||||
- 0.0.0.0/0
|
||||
- ::/0
|
||||
subnets:
|
||||
- cidr: 10.0.32.0/19
|
||||
name: us-test1
|
||||
type: Public
|
||||
zone: us-test1
|
||||
topology:
|
||||
dns:
|
||||
type: Private
|
||||
masters: public
|
||||
nodes: public
|
||||
|
||||
---
|
||||
|
||||
apiVersion: kops.k8s.io/v1alpha2
|
||||
kind: InstanceGroup
|
||||
metadata:
|
||||
creationTimestamp: "2017-01-01T00:00:00Z"
|
||||
labels:
|
||||
kops.k8s.io/cluster: minimal.k8s.local
|
||||
name: control-plane-us-test1-1
|
||||
spec:
|
||||
image: ubuntu-20.04
|
||||
machineType: n1-standard-2
|
||||
maxSize: 1
|
||||
minSize: 1
|
||||
role: Master
|
||||
subnets:
|
||||
- us-test1
|
||||
|
||||
---
|
||||
|
||||
apiVersion: kops.k8s.io/v1alpha2
|
||||
kind: InstanceGroup
|
||||
metadata:
|
||||
creationTimestamp: "2017-01-01T00:00:00Z"
|
||||
labels:
|
||||
kops.k8s.io/cluster: minimal.k8s.local
|
||||
name: control-plane-us-test1-2
|
||||
spec:
|
||||
image: ubuntu-20.04
|
||||
machineType: n1-standard-2
|
||||
maxSize: 1
|
||||
minSize: 1
|
||||
role: Master
|
||||
subnets:
|
||||
- us-test1
|
||||
|
||||
---
|
||||
|
||||
apiVersion: kops.k8s.io/v1alpha2
|
||||
kind: InstanceGroup
|
||||
metadata:
|
||||
creationTimestamp: "2017-01-01T00:00:00Z"
|
||||
labels:
|
||||
kops.k8s.io/cluster: minimal.k8s.local
|
||||
name: control-plane-us-test1-3
|
||||
spec:
|
||||
image: ubuntu-20.04
|
||||
machineType: n1-standard-2
|
||||
maxSize: 1
|
||||
minSize: 1
|
||||
role: Master
|
||||
subnets:
|
||||
- us-test1
|
||||
|
||||
---
|
||||
|
||||
apiVersion: kops.k8s.io/v1alpha2
|
||||
kind: InstanceGroup
|
||||
metadata:
|
||||
creationTimestamp: "2017-01-01T00:00:00Z"
|
||||
labels:
|
||||
kops.k8s.io/cluster: minimal.k8s.local
|
||||
name: nodes-us-test1
|
||||
spec:
|
||||
image: ubuntu-20.04
|
||||
machineType: n1-standard-2
|
||||
maxSize: 1
|
||||
minSize: 1
|
||||
role: Node
|
||||
subnets:
|
||||
- us-test1
|
|
@ -0,0 +1,9 @@
|
|||
CloudProvider: openstack
|
||||
ClusterName: minimal.k8s.local
|
||||
Image: ubuntu-20.04
|
||||
KubernetesVersion: v1.25.0
|
||||
ControlPlaneCount: 3
|
||||
NetworkCIDR: 10.0.0.0/16
|
||||
Networking: cni
|
||||
Zones:
|
||||
- us-test1
|
|
@ -344,6 +344,14 @@ func NewCluster(opt *NewClusterOptions, clientset simple.Clientset) (*NewCluster
|
|||
MaxRetries: fi.PtrTo(3),
|
||||
},
|
||||
}
|
||||
tags := make(map[string]string)
|
||||
tags[openstack.TagClusterName] = cluster.GetName()
|
||||
osCloud, err := openstack.NewOpenstackCloud(tags, &cluster.Spec, "openstackmodel")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cloud = osCloud
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("unsupported cloud provider %s", opt.CloudProvider)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue