Skip to content

Commit

Permalink
Merge tag 'v0.24.5' into update-cilium-extension
Browse files Browse the repository at this point in the history
  • Loading branch information
robertvolkmann committed Sep 18, 2024
2 parents f06cf65 + d1b4928 commit 77f3ada
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 264 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up Go 1.22
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
go-version-file: 'go.mod'

- name: Check (lint) and Test
run: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /go/src/github.com/metal-stack/gardener-extension-provider-metal
COPY . .
RUN make install

FROM alpine:3.19
FROM alpine:3.20
WORKDIR /
COPY charts /charts
COPY --from=builder /go/bin/gardener-extension-metal-hyper /gardener-extension-metal-hyper
Expand Down
2 changes: 1 addition & 1 deletion example/controller-registration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ providerConfig:
chart: H4sIAAAAAAAAA+0ca2/cNjKf9SsIuUXbQ6R9eO0EAnKoG7up7xJ7YfvSOxRFoJXoXcVaURUlO26a/37Dl0S9Vis7ddJGAwNeUZzhkJwZDodDLd3ExxFOLPwuxRENSGTFCbkOfCha49QNR4/uDWOAJ3t7/D9A9T//PdmdTaZ70/19Vj7Z3x3PHqG9+zfdDRlN3QShRwkh6aZ6Xe//orDsnP/nKzdJ7Vt3Hd61DTbB+7NZ6/xPd2fl+Z9C0fgRGn/MjrbBFz7/bhy8xgmbdwddTww3jvNHc2KPTcPH1EuCOOVFB+gnHK6Rx0QCXZIEpSuMXkgRQq+YvKC5FB+US5QRuWvsoE5RM65V02Mb2jY+9dh8CdCt/z7x7CW5Txtd+r+3+6Ri/5/MxnuD/j8EjEZL4iyZBLgpRnSFLA+Ztj2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d8f7Vf0fz/aH858HAZF2ziMlKs3cQcuVlygHTYa5mnLBK5+EYmvj0kF8rWDb/FhLQj8Ib9xbahj6MauDJkYRn0HvPxiG5iI46On46dgoUu94wcQwtIxZ+UmA/ERF7CkqWcAi8a58TLKhYh6XF3Wa8q8dtMuyW8SRyqY229KeHXTphhQbRj3N10G//GpUknZ5mbGDmvJ+2GcQWFZTIO+D72gZQLGbUZFhzJMHDZH9JAb8TJ/u4guPhYOu/1yEZDFau8y9Gi2yIAQ3mpEeidugLI/fUMlnGlUhQ0tCliF+U9yLELiWu/b3ZxKNy425yz43KwryD8FO7MnEfvfX7tWk1ivzn89Yz6bihW3bhlHyHx1D5AqqhE/mjRo7O1CWsrMDyj9MKXXlMcL20kZU3XRa3CLu1BfXigBTKRYjDHTE5aj8opLC5S8NdRNb3Z2SSY2Gl7PW/FWLpm9awD6JqTurNHpLSaR0pfi+RGMN/uWHyVikkMnPMky4zpW/fsD0ovKFgMY7/6zeho8WiNfFdf7KPfXiKr8qUJfzBX+l+/b5bXtDZcXVb9AblSZKF+Hza/DCRIjC6oV1ZiwbrvocX55AI9B9zOOsjbfA2+6AG/lH/4T0YTkYysjLr6oM/tgAAwwwwAADDDDAAAMMMMAAAwwwwAADDDDAAAMMMMDnDf8HJasSEQB4AAA=
values:
image:
tag: v0.24.3
tag: v0.24.4
---
apiVersion: core.gardener.cloud/v1beta1
kind: ControllerRegistration
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/metal-stack/gardener-extension-provider-metal

go 1.22
go 1.22.0

replace github.com/gardener/gardener-extension-networking-cilium => github.com/metal-stack/gardener-extension-networking-cilium v1.16.1-0.20240905135331-af877fc185c9

Expand All @@ -9,7 +9,7 @@ require (
github.com/ahmetb/gen-crd-api-reference-docs v0.3.0
github.com/coreos/go-systemd/v22 v22.5.0
github.com/gardener/etcd-druid v0.22.0
github.com/gardener/gardener v1.87.4
github.com/gardener/gardener v1.89.4
github.com/gardener/gardener-extension-networking-calico v1.36.1
github.com/gardener/gardener-extension-networking-cilium v1.26.0
github.com/gardener/machine-controller-manager v0.50.1
Expand All @@ -32,7 +32,7 @@ require (
k8s.io/apimachinery v0.29.3
k8s.io/autoscaler/vertical-pod-autoscaler v1.0.0
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
k8s.io/code-generator v0.28.3
k8s.io/code-generator v0.28.4
k8s.io/component-base v0.29.3
k8s.io/kubelet v0.28.3
sigs.k8s.io/controller-runtime v0.16.6
Expand All @@ -46,7 +46,6 @@ require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/bronze1man/yaml2json v0.0.0-20211227013850-8972abeaea25 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/coreos/go-oidc/v3 v3.10.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
Expand Down Expand Up @@ -118,6 +117,7 @@ require (
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.71.0 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.54.0 // indirect
Expand Down Expand Up @@ -159,7 +159,7 @@ require (
helm.sh/helm/v3 v3.11.1 // indirect
istio.io/api v1.19.2-0.20231011000955-f3015ebb5bd4 // indirect
istio.io/client-go v1.19.3 // indirect
k8s.io/apiserver v0.28.9 // indirect
k8s.io/apiserver v0.29.2 // indirect
k8s.io/cluster-bootstrap v0.28.3 // indirect
k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 // indirect
k8s.io/helm v2.17.0+incompatible // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,6 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/bronze1man/yaml2json v0.0.0-20211227013850-8972abeaea25 h1:GMDsCxuwEJ1tYY5anXDexdmQ1BDVzyU5BDU7N3PQWl4=
github.com/bronze1man/yaml2json v0.0.0-20211227013850-8972abeaea25/go.mod h1:mVTg4vqWRIHEJK5QnZhSXBUP8GmI7ArXGq182zSJbxM=
github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down Expand Up @@ -727,8 +725,8 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/gardener/etcd-druid v0.22.0 h1:DVe+Zjrb93r9vI1uUiCTMHBffIUoMAKhNzFZNC6hsQ8=
github.com/gardener/etcd-druid v0.22.0/go.mod h1:FROhfVKyWBo4krlPe3R6FIhJRmOmijEWBdEeUP0CJjE=
github.com/gardener/gardener v1.87.4 h1:pOWHDirMd04dLGd7I8fcv8UAZwrW6uFV8fJJfiQN0E0=
github.com/gardener/gardener v1.87.4/go.mod h1:MNqPkSxLD2w+HeIP56JnZbZtaqPnDb4hSRl3JWEZTWU=
github.com/gardener/gardener v1.89.4 h1:m2K/lLL25wLta6mAFQ25/ngR+KYeMICF6MWLgrwEtu0=
github.com/gardener/gardener v1.89.4/go.mod h1:9XpmG8MvZ2p36J7200qaGcqaFQ9vaP2ogZVkU6VgNGI=
github.com/gardener/gardener-extension-networking-calico v1.36.1 h1:WyAdADamhxQgcCBrQOZAeSM/wm/urmmwBaqd2YLc7MY=
github.com/gardener/gardener-extension-networking-calico v1.36.1/go.mod h1:GFmktIEzLxrOV6uNrCREeKjIkwYK6TlVOEPP7dffjAM=
github.com/gardener/hvpa-controller/api v0.5.0 h1:f4F3O7YUrenwh4S3TgPREPiB287JjjUiUL18OqPLyAA=
Expand Down Expand Up @@ -1125,6 +1123,8 @@ github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qR
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.71.0 h1:et+XkusxWLz+XNqZiyMom9tv9ACvNAUyLXti2LTiV7o=
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.71.0/go.mod h1:3RiUkFmR9kmPZi9r/8a5jw0a9yg+LMmr7qa0wjqvSiI=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
Expand Down Expand Up @@ -2016,8 +2016,8 @@ k8s.io/apiextensions-apiserver v0.28.3 h1:Od7DEnhXHnHPZG+W9I97/fSQkVpVPQx2diy+2E
k8s.io/apiextensions-apiserver v0.28.3/go.mod h1:NE1XJZ4On0hS11aWWJUTNkmVB03j9LM7gJSisbRt8Lc=
k8s.io/apimachinery v0.28.3 h1:B1wYx8txOaCQG0HmYF6nbpU8dg6HvA06x5tEffvOe7A=
k8s.io/apimachinery v0.28.3/go.mod h1:uQTKmIqs+rAYaq+DFaoD2X7pcjLOqbQX2AOiO0nIpb8=
k8s.io/apiserver v0.28.9 h1:koPXvgSXRBDxKJQjJGdZNgPsT9lQv6scJJFipd1m86E=
k8s.io/apiserver v0.28.9/go.mod h1:D51I37WBZojJhmLcjNVE4GSVrjiUHP+yq+N5KvKn2wY=
k8s.io/apiserver v0.29.2 h1:+Z9S0dSNr+CjnVXQePG8TcBWHr3Q7BmAr7NraHvsMiQ=
k8s.io/apiserver v0.29.2/go.mod h1:B0LieKVoyU7ykQvPFm7XSdIHaCHSzCzQWPFa5bqbeMQ=
k8s.io/autoscaler/vertical-pod-autoscaler v0.9.0/go.mod h1:PwWTGRRCxefhAezrDbG/tRYSAW7etHjjMPAr8fXKVAA=
k8s.io/autoscaler/vertical-pod-autoscaler v1.0.0 h1:y0TgWoHaeYEv3L1MfLC+D2WVxyN1fGr6axURHXq+wHE=
k8s.io/autoscaler/vertical-pod-autoscaler v1.0.0/go.mod h1:w6/LjLR3DPQd57vlgvgbpzpuJKsCiily0+OzQI+nyfI=
Expand Down
165 changes: 0 additions & 165 deletions pkg/webhook/controlplane/ensurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ package controlplane

import (
"context"
"encoding/base64"
"fmt"
"strings"

"github.com/Masterminds/semver/v3"
"github.com/coreos/go-systemd/v22/unit"
Expand All @@ -25,7 +22,6 @@ import (
"github.com/metal-stack/gardener-extension-provider-metal/pkg/metal"

"github.com/metal-stack/gardener-extension-provider-metal/pkg/apis/config"
metalapi "github.com/metal-stack/gardener-extension-provider-metal/pkg/apis/metal"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down Expand Up @@ -180,167 +176,6 @@ func (e *ensurer) EnsureVPNSeedServerDeployment(ctx context.Context, gctx gconte
return nil
}

// TODO:
// - Write configuration also into shoot.spec.worker[n].image.providerconfig, but then the worker rolls ?
// - calculate hash over containerd/config.toml and add to containerd.service Unit to trigger restart on changes

// EnsureAdditionalFiles adds additional files to override DNS and NTP configurations from the NetworkIsolation.
func (e *ensurer) EnsureAdditionalFiles(ctx context.Context, gctx gcontext.GardenContext, new, old *[]extensionsv1alpha1.File) error {
cluster, err := gctx.GetCluster(ctx)
if err != nil {
return err
}

controlPlaneConfig, err := helper.ControlPlaneConfigFromClusterShootSpec(cluster)
if err != nil {
return err
}

networkAccessType := metalapi.NetworkAccessBaseline
if controlPlaneConfig.NetworkAccessType != nil {
networkAccessType = *controlPlaneConfig.NetworkAccessType
}

if networkAccessType == metalapi.NetworkAccessBaseline {
return nil
}

infra := &extensionsv1alpha1.Infrastructure{}
if err := e.client.Get(ctx, kutil.Key(cluster.ObjectMeta.Name, cluster.Shoot.Name), infra); err != nil {
logger.Error(err, "could not read Infrastructure for cluster", "cluster name", cluster.ObjectMeta.Name)
return err
}

infraConf, err := helper.InfrastructureConfigFromInfrastructure(infra)
if err != nil {
return err
}

cloudProfileConfig, err := helper.CloudProfileConfigFromCluster(cluster)
if err != nil {
return err
}

_, partition, err := helper.FindMetalControlPlane(cloudProfileConfig, infraConf.PartitionID)
if err != nil {
return err
}

if partition.NetworkIsolation == nil {
return nil
}

if networkAccessType != metalapi.NetworkAccessBaseline {
dnsFiles := additionalDNSConfFiles(partition.NetworkIsolation.DNSServers)
for _, f := range dnsFiles {
*new = extensionswebhook.EnsureFileWithPath(*new, f)
}

ntpFiles := additionalNTPConfFiles(partition.NetworkIsolation.NTPServers)
for _, f := range ntpFiles {
*new = extensionswebhook.EnsureFileWithPath(*new, f)
}

containerdFiles := additionalContainterdConfigFiles(partition.NetworkIsolation.RegistryMirrors)
for _, f := range containerdFiles {
*new = extensionswebhook.EnsureFileWithPath(*new, f)
}
}

return nil
}

func additionalDNSConfFiles(dnsServers []string) []extensionsv1alpha1.File {
resolveDNS := strings.Join(dnsServers, " ")
systemdResolvedConfd := fmt.Sprintf(`# Generated by gardener-extension-provider-metal
[Resolve]
DNS=%s
Domain=~.
`, resolveDNS)
resolvConf := "# Generated by gardener-extension-provider-metal\n"
for _, ip := range dnsServers {
resolvConf += fmt.Sprintf("nameserver %s\n", ip)
}

return []extensionsv1alpha1.File{
{
Path: "/etc/systemd/resolved.conf.d/dns.conf",
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: string(extensionsv1alpha1.B64FileCodecID),
Data: base64.StdEncoding.EncodeToString([]byte(systemdResolvedConfd)),
},
},
},
{
Path: "/etc/resolv.conf",
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: string(extensionsv1alpha1.B64FileCodecID),
Data: base64.StdEncoding.EncodeToString([]byte(resolvConf)),
},
},
},
}
}

func additionalNTPConfFiles(ntpServers []string) []extensionsv1alpha1.File {
ntps := strings.Join(ntpServers, " ")
renderedContent := fmt.Sprintf(`# Generated by gardener-extension-provider-metal
[Time]
NTP=%s
`, ntps)

return []extensionsv1alpha1.File{
{
Path: "/etc/systemd/timesyncd.conf",
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: string(extensionsv1alpha1.B64FileCodecID),
Data: base64.StdEncoding.EncodeToString([]byte(renderedContent)),
},
},
},
}
}

func additionalContainterdConfigFiles(mirrors []metalapi.RegistryMirror) []extensionsv1alpha1.File {
if len(mirrors) == 0 {
return nil
}
// TODO: other parties might also want to write to the containerd config.toml.
// For this case we might want to unmarshal any existing new file to add and patch it with our changes.
renderedContent := `# Generated by gardener-extension-provider-metal
imports = ["/etc/containerd/conf.d/*.toml"]
version = 2
[plugins."io.containerd.grpc.v1.cri".registry]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
`
for _, m := range mirrors {
for _, of := range m.MirrorOf {
renderedContent += fmt.Sprintf(` [plugins."io.containerd.grpc.v1.cri".registry.mirrors.%q]
endpoint = [%q]
`, of, m.Endpoint)
}
}

return []extensionsv1alpha1.File{
{
Path: "/etc/containerd/config.toml",
Content: extensionsv1alpha1.FileContent{
Inline: &extensionsv1alpha1.FileContentInline{
Encoding: string(extensionsv1alpha1.B64FileCodecID),
Data: base64.StdEncoding.EncodeToString([]byte(renderedContent)),
},
},
},
}
}

// ImageVector is exposed for testing.
var ImageVector = imagevector.ImageVector()

Expand Down
Loading

0 comments on commit 77f3ada

Please sign in to comment.