Skip to content

Commit

Permalink
helm: revert parts of CoreDNS Helm chart packaging (#3366)
Browse files Browse the repository at this point in the history
* Revert "helm: fix kubeadm bugs caused by CoreDNS installation (#3353)"

This reverts commit 8ef5ea2.

* Revert "helm: manage CoreDNS addon as Helm chart (#3236)"

This reverts commit 97c77e2.

* upgrade-agent: ignore CoreDNS preflight errors
  • Loading branch information
burgerdev authored Sep 19, 2024
1 parent 89eb8ca commit 850b460
Show file tree
Hide file tree
Showing 28 changed files with 69 additions and 750 deletions.
3 changes: 2 additions & 1 deletion bootstrapper/internal/kubernetes/k8sapi/k8sutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type Client interface {
AddNodeSelectorsToDeployment(ctx context.Context, selectors map[string]string, name string, namespace string) error
ListAllNamespaces(ctx context.Context) (*corev1.NamespaceList, error)
AnnotateNode(ctx context.Context, nodeName, annotationKey, annotationValue string) error
EnforceCoreDNSSpread(ctx context.Context) error
PatchFirstNodePodCIDR(ctx context.Context, firstNodePodCIDR string) error
}

Expand Down Expand Up @@ -149,7 +150,7 @@ func (k *KubernetesUtil) InitCluster(

// initialize the cluster
log.Info("Initializing the cluster using kubeadm init")
skipPhases := "--skip-phases=preflight,certs,addon/coredns"
skipPhases := "--skip-phases=preflight,certs"
if !conformanceMode {
skipPhases += ",addon/kube-proxy"
}
Expand Down
4 changes: 4 additions & 0 deletions bootstrapper/internal/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ func (k *KubeWrapper) InitCluster(
return nil, fmt.Errorf("waiting for Kubernetes API to be available: %w", err)
}

if err := k.client.EnforceCoreDNSSpread(ctx); err != nil {
return nil, fmt.Errorf("configuring CoreDNS deployment: %w", err)
}

// Setup the K8s components ConfigMap.
k8sComponentsConfigMap, err := k.setupK8sComponentsConfigMap(ctx, kubernetesComponents, versionString)
if err != nil {
Expand Down
4 changes: 0 additions & 4 deletions cli/internal/cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,6 @@ func (a *applyCmd) apply(
if err := a.runHelmApply(cmd, conf, stateFile, upgradeDir); err != nil {
return err
}
if err := a.applier.CleanupCoreDNSResources(cmd.Context()); err != nil {
return fmt.Errorf("cleaning up CoreDNS: %w", err)
}
}

// Upgrade node image
Expand Down Expand Up @@ -850,7 +847,6 @@ type applier interface {
// methods required to install/upgrade Helm charts

AnnotateCoreDNSResources(context.Context) error
CleanupCoreDNSResources(context.Context) error
PrepareHelmCharts(
flags helm.Options, state *state.State, serviceAccURI string, masterSecret uri.MasterSecret,
) (helm.Applier, bool, error)
Expand Down
1 change: 0 additions & 1 deletion cli/internal/cmd/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,6 @@ func (s *stubConstellApplier) Init(context.Context, atls.Validator, *state.State

type helmApplier interface {
AnnotateCoreDNSResources(context.Context) error
CleanupCoreDNSResources(ctx context.Context) error
PrepareHelmCharts(
flags helm.Options, stateFile *state.State, serviceAccURI string, masterSecret uri.MasterSecret,
) (
Expand Down
1 change: 0 additions & 1 deletion cli/internal/cmd/applyhelm.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ func (a *applyCmd) runHelmApply(cmd *cobra.Command, conf *config.Config, stateFi
HelmWaitMode: a.flags.helmWaitMode,
ApplyTimeout: a.flags.helmTimeout,
AllowDestructive: helm.DenyDestructive,
ServiceCIDR: conf.ServiceCIDR,
}
if conf.Provider.OpenStack != nil {
var deployYawolLoadBalancer bool
Expand Down
4 changes: 0 additions & 4 deletions cli/internal/cmd/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,6 @@ func (s stubHelmApplier) AnnotateCoreDNSResources(_ context.Context) error {
return nil
}

func (s stubHelmApplier) CleanupCoreDNSResources(_ context.Context) error {
return nil
}

func (s stubHelmApplier) PrepareHelmCharts(
_ helm.Options, _ *state.State, _ string, _ uri.MasterSecret,
) (helm.Applier, bool, error) {
Expand Down
4 changes: 0 additions & 4 deletions cli/internal/cmd/upgradeapply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,6 @@ func (m *mockApplier) AnnotateCoreDNSResources(_ context.Context) error {
return nil
}

func (m *mockApplier) CleanupCoreDNSResources(_ context.Context) error {
return nil
}

func (m *mockApplier) PrepareHelmCharts(
helmOpts helm.Options, stateFile *state.State, str string, masterSecret uri.MasterSecret,
) (helm.Applier, bool, error) {
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,6 @@ require (
github.com/cloudflare/circl v1.3.7 // indirect
github.com/containerd/containerd v1.7.12 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/coredns/caddy v1.1.1 // indirect
github.com/coredns/corefile-migration v1.0.21 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/cyberphone/json-canonicalization v0.0.0-20220623050100-57a0ce2678a7 // indirect
Expand Down
196 changes: 0 additions & 196 deletions go.sum

Large diffs are not rendered by default.

15 changes: 0 additions & 15 deletions internal/constellation/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,6 @@ func (a *Applier) AnnotateCoreDNSResources(ctx context.Context) error {
return nil
}

// CleanupCoreDNSResources removes CoreDNS resources that are not managed by Helm.
//
// This is only required when CoreDNS was installed by kubeadm directly.
// TODO(burgerdev): remove after v2.19 is released.
func (a *Applier) CleanupCoreDNSResources(ctx context.Context) error {
err := a.dynamicClient.
Resource(schema.GroupVersionResource{Group: "", Version: "v1", Resource: "configmaps"}).
Namespace("kube-system").
Delete(ctx, "coredns", v1.DeleteOptions{})
if !k8serrors.IsNotFound(err) {
return err
}
return nil
}

// PrepareHelmCharts loads Helm charts for Constellation and returns an executor to apply them.
func (a *Applier) PrepareHelmCharts(
flags helm.Options, state *state.State, serviceAccURI string, masterSecret uri.MasterSecret,
Expand Down
9 changes: 0 additions & 9 deletions internal/constellation/helm/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,6 @@ go_library(
"charts/cert-manager/templates/cainjector-config.yaml",
"charts/cert-manager/templates/extras-objects.yaml",
"charts/cert-manager/templates/podmonitor.yaml",
"charts/coredns/Chart.yaml",
"charts/coredns/values.yaml",
"charts/coredns/templates/clusterrole.yaml",
"charts/coredns/templates/clusterrolebinding.yaml",
"charts/coredns/templates/configmap.yaml",
"charts/coredns/templates/deployment.yaml",
"charts/coredns/templates/service.yaml",
"charts/coredns/templates/serviceaccount.yaml",
],
importpath = "github.com/edgelesssys/constellation/v2/internal/constellation/helm",
visibility = ["//:__subpackages__"],
Expand Down Expand Up @@ -500,7 +492,6 @@ go_library(
"@io_k8s_client_go//restmapper",
"@io_k8s_client_go//tools/clientcmd",
"@io_k8s_client_go//util/retry",
"@io_k8s_kubernetes//cmd/kubeadm/app/constants",
"@sh_helm_helm_v3//pkg/action",
"@sh_helm_helm_v3//pkg/chart",
"@sh_helm_helm_v3//pkg/chart/loader",
Expand Down
3 changes: 0 additions & 3 deletions internal/constellation/helm/charts/coredns/Chart.yaml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

109 changes: 0 additions & 109 deletions internal/constellation/helm/charts/coredns/templates/deployment.yaml

This file was deleted.

33 changes: 0 additions & 33 deletions internal/constellation/helm/charts/coredns/templates/service.yaml

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions internal/constellation/helm/charts/coredns/values.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions internal/constellation/helm/corednsgen/BUILD.bazel

This file was deleted.

Loading

0 comments on commit 850b460

Please sign in to comment.