Skip to content

Commit

Permalink
Add integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hakman committed Dec 14, 2022
1 parent b9f7c26 commit cfa5a67
Show file tree
Hide file tree
Showing 27 changed files with 4,096 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/kops/create_cluster_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func TestCreateClusterHA(t *testing.T) {
// TestCreateClusterMinimalGCE runs kops create cluster minimal.example.com --cloud gce --zones us-test1-a
func TestCreateClusterMinimalGCE(t *testing.T) {
runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/minimal-1.26-gce", "v1alpha2")
runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/minimal-1.26-gce-dns-none", "v1alpha2")
}

// TestCreateClusterHAGCE runs kops create cluster ha-gce.example.com --cloud gce --zones us-test1-a,us-test1-b,us-test1-c --master-zones us-test1-a,us-test1-b,us-test1-c
Expand Down
10 changes: 10 additions & 0 deletions cmd/kops/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,16 @@ func TestMinimalGCEInternalLoadBalancerLongClusterName(t *testing.T) {
runTestTerraformGCE(t)
}

// TestMinimalGCEDNSNone runs tests on a minimal GCE configuration with --dns=none
func TestMinimalGCEDNSNone(t *testing.T) {
newIntegrationTest("minimal-gce.example.com", "minimal_gce_dns-none").
withAddons(
gcpCCMAddon,
gcpPDCSIAddon,
).
runTestTerraformGCE(t)
}

// TestHA runs the test on a simple HA configuration, similar to kops create cluster minimal.example.com --zones us-west-1a,us-west-1b,us-west-1c --master-count=3
func TestHA(t *testing.T) {
newIntegrationTest("ha.example.com", "ha").withZones(3).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
name: minimal.example.com
spec:
api:
loadBalancer:
type: Public
authorization:
rbac: {}
channel: stable
cloudConfig: {}
cloudProvider: gce
configBase: memfs://tests/minimal.example.com
etcdClusters:
- cpuRequest: 200m
etcdMembers:
- instanceGroup: control-plane-us-test1-a
name: a
memoryRequest: 100Mi
name: main
- cpuRequest: 100m
etcdMembers:
- instanceGroup: control-plane-us-test1-a
name: a
memoryRequest: 100Mi
name: events
iam:
allowContainerRegistry: true
legacy: false
kubelet:
anonymousAuth: false
kubernetesApiAccess:
- 0.0.0.0/0
- ::/0
kubernetesVersion: v1.26.0
networking:
cni: {}
nonMasqueradeCIDR: 100.64.0.0/10
project: testproject
sshAccess:
- 0.0.0.0/0
- ::/0
subnets:
- cidr: 10.0.16.0/20
name: us-test1
region: us-test1
type: Public
topology:
dns:
type: None
masters: public
nodes: public

---

apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
labels:
kops.k8s.io/cluster: minimal.example.com
name: control-plane-us-test1-a
spec:
image: ubuntu-os-cloud/ubuntu-2004-focal-v20221018
machineType: e2-medium
maxSize: 1
minSize: 1
role: Master
subnets:
- us-test1
zones:
- us-test1-a

---

apiVersion: kops.k8s.io/v1alpha2
kind: InstanceGroup
metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
labels:
kops.k8s.io/cluster: minimal.example.com
name: nodes-us-test1-a
spec:
image: ubuntu-os-cloud/ubuntu-2004-focal-v20221018
machineType: e2-medium
maxSize: 1
minSize: 1
role: Node
subnets:
- us-test1
zones:
- us-test1-a
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CloudProvider: gce
ClusterName: minimal.example.com
Networking: cni
KubernetesVersion: v1.26.0
Project: testproject
Zones:
- us-test1-a
DNSType: none
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
name: minimal-gce.example.com
spec:
api:
loadBalancer:
subnets:
- name: us-test-1
type: Internal
useForInternalApi: true
authorization:
rbac: {}
channel: stable
cloudConfig:
gcpPDCSIDriver:
enabled: true
manageStorageClasses: true
multizone: true
nodeTags: minimal-gce-example-com-k8s-io-role-node
cloudControllerManager:
allocateNodeCIDRs: true
cidrAllocatorType: CloudAllocator
clusterCIDR: 100.96.0.0/11
clusterName: minimal-gce-example-com
image: k8scloudprovidergcp/cloud-controller-manager:latest
leaderElection:
leaderElect: true
cloudProvider: gce
clusterDNSDomain: cluster.local
configBase: memfs://tests/minimal-gce.example.com
configStore: memfs://tests/minimal-gce.example.com
containerRuntime: containerd
containerd:
logLevel: info
runc:
version: 1.1.4
version: 1.6.12
docker:
skipInstall: true
etcdClusters:
- backups:
backupStore: memfs://tests/minimal-gce.example.com/backups/etcd/main
cpuRequest: 200m
etcdMembers:
- instanceGroup: master-us-test1-a
name: a
memoryRequest: 100Mi
name: main
version: 3.5.6
- backups:
backupStore: memfs://tests/minimal-gce.example.com/backups/etcd/events
cpuRequest: 100m
etcdMembers:
- instanceGroup: master-us-test1-a
name: a
memoryRequest: 100Mi
name: events
version: 3.5.6
iam:
legacy: false
keyStore: memfs://tests/minimal-gce.example.com/pki
kubeAPIServer:
allowPrivileged: true
anonymousAuth: false
apiAudiences:
- kubernetes.svc.default
apiServerCount: 1
authorizationMode: Node,RBAC
bindAddress: 0.0.0.0
cloudProvider: external
enableAdmissionPlugins:
- NamespaceLifecycle
- LimitRanger
- ServiceAccount
- DefaultStorageClass
- DefaultTolerationSeconds
- MutatingAdmissionWebhook
- ValidatingAdmissionWebhook
- NodeRestriction
- ResourceQuota
etcdServers:
- https://127.0.0.1:4001
etcdServersOverrides:
- /events#https://127.0.0.1:4002
image: registry.k8s.io/kube-apiserver:v1.26.0
kubeletPreferredAddressTypes:
- InternalIP
- Hostname
- ExternalIP
logLevel: 2
requestheaderAllowedNames:
- aggregator
requestheaderExtraHeaderPrefixes:
- X-Remote-Extra-
requestheaderGroupHeaders:
- X-Remote-Group
requestheaderUsernameHeaders:
- X-Remote-User
securePort: 443
serviceAccountIssuer: https://api.internal.minimal-gce.example.com
serviceAccountJWKSURI: https://api.internal.minimal-gce.example.com/openid/v1/jwks
serviceClusterIPRange: 100.64.0.0/13
storageBackend: etcd3
kubeControllerManager:
allocateNodeCIDRs: true
attachDetachReconcileSyncPeriod: 1m0s
cloudProvider: external
clusterCIDR: 100.96.0.0/11
clusterName: minimal-gce.example.com
configureCloudRoutes: false
image: registry.k8s.io/kube-controller-manager:v1.26.0
leaderElection:
leaderElect: true
logLevel: 2
useServiceAccountCredentials: true
kubeDNS:
cacheMaxConcurrent: 150
cacheMaxSize: 1000
cpuRequest: 100m
domain: cluster.local
memoryLimit: 170Mi
memoryRequest: 70Mi
nodeLocalDNS:
cpuRequest: 25m
enabled: false
image: registry.k8s.io/dns/k8s-dns-node-cache:1.22.8
memoryRequest: 5Mi
provider: CoreDNS
serverIP: 100.64.0.10
kubeProxy:
clusterCIDR: 100.96.0.0/11
cpuRequest: 100m
image: registry.k8s.io/kube-proxy:v1.26.0
logLevel: 2
kubeScheduler:
image: registry.k8s.io/kube-scheduler:v1.26.0
leaderElection:
leaderElect: true
logLevel: 2
kubelet:
anonymousAuth: false
cgroupDriver: systemd
cgroupRoot: /
cloudProvider: external
clusterDNS: 100.64.0.10
clusterDomain: cluster.local
enableDebuggingHandlers: true
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
hairpinMode: promiscuous-bridge
kubeconfigPath: /var/lib/kubelet/kubeconfig
logLevel: 2
podInfraContainerImage: registry.k8s.io/pause:3.6
podManifestPath: /etc/kubernetes/manifests
protectKernelDefaults: true
registerSchedulable: true
shutdownGracePeriod: 30s
shutdownGracePeriodCriticalPods: 10s
kubernetesApiAccess:
- 0.0.0.0/0
- ::/0
kubernetesVersion: 1.26.0
masterKubelet:
anonymousAuth: false
cgroupDriver: systemd
cgroupRoot: /
cloudProvider: external
clusterDNS: 100.64.0.10
clusterDomain: cluster.local
enableDebuggingHandlers: true
evictionHard: memory.available<100Mi,nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<10%,imagefs.inodesFree<5%
hairpinMode: promiscuous-bridge
kubeconfigPath: /var/lib/kubelet/kubeconfig
logLevel: 2
podInfraContainerImage: registry.k8s.io/pause:3.6
podManifestPath: /etc/kubernetes/manifests
protectKernelDefaults: true
registerSchedulable: true
shutdownGracePeriod: 30s
shutdownGracePeriodCriticalPods: 10s
masterPublicName: api.minimal-gce.example.com
networking:
cni: {}
nonMasqueradeCIDR: 100.64.0.0/10
podCIDR: 100.96.0.0/11
project: testproject
secretStore: memfs://tests/minimal-gce.example.com/secrets
serviceClusterIPRange: 100.64.0.0/13
sshAccess:
- 0.0.0.0/0
- ::/0
subnets:
- cidr: 10.0.16.0/20
name: us-test1
region: us-test1
type: Private
topology:
dns:
type: None
masters: private
nodes: private
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"memberCount": 1,
"etcdVersion": "3.5.6"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"memberCount": 1,
"etcdVersion": "3.5.6"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.21.0-alpha.1
Loading

0 comments on commit cfa5a67

Please sign in to comment.