|
| 1 | +package v1alpha1 |
| 2 | + |
| 3 | +import ( |
| 4 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 5 | +) |
| 6 | + |
| 7 | +// GatewayServiceConfigSpec defines the desired state of GatewayServiceConfig |
| 8 | +type GatewayServiceConfigSpec struct { |
| 9 | + // EnvoyGateway configuration. |
| 10 | + EnvoyGateway EnvoyGatewayConfig `json:"envoyGateway"` |
| 11 | + |
| 12 | + // Clusters that should be included in the gateway configuration. |
| 13 | + Clusters []ClusterTerm `json:"clusters,omitempty"` |
| 14 | + |
| 15 | + // DNS configuration. |
| 16 | + DNS DNSConfig `json:"dns"` |
| 17 | +} |
| 18 | + |
| 19 | +type ClusterTerm struct { |
| 20 | + // Selector for multiple clusters using labels and purpose. |
| 21 | + Selector *ClusterSelector `json:"selector,omitempty"` |
| 22 | + |
| 23 | + // ClusterRef can be used to reference a single cluster. |
| 24 | + ClusterRef *ClusterRef `json:"clusterRef,omitempty"` |
| 25 | +} |
| 26 | + |
| 27 | +type ClusterSelector struct { |
| 28 | + // MatchLabels selects clusters based on labels. |
| 29 | + MatchLabels map[string]string `json:"matchLabels,omitempty"` |
| 30 | + |
| 31 | + // MatchPurpose selects clusters based on purpose. |
| 32 | + MatchPurpose string `json:"matchPurpose,omitempty"` |
| 33 | +} |
| 34 | + |
| 35 | +type ClusterRef struct { |
| 36 | + // Name of the referenced Cluster. |
| 37 | + // +kubebuilder:validation:Required |
| 38 | + // +kubebuilder:validation:MinLength=1 |
| 39 | + Name string `json:"name"` |
| 40 | + |
| 41 | + // Namespace of the referenced Cluster. |
| 42 | + // +kubebuilder:default=default |
| 43 | + Namespace string `json:"namespace"` |
| 44 | +} |
| 45 | + |
| 46 | +type EnvoyGatewayConfig struct { |
| 47 | + // Images overrides container image locations for Envoy components. |
| 48 | + Images *ImagesConfig `json:"images,omitempty"` |
| 49 | + |
| 50 | + // Chart configuration for Envoy Gateway. |
| 51 | + Chart EnvoyGatewayChart `json:"chart"` |
| 52 | +} |
| 53 | + |
| 54 | +type EnvoyGatewayChart struct { |
| 55 | + // URL to the chart. Default: oci://docker.io/envoyproxy/gateway-helm |
| 56 | + // +kubebuilder:default="oci://docker.io/envoyproxy/gateway-helm" |
| 57 | + URL string `json:"url"` |
| 58 | + |
| 59 | + // Tag of the chart. Example: 1.5.4 |
| 60 | + // +kubebuilder:validation:Required |
| 61 | + // +kubebuilder:validation:MinLength=1 |
| 62 | + Tag string `json:"tag"` |
| 63 | +} |
| 64 | + |
| 65 | +type ImagesConfig struct { |
| 66 | + // EnvoyProxy image. Example: docker.io/envoyproxy/envoy:distroless-v1.35.3 |
| 67 | + EnvoyProxy string `json:"proxy"` |
| 68 | + |
| 69 | + // EnvoyGateway image. Example: docker.io/envoyproxy/gateway:v1.5.1 |
| 70 | + EnvoyGateway string `json:"gateway"` |
| 71 | + |
| 72 | + // Ratelimit image. Example: docker.io/envoyproxy/ratelimit:e74a664a |
| 73 | + Ratelimit string `json:"rateLimit"` |
| 74 | +} |
| 75 | + |
| 76 | +type DNSConfig struct { |
| 77 | + // BaseDomain is the domain from which subdomains will be derived. Example: dev.openmcp.example.com. |
| 78 | + // +kubebuilder:validation:Required |
| 79 | + // +kubebuilder:validation:MinLength=1 |
| 80 | + BaseDomain string `json:"baseDomain"` |
| 81 | + |
| 82 | + // SubdomainTemplate defines how subdomains for clusters will be generated. |
| 83 | + // +kubebuilder:default={{.Cluster.Name}}.{{.Cluster.Namespace}} |
| 84 | + // SubdomainTemplate string `json:"subdomainTemplate"` |
| 85 | +} |
| 86 | + |
| 87 | +// +kubebuilder:object:root=true |
| 88 | +// +kubebuilder:metadata:labels="openmcp.cloud/cluster=platform" |
| 89 | +// +kubebuilder:resource:scope=Cluster |
| 90 | + |
| 91 | +// GatewayServiceConfig is the Schema for the Gateway PlatformService configuration API |
| 92 | +type GatewayServiceConfig struct { |
| 93 | + metav1.TypeMeta `json:",inline"` |
| 94 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 95 | + |
| 96 | + Spec GatewayServiceConfigSpec `json:"spec,omitempty"` |
| 97 | +} |
| 98 | + |
| 99 | +// +kubebuilder:object:root=true |
| 100 | + |
| 101 | +// GatewayServiceConfigList contains a list of GatewayServiceConfig |
| 102 | +type GatewayServiceConfigList struct { |
| 103 | + metav1.TypeMeta `json:",inline"` |
| 104 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 105 | + Items []GatewayServiceConfig `json:"items"` |
| 106 | +} |
| 107 | + |
| 108 | +func init() { |
| 109 | + SchemeBuilder.Register(&GatewayServiceConfig{}, &GatewayServiceConfigList{}) |
| 110 | +} |
0 commit comments