From d4a4834282f3c91c646922e56105975efe4a537d Mon Sep 17 00:00:00 2001 From: Alessandro Olivero Date: Mon, 11 Sep 2023 11:05:45 +0200 Subject: [PATCH] CRDs helm subchart --- Makefile | 2 +- apis/ipam/v1alpha1/zz_generated.deepcopy.go | 1 - deployments/liqo/Chart.yaml | 8 +- deployments/liqo/charts/liqo-crds/.helmignore | 23 ++++++ deployments/liqo/charts/liqo-crds/Chart.yaml | 18 ++++ .../discovery.liqo.io_foreignclusters.yaml | 0 .../discovery.liqo.io_resourcerequests.yaml | 0 .../liqo-crds}/crds/ipam.liqo.io_ips.yaml | 3 +- .../crds/ipam.liqo.io_networks.yaml | 3 +- .../crds/net.liqo.io_ipamstorages.yaml | 0 .../crds/net.liqo.io_natmappings.yaml | 0 .../crds/net.liqo.io_networkconfigs.yaml | 0 .../crds/net.liqo.io_tunnelendpoints.yaml | 0 .../networking.liqo.io_configurations.yaml | 0 .../crds/networking.liqo.io_connections.yaml | 0 ...orking.liqo.io_firewallconfigurations.yaml | 0 .../networking.liqo.io_gatewayclients.yaml | 0 .../networking.liqo.io_gatewayservers.yaml | 0 .../crds/networking.liqo.io_publickeys.yaml | 0 .../networking.liqo.io_wggatewayclients.yaml | 0 ...king.liqo.io_wggatewayclienttemplates.yaml | 0 .../networking.liqo.io_wggatewayservers.yaml | 0 ...king.liqo.io_wggatewayservertemplates.yaml | 0 ...floading.liqo.io_namespaceoffloadings.yaml | 0 .../crds/sharing.liqo.io_resourceoffers.yaml | 0 .../virtualkubelet.liqo.io_namespacemaps.yaml | 0 ...lkubelet.liqo.io_shadowendpointslices.yaml | 0 .../virtualkubelet.liqo.io_shadowpods.yaml | 0 .../virtualkubelet.liqo.io_virtualnodes.yaml | 0 deployments/liqo/charts/liqo-crds/values.yaml | 82 +++++++++++++++++++ .../ip-controller/ip_controller.go | 2 +- 31 files changed, 129 insertions(+), 13 deletions(-) create mode 100644 deployments/liqo/charts/liqo-crds/.helmignore create mode 100644 deployments/liqo/charts/liqo-crds/Chart.yaml rename deployments/liqo/{ => charts/liqo-crds}/crds/discovery.liqo.io_foreignclusters.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/discovery.liqo.io_resourcerequests.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/ipam.liqo.io_ips.yaml (96%) rename deployments/liqo/{ => charts/liqo-crds}/crds/ipam.liqo.io_networks.yaml (96%) rename deployments/liqo/{ => charts/liqo-crds}/crds/net.liqo.io_ipamstorages.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/net.liqo.io_natmappings.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/net.liqo.io_networkconfigs.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/net.liqo.io_tunnelendpoints.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/networking.liqo.io_configurations.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/networking.liqo.io_connections.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/networking.liqo.io_firewallconfigurations.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/networking.liqo.io_gatewayclients.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/networking.liqo.io_gatewayservers.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/networking.liqo.io_publickeys.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/networking.liqo.io_wggatewayclients.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/networking.liqo.io_wggatewayclienttemplates.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/networking.liqo.io_wggatewayservers.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/networking.liqo.io_wggatewayservertemplates.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/offloading.liqo.io_namespaceoffloadings.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/sharing.liqo.io_resourceoffers.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/virtualkubelet.liqo.io_namespacemaps.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/virtualkubelet.liqo.io_shadowendpointslices.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/virtualkubelet.liqo.io_shadowpods.yaml (100%) rename deployments/liqo/{ => charts/liqo-crds}/crds/virtualkubelet.liqo.io_virtualnodes.yaml (100%) create mode 100644 deployments/liqo/charts/liqo-crds/values.yaml diff --git a/Makefile b/Makefile index f421868704..9a7a4cca73 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ purge: manifests ctl # Generate manifests e.g. CRD, RBAC etc. manifests: controller-gen rm -f deployments/liqo/crds/* - $(CONTROLLER_GEN) paths="./apis/..." crd:generateEmbeddedObjectMeta=true output:crd:artifacts:config=deployments/liqo/crds + $(CONTROLLER_GEN) paths="./apis/..." crd:generateEmbeddedObjectMeta=true output:crd:artifacts:config=deployments/liqo/charts/liqo-crds/crds #Generate RBAC for each controller rbacs: controller-gen diff --git a/apis/ipam/v1alpha1/zz_generated.deepcopy.go b/apis/ipam/v1alpha1/zz_generated.deepcopy.go index 3e6627aca2..b5ca0aa7ab 100644 --- a/apis/ipam/v1alpha1/zz_generated.deepcopy.go +++ b/apis/ipam/v1alpha1/zz_generated.deepcopy.go @@ -1,5 +1,4 @@ //go:build !ignore_autogenerated -// +build !ignore_autogenerated // Copyright 2019-2023 The Liqo Authors // diff --git a/deployments/liqo/Chart.yaml b/deployments/liqo/Chart.yaml index ec29bab0ca..07bdfb5f71 100644 --- a/deployments/liqo/Chart.yaml +++ b/deployments/liqo/Chart.yaml @@ -14,9 +14,5 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: "0.1" - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. -# AppVersion is commented by default. Uncomment it or add it as extra-args to helm package if you want to release a new Liqo version -# appVersion: +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 diff --git a/deployments/liqo/charts/liqo-crds/.helmignore b/deployments/liqo/charts/liqo-crds/.helmignore new file mode 100644 index 0000000000..0e8a0eb36f --- /dev/null +++ b/deployments/liqo/charts/liqo-crds/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/deployments/liqo/charts/liqo-crds/Chart.yaml b/deployments/liqo/charts/liqo-crds/Chart.yaml new file mode 100644 index 0000000000..dfea5fd4c1 --- /dev/null +++ b/deployments/liqo/charts/liqo-crds/Chart.yaml @@ -0,0 +1,18 @@ +apiVersion: v2 +name: liqo-crds +description: A Helm chart for Liqo, contains the CRDs + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 diff --git a/deployments/liqo/crds/discovery.liqo.io_foreignclusters.yaml b/deployments/liqo/charts/liqo-crds/crds/discovery.liqo.io_foreignclusters.yaml similarity index 100% rename from deployments/liqo/crds/discovery.liqo.io_foreignclusters.yaml rename to deployments/liqo/charts/liqo-crds/crds/discovery.liqo.io_foreignclusters.yaml diff --git a/deployments/liqo/crds/discovery.liqo.io_resourcerequests.yaml b/deployments/liqo/charts/liqo-crds/crds/discovery.liqo.io_resourcerequests.yaml similarity index 100% rename from deployments/liqo/crds/discovery.liqo.io_resourcerequests.yaml rename to deployments/liqo/charts/liqo-crds/crds/discovery.liqo.io_resourcerequests.yaml diff --git a/deployments/liqo/crds/ipam.liqo.io_ips.yaml b/deployments/liqo/charts/liqo-crds/crds/ipam.liqo.io_ips.yaml similarity index 96% rename from deployments/liqo/crds/ipam.liqo.io_ips.yaml rename to deployments/liqo/charts/liqo-crds/crds/ipam.liqo.io_ips.yaml index 00ddee8198..d78ee90d19 100644 --- a/deployments/liqo/crds/ipam.liqo.io_ips.yaml +++ b/deployments/liqo/charts/liqo-crds/crds/ipam.liqo.io_ips.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.9.2 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.13.0 name: ips.ipam.liqo.io spec: group: ipam.liqo.io diff --git a/deployments/liqo/crds/ipam.liqo.io_networks.yaml b/deployments/liqo/charts/liqo-crds/crds/ipam.liqo.io_networks.yaml similarity index 96% rename from deployments/liqo/crds/ipam.liqo.io_networks.yaml rename to deployments/liqo/charts/liqo-crds/crds/ipam.liqo.io_networks.yaml index 8e4882c4be..3a9df598e1 100644 --- a/deployments/liqo/crds/ipam.liqo.io_networks.yaml +++ b/deployments/liqo/charts/liqo-crds/crds/ipam.liqo.io_networks.yaml @@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.9.2 - creationTimestamp: null + controller-gen.kubebuilder.io/version: v0.13.0 name: networks.ipam.liqo.io spec: group: ipam.liqo.io diff --git a/deployments/liqo/crds/net.liqo.io_ipamstorages.yaml b/deployments/liqo/charts/liqo-crds/crds/net.liqo.io_ipamstorages.yaml similarity index 100% rename from deployments/liqo/crds/net.liqo.io_ipamstorages.yaml rename to deployments/liqo/charts/liqo-crds/crds/net.liqo.io_ipamstorages.yaml diff --git a/deployments/liqo/crds/net.liqo.io_natmappings.yaml b/deployments/liqo/charts/liqo-crds/crds/net.liqo.io_natmappings.yaml similarity index 100% rename from deployments/liqo/crds/net.liqo.io_natmappings.yaml rename to deployments/liqo/charts/liqo-crds/crds/net.liqo.io_natmappings.yaml diff --git a/deployments/liqo/crds/net.liqo.io_networkconfigs.yaml b/deployments/liqo/charts/liqo-crds/crds/net.liqo.io_networkconfigs.yaml similarity index 100% rename from deployments/liqo/crds/net.liqo.io_networkconfigs.yaml rename to deployments/liqo/charts/liqo-crds/crds/net.liqo.io_networkconfigs.yaml diff --git a/deployments/liqo/crds/net.liqo.io_tunnelendpoints.yaml b/deployments/liqo/charts/liqo-crds/crds/net.liqo.io_tunnelendpoints.yaml similarity index 100% rename from deployments/liqo/crds/net.liqo.io_tunnelendpoints.yaml rename to deployments/liqo/charts/liqo-crds/crds/net.liqo.io_tunnelendpoints.yaml diff --git a/deployments/liqo/crds/networking.liqo.io_configurations.yaml b/deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_configurations.yaml similarity index 100% rename from deployments/liqo/crds/networking.liqo.io_configurations.yaml rename to deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_configurations.yaml diff --git a/deployments/liqo/crds/networking.liqo.io_connections.yaml b/deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_connections.yaml similarity index 100% rename from deployments/liqo/crds/networking.liqo.io_connections.yaml rename to deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_connections.yaml diff --git a/deployments/liqo/crds/networking.liqo.io_firewallconfigurations.yaml b/deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_firewallconfigurations.yaml similarity index 100% rename from deployments/liqo/crds/networking.liqo.io_firewallconfigurations.yaml rename to deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_firewallconfigurations.yaml diff --git a/deployments/liqo/crds/networking.liqo.io_gatewayclients.yaml b/deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_gatewayclients.yaml similarity index 100% rename from deployments/liqo/crds/networking.liqo.io_gatewayclients.yaml rename to deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_gatewayclients.yaml diff --git a/deployments/liqo/crds/networking.liqo.io_gatewayservers.yaml b/deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_gatewayservers.yaml similarity index 100% rename from deployments/liqo/crds/networking.liqo.io_gatewayservers.yaml rename to deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_gatewayservers.yaml diff --git a/deployments/liqo/crds/networking.liqo.io_publickeys.yaml b/deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_publickeys.yaml similarity index 100% rename from deployments/liqo/crds/networking.liqo.io_publickeys.yaml rename to deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_publickeys.yaml diff --git a/deployments/liqo/crds/networking.liqo.io_wggatewayclients.yaml b/deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_wggatewayclients.yaml similarity index 100% rename from deployments/liqo/crds/networking.liqo.io_wggatewayclients.yaml rename to deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_wggatewayclients.yaml diff --git a/deployments/liqo/crds/networking.liqo.io_wggatewayclienttemplates.yaml b/deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_wggatewayclienttemplates.yaml similarity index 100% rename from deployments/liqo/crds/networking.liqo.io_wggatewayclienttemplates.yaml rename to deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_wggatewayclienttemplates.yaml diff --git a/deployments/liqo/crds/networking.liqo.io_wggatewayservers.yaml b/deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_wggatewayservers.yaml similarity index 100% rename from deployments/liqo/crds/networking.liqo.io_wggatewayservers.yaml rename to deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_wggatewayservers.yaml diff --git a/deployments/liqo/crds/networking.liqo.io_wggatewayservertemplates.yaml b/deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_wggatewayservertemplates.yaml similarity index 100% rename from deployments/liqo/crds/networking.liqo.io_wggatewayservertemplates.yaml rename to deployments/liqo/charts/liqo-crds/crds/networking.liqo.io_wggatewayservertemplates.yaml diff --git a/deployments/liqo/crds/offloading.liqo.io_namespaceoffloadings.yaml b/deployments/liqo/charts/liqo-crds/crds/offloading.liqo.io_namespaceoffloadings.yaml similarity index 100% rename from deployments/liqo/crds/offloading.liqo.io_namespaceoffloadings.yaml rename to deployments/liqo/charts/liqo-crds/crds/offloading.liqo.io_namespaceoffloadings.yaml diff --git a/deployments/liqo/crds/sharing.liqo.io_resourceoffers.yaml b/deployments/liqo/charts/liqo-crds/crds/sharing.liqo.io_resourceoffers.yaml similarity index 100% rename from deployments/liqo/crds/sharing.liqo.io_resourceoffers.yaml rename to deployments/liqo/charts/liqo-crds/crds/sharing.liqo.io_resourceoffers.yaml diff --git a/deployments/liqo/crds/virtualkubelet.liqo.io_namespacemaps.yaml b/deployments/liqo/charts/liqo-crds/crds/virtualkubelet.liqo.io_namespacemaps.yaml similarity index 100% rename from deployments/liqo/crds/virtualkubelet.liqo.io_namespacemaps.yaml rename to deployments/liqo/charts/liqo-crds/crds/virtualkubelet.liqo.io_namespacemaps.yaml diff --git a/deployments/liqo/crds/virtualkubelet.liqo.io_shadowendpointslices.yaml b/deployments/liqo/charts/liqo-crds/crds/virtualkubelet.liqo.io_shadowendpointslices.yaml similarity index 100% rename from deployments/liqo/crds/virtualkubelet.liqo.io_shadowendpointslices.yaml rename to deployments/liqo/charts/liqo-crds/crds/virtualkubelet.liqo.io_shadowendpointslices.yaml diff --git a/deployments/liqo/crds/virtualkubelet.liqo.io_shadowpods.yaml b/deployments/liqo/charts/liqo-crds/crds/virtualkubelet.liqo.io_shadowpods.yaml similarity index 100% rename from deployments/liqo/crds/virtualkubelet.liqo.io_shadowpods.yaml rename to deployments/liqo/charts/liqo-crds/crds/virtualkubelet.liqo.io_shadowpods.yaml diff --git a/deployments/liqo/crds/virtualkubelet.liqo.io_virtualnodes.yaml b/deployments/liqo/charts/liqo-crds/crds/virtualkubelet.liqo.io_virtualnodes.yaml similarity index 100% rename from deployments/liqo/crds/virtualkubelet.liqo.io_virtualnodes.yaml rename to deployments/liqo/charts/liqo-crds/crds/virtualkubelet.liqo.io_virtualnodes.yaml diff --git a/deployments/liqo/charts/liqo-crds/values.yaml b/deployments/liqo/charts/liqo-crds/values.yaml new file mode 100644 index 0000000000..c81df98717 --- /dev/null +++ b/deployments/liqo/charts/liqo-crds/values.yaml @@ -0,0 +1,82 @@ +# Default values for liqo-crds. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: nginx + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/pkg/liqo-controller-manager/ip-controller/ip_controller.go b/pkg/liqo-controller-manager/ip-controller/ip_controller.go index 9dae9dc1ec..93259c33f5 100644 --- a/pkg/liqo-controller-manager/ip-controller/ip_controller.go +++ b/pkg/liqo-controller-manager/ip-controller/ip_controller.go @@ -16,7 +16,6 @@ package ipctrl import ( "context" - "slices" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/labels" @@ -29,6 +28,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/reconcile" + "slices" ipamv1alpha1 "github.com/liqotech/liqo/apis/ipam/v1alpha1" "github.com/liqotech/liqo/apis/virtualkubelet/v1alpha1"