Skip to content

Commit

Permalink
Add integration test for GCE cluster with very long cluster name
Browse files Browse the repository at this point in the history
  • Loading branch information
hakman committed Jun 25, 2022
1 parent 05188a3 commit 808fc2d
Show file tree
Hide file tree
Showing 27 changed files with 3,686 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/kops/integration_test.go
Expand Up @@ -255,20 +255,27 @@ func TestMinimalGCE(t *testing.T) {
runTestTerraformGCE(t)
}

// TestMinimalGCE runs tests on a minimal GCE configuration with private topology.
// TestMinimalGCEPrivate runs tests on a minimal GCE configuration with private topology.
func TestMinimalGCEPrivate(t *testing.T) {
newIntegrationTest("minimal-gce-private.example.com", "minimal_gce_private").
withAddons(dnsControllerAddon, "rbac.addons.k8s.io-k8s-1.8").
runTestTerraformGCE(t)
}

// TestMinimalGCE runs tests on a minimal GCE configuration with an internal load balancer.
// TestMinimalGCEInternalLoadBalancer runs tests on a minimal GCE configuration with an internal load balancer.
func TestMinimalGCEInternalLoadBalancer(t *testing.T) {
newIntegrationTest("minimal-gce-ilb.example.com", "minimal_gce_ilb").
withAddons(dnsControllerAddon, "rbac.addons.k8s.io-k8s-1.8").
runTestTerraformGCE(t)
}

// TestMinimalGCELongClusterName runs tests on a minimal GCE configuration with a very long cluster name
func TestMinimalGCELongClusterName(t *testing.T) {
newIntegrationTest("minimal-gce-with-a-very-very-very-long-name.example.com", "minimal_gce_longclustername").
withAddons(dnsControllerAddon, leaderElectionAddon, "gcp-pd-csi-driver.addons.k8s.io-k8s-1.23").
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
@@ -0,0 +1,188 @@
apiVersion: kops.k8s.io/v1alpha2
kind: Cluster
metadata:
creationTimestamp: "2017-01-01T00:00:00Z"
name: minimal-gce-with-a-very-very-very-long-name.example.com
spec:
api:
dns: {}
authorization:
alwaysAllow: {}
channel: stable
cloudConfig:
gcpPDCSIDriver:
enabled: true
manageStorageClasses: true
multizone: true
nodeTags: minimal-gce-with-a-very-very-very-long--jvje0u-k8s-io-role-node
cloudProvider: gce
clusterDNSDomain: cluster.local
configBase: memfs://tests/minimal-gce-with-a-very-very-very-long-name.example.com
configStore: memfs://tests/minimal-gce-with-a-very-very-very-long-name.example.com
containerRuntime: containerd
containerd:
logLevel: info
version: 1.6.6
dnsZone: "1"
docker:
skipInstall: true
etcdClusters:
- backups:
backupStore: memfs://tests/minimal-gce-with-a-very-very-very-long-name.example.com/backups/etcd/main
etcdMembers:
- instanceGroup: master-us-test1-a
name: "1"
name: main
version: 3.5.4
- backups:
backupStore: memfs://tests/minimal-gce-with-a-very-very-very-long-name.example.com/backups/etcd/events
etcdMembers:
- instanceGroup: master-us-test1-a
name: "1"
name: events
version: 3.5.4
externalDns:
provider: dns-controller
iam:
legacy: false
keyStore: memfs://tests/minimal-gce-with-a-very-very-very-long-name.example.com/pki
kubeAPIServer:
allowPrivileged: true
anonymousAuth: false
apiAudiences:
- kubernetes.svc.default
apiServerCount: 1
authorizationMode: AlwaysAllow
bindAddress: 0.0.0.0
cloudProvider: gce
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.23.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-with-a-very-very-very-long-name.example.com
serviceAccountJWKSURI: https://api.internal.minimal-gce-with-a-very-very-very-long-name.example.com/openid/v1/jwks
serviceClusterIPRange: 100.64.0.0/13
storageBackend: etcd3
kubeControllerManager:
allocateNodeCIDRs: true
attachDetachReconcileSyncPeriod: 1m0s
cloudProvider: gce
clusterCIDR: 100.96.0.0/11
clusterName: minimal-gce-with-a-very-very-very-long-name-example-com
configureCloudRoutes: false
enableLeaderMigration: true
image: registry.k8s.io/kube-controller-manager:v1.23.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.21.3
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.23.0
logLevel: 2
kubeScheduler:
image: registry.k8s.io/kube-scheduler:v1.23.0
leaderElection:
leaderElect: true
logLevel: 2
kubelet:
anonymousAuth: false
cgroupDriver: systemd
cgroupRoot: /
cloudProvider: gce
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
networkPluginName: cni
podInfraContainerImage: registry.k8s.io/pause:3.6
podManifestPath: /etc/kubernetes/manifests
protectKernelDefaults: true
shutdownGracePeriod: 30s
shutdownGracePeriodCriticalPods: 10s
kubernetesApiAccess:
- 0.0.0.0/0
kubernetesVersion: 1.23.0
masterInternalName: api.internal.minimal-gce-with-a-very-very-very-long-name.example.com
masterKubelet:
anonymousAuth: false
cgroupDriver: systemd
cgroupRoot: /
cloudProvider: gce
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
networkPluginName: cni
podInfraContainerImage: registry.k8s.io/pause:3.6
podManifestPath: /etc/kubernetes/manifests
protectKernelDefaults: true
registerSchedulable: false
shutdownGracePeriod: 30s
shutdownGracePeriodCriticalPods: 10s
masterPublicName: api.minimal-gce-with-a-very-very-very-long-name.example.com
networking:
cni: {}
nonMasqueradeCIDR: 100.64.0.0/10
podCIDR: 100.96.0.0/11
project: testproject
secretStore: memfs://tests/minimal-gce-with-a-very-very-very-long-name.example.com/secrets
serviceClusterIPRange: 100.64.0.0/13
sshAccess:
- 0.0.0.0/0
subnets:
- cidr: 10.0.16.0/20
name: us-test1
region: us-test1
type: Public
topology:
dns:
type: Public
masters: public
nodes: public
@@ -0,0 +1,4 @@
{
"memberCount": 1,
"etcdVersion": "3.5.4"
}
@@ -0,0 +1,4 @@
{
"memberCount": 1,
"etcdVersion": "3.5.4"
}
@@ -0,0 +1 @@
1.21.0-alpha.1
@@ -0,0 +1,62 @@
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
k8s-app: etcd-manager-events
name: etcd-manager-events
namespace: kube-system
spec:
containers:
- command:
- /bin/sh
- -c
- mkfifo /tmp/pipe; (tee -a /var/log/etcd.log < /tmp/pipe & ) ; exec /etcd-manager
--backup-store=memfs://tests/minimal-gce-with-a-very-very-very-long-name.example.com/backups/etcd/events
--client-urls=https://__name__:4002 --cluster-name=etcd-events --containerized=true
--dns-suffix=.internal.minimal-gce-with-a-very-very-very-long-name.example.com
--grpc-port=3997 --peer-urls=https://__name__:2381 --quarantine-client-urls=https://__name__:3995
--v=6 --volume-name-tag=k8s-io-etcd-events --volume-provider=gce --volume-tag=k8s-io-cluster-name=minimal-gce-with-a-very-very-very-long-name-example-com
--volume-tag=k8s-io-etcd-events --volume-tag=k8s-io-role-master=master > /tmp/pipe
2>&1
image: registry.k8s.io/etcdadm/etcd-manager:v3.0.20220617
name: etcd-manager
resources:
requests:
cpu: 200m
memory: 100Mi
securityContext:
privileged: true
volumeMounts:
- mountPath: /rootfs
name: rootfs
- mountPath: /run
name: run
- mountPath: /etc/kubernetes/pki/etcd-manager
name: pki
- mountPath: /var/log/etcd.log
name: varlogetcd
hostNetwork: true
hostPID: true
priorityClassName: system-cluster-critical
tolerations:
- key: CriticalAddonsOnly
operator: Exists
volumes:
- hostPath:
path: /
type: Directory
name: rootfs
- hostPath:
path: /run
type: DirectoryOrCreate
name: run
- hostPath:
path: /etc/kubernetes/pki/etcd-manager-events
type: DirectoryOrCreate
name: pki
- hostPath:
path: /var/log/etcd-events.log
type: FileOrCreate
name: varlogetcd
status: {}
@@ -0,0 +1,62 @@
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
k8s-app: etcd-manager-main
name: etcd-manager-main
namespace: kube-system
spec:
containers:
- command:
- /bin/sh
- -c
- mkfifo /tmp/pipe; (tee -a /var/log/etcd.log < /tmp/pipe & ) ; exec /etcd-manager
--backup-store=memfs://tests/minimal-gce-with-a-very-very-very-long-name.example.com/backups/etcd/main
--client-urls=https://__name__:4001 --cluster-name=etcd --containerized=true
--dns-suffix=.internal.minimal-gce-with-a-very-very-very-long-name.example.com
--grpc-port=3996 --peer-urls=https://__name__:2380 --quarantine-client-urls=https://__name__:3994
--v=6 --volume-name-tag=k8s-io-etcd-main --volume-provider=gce --volume-tag=k8s-io-cluster-name=minimal-gce-with-a-very-very-very-long-name-example-com
--volume-tag=k8s-io-etcd-main --volume-tag=k8s-io-role-master=master > /tmp/pipe
2>&1
image: registry.k8s.io/etcdadm/etcd-manager:v3.0.20220617
name: etcd-manager
resources:
requests:
cpu: 200m
memory: 100Mi
securityContext:
privileged: true
volumeMounts:
- mountPath: /rootfs
name: rootfs
- mountPath: /run
name: run
- mountPath: /etc/kubernetes/pki/etcd-manager
name: pki
- mountPath: /var/log/etcd.log
name: varlogetcd
hostNetwork: true
hostPID: true
priorityClassName: system-cluster-critical
tolerations:
- key: CriticalAddonsOnly
operator: Exists
volumes:
- hostPath:
path: /
type: Directory
name: rootfs
- hostPath:
path: /run
type: DirectoryOrCreate
name: run
- hostPath:
path: /etc/kubernetes/pki/etcd-manager-main
type: DirectoryOrCreate
name: pki
- hostPath:
path: /var/log/etcd.log
type: FileOrCreate
name: varlogetcd
status: {}
@@ -0,0 +1,33 @@
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
spec:
containers:
- args:
- --ca-cert=/secrets/ca.crt
- --client-cert=/secrets/client.crt
- --client-key=/secrets/client.key
image: registry.k8s.io/kops/kube-apiserver-healthcheck:1.24.0-beta.1
livenessProbe:
httpGet:
host: 127.0.0.1
path: /.kube-apiserver-healthcheck/healthz
port: 3990
initialDelaySeconds: 5
timeoutSeconds: 5
name: healthcheck
resources: {}
securityContext:
runAsNonRoot: true
runAsUser: 10012
volumeMounts:
- mountPath: /secrets
name: healthcheck-secrets
readOnly: true
volumes:
- hostPath:
path: /etc/kubernetes/kube-apiserver-healthcheck/secrets
type: Directory
name: healthcheck-secrets
status: {}

0 comments on commit 808fc2d

Please sign in to comment.