-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add standalong dataplanes for K8S (#281)
* add standalone dataplane runtime * add k8s deployment * fix configuration * fix health check, clean up variables * fix superuser seed, kubernetes probes * formatting * removed codeql * fix test
- Loading branch information
1 parent
a5f00bf
commit 7f23c0c
Showing
26 changed files
with
388 additions
and
130 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
# | ||
# Copyright (c) 2023 Contributors to the Eclipse Foundation | ||
# | ||
# See the NOTICE file(s) distributed with this work for additional | ||
# information regarding copyright ownership. | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Apache License, Version 2.0 which is available at | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
resource "kubernetes_deployment" "dataplane" { | ||
# needs a hard dependency, otherwise the dataplane registration fails, and it is not retried | ||
depends_on = [kubernetes_deployment.controlplane] | ||
metadata { | ||
name = "${lower(var.humanReadableName)}-dataplane" | ||
namespace = var.namespace | ||
labels = { | ||
App = "${lower(var.humanReadableName)}-dataplane" | ||
} | ||
} | ||
|
||
spec { | ||
replicas = 1 | ||
selector { | ||
match_labels = { | ||
App = "${lower(var.humanReadableName)}-dataplane" | ||
} | ||
} | ||
|
||
template { | ||
metadata { | ||
labels = { | ||
App = "${lower(var.humanReadableName)}-dataplane" | ||
} | ||
} | ||
|
||
spec { | ||
container { | ||
name = "dataplane-${lower(var.humanReadableName)}" | ||
image = "dataplane:latest" | ||
image_pull_policy = "Never" | ||
|
||
env_from { | ||
config_map_ref { | ||
name = kubernetes_config_map.dataplane-config.metadata[0].name | ||
} | ||
} | ||
|
||
port { | ||
container_port = var.ports.public | ||
name = "public-port" | ||
} | ||
|
||
port { | ||
container_port = var.ports.debug | ||
name = "debug-port" | ||
} | ||
|
||
liveness_probe { | ||
exec { | ||
command = ["curl", "-X GET", "http://localhost:${var.ports.web}/api/check/liveness"] | ||
} | ||
failure_threshold = 10 | ||
period_seconds = 5 | ||
timeout_seconds = 30 | ||
} | ||
|
||
readiness_probe { | ||
exec { | ||
command = ["curl", "-X GET", "http://localhost:${var.ports.web}/api/check/readiness"] | ||
} | ||
failure_threshold = 10 | ||
period_seconds = 5 | ||
timeout_seconds = 30 | ||
} | ||
|
||
startup_probe { | ||
exec { | ||
command = ["curl", "-X GET", "http://localhost:${var.ports.web}/api/check/startup"] | ||
} | ||
failure_threshold = 10 | ||
period_seconds = 5 | ||
timeout_seconds = 30 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
resource "kubernetes_config_map" "dataplane-config" { | ||
metadata { | ||
name = "${lower(var.humanReadableName)}-dataplane-config" | ||
namespace = var.namespace | ||
} | ||
|
||
## Create databases for keycloak and MIW, create users and assign privileges | ||
data = { | ||
# hostname is "localhost" by default, but must be the service name at which the dataplane is reachable. URL scheme and port are appended by the application | ||
EDC_HOSTNAME = local.dataplane-service-name | ||
EDC_RUNTIME_ID = "${var.humanReadableName}-dataplane" | ||
EDC_PARTICIPANT_ID = var.participantId | ||
EDC_TRANSFER_PROXY_TOKEN_VERIFIER_PUBLICKEY_ALIAS = "${var.participantId}#${var.aliases.sts-public-key-id}" | ||
EDC_TRANSFER_PROXY_TOKEN_SIGNER_PRIVATEKEY_ALIAS = var.aliases.sts-private-key | ||
EDC_DPF_SELECTOR_URL = "http://${local.controlplane-service-name}:${var.ports.control}/api/control/v1/dataplanes" | ||
WEB_HTTP_PORT = var.ports.web | ||
WEB_HTTP_PATH = "/api" | ||
WEB_HTTP_CONTROL_PORT = var.ports.control | ||
WEB_HTTP_CONTROL_PATH = "/api/control" | ||
WEB_HTTP_PUBLIC_PORT = var.ports.public | ||
WEB_HTTP_PUBLIC_PATH = "/api/public" | ||
JAVA_TOOL_OPTIONS = "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=${var.ports.debug}" | ||
} | ||
} |
Oops, something went wrong.