Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
zioproto authored and k8s-infra-cherrypick-robot committed Apr 8, 2024
1 parent 32b1b3a commit a0b1e3e
Show file tree
Hide file tree
Showing 2 changed files with 253 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/e2e/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,27 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
Expect(err).ToNot(HaveOccurred())
Expect(manifests).To(Equal(string(expectedManifests)))
})
It("should deploy core and infra with feature gates enabled", func() {
manifests, err := helmChart.Run(map[string]string{
"configSecret.name": "aws-variables",
"configSecret.namespace": "default",
"infrastructure": "aws:v2.4.0",
"addon": "helm:",
"image.manager.tag": "v0.9.1",
"cert-manager.enabled": "false",
"cert-manager.installCRDs": "false",
"core": "cluster-api:v1.6.2",
"manager.featureGates.core.ClusterTopology": "true",
"manager.featureGates.core.MachinePool": "true",
"manager.featureGates.aws.ClusterTopology": "true",
"manager.featureGates.aws.MachinePool": "true",
"manager.featureGates.aws.EKSEnableIAM": "true",
"manager.featureGates.aws.EKSAllowAddRoles": "true",
})
Expect(err).ToNot(HaveOccurred())
Expect(manifests).ToNot(BeEmpty())
expectedManifests, err := os.ReadFile(filepath.Join(customManifestsFolder, "feature-gates.yaml"))
Expect(err).ToNot(HaveOccurred())
Expect(manifests).To(Equal(string(expectedManifests)))
})
})
230 changes: 230 additions & 0 deletions test/e2e/resources/feature-gates.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
---
# Source: cluster-api-operator/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: capi-cluster-api-operator
namespace: 'default'
labels:
app: cluster-api-operator
app.kubernetes.io/name: cluster-api-operator
app.kubernetes.io/instance: capi
app.kubernetes.io/component: "controller"
control-plane: controller-manager
clusterctl.cluster.x-k8s.io/core: capi-operator
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: cluster-api-operator
app.kubernetes.io/instance: capi
app.kubernetes.io/component: "controller"
control-plane: controller-manager
clusterctl.cluster.x-k8s.io/core: capi-operator
template:
metadata:
labels:
app: cluster-api-operator
app.kubernetes.io/name: cluster-api-operator
app.kubernetes.io/instance: capi
app.kubernetes.io/component: "controller"
control-plane: controller-manager
clusterctl.cluster.x-k8s.io/core: capi-operator
spec:
containers:
- args:
- --v=2
- --health-addr=:8081
- --metrics-bind-addr=127.0.0.1:8080
- --diagnostics-address=8443
- --leader-elect=true
command:
- /manager
image: "gcr.io/k8s-staging-capi-operator/cluster-api-operator:v0.9.1"
imagePullPolicy: IfNotPresent
name: manager
ports:
- containerPort: 9443
name: webhook-server
protocol: TCP
resources:
limits:
cpu: 100m
memory: 150Mi
requests:
cpu: 100m
memory: 100Mi
volumeMounts:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true
terminationGracePeriodSeconds: 10
volumes:
- name: cert
secret:
defaultMode: 420
secretName: capi-operator-webhook-service-cert
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
- ppc64le
- key: kubernetes.io/os
operator: In
values:
- linux
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
- effect: NoSchedule
key: node-role.kubernetes.io/control-plane
---
# Source: cluster-api-operator/templates/addon.yaml
# Addon provider
---
# Source: cluster-api-operator/templates/bootstrap.yaml
# Bootstrap provider
---
# Source: cluster-api-operator/templates/control-plane.yaml
# Control plane provider
---
# Source: cluster-api-operator/templates/core-conditions.yaml
# Deploy core components if not specified
---
# Source: cluster-api-operator/templates/core.yaml
# Core provider
---
# Source: cluster-api-operator/templates/infra-conditions.yaml
# Deploy bootstrap, and infrastructure components if not specified
---
# Source: cluster-api-operator/templates/infra.yaml
# Infrastructure providers
---
# Source: cluster-api-operator/templates/addon.yaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
name: helm-addon-system
---
# Source: cluster-api-operator/templates/core.yaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
name: capi-system
---
# Source: cluster-api-operator/templates/infra-conditions.yaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
name: capi-kubeadm-bootstrap-system
---
# Source: cluster-api-operator/templates/infra-conditions.yaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
name: capi-kubeadm-control-plane-system
---
# Source: cluster-api-operator/templates/infra.yaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
name: aws-infrastructure-system
---
# Source: cluster-api-operator/templates/addon.yaml
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: AddonProvider
metadata:
name: helm
namespace: helm-addon-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
---
# Source: cluster-api-operator/templates/infra-conditions.yaml
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: BootstrapProvider
metadata:
name: kubeadm
namespace: capi-kubeadm-bootstrap-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
spec:
configSecret:
name: aws-variables
namespace: default
---
# Source: cluster-api-operator/templates/infra-conditions.yaml
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: ControlPlaneProvider
metadata:
name: kubeadm
namespace: capi-kubeadm-control-plane-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
spec:
configSecret:
name: aws-variables
namespace: default
---
# Source: cluster-api-operator/templates/core.yaml
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: CoreProvider
metadata:
name: cluster-api
namespace: capi-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
spec:
version: v1.6.2
manager:
featureGates:
ClusterTopology: true
MachinePool: true
configSecret:
name: aws-variables
namespace: default
---
# Source: cluster-api-operator/templates/infra.yaml
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: InfrastructureProvider
metadata:
name: aws
namespace: aws-infrastructure-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
spec:
version: v2.4.0
manager:
featureGates:
ClusterTopology: true
EKSAllowAddRoles: true
EKSEnableIAM: true
MachinePool: true
configSecret:
name: aws-variables
namespace: default

0 comments on commit a0b1e3e

Please sign in to comment.