From 1378fb2f1575e80aa7f39ca8ac9bd35c5af4a655 Mon Sep 17 00:00:00 2001 From: Gerrit91 Date: Wed, 8 Nov 2023 08:47:05 +0100 Subject: [PATCH] Progress. --- architecture.drawio.svg | 45 +++++++---- .../templates/deployment.yaml | 3 + charts/images.yaml | 2 +- example/controller-registration.yaml | 2 +- example/shoot.yaml | 8 +- pkg/controller/actuator.go | 76 ++++++++++++++++++- 6 files changed, 114 insertions(+), 22 deletions(-) diff --git a/architecture.drawio.svg b/architecture.drawio.svg index 3d5d88e..d0e7d23 100644 --- a/architecture.drawio.svg +++ b/architecture.drawio.svg @@ -1,4 +1,4 @@ - + @@ -54,7 +54,7 @@ - + @@ -89,12 +89,12 @@ - - + + -
+
cluster forwarding @@ -104,13 +104,13 @@
- + cluster forwarding... - - + + @@ -145,7 +145,7 @@ - + @@ -233,11 +233,11 @@ - + -
+
External Audit Sinks @@ -247,7 +247,7 @@
- + External Audit Sinks... @@ -292,7 +292,7 @@ - + @@ -314,6 +314,25 @@ + + + + +
+
+
+ audittailer-vpn-gateway +
+
+
+
+ + audittailer-vpn-gateway + +
+
+ + diff --git a/charts/gardener-extension-audit/templates/deployment.yaml b/charts/gardener-extension-audit/templates/deployment.yaml index fdb9a5f..b1c8e9d 100644 --- a/charts/gardener-extension-audit/templates/deployment.yaml +++ b/charts/gardener-extension-audit/templates/deployment.yaml @@ -19,6 +19,9 @@ spec: {{- end }} checksum/configmap-{{ include "name" . }}-config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} labels: + networking.gardener.cloud/to-runtime-apiserver: allowed + networking.gardener.cloud/to-dns: allowed + networking.resources.gardener.cloud/to-all-shoots-kube-apiserver-tcp-443: allowed {{ include "labels" . | indent 8 }} spec: containers: diff --git a/charts/images.yaml b/charts/images.yaml index 10113b4..d1ceb6d 100644 --- a/charts/images.yaml +++ b/charts/images.yaml @@ -2,7 +2,7 @@ images: - name: audit-forwarder sourceRepository: https://github.com/metal-stack/audit-forwarder repository: ghcr.io/metal-stack/audit-forwarder - tag: "latest" + tag: "support-audit-extension" # TODO: Pinning - name: fluent-bit sourceRepository: https://github.com/fluent/fluent-bit repository: fluent/fluent-bit diff --git a/example/controller-registration.yaml b/example/controller-registration.yaml index e102be4..fec1daa 100644 --- a/example/controller-registration.yaml +++ b/example/controller-registration.yaml @@ -5,7 +5,7 @@ metadata: name: audit type: helm providerConfig: - chart: H4sIAAAAAAAAA+0ca2/bOLKf9SsIdxdogZNkO46zENC7S1PfbnBtEiS9LA6HQ0BLtK1GErUUlSbX9r/f8CGZkmXLTlKn3XpQwBJFzgw5D86Qk04xC0hCmE1uOUmykCY2zoOQu88eD7oAB/v78heg/iufe3uDXn+/PxyK9t5gMOw+Q/uPyMNSyDOOGULPGKV8Vb+2798pTJfJ/2iGGXfucBw9mIYQ8HAwWCr/fnevJv/hAH5Q9xHm1wo/uPxxGl4SJuTuoZuehdN0/tp1ek7XCkjmszDlsu0Q/UaiGPlCOdCEMsRnBEmFQaUCWQmOiYeWaZZ1UyPw1EvwQ8NS+w+o70zpo9Bos//BsFez/32Anf1vA1x3Sr2p0ADMCcpmyPZRx3Fc+HdDkoAydxryWT52fBq7hbLMH2bYv3aL4bZPE85oFIE6MTINMw6toFEOoFU+wkE/vfAx/EoCl6Pzi+PTk5f6ldziOI2IuwyL2IvQqFBTT2LsWJbrojPgAk+JdkskweOIZKgysTxNqXZZujFMptJ7+ZQx4nM0J4sqZK3UxP5n81ZL7Z8TEAYsXfbwSHDz+G842B/u4r9twBryv5qRKIU92+Hp/WLBFv/f6/f2q/Lvdw8ODnb+fxvw6ZONAjIJE4I6Im7rIPvLF2tp7Ca6w7YgO1nm2AiPSZQ5ED861+ROYZEv+ZiwhIAeOSF1BYUKjiUobnCUa1Y+fUJh4kd5UDLoID1wBSOLY+sMCiweWtJD05eUFmcRJqAziU/kcOecRARnxDkB5ho5K1kLY9hGFGcIiS/hBM1wdsbg+y3qZDPc3x96QPZSkAdSor/D8RSVI1IWJnyCOj9nf/85q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/shoot.yaml b/example/shoot.yaml index 880ee2f..c8909e1 100644 --- a/example/shoot.yaml +++ b/example/shoot.yaml @@ -42,9 +42,6 @@ spec: providerConfig: apiVersion: calico.networking.extensions.gardener.cloud/v1alpha1 kind: NetworkConfig - backend: none - typha: - enabled: false provider: type: local workers: @@ -58,8 +55,11 @@ spec: maxSurge: 1 maxUnavailable: 0 kubernetes: - version: 1.25.4 + version: 1.26.0 kubelet: + seccompDefault: true serializeImagePulls: false registryPullQPS: 10 registryBurst: 20 + protectKernelDefaults: true + streamingConnectionIdleTimeout: 5m diff --git a/pkg/controller/actuator.go b/pkg/controller/actuator.go index c5c4b65..2f2a5c5 100644 --- a/pkg/controller/actuator.go +++ b/pkg/controller/actuator.go @@ -658,7 +658,7 @@ func seedObjects(auditConfig *v1alpha1.AuditConfig, secrets map[string]*corev1.S Name forward Match audit Host audit-cluster-forwarding-vpn-gateway - Port 9090 + Port 9876 Require_ack_response True Compress gzip tls On @@ -748,9 +748,53 @@ func seedObjects(auditConfig *v1alpha1.AuditConfig, secrets map[string]*corev1.S Name: "AUDIT_TLS_VHOST", Value: "audittailer", }, + { + Name: "AUDIT_PROXY_HOST", + Value: "vpn-seed-server", + }, + { + Name: "AUDIT_PROXY_PORT", + Value: "9443", + }, + { + Name: "AUDIT_PROXY_CA_FILE", + Value: "/proxy/ca/bundle.crt", + }, + { + Name: "AUDIT_PROXY_CLIENT_CRT_FILE", + Value: "/proxy/client/tls.crt", + }, + { + Name: "AUDIT_PROXY_CLIENT_KEY_FILE", + Value: "/proxy/client/tls.key", + }, + }, + VolumeMounts: []corev1.VolumeMount{ + { + Name: "ca-vpn", + MountPath: "/proxy/ca", + ReadOnly: true, + }, + { + Name: "http-proxy", + MountPath: "/proxy/client", + ReadOnly: true, + }, }, }, }, + Volumes: []corev1.Volume{ + { + Name: "ca-vpn", + MountPath: "/proxy/ca", + ReadOnly: true, + }, + { + Name: "http-proxy", + MountPath: "/proxy/client", + ReadOnly: true, + }, + }, }, }, }, @@ -760,7 +804,28 @@ func seedObjects(auditConfig *v1alpha1.AuditConfig, secrets map[string]*corev1.S return nil, err } - objects = append(objects, auditForwarder) + auditforwarderService := &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: "audit-cluster-forwarding-vpn-gateway", + Namespace: namespace, + Labels: map[string]string{ + "app": "audit-cluster-forwarding-vpn-gateway", + }, + }, + Spec: corev1.ServiceSpec{ + Selector: map[string]string{ + "app": "audit-cluster-forwarding-vpn-gateway", + }, + Ports: []corev1.ServicePort{ + { + Port: 9876, + TargetPort: intstr.FromInt(9876), + }, + }, + }, + } + + objects = append(objects, auditForwarder, auditforwarderService) auditforwarderNetworkpolicies := []client.Object{ &networkingv1.NetworkPolicy{ @@ -913,6 +978,10 @@ func shootObjects(secrets map[string]*corev1.Secret) ([]client.Object, error) { } ) + audittailerServerSecret := secrets["audittailer-server"].DeepCopy() + audittailerServerSecret.Namespace = v1alpha1.ShootAudittailerNamespace + audittailerServerSecret.ObjectMeta.ResourceVersion = "" + return []client.Object{ &corev1.Namespace{ ObjectMeta: metav1.ObjectMeta{ @@ -922,6 +991,7 @@ func shootObjects(secrets map[string]*corev1.Secret) ([]client.Object, error) { }, }, }, + audittailerServerSecret, audittailerConfig, &appsv1.Deployment{ ObjectMeta: metav1.ObjectMeta{ @@ -1083,7 +1153,7 @@ func shootObjects(secrets map[string]*corev1.Secret) ([]client.Object, error) { Subjects: []rbacv1.Subject{ { Kind: "ServiceAccount", - Name: "audittailer-client", + Name: "audit-cluster-forwarding-vpn-gateway", Namespace: "kube-system", }, },