mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
feat(vpc): cozyplane variant of the VPC application
The kubevirt flavor of virtualprivatecloud is kube-ovn/multus-backed, so the cozyplane networking variant skipped it and the VirtualPrivateCloud catalog kind was simply absent there. This adds an alternative flavor serving the same kind from sdn.cozystack.io: the chart creates a namespaced VPC, the owner-namespace VPCBinding (attachment is default-deny even for the owner), one VPCPeering half per declared peer, and an optional VPCGateway as the north-south boundary. Delivery follows the networking variant: the PackageSource gains a cozyplane variant whose ordering edge is the aggregated sdn apiserver instead of multus, the iaas bundle selects the flavor by networkingVariant, and virtualprivatecloud-rd installs the matching ApplicationDefinition. Each flavor's definition must point at its own variant's ExternalArtifact, which is why hack/update-crd.sh now honors VARIANT from the environment instead of always reading variants[0]. Assisted-by: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
This commit is contained in:
1 parent
f91ffd8fa7
commit
e4ac5dbb9c
19 files changed
+619
-14
No files matched your search
+9
-4
@@ -67,11 +67,16 @@ esac
|
||||
|
||||
# Determine variant from PackageSource file
|
||||
# Look for packages/core/platform/sources/${NAME}-application.yaml
|
||||
# VARIANT (with OUT) is settable from the environment for a chart that provides
|
||||
# an ALTERNATIVE variant of an application: its ApplicationDefinition must point
|
||||
# at that variant's ExternalArtifact, not at variants[0]'s.
|
||||
PACKAGE_SOURCE_FILE="../../core/platform/sources/${NAME}-application.yaml"
|
||||
if [[ -f "$PACKAGE_SOURCE_FILE" ]]; then
|
||||
VARIANT="$(yq -r '.spec.variants[0].name // "default"' "$PACKAGE_SOURCE_FILE")"
|
||||
else
|
||||
VARIANT="default"
|
||||
if [[ -z "${VARIANT:-}" ]]; then
|
||||
if [[ -f "$PACKAGE_SOURCE_FILE" ]]; then
|
||||
VARIANT="$(yq -r '.spec.variants[0].name // "default"' "$PACKAGE_SOURCE_FILE")"
|
||||
else
|
||||
VARIANT="default"
|
||||
fi
|
||||
fi
|
||||
|
||||
# If file doesn't exist, create a minimal skeleton
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: virtualprivatecloud
|
||||
description: Isolated networks
|
||||
icon: /logos/vpc.svg
|
||||
type: application
|
||||
version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process
|
||||
@@ -0,0 +1,11 @@
|
||||
include ../../../hack/package.mk
|
||||
|
||||
generate:
|
||||
cozyvalues-gen -v values.yaml -s values.schema.json -r README.md
|
||||
OUT=../../system/virtualprivatecloud-rd/cozyrds/virtualprivatecloud-cozyplane.yaml VARIANT=cozyplane ../../../hack/update-crd.sh
|
||||
|
||||
test:
|
||||
helm unittest .
|
||||
|
||||
update:
|
||||
echo
|
||||
@@ -0,0 +1,35 @@
|
||||
# VPC (cozyplane)
|
||||
|
||||
A Virtual Private Cloud backed by the cozyplane CNI: an isolated overlay network for the tenant's workloads, with optional peering to other tenants' VPCs and an explicit north-south boundary.
|
||||
|
||||
## Service details
|
||||
|
||||
This is the VPC application for the `cozyplane` networking variant. It serves the same catalog kind as the kube-ovn/multus-backed VPC application, but creates `sdn.cozystack.io` resources: a namespaced `VPC` (the overlay, with a cluster-unique network id assigned by the platform), a `VPCBinding` that authorizes the tenant's own namespace to attach workloads (attachment is default-deny, ownership and use are separate), one `VPCPeering` half per declared peer, and an optional `VPCGateway`.
|
||||
|
||||
Workloads attach to the VPC with the `sdn.cozystack.io/vpc` annotation naming the VPC; there are no secondary network interfaces and no NetworkAttachmentDefinitions on this variant.
|
||||
|
||||
## Deployment notes
|
||||
|
||||
VPC name must be unique within a tenant. Address ranges may overlap with other VPCs — isolation is by overlay, not address space.
|
||||
|
||||
Peering is declared bidirectionally: each owner lists the other in `peers`, and the peering is live only while both declarations exist. Removing either side stops cross-VPC traffic immediately. The two VPCs' address ranges must not overlap.
|
||||
|
||||
By default a VPC is a closed island. Enabling the gateway opens many-to-one egress for the VPC's workloads (`gateway.nat`) and, separately, admits `Service` type=LoadBalancer traffic onto the VPC's workloads (`gateway.ingressLoadBalancer`). Cluster-internal destinations remain refused either way; cluster DNS keeps working without the gateway.
|
||||
|
||||
## Parameters
|
||||
|
||||
### Common parameters
|
||||
|
||||
| Name | Description | Type | Value |
|
||||
| ----------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------- | ------- |
|
||||
| `cidrs` | Address ranges (IPv4 and/or IPv6) of the VPC. May overlap with other VPCs: isolation is by overlay, not address space. | `[]string` | `[]` |
|
||||
| `mtu` | MTU advertised to workloads in this VPC. 0 selects the platform default. | `int` | `0` |
|
||||
| `peers` | VPC peering connections (bidirectional declaration required) | `[]object` | `[]` |
|
||||
| `peers[i].vpcName` | Name of the remote VPC (without "virtualprivatecloud-" prefix) | `string` | `""` |
|
||||
| `peers[i].tenantNamespace` | Namespace of the remote tenant | `string` | `""` |
|
||||
| `gateway` | North-south boundary of the VPC | `object` | `{}` |
|
||||
| `gateway.enabled` | Open a path to the outside. Without a gateway the VPC is a closed island: no way out, no way in. | `bool` | `false` |
|
||||
| `gateway.nat` | Many-to-one egress for workloads with no external address of their own. | `bool` | `true` |
|
||||
| `gateway.ingressLoadBalancer` | Admit Service type=LoadBalancer traffic onto this VPC's workloads. | `bool` | `false` |
|
||||
| `gateway.loadBalancerClass` | The LoadBalancer implementation that allocates the egress identity. Empty selects the cluster default. | `string` | `""` |
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<svg width="144" height="144" viewBox="0 0 144 144" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="144" height="144" rx="24" fill="url(#paint0_linear_1025_3)"/>
|
||||
<path d="M109.6 86.1H114.3C116.885 86.1 119 88.215 119 90.847V104.853C119 107.485 116.885 109.6 114.3 109.6H95.5C92.915 109.6 90.8 107.485 90.8 104.853V90.847C90.8 88.215 92.915 86.1 95.5 86.1H100.2V76.7H76.7V86.1H81.4C83.985 86.1 86.1 88.215 86.1 90.847V104.853C86.1 107.485 83.985 109.6 81.4 109.6H62.6C60.015 109.6 57.9 107.485 57.9 104.853V90.847C57.9 88.215 60.015 86.1 62.6 86.1H67.3V76.7H43.8V86.1H48.5C51.085 86.1 53.2 88.215 53.2 90.847V104.853C53.2 107.485 51.085 109.6 48.5 109.6H29.7C27.115 109.6 25 107.485 25 104.853V90.847C25 88.215 27.115 86.1 29.7 86.1H34.4V76.7C34.4 71.53 38.63 67.3 43.8 67.3H67.3V57.9H62.6C60.015 57.9 57.9 55.785 57.9 53.153V39.147C57.9 36.515 60.015 34.4 62.6 34.4H81.4C83.985 34.4 86.1 36.515 86.1 39.147V53.153C86.1 55.785 83.985 57.9 81.4 57.9H76.7V67.3H100.2C105.37 67.3 109.6 71.53 109.6 76.7V86.1Z" fill="white"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_1025_3" x1="142.5" y1="143" x2="3.99999" y2="9.49999" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#00082E"/>
|
||||
<stop offset="1" stop-color="#2E3067"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,73 @@
|
||||
## Release.Namespace == tenant namespace
|
||||
## Release.Name == "virtualprivatecloud-" + the VPC's catalog name
|
||||
|
||||
---
|
||||
apiVersion: sdn.cozystack.io/v1alpha1
|
||||
kind: VPC
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
cozystack.io/vpcName: {{ .Release.Name }}
|
||||
cozystack.io/tenantName: {{ .Release.Namespace }}
|
||||
spec:
|
||||
cidrs: {{ .Values.cidrs | toJson }}
|
||||
{{- with .Values.mtu }}
|
||||
mtu: {{ . }}
|
||||
{{- end }}
|
||||
---
|
||||
# Attachment is default-deny even for the owner: the VPC's namespace expresses
|
||||
# ownership, a VPCBinding expresses use — so the tenant's own namespace needs one.
|
||||
apiVersion: sdn.cozystack.io/v1alpha1
|
||||
kind: VPCBinding
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
cozystack.io/vpcName: {{ .Release.Name }}
|
||||
cozystack.io/tenantName: {{ .Release.Namespace }}
|
||||
spec:
|
||||
vpcRef:
|
||||
namespace: {{ .Release.Namespace }}
|
||||
name: {{ .Release.Name }}
|
||||
{{- range .Values.peers }}
|
||||
---
|
||||
# One half of a symmetric peering. The remote owner declares the mirror half in
|
||||
# their own VPC, and the peering is live only while both halves exist.
|
||||
apiVersion: sdn.cozystack.io/v1alpha1
|
||||
kind: VPCPeering
|
||||
metadata:
|
||||
{{- /* The hash keeps (tenant-a, b-c) and (tenant-a-b, c) apart. */}}
|
||||
name: {{ printf "%s-to-%s-%s-%s" $.Release.Name .tenantNamespace .vpcName (printf "%s/%s" .tenantNamespace .vpcName | sha256sum | trunc 8) | quote }}
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
labels:
|
||||
cozystack.io/vpcName: {{ $.Release.Name }}
|
||||
cozystack.io/tenantName: {{ $.Release.Namespace }}
|
||||
spec:
|
||||
vpcRef:
|
||||
name: {{ $.Release.Name }}
|
||||
peerRef:
|
||||
namespace: {{ .tenantNamespace | quote }}
|
||||
name: {{ printf "virtualprivatecloud-%s" .vpcName | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.gateway.enabled }}
|
||||
---
|
||||
apiVersion: sdn.cozystack.io/v1alpha1
|
||||
kind: VPCGateway
|
||||
metadata:
|
||||
name: {{ .Release.Name }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
cozystack.io/vpcName: {{ .Release.Name }}
|
||||
cozystack.io/tenantName: {{ .Release.Namespace }}
|
||||
spec:
|
||||
vpcRef:
|
||||
name: {{ .Release.Name }}
|
||||
{{- with .Values.gateway.loadBalancerClass }}
|
||||
loadBalancerClass: {{ . | quote }}
|
||||
{{- end }}
|
||||
nat:
|
||||
enabled: {{ .Values.gateway.nat }}
|
||||
ingress:
|
||||
loadBalancer: {{ .Values.gateway.ingressLoadBalancer }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,153 @@
|
||||
suite: cozyplane vpc rendering
|
||||
templates:
|
||||
- templates/vpc.yaml
|
||||
release:
|
||||
name: virtualprivatecloud-myvpc
|
||||
namespace: tenant-team-a
|
||||
tests:
|
||||
- it: renders the VPC and the owner-namespace binding, nothing else
|
||||
set:
|
||||
cidrs: ["10.10.0.0/24"]
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentSelector:
|
||||
path: kind
|
||||
value: VPC
|
||||
equal:
|
||||
path: spec.cidrs
|
||||
value: ["10.10.0.0/24"]
|
||||
# Attachment is default-deny even for the owner, so the release must
|
||||
# carry a binding for its own namespace or no pod can ever attach.
|
||||
- documentSelector:
|
||||
path: kind
|
||||
value: VPCBinding
|
||||
equal:
|
||||
path: spec.vpcRef
|
||||
value:
|
||||
namespace: tenant-team-a
|
||||
name: virtualprivatecloud-myvpc
|
||||
|
||||
- it: omits mtu at 0 so the platform default applies
|
||||
set:
|
||||
cidrs: ["10.10.0.0/24"]
|
||||
asserts:
|
||||
- documentSelector:
|
||||
path: kind
|
||||
value: VPC
|
||||
notExists:
|
||||
path: spec.mtu
|
||||
|
||||
- it: sets an explicit mtu
|
||||
set:
|
||||
cidrs: ["10.10.0.0/24"]
|
||||
mtu: 1400
|
||||
asserts:
|
||||
- documentSelector:
|
||||
path: kind
|
||||
value: VPC
|
||||
equal:
|
||||
path: spec.mtu
|
||||
value: 1400
|
||||
|
||||
- it: renders one peering half per peer, addressing the remote release name
|
||||
set:
|
||||
cidrs: ["10.10.0.0/24"]
|
||||
peers:
|
||||
- vpcName: other-vpc
|
||||
tenantNamespace: tenant-team-b
|
||||
asserts:
|
||||
- documentSelector:
|
||||
path: kind
|
||||
value: VPCPeering
|
||||
equal:
|
||||
path: spec.peerRef
|
||||
value:
|
||||
namespace: tenant-team-b
|
||||
# The catalog name resolves to the remote VPC through the same
|
||||
# release prefix this chart's own objects carry.
|
||||
name: virtualprivatecloud-other-vpc
|
||||
- documentSelector:
|
||||
path: kind
|
||||
value: VPCPeering
|
||||
equal:
|
||||
path: spec.vpcRef
|
||||
value:
|
||||
name: virtualprivatecloud-myvpc
|
||||
|
||||
- it: names peerings apart when their joined target names collide
|
||||
set:
|
||||
cidrs: ["10.10.0.0/24"]
|
||||
peers:
|
||||
- vpcName: c
|
||||
tenantNamespace: tenant-a-b
|
||||
- vpcName: b-c
|
||||
tenantNamespace: tenant-a
|
||||
asserts:
|
||||
- documentSelector:
|
||||
path: spec.peerRef.namespace
|
||||
value: tenant-a
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: virtualprivatecloud-myvpc-to-tenant-a-b-c-0cc24cae
|
||||
- documentSelector:
|
||||
path: spec.peerRef.namespace
|
||||
value: tenant-a-b
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: virtualprivatecloud-myvpc-to-tenant-a-b-c-b82e8c9a
|
||||
|
||||
- it: refuses a peer namespace or VPC name that is not a DNS-1123 label
|
||||
set:
|
||||
cidrs: ["10.10.0.0/24"]
|
||||
peers:
|
||||
- vpcName: "other\n---\nkind: ClusterRoleBinding"
|
||||
tenantNamespace: tenant-team-b
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorPattern: 'vpcName.*does not match pattern'
|
||||
|
||||
- it: renders the gateway only when enabled
|
||||
set:
|
||||
cidrs: ["10.10.0.0/24"]
|
||||
gateway:
|
||||
enabled: true
|
||||
nat: true
|
||||
ingressLoadBalancer: false
|
||||
loadBalancerClass: ""
|
||||
asserts:
|
||||
- documentSelector:
|
||||
path: kind
|
||||
value: VPCGateway
|
||||
equal:
|
||||
path: spec.nat.enabled
|
||||
value: true
|
||||
- documentSelector:
|
||||
path: kind
|
||||
value: VPCGateway
|
||||
equal:
|
||||
path: spec.ingress.loadBalancer
|
||||
value: false
|
||||
# Empty selects the cluster default, so the field must be absent rather
|
||||
# than an empty string the apiserver would treat as a named class.
|
||||
- documentSelector:
|
||||
path: kind
|
||||
value: VPCGateway
|
||||
notExists:
|
||||
path: spec.loadBalancerClass
|
||||
|
||||
- it: names a loadBalancerClass when given one
|
||||
set:
|
||||
cidrs: ["10.10.0.0/24"]
|
||||
gateway:
|
||||
enabled: true
|
||||
nat: true
|
||||
ingressLoadBalancer: true
|
||||
loadBalancerClass: metallb
|
||||
asserts:
|
||||
- documentSelector:
|
||||
path: kind
|
||||
value: VPCGateway
|
||||
equal:
|
||||
path: spec.loadBalancerClass
|
||||
value: metallb
|
||||
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"title": "Chart Values",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"cidrs": {
|
||||
"description": "Address ranges (IPv4 and/or IPv6) of the VPC. May overlap with other VPCs: isolation is by overlay, not address space.",
|
||||
"type": "array",
|
||||
"default": [],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"mtu": {
|
||||
"description": "MTU advertised to workloads in this VPC. 0 selects the platform default.",
|
||||
"type": "integer",
|
||||
"default": 0
|
||||
},
|
||||
"peers": {
|
||||
"description": "VPC peering connections (bidirectional declaration required)",
|
||||
"type": "array",
|
||||
"default": [],
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"tenantNamespace",
|
||||
"vpcName"
|
||||
],
|
||||
"properties": {
|
||||
"tenantNamespace": {
|
||||
"description": "Namespace of the remote tenant",
|
||||
"type": "string",
|
||||
"maxLength": 63,
|
||||
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
|
||||
},
|
||||
"vpcName": {
|
||||
"description": "Name of the remote VPC (without \"virtualprivatecloud-\" prefix)",
|
||||
"type": "string",
|
||||
"maxLength": 63,
|
||||
"pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"gateway": {
|
||||
"description": "North-south boundary of the VPC",
|
||||
"type": "object",
|
||||
"default": {},
|
||||
"required": [
|
||||
"enabled",
|
||||
"ingressLoadBalancer",
|
||||
"nat"
|
||||
],
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"description": "Open a path to the outside. Without a gateway the VPC is a closed island: no way out, no way in.",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"ingressLoadBalancer": {
|
||||
"description": "Admit Service type=LoadBalancer traffic onto this VPC's workloads.",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"loadBalancerClass": {
|
||||
"description": "The LoadBalancer implementation that allocates the egress identity. Empty selects the cluster default.",
|
||||
"type": "string",
|
||||
"default": ""
|
||||
},
|
||||
"nat": {
|
||||
"description": "Many-to-one egress for workloads with no external address of their own.",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
##
|
||||
## @section Common parameters
|
||||
##
|
||||
|
||||
## @param {[]string} cidrs - Address ranges (IPv4 and/or IPv6) of the VPC. May overlap with other VPCs: isolation is by overlay, not address space.
|
||||
cidrs: []
|
||||
## Example:
|
||||
## cidrs:
|
||||
## - "10.10.0.0/24"
|
||||
|
||||
## @param {int} [mtu] - MTU advertised to workloads in this VPC. 0 selects the platform default.
|
||||
mtu: 0
|
||||
|
||||
## @typedef {struct} Peer - VPC peering target
|
||||
## @field {string} vpcName - Name of the remote VPC (without "virtualprivatecloud-" prefix)
|
||||
## @maxLength 63
|
||||
## @pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
|
||||
## @field {string} tenantNamespace - Namespace of the remote tenant
|
||||
## @maxLength 63
|
||||
## @pattern ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
|
||||
|
||||
## @param {[]Peer} peers - VPC peering connections (bidirectional declaration required)
|
||||
peers: []
|
||||
## Example:
|
||||
## peers:
|
||||
## - vpcName: "other-vpc"
|
||||
## tenantNamespace: "tenant-other"
|
||||
|
||||
## @typedef {struct} Gateway - The VPC's north-south boundary
|
||||
## @field {bool} enabled - Open a path to the outside. Without a gateway the VPC is a closed island: no way out, no way in.
|
||||
## @field {bool} nat - Many-to-one egress for workloads with no external address of their own.
|
||||
## @field {bool} ingressLoadBalancer - Admit Service type=LoadBalancer traffic onto this VPC's workloads.
|
||||
## @field {string} [loadBalancerClass] - The LoadBalancer implementation that allocates the egress identity. Empty selects the cluster default.
|
||||
|
||||
## @param {Gateway} gateway - North-south boundary of the VPC
|
||||
gateway:
|
||||
enabled: false
|
||||
nat: true
|
||||
ingressLoadBalancer: false
|
||||
loadBalancerClass: ""
|
||||
@@ -28,3 +28,26 @@ spec:
|
||||
install:
|
||||
namespace: cozy-system
|
||||
releaseName: virtualprivatecloud-rd
|
||||
# The cozyplane networking variant's VPC: the same VirtualPrivateCloud
|
||||
# catalog kind, backed by sdn.cozystack.io resources instead of
|
||||
# kube-ovn/multus. No multus edge — this variant creates no
|
||||
# NetworkAttachmentDefinitions.
|
||||
- name: cozyplane
|
||||
dependsOn:
|
||||
- cozystack.networking
|
||||
# cozystack-engine ships the ApplicationDefinition CRD rendered by the *-rd component below.
|
||||
- cozystack.cozystack-engine
|
||||
# The aggregated apiserver serves sdn.cozystack.io; until it lands the
|
||||
# group is not served and a tenant VPC release cannot apply.
|
||||
- cozystack.cozyplane-apiserver
|
||||
components:
|
||||
- name: virtualprivatecloud
|
||||
path: apps/vpc-cozyplane
|
||||
- name: virtualprivatecloud-rd
|
||||
path: system/virtualprivatecloud-rd
|
||||
valuesFiles:
|
||||
- values.yaml
|
||||
- values-cozyplane.yaml
|
||||
install:
|
||||
namespace: cozy-system
|
||||
releaseName: virtualprivatecloud-rd
|
||||
@@ -260,12 +260,13 @@
|
||||
{{include "cozystack.platform.package" (list "cozystack.kubernetes-application" "kubevirt" $) }}
|
||||
{{include "cozystack.platform.package" (list "cozystack.kubernetes-nodes-application" "kubevirt" $) }}
|
||||
{{include "cozystack.platform.package" (list "cozystack.computeplane-application" "kubevirt" $) }}
|
||||
{{- /* virtualprivatecloud is Cozystack's kube-ovn/multus tenant VPC app; it
|
||||
hard-depends on cozystack.multus and cannot function without kube-ovn. The
|
||||
cozyplane variant runs neither and provides VPC tenancy through its own
|
||||
sdn.cozystack.io model, so skip it here (otherwise its Package hangs on a
|
||||
multus dependency that the variant never installs). */ -}}
|
||||
{{- if ne (.Values.bundles.system.networkingVariant | default "kubeovn-cilium") "cozyplane" }}
|
||||
{{- /* virtualprivatecloud follows the networking variant: the kubevirt flavor
|
||||
is kube-ovn/multus-backed and would hang on a multus dependency the
|
||||
cozyplane variant never installs; the cozyplane flavor serves the same
|
||||
catalog kind from sdn.cozystack.io. */ -}}
|
||||
{{- if eq (.Values.bundles.system.networkingVariant | default "kubeovn-cilium") "cozyplane" }}
|
||||
{{include "cozystack.platform.package" (list "cozystack.virtualprivatecloud-application" "cozyplane" $) }}
|
||||
{{- else }}
|
||||
{{include "cozystack.platform.package" (list "cozystack.virtualprivatecloud-application" "kubevirt" $) }}
|
||||
{{- end }}
|
||||
{{include "cozystack.platform.package" (list "cozystack.vm-disk-application" "kubevirt" $) }}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
suite: vpc application follows the networking variant
|
||||
templates:
|
||||
- templates/bundles/iaas.yaml
|
||||
release:
|
||||
name: cozystack
|
||||
namespace: cozy-system
|
||||
tests:
|
||||
- it: installs the kubevirt vpc flavor on the default variant
|
||||
set:
|
||||
bundles:
|
||||
system:
|
||||
enabled: true
|
||||
variant: isp-full
|
||||
iaas:
|
||||
enabled: true
|
||||
documentSelector:
|
||||
path: metadata.name
|
||||
value: cozystack.virtualprivatecloud-application
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.variant
|
||||
value: kubevirt
|
||||
|
||||
- it: installs the cozyplane vpc flavor on the cozyplane variant
|
||||
set:
|
||||
bundles:
|
||||
system:
|
||||
enabled: true
|
||||
variant: isp-full
|
||||
networkingVariant: cozyplane
|
||||
iaas:
|
||||
enabled: true
|
||||
documentSelector:
|
||||
path: metadata.name
|
||||
value: cozystack.virtualprivatecloud-application
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.variant
|
||||
value: cozyplane
|
||||
@@ -0,0 +1,42 @@
|
||||
suite: the cozyplane vpc variant's dependency edges
|
||||
# Its own suite because it renders templates/sources.yaml — see
|
||||
# vpc_multus_dependency_test.yaml for why sources suites stay separate from
|
||||
# bundle suites.
|
||||
templates:
|
||||
- templates/sources.yaml
|
||||
release:
|
||||
name: cozystack
|
||||
namespace: cozy-system
|
||||
tests:
|
||||
- it: gates the cozyplane vpc flavor on the aggregated sdn apiserver, not on multus
|
||||
documentSelector:
|
||||
path: metadata.name
|
||||
value: cozystack.virtualprivatecloud-application
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.variants[1].name
|
||||
value: cozyplane
|
||||
# sdn.cozystack.io is served only by the aggregated apiserver; without
|
||||
# this edge the tenant VPC release races the group's availability.
|
||||
- contains:
|
||||
path: spec.variants[1].dependsOn
|
||||
content: cozystack.cozyplane-apiserver
|
||||
# No NetworkAttachmentDefinitions in this flavor, so no multus edge —
|
||||
# the cozyplane bundle never installs multus and the edge would hang.
|
||||
- notContains:
|
||||
path: spec.variants[1].dependsOn
|
||||
content: cozystack.multus
|
||||
# The rd component must select the cozyplane ApplicationDefinition, or
|
||||
# the installed definition points at an artifact this variant never
|
||||
# builds.
|
||||
- contains:
|
||||
path: spec.variants[1].components
|
||||
content:
|
||||
name: virtualprivatecloud-rd
|
||||
path: system/virtualprivatecloud-rd
|
||||
valuesFiles:
|
||||
- values.yaml
|
||||
- values-cozyplane.yaml
|
||||
install:
|
||||
namespace: cozy-system
|
||||
releaseName: virtualprivatecloud-rd
|
||||
@@ -2,3 +2,6 @@ export NAME=virtualprivatecloud-rd
|
||||
export NAMESPACE=cozy-system
|
||||
|
||||
include ../../../hack/package.mk
|
||||
|
||||
test:
|
||||
helm unittest .
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
apiVersion: cozystack.io/v1alpha1
|
||||
kind: ApplicationDefinition
|
||||
metadata:
|
||||
name: virtualprivatecloud
|
||||
spec:
|
||||
application:
|
||||
kind: VirtualPrivateCloud
|
||||
plural: virtualprivateclouds
|
||||
singular: virtualprivatecloud
|
||||
openAPISchema: |-
|
||||
{"title":"Chart Values","type":"object","properties":{"cidrs":{"description":"Address ranges (IPv4 and/or IPv6) of the VPC. May overlap with other VPCs: isolation is by overlay, not address space.","type":"array","default":[],"items":{"type":"string"}},"mtu":{"description":"MTU advertised to workloads in this VPC. 0 selects the platform default.","type":"integer","default":0},"peers":{"description":"VPC peering connections (bidirectional declaration required)","type":"array","default":[],"items":{"type":"object","required":["tenantNamespace","vpcName"],"properties":{"tenantNamespace":{"description":"Namespace of the remote tenant","type":"string","maxLength":63,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"},"vpcName":{"description":"Name of the remote VPC (without \"virtualprivatecloud-\" prefix)","type":"string","maxLength":63,"pattern":"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}}}},"gateway":{"description":"North-south boundary of the VPC","type":"object","default":{},"required":["enabled","ingressLoadBalancer","nat"],"properties":{"enabled":{"description":"Open a path to the outside. Without a gateway the VPC is a closed island: no way out, no way in.","type":"boolean","default":false},"ingressLoadBalancer":{"description":"Admit Service type=LoadBalancer traffic onto this VPC's workloads.","type":"boolean","default":false},"loadBalancerClass":{"description":"The LoadBalancer implementation that allocates the egress identity. Empty selects the cluster default.","type":"string","default":""},"nat":{"description":"Many-to-one egress for workloads with no external address of their own.","type":"boolean","default":true}}}}}
|
||||
release:
|
||||
prefix: "virtualprivatecloud-"
|
||||
labels:
|
||||
sharding.fluxcd.io/key: tenants
|
||||
chartRef:
|
||||
kind: ExternalArtifact
|
||||
name: cozystack-virtualprivatecloud-application-cozyplane-virtualprivatecloud
|
||||
namespace: cozy-system
|
||||
dashboard:
|
||||
category: IaaS
|
||||
singular: VPC
|
||||
plural: VPCs
|
||||
description: "Isolated networks"
|
||||
icon: PHN2ZyB3aWR0aD0iMTQ0IiBoZWlnaHQ9IjE0NCIgdmlld0JveD0iMCAwIDE0NCAxNDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxNDQiIGhlaWdodD0iMTQ0IiByeD0iMjQiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl8xMDI1XzMpIi8+CjxwYXRoIGQ9Ik0xMDkuNiA4Ni4xSDExNC4zQzExNi44ODUgODYuMSAxMTkgODguMjE1IDExOSA5MC44NDdWMTA0Ljg1M0MxMTkgMTA3LjQ4NSAxMTYuODg1IDEwOS42IDExNC4zIDEwOS42SDk1LjVDOTIuOTE1IDEwOS42IDkwLjggMTA3LjQ4NSA5MC44IDEwNC44NTNWOTAuODQ3QzkwLjggODguMjE1IDkyLjkxNSA4Ni4xIDk1LjUgODYuMUgxMDAuMlY3Ni43SDc2LjdWODYuMUg4MS40QzgzLjk4NSA4Ni4xIDg2LjEgODguMjE1IDg2LjEgOTAuODQ3VjEwNC44NTNDODYuMSAxMDcuNDg1IDgzLjk4NSAxMDkuNiA4MS40IDEwOS42SDYyLjZDNjAuMDE1IDEwOS42IDU3LjkgMTA3LjQ4NSA1Ny45IDEwNC44NTNWOTAuODQ3QzU3LjkgODguMjE1IDYwLjAxNSA4Ni4xIDYyLjYgODYuMUg2Ny4zVjc2LjdINDMuOFY4Ni4xSDQ4LjVDNTEuMDg1IDg2LjEgNTMuMiA4OC4yMTUgNTMuMiA5MC44NDdWMTA0Ljg1M0M1My4yIDEwNy40ODUgNTEuMDg1IDEwOS42IDQ4LjUgMTA5LjZIMjkuN0MyNy4xMTUgMTA5LjYgMjUgMTA3LjQ4NSAyNSAxMDQuODUzVjkwLjg0N0MyNSA4OC4yMTUgMjcuMTE1IDg2LjEgMjkuNyA4Ni4xSDM0LjRWNzYuN0MzNC40IDcxLjUzIDM4LjYzIDY3LjMgNDMuOCA2Ny4zSDY3LjNWNTcuOUg2Mi42QzYwLjAxNSA1Ny45IDU3LjkgNTUuNzg1IDU3LjkgNTMuMTUzVjM5LjE0N0M1Ny45IDM2LjUxNSA2MC4wMTUgMzQuNCA2Mi42IDM0LjRIODEuNEM4My45ODUgMzQuNCA4Ni4xIDM2LjUxNSA4Ni4xIDM5LjE0N1Y1My4xNTNDODYuMSA1NS43ODUgODMuOTg1IDU3LjkgODEuNCA1Ny45SDc2LjdWNjcuM0gxMDAuMkMxMDUuMzcgNjcuMyAxMDkuNiA3MS41MyAxMDkuNiA3Ni43Vjg2LjFaIiBmaWxsPSJ3aGl0ZSIvPgo8ZGVmcz4KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDBfbGluZWFyXzEwMjVfMyIgeDE9IjE0Mi41IiB5MT0iMTQzIiB4Mj0iMy45OTk5OSIgeTI9IjkuNDk5OTkiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iIzAwMDgyRSIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiMyRTMwNjciLz4KPC9saW5lYXJHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4K
|
||||
keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "cidrs"], ["spec", "mtu"], ["spec", "peers"], ["spec", "gateway"], ["spec", "gateway", "enabled"], ["spec", "gateway", "nat"], ["spec", "gateway", "ingressLoadBalancer"], ["spec", "gateway", "loadBalancerClass"]]
|
||||
secrets:
|
||||
exclude: []
|
||||
include: []
|
||||
services:
|
||||
exclude: []
|
||||
include: []
|
||||
@@ -1,4 +1,15 @@
|
||||
{{- range $path, $_ := .Files.Glob "cozyrds/*" }}
|
||||
---
|
||||
{{ $.Files.Get $path }}
|
||||
{{- /* One ApplicationDefinition per cluster: both variants register the same
|
||||
VirtualPrivateCloud kind (same release prefix), so rendering more than
|
||||
one is a same-name collision. The variant value picks the backing
|
||||
chart's definition; the PackageSource variant sets it. */ -}}
|
||||
{{- $variant := .Values.variant | default "kubevirt" -}}
|
||||
{{- $file := printf "cozyrds/virtualprivatecloud-%s.yaml" $variant -}}
|
||||
{{- if eq $variant "kubevirt" -}}
|
||||
{{- $file = "cozyrds/virtualprivatecloud.yaml" -}}
|
||||
{{- end -}}
|
||||
{{- $doc := .Files.Get $file -}}
|
||||
{{- if not $doc -}}
|
||||
{{- fail (printf "unknown variant %q: %s does not exist" $variant $file) -}}
|
||||
{{- end }}
|
||||
---
|
||||
{{ $doc }}
|
||||
@@ -0,0 +1,41 @@
|
||||
suite: ApplicationDefinition variant selection
|
||||
templates:
|
||||
- templates/cozyrd.yaml
|
||||
release:
|
||||
name: virtualprivatecloud-rd
|
||||
namespace: cozy-system
|
||||
tests:
|
||||
# Both variants register the same VirtualPrivateCloud kind, so exactly one
|
||||
# ApplicationDefinition may render, and its chartRef must name the artifact
|
||||
# of the variant that was selected — a mismatch leaves every tenant VPC
|
||||
# release pointing at a chart the cluster does not build.
|
||||
- it: defaults to the kubevirt definition
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: virtualprivatecloud
|
||||
- equal:
|
||||
path: spec.release.chartRef.name
|
||||
value: cozystack-virtualprivatecloud-application-kubevirt-virtualprivatecloud
|
||||
|
||||
- it: selects the cozyplane definition
|
||||
set:
|
||||
variant: cozyplane
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: virtualprivatecloud
|
||||
- equal:
|
||||
path: spec.release.chartRef.name
|
||||
value: cozystack-virtualprivatecloud-application-cozyplane-virtualprivatecloud
|
||||
|
||||
- it: refuses an unknown variant
|
||||
set:
|
||||
variant: nonesuch
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorPattern: 'unknown variant "nonesuch"'
|
||||
@@ -0,0 +1 @@
|
||||
variant: cozyplane
|
||||
@@ -1 +1,3 @@
|
||||
{}
|
||||
# Which cozyrds/ ApplicationDefinition this release installs. The platform
|
||||
# bundle selects it per networking variant through the PackageSource.
|
||||
variant: kubevirt
|
||||
Reference in new issue
Block a user