Skip to content

Commit

Permalink
refactor: remove eks
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianKramm committed Jul 23, 2024
1 parent 1b6eea2 commit 599af4f
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 362 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ jobs:
strategy:
fail-fast: false
matrix:
distribution: ["k3s", "k8s", "k0s", "eks"]
distribution: ["k3s", "k8s", "k0s"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -261,7 +261,7 @@ jobs:
strategy:
fail-fast: false
matrix:
distribution: ["k3s", "k8s", "k0s", "eks"]
distribution: ["k3s", "k8s", "k0s"]
test-suite-path: ${{fromJson(needs.get-testsuites-dir.outputs.matrix)}}
multinamespace-mode: ["false", "true"]
ha: ["false", "true"]
Expand All @@ -280,14 +280,10 @@ jobs:
multinamespace-mode: "false"
exclude:
- ha: "true"
- distribution: "eks"
test-suite-path: "./test/e2e_scheduler"
- distribution: "k8s"
multinamespace-mode: "true"
- distribution: "k0s"
multinamespace-mode: "true"
- distribution: "eks"
multinamespace-mode: "true"
- distribution: "k3s"
multinamespace-mode: "true"
test-suite-path: "./test/e2e_target_namespace"
Expand Down
6 changes: 0 additions & 6 deletions chart/templates/_distro.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
{{ toYaml .Values.controlPlane.distro.k8s.env }}
{{- else if and (eq (include "vcluster.distro" .) "k0s") .Values.controlPlane.distro.k0s.env -}}
{{ toYaml .Values.controlPlane.distro.k0s.env }}
{{- else if and (eq (include "vcluster.distro" .) "eks") .Values.controlPlane.distro.eks.env -}}
{{ toYaml .Values.controlPlane.distro.eks.env }}
{{- end -}}
{{- end -}}

Expand All @@ -27,10 +25,6 @@ k0s
k8s
{{- $distros = add1 $distros -}}
{{- end -}}
{{- if .Values.controlPlane.distro.eks.enabled -}}
eks
{{- $distros = add1 $distros -}}
{{- end -}}
{{- if eq $distros 0 -}}
k8s
{{- else if gt $distros 1 -}}
Expand Down
86 changes: 0 additions & 86 deletions chart/templates/_init-containers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,95 +5,9 @@
{{ include "vcluster.k8s.initContainers" . }}
{{- else if eq (include "vcluster.distro" .) "k0s" -}}
{{ include "vcluster.k0s.initContainers" . }}
{{- else if eq (include "vcluster.distro" .) "eks" -}}
{{ include "vcluster.eks.initContainers" . }}
{{- end -}}
{{- end -}}

{{- define "vcluster.eks.initContainers" -}}
{{- include "vcluster.oldPlugins.initContainers" . }}
{{- include "vcluster.plugins.initContainers" . }}
# this is needed because the k8s containers are distroless and thus we don't have any
# way of copying the binaries otherwise
- name: vcluster-copy
image: {{ include "vcluster.controlPlane.image" . | quote }}
volumeMounts:
- mountPath: /binaries
name: binaries
command:
- /bin/sh
args:
- -c
- "cp /vcluster /binaries/vcluster"
{{- if .Values.controlPlane.statefulSet.imagePullPolicy }}
imagePullPolicy: {{ .Values.controlPlane.statefulSet.imagePullPolicy }}
{{- end }}
securityContext:
{{ toYaml .Values.controlPlane.distro.eks.securityContext | indent 4 }}
resources:
{{ toYaml .Values.controlPlane.distro.eks.resources | indent 4 }}
{{- if .Values.controlPlane.distro.eks.controllerManager.enabled }}
- name: kube-controller-manager
image: "{{ include "vcluster.image" (dict "defaultImageRegistry" .Values.controlPlane.advanced.defaultImageRegistry "registry" .Values.controlPlane.distro.eks.controllerManager.image.registry "repository" .Values.controlPlane.distro.eks.controllerManager.image.repository "tag" .Values.controlPlane.distro.eks.controllerManager.image.tag) }}"
volumeMounts:
- mountPath: /binaries
name: binaries
command:
- /binaries/vcluster
args:
- cp
- /usr/local/bin/kube-controller-manager
- /binaries/kube-controller-manager
{{- if .Values.controlPlane.distro.eks.controllerManager.imagePullPolicy }}
imagePullPolicy: {{ .Values.controlPlane.distro.eks.controllerManager.imagePullPolicy }}
{{- end }}
securityContext:
{{ toYaml .Values.controlPlane.distro.eks.securityContext | indent 4 }}
resources:
{{ toYaml .Values.controlPlane.distro.eks.resources | indent 4 }}
{{- end }}
{{- if .Values.controlPlane.advanced.virtualScheduler.enabled }}
- name: kube-scheduler-manager
image: "{{ include "vcluster.image" (dict "defaultImageRegistry" .Values.controlPlane.advanced.defaultImageRegistry "registry" .Values.controlPlane.distro.eks.scheduler.image.registry "repository" .Values.controlPlane.distro.eks.scheduler.image.repository "tag" .Values.controlPlane.distro.eks.scheduler.image.tag) }}"
volumeMounts:
- mountPath: /binaries
name: binaries
command:
- /binaries/vcluster
args:
- cp
- /usr/local/bin/kube-scheduler
- /binaries/kube-scheduler
{{- if .Values.controlPlane.distro.eks.scheduler.imagePullPolicy }}
imagePullPolicy: {{ .Values.controlPlane.distro.eks.scheduler.imagePullPolicy }}
{{- end }}
securityContext:
{{ toYaml .Values.controlPlane.distro.eks.securityContext | indent 4 }}
resources:
{{ toYaml .Values.controlPlane.distro.eks.resources | indent 4 }}
{{- end }}
{{- if .Values.controlPlane.distro.eks.apiServer.enabled }}
- name: kube-apiserver
image: "{{ include "vcluster.image" (dict "defaultImageRegistry" .Values.controlPlane.advanced.defaultImageRegistry "registry" .Values.controlPlane.distro.eks.apiServer.image.registry "repository" .Values.controlPlane.distro.eks.apiServer.image.repository "tag" .Values.controlPlane.distro.eks.apiServer.image.tag) }}"
volumeMounts:
- mountPath: /binaries
name: binaries
command:
- /binaries/vcluster
args:
- cp
- /usr/local/bin/kube-apiserver
- /binaries/kube-apiserver
{{- if .Values.controlPlane.distro.eks.apiServer.imagePullPolicy }}
imagePullPolicy: {{ .Values.controlPlane.distro.eks.apiServer.imagePullPolicy }}
{{- end }}
securityContext:
{{ toYaml .Values.controlPlane.distro.eks.securityContext | indent 4 }}
resources:
{{ toYaml .Values.controlPlane.distro.eks.resources | indent 4 }}
{{- end }}
{{- end -}}

{{- define "vcluster.k8s.initContainers" -}}
{{- include "vcluster.oldPlugins.initContainers" . }}
{{- include "vcluster.plugins.initContainers" . }}
Expand Down
4 changes: 2 additions & 2 deletions chart/tests/etcd-headless-service_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ tests:
path: metadata.annotations.test
value: test

- it: enable for eks & defaults
- it: enable for k8s & defaults
release:
name: my-release
namespace: my-namespace
Expand All @@ -80,7 +80,7 @@ tests:
annotations:
test: test
distro:
eks:
k8s:
enabled: true
asserts:
- hasDocuments:
Expand Down
2 changes: 1 addition & 1 deletion chart/tests/etcd-statefulset_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ tests:
annotations:
test: test
distro:
eks:
k8s:
enabled: true
asserts:
- hasDocuments:
Expand Down
8 changes: 4 additions & 4 deletions chart/tests/statefulset_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -437,11 +437,11 @@ tests:
requests:
storage: 5Gi

- it: enable eks
- it: enable k8s
set:
controlPlane:
distro:
eks:
k8s:
enabled: true
release:
name: my-release
Expand All @@ -457,11 +457,11 @@ tests:
path: spec.volumeClaimTemplates
count: 1

- it: enable eks with deploy etcd
- it: enable k8s with deploy etcd
set:
controlPlane:
distro:
eks:
k8s:
enabled: true
backingStore:
etcd:
Expand Down
4 changes: 0 additions & 4 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -741,10 +741,6 @@
"k0s": {
"$ref": "#/$defs/DistroK0s",
"description": "K0S holds k0s relevant configuration."
},
"eks": {
"$ref": "#/$defs/DistroK8s",
"description": "EKS holds eks relevant configuration."
}
},
"additionalProperties": false,
Expand Down
71 changes: 1 addition & 70 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ controlPlane:
# Repository is the repository of the container image, e.g. my-repo/my-image
repository: "kube-scheduler"
# Tag is the tag of the container image, e.g. latest
tag: "v1.29.0"
tag: "v1.30.2"
# Env are extra environment variables to use for the main container and NOT the init container.
env: []
# Security options can be used for the distro init container
Expand Down Expand Up @@ -249,75 +249,6 @@ controlPlane:
requests:
cpu: 40m
memory: 64Mi
# EKS holds eks relevant configuration.
eks:
# Enabled specifies if the K8s distro should be enabled. Only one distro can be enabled at the same time.
enabled: false
# APIServer holds configuration specific to starting the api server.
apiServer:
enabled: true
# Command is the command to start the distro binary. This will override the existing command.
command: []
# ExtraArgs are additional arguments to pass to the distro binary.
extraArgs: []
# ImagePullPolicy is the pull policy for the distro image
imagePullPolicy: ""
# Image is the distro image
image:
# Registry is the registry of the container image, e.g. my-registry.com or ghcr.io. This setting can be globally
# overridden via the controlPlane.advanced.defaultImageRegistry option. Empty means docker hub.
registry: "public.ecr.aws"
# Repository is the repository of the container image, e.g. my-repo/my-image
repository: "eks-distro/kubernetes/kube-apiserver"
# Tag is the tag of the container image, e.g. latest
tag: "v1.28.2-eks-1-28-6"
# ControllerManager holds configuration specific to starting the controller manager.
controllerManager:
enabled: true
# Command is the command to start the distro binary. This will override the existing command.
command: []
# ExtraArgs are additional arguments to pass to the distro binary.
extraArgs: []
# ImagePullPolicy is the pull policy for the distro image
imagePullPolicy: ""
# Image is the distro image
image:
# Registry is the registry of the container image, e.g. my-registry.com or ghcr.io. This setting can be globally
# overridden via the controlPlane.advanced.defaultImageRegistry option. Empty means docker hub.
registry: "public.ecr.aws"
# Repository is the repository of the container image, e.g. my-repo/my-image
repository: "eks-distro/kubernetes/kube-controller-manager"
# Tag is the tag of the container image, e.g. latest
tag: "v1.28.2-eks-1-28-6"
# Scheduler holds configuration specific to starting the scheduler. Enable this via controlPlane.advanced.virtualScheduler.enabled
scheduler:
# Command is the command to start the distro binary. This will override the existing command.
command: []
# ExtraArgs are additional arguments to pass to the distro binary.
extraArgs: []
# ImagePullPolicy is the pull policy for the distro image
imagePullPolicy: ""
# Image is the distro image
image:
# Registry is the registry of the container image, e.g. my-registry.com or ghcr.io. This setting can be globally
# overridden via the controlPlane.advanced.defaultImageRegistry option. Empty means docker hub.
registry: "public.ecr.aws"
# Repository is the repository of the container image, e.g. my-repo/my-image
repository: "eks-distro/kubernetes/kube-scheduler"
# Tag is the tag of the container image, e.g. latest
tag: "v1.28.2-eks-1-28-6"
# Env are extra environment variables to use for the main container and NOT the init container.
env: []
# Security options can be used for the distro init container
securityContext: {}
# Resources for the distro init container
resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 40m
memory: 64Mi

# BackingStore defines which backing store to use for virtual cluster. If not defined will use embedded database as a default backing store.
backingStore:
Expand Down
2 changes: 1 addition & 1 deletion cmd/vclusterctl/cmd/convert/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ cat /my/k0s/values.yaml | vcluster convert config --distro k0s
}}

cobraCmd.Flags().StringVarP(&c.filePath, "file", "f", "", "Path to the input file")
cobraCmd.Flags().StringVar(&c.distro, "distro", "", fmt.Sprintf("Kubernetes distro of the config. Allowed distros: %s", strings.Join([]string{"k8s", "k3s", "k0s", "eks"}, ", ")))
cobraCmd.Flags().StringVar(&c.distro, "distro", "", fmt.Sprintf("Kubernetes distro of the config. Allowed distros: %s", strings.Join([]string{"k8s", "k3s", "k0s"}, ", ")))
cobraCmd.Flags().StringVarP(&c.format, "output", "o", "yaml", "Prints the output in the specified format. Allowed values: yaml, json")

return cobraCmd
Expand Down
7 changes: 1 addition & 6 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,6 @@ func (c *Config) Distro() string {
return K0SDistro
} else if c.ControlPlane.Distro.K8S.Enabled {
return K8SDistro
} else if c.ControlPlane.Distro.EKS.Enabled {
return EKSDistro
}

return K8SDistro
Expand Down Expand Up @@ -259,7 +257,7 @@ func (c *Config) IsProFeatureEnabled() bool {
return true
}

if c.Distro() == K8SDistro || c.Distro() == EKSDistro {
if c.Distro() == K8SDistro {
if c.ControlPlane.BackingStore.Database.External.Enabled {
return true
}
Expand Down Expand Up @@ -754,9 +752,6 @@ type Distro struct {

// K0S holds k0s relevant configuration.
K0S DistroK0s `json:"k0s,omitempty"`

// EKS holds eks relevant configuration.
EKS DistroK8s `json:"eks,omitempty"`
}

type DistroK3s struct {
Expand Down
Loading

0 comments on commit 599af4f

Please sign in to comment.