Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • eclipse-research-labs/nemo-project/nemo-infrastructure-management/federated-meta-network-cluster-controller/multi-domain-l2s-m
1 result
Show changes
Commits on Source (22)
Showing
with 109 additions and 210 deletions
CONTROLLER_IP=10.152.183.155
CONTROLLER_PORT=8181
SWITCHES_NAMESPACE=l2sm-system
CONTROLLER_IP=localhost
CONTROLLER_PORT=30000
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://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.
name: Sync to GitLab
on:
......
.vscode
tls.b64
bin/
\ No newline at end of file
bin/
plugins/
.env
examples2/
\ No newline at end of file
# Image URL to use all building/pushing image targets
IMG ?= alexdecb/l2sm-controller-manager:2.7.1
IMG ?= alexdecb/l2sm-controller-manager:2.7.2
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.29.0
DEV_IP = 163.117.139.220
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
......@@ -15,7 +16,7 @@ endif
# Be aware that the target commands are only tested with Docker which is
# scaffolded by default. However, you might want to replace it to use other
# tools. (i.e. podman)
CONTAINER_TOOL ?= sudo docker
CONTAINER_TOOL ?= docker
# Setting SHELL to bash allows bash commands to be executed by recipes.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
......@@ -125,8 +126,6 @@ build-installer: manifests generate kustomize ## Generate a consolidated YAML wi
echo "---" >> deployments/l2sm-deployment.yaml # Add a document separator before appending
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default >> deployments/l2sm-deployment.yaml
echo "---" >> deployments/l2sm-deployment.yaml # Add a document separator before appending
$(KUSTOMIZE) build config/tmp >> deployments/l2sm-deployment.yaml
##@ Deployment
......@@ -147,39 +146,40 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
$(KUSTOMIZE) build config/tmp | $(KUBECTL) apply -f -
.PHONY: undeploy
undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/tmp | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
$(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
.PHONY: webhook-certs
webhook-certs: ## generate self-signed cert and key for local webhook development
mkdir -p /tmp/k8s-webhook-server/serving-certs
openssl req -x509 -newkey rsa:2048 -nodes -keyout /tmp/k8s-webhook-server/serving-certs/tls.key -out /tmp/k8s-webhook-server/serving-certs/tls.crt -days 365 -config ./config/dev/openssl.cnf -batch -subj '/CN=local-webhook'
sed -e 's/{{IP_2}}/$(DEV_IP)/' ./config/dev/openssl.cnf > /tmp/openssl.cnf
openssl req -x509 -newkey rsa:2048 -nodes -keyout /tmp/k8s-webhook-server/serving-certs/tls.key -out /tmp/k8s-webhook-server/serving-certs/tls.crt -days 365 -config /tmp/openssl.cnf -batch -subj '/CN=local-webhook'
cat /tmp/k8s-webhook-server/serving-certs/tls.crt | base64 -w0 > /tmp/k8s-webhook-server/tls.b64
# $(eval B64_CERT := $(shell cat /tmp/k8s-webhook-server/tls.b64))
# echo $(B64_CERT)
# cat /tmp/k8s-webhook-server/tls.b64
# openssl req -x509 \
# -newkey rsa:2048 \
# -nodes \
# -keyout /tmp/k8s-webhook-server/serving-certs/tls.key \
# -out /tmp/k8s-webhook-server/serving-certs/tls.crt \
# -days 365 \
# -subj '/CN=local-webhook'
##@ Webhook
.PHONY: create-cluster
create-cluster:
kind create cluster --config ./examples/quickstart/kind-cluster.yaml
./hack/install_dependencies.sh
.PHONY: delete-cluster
delete-cluster:
kind delete cluster --name l2sm-test
sudo rm -r ./plugins/
.PHONY: deploy-dev
deploy-dev: webhook-certs manifests kustomize ## Deploy validating and mutating webhooks to the K8s cluster specified in ~/.kube/config.
deploy-dev: webhook-certs install manifests kustomize ## Deploy validating and mutating webhooks to the K8s cluster specified in ~/.kube/config.
sed -i'' -e 's/caBundle: .*/caBundle: $(shell cat /tmp/k8s-webhook-server/tls.b64)/' ./config/dev/webhookcainjection_patch.yaml
sed -i'' -e 's|url: .*|url: https://$(DEV_IP):9443/mutate-v1-pod|' ./config/dev/webhookcainjection_patch.yaml
$(KUSTOMIZE) build config/dev | $(KUBECTL) apply -f -
echo -e "CONTROLLER_IP=localhost\nCONTROLLER_PORT=30000" > .env
.PHONY: undeploy-dev
undeploy-dev: kustomize ## Undeploy validating and mutating webhooks from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/dev | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
......@@ -191,7 +191,7 @@ FILES := $(shell find . -type f \( -name "*.go" -o -name "*.json" -o -name "*.ya
# Install the addlicense tool if not installed
.PHONY: install-tools
install-tools:
@go install github.com/google/addlicense@latest
GOBIN=$(LOCALBIN) go install github.com/google/addlicense@latest
# Add license headers to the files
.PHONY: add-license
......@@ -216,7 +216,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest-$(ENVTEST_VERSION)
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint-$(GOLANGCI_LINT_VERSION)
## Tool Versions
KUSTOMIZE_VERSION ?= v5.3.0
KUSTOMIZE_VERSION ?= v5.5.0
CONTROLLER_TOOLS_VERSION ?= v0.14.0
ENVTEST_VERSION ?= latest
GOLANGCI_LINT_VERSION ?= v1.54.2
......
......@@ -45,11 +45,12 @@ type OverlaySpec struct {
// selecting the nodes that are going to be linked.
Topology *TopologySpec `json:"topology,omitempty"`
// Field exclusive to the multi-domain overlay type. If specified in other types of overlays, the reosurce will launch an error and won't be created.
Neighbors []NeighborSpec `json:"neighbors,omitempty"`
// Template describes the virtual switch pod that will be created.
SwitchTemplate *SwitchTemplateSpec `json:"switchTemplate"`
// Interface number specifies how many interfaces the switch should have predefined (if used with multus)
//+kubebuilder:default:value=10
InterfaceNumber int `json:"interfaceNumber,omitempty"`
}
// OverlayStatus defines the observed state of Overlay
......
......@@ -388,11 +388,6 @@ func (in *OverlaySpec) DeepCopyInto(out *OverlaySpec) {
*out = new(TopologySpec)
(*in).DeepCopyInto(*out)
}
if in.Neighbors != nil {
in, out := &in.Neighbors, &out.Neighbors
*out = make([]NeighborSpec, len(*in))
copy(*out, *in)
}
if in.SwitchTemplate != nil {
in, out := &in.SwitchTemplate, &out.SwitchTemplate
*out = new(SwitchTemplateSpec)
......
......@@ -54,6 +54,7 @@ func init() {
}
func main() {
var metricsAddr string
var enableLeaderElection bool
var probeAddr string
......
......@@ -53,26 +53,11 @@ spec:
spec:
description: OverlaySpec defines the desired state of Overlay
properties:
neighbors:
description: Field exclusive to the multi-domain overlay type. If
specified in other types of overlays, the reosurce will launch
an error and won't be created.
items:
properties:
domain:
description: |-
Domain where the neighbor's NED switch can be reached at. Must be a valid IP Address or Domain name, reachable from the node the NED
is going to be deployed at.
type: string
node:
description: Name of the cluster the link is going to be made
upon.
type: string
required:
- domain
- node
type: object
type: array
interfaceNumber:
default: 10
description: Interface number specifies how many interfaces the switch
should have predefined (if used with multus)
type: integer
networkController:
description: The SDN Controller that manages the overlay network.
Must specify a domain and a name.
......
......@@ -27,7 +27,8 @@ resources:
# crd/kustomization.yaml
- ../webhook
- ../sdncontroller
- ../tmp
# - ../tmp
patches:
- path: webhookcainjection_patch.yaml
- path: sdncontroller_patch.yaml
......@@ -28,6 +28,6 @@ extendedKeyUsage = serverAuth
[ alt_names ]
IP.1 = 127.0.0.1
IP.2 = 192.168.122.60
IP.2 = {{IP_2}}
DNS.1 = localhost
DNS.2 = webhook-server.local
......@@ -12,15 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
namespace: l2sm-system
resources:
- vhost1.yaml
- vhost2.yaml
- vhost3.yaml
- vhost4.yaml
- vhost5.yaml
- vhost6.yaml
- vhost7.yaml
- vhost8.yaml
- vhost9.yaml
- vhost10.yaml
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: controller-service
spec:
type: NodePort
ports:
- name: http-port
protocol: TCP
port: 8181
targetPort: 8181
nodePort: 30000
......@@ -26,8 +26,8 @@ metadata:
webhooks:
- name: mpod.kb.io
clientConfig:
url: https://192.168.122.60:9443/mutate-v1-pod
caBundle: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURIVENDQWdXZ0F3SUJBZ0lVS1B3bFFOc0RrOTc2Uk5NMGRVQ2l4c2dxNk5Fd0RRWUpLb1pJaHZjTkFRRUwKQlFBd0dERVdNQlFHQTFVRUF3d05iRzlqWVd3dGQyVmlhRzl2YXpBZUZ3MHlOREV3TURNd05ESXdOREJhRncweQpOVEV3TURNd05ESXdOREJhTUJneEZqQVVCZ05WQkFNTURXeHZZMkZzTFhkbFltaHZiMnN3Z2dFaU1BMEdDU3FHClNJYjNEUUVCQVFVQUE0SUJEd0F3Z2dFS0FvSUJBUUM4aDQ5S0Y0Y0hvS1dDVVU2ZmdJdXdvWXNvVm1mZkFSRjYKYVF1ZHlCektZaVRaNUxlYUZjUlp6dmg0U2RLZllhQmI5ZW9RU1hsUUhWU3lXVjN2MWFrRWRpcWxiWXJpRzhRLwp0UWFIZHpZT05rcEc0aHQyRW04cDN5Q08vTkhlRHNtZ3JBQ1pYWEFxNDFuai9qcHFQd2xDUkdwQk9Sa3dTeXZZCjJmUWM3Z1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HZoL2daS0hKUWZRdDZySW54TmR2UW9aTTFNUW1oR1NodUVxMWt2eU8KZ0ltZDA1UkZqZVVyUHk1ZFlQdGdaZmE1VWh6eWIybmZHN2NodzZlRTFkWlg4eDBYVWJTZGNkVkVHY2pJV1pmMQpUbEZiSnk2cWo1OG5BTWJ0TzdPaEd6RHRQK3lhUnA4d0VwTHJlVlZIajFhOHNJQzRRQjRrQ3JmWjBYbXdqTWR2CjdjSjZDVll4UkhzTllCYktmM2pRUEx2TnJEWmM0L215cXNoK29kWU1KRlg1c09SbExwTmE5aHpVK2NkZnJScC8KVktHZjh2QzhGS2dkdTljNEJ4WStralZwbEgyV01EdzVLbVVOS2czdkxtdzYKLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
rules:
- operations: [ "CREATE", "UPDATE" ]
apiGroups: [""]
......
......@@ -19,4 +19,4 @@ kind: Kustomization
images:
- name: controller
newName: alexdecb/l2sm-controller-manager
newTag: 2.7.1
newTag: 2.7.2
......@@ -89,8 +89,8 @@ spec:
value: l2sm-controller-service.l2sm-system.svc.cluster.local
- name: CONTROLLER_PORT
value: "8181"
- name: SWITCHES_NAMESPACE
value: "l2sm-system"
# - name: SWITCHES_NAMESPACE
# value: "l2sm-system"
image: controller:latest
name: manager
securityContext:
......
......@@ -30,6 +30,18 @@ rules:
- patch
- update
- watch
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
......@@ -56,6 +68,30 @@ rules:
- get
- patch
- update
- apiGroups:
- ""
resources:
- services
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- k8s.cni.cncf.io
resources:
- network-attachment-definitions
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- l2sm.l2sm.k8s.local
resources:
......
......@@ -44,14 +44,6 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: NVETHS
value: "10"
- name: CONTROLLERIP
value: "l2sm-controller-service"
- name: PODNAME
valueFrom:
fieldRef:
fieldPath: metadata.name
imagePullPolicy: Always
securityContext:
capabilities:
......
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://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.
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth1
labels:
app: l2sm
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "br1",
"mtu": 1400,
"device": "veth1",
"ipam": {
"type":"static"
}
}'
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://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.
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth10
labels:
app: l2sm
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "br10",
"mtu": 1400,
"device": "veth10",
"ipam": {
"type":"static"
}
}'
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://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.
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth2
labels:
app: l2sm
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "br2",
"mtu": 1400,
"device": "veth2",
"ipam": {
"type":"static"
}
}'
# Copyright 2024 Universidad Carlos III de Madrid
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://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.
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: veth4
labels:
app: l2sm
spec:
config: '{
"cniVersion": "0.3.0",
"type": "bridge",
"bridge": "br4",
"mtu": 1400,
"device": "veth4",
"ipam": {
"type":"static"
}
}'