first-commit
This commit is contained in:
727
modules/k8s/api/application/v1/application_types.go
Normal file
727
modules/k8s/api/application/v1/application_types.go
Normal file
@@ -0,0 +1,727 @@
|
||||
/*
|
||||
Copyright 2025.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// ApplicationSpec defines the desired state of Application
|
||||
type ApplicationSpec struct {
|
||||
// Template defines the application template
|
||||
// +required
|
||||
Template ApplicationTemplate `json:"template"`
|
||||
|
||||
// Replicas defines the number of desired replicas
|
||||
// +optional
|
||||
// +kubebuilder:default=1
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
Replicas *int32 `json:"replicas,omitempty"`
|
||||
|
||||
// Environment defines environment variables for the application
|
||||
// +optional
|
||||
Environment map[string]string `json:"environment,omitempty"`
|
||||
|
||||
// Resources defines resource requirements for the application
|
||||
// +optional
|
||||
Resources ResourceRequirements `json:"resources,omitempty"`
|
||||
|
||||
// Expose defines whether to expose the application as a service (deprecated, use Service instead)
|
||||
// +optional
|
||||
// +kubebuilder:default=false
|
||||
Expose bool `json:"expose,omitempty"`
|
||||
|
||||
// Service defines service configuration for the application
|
||||
// +optional
|
||||
Service *ServiceConfig `json:"service,omitempty"`
|
||||
|
||||
// 网络策略配置,包含了南北向和东西向流量管理
|
||||
// +optional
|
||||
NetworkPolicy *NetworkPolicy `json:"networkPolicy,omitempty"`
|
||||
|
||||
// 保留现有的TrafficPolicy用于向后兼容,但增强其功能
|
||||
// +optional
|
||||
TrafficPolicy *TrafficPolicy `json:"trafficPolicy,omitempty"`
|
||||
}
|
||||
|
||||
// NetworkPolicy 定义应用的网络和流量策略
|
||||
// +kubebuilder:object:generate=true
|
||||
// +kubebuilder:validation:Optional
|
||||
type NetworkPolicy struct {
|
||||
// Gateway定义南北向流量入口配置
|
||||
// +optional
|
||||
Gateway *GatewayConfig `json:"gateway,omitempty"`
|
||||
|
||||
// Mesh定义服务网格相关配置
|
||||
// +optional
|
||||
Mesh *MeshConfig `json:"mesh,omitempty"`
|
||||
}
|
||||
|
||||
// GatewayConfig 定义南北向流量入口配置
|
||||
// +kubebuilder:object:generate=true
|
||||
// +kubebuilder:validation:Optional
|
||||
type GatewayConfig struct {
|
||||
// 是否启用Gateway
|
||||
// +optional
|
||||
// +kubebuilder:default=false
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
|
||||
// 暴露的端口列表
|
||||
// +optional
|
||||
// +kubebuilder:validation:MinItems=0
|
||||
// +listType=atomic
|
||||
Ports []GatewayPort `json:"ports,omitempty"`
|
||||
|
||||
// 域名列表,用于HTTP/HTTPS协议
|
||||
// +optional
|
||||
// +listType=atomic
|
||||
// +kubebuilder:validation:MinItems=0
|
||||
Hosts []string `json:"hosts,omitempty"`
|
||||
|
||||
// TLS配置
|
||||
// +optional
|
||||
// +listType=atomic
|
||||
// +kubebuilder:validation:MinItems=0
|
||||
TLS []GatewayTLS `json:"tls,omitempty"`
|
||||
|
||||
// 额外的Gateway注解
|
||||
// +optional
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
}
|
||||
|
||||
// GatewayPort 定义Gateway暴露的端口
|
||||
// +kubebuilder:object:generate=true
|
||||
type GatewayPort struct {
|
||||
// 端口名称
|
||||
// +required
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
// +kubebuilder:validation:MaxLength=63
|
||||
// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
|
||||
Name string `json:"name"`
|
||||
|
||||
// 端口号
|
||||
// +required
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=65535
|
||||
Number int32 `json:"number"`
|
||||
|
||||
// 协议类型
|
||||
// +optional
|
||||
// +kubebuilder:default="HTTP"
|
||||
// +kubebuilder:validation:Enum=HTTP;HTTPS;TCP;UDP;GRPC;TLS;MONGO
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
|
||||
// 目标端口(如与端口号不同)
|
||||
// +optional
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=65535
|
||||
TargetPort int32 `json:"targetPort,omitempty"`
|
||||
}
|
||||
|
||||
// GatewayTLS 定义Gateway的TLS配置
|
||||
// +kubebuilder:object:generate=true
|
||||
type GatewayTLS struct {
|
||||
// 主机列表
|
||||
// +optional
|
||||
// +listType=atomic
|
||||
Hosts []string `json:"hosts,omitempty"`
|
||||
|
||||
// 证书Secret名称
|
||||
// +optional
|
||||
// +kubebuilder:validation:MinLength=0
|
||||
// +kubebuilder:validation:MaxLength=253
|
||||
SecretName string `json:"secretName,omitempty"`
|
||||
|
||||
// TLS模式
|
||||
// +optional
|
||||
// +kubebuilder:default="SIMPLE"
|
||||
// +kubebuilder:validation:Enum=SIMPLE;MUTUAL;PASSTHROUGH
|
||||
Mode string `json:"mode,omitempty"`
|
||||
|
||||
// 最低TLS版本
|
||||
// +optional
|
||||
// +kubebuilder:default="TLSv1_2"
|
||||
// +kubebuilder:validation:Enum=TLSv1_0;TLSv1_1;TLSv1_2;TLSv1_3
|
||||
MinProtocolVersion string `json:"minProtocolVersion,omitempty"`
|
||||
}
|
||||
|
||||
// MeshConfig 定义服务网格相关配置
|
||||
// +kubebuilder:object:generate=true
|
||||
// +kubebuilder:validation:Optional
|
||||
type MeshConfig struct {
|
||||
// 是否启用服务网格
|
||||
// +optional
|
||||
// +kubebuilder:default=false
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
|
||||
// Sidecar注入配置
|
||||
// +optional
|
||||
Sidecar *SidecarConfig `json:"sidecar,omitempty"`
|
||||
|
||||
// 路由规则
|
||||
// +optional
|
||||
// +listType=atomic
|
||||
Routes []RouteConfig `json:"routes,omitempty"`
|
||||
|
||||
// 熔断策略
|
||||
// +optional
|
||||
CircuitBreaker *CircuitBreaker `json:"circuitBreaker,omitempty"`
|
||||
|
||||
// 超时配置(毫秒)
|
||||
// +optional
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
Timeout int32 `json:"timeout,omitempty"`
|
||||
|
||||
// 重试策略
|
||||
// +optional
|
||||
Retry *RetryPolicy `json:"retry,omitempty"`
|
||||
|
||||
// 故障注入(用于测试)
|
||||
// +optional
|
||||
FaultInjection *FaultInjection `json:"faultInjection,omitempty"`
|
||||
|
||||
// 负载均衡策略
|
||||
// +optional
|
||||
LoadBalancer *LoadBalancerSettings `json:"loadBalancer,omitempty"`
|
||||
}
|
||||
|
||||
// SidecarConfig 定义Sidecar代理配置
|
||||
// +kubebuilder:object:generate=true
|
||||
type SidecarConfig struct {
|
||||
// 是否手动注入Sidecar
|
||||
// +optional
|
||||
// +kubebuilder:default=true
|
||||
Inject bool `json:"inject,omitempty"`
|
||||
|
||||
// 资源限制
|
||||
// +optional
|
||||
Resources *ResourceRequirements `json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
// RouteConfig 定义路由规则
|
||||
// +kubebuilder:object:generate=true
|
||||
type RouteConfig struct {
|
||||
// 路由名称
|
||||
// +optional
|
||||
// +kubebuilder:validation:MaxLength=253
|
||||
// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// 匹配条件
|
||||
// +optional
|
||||
Match *HTTPMatchRequest `json:"match,omitempty"`
|
||||
|
||||
// 目标服务
|
||||
// +required
|
||||
Destination RouteDestination `json:"destination"`
|
||||
|
||||
// 权重(0-100)
|
||||
// +optional
|
||||
// +kubebuilder:default=100
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
// +kubebuilder:validation:Maximum=100
|
||||
Weight int32 `json:"weight,omitempty"`
|
||||
}
|
||||
|
||||
// HTTPMatchRequest 定义HTTP匹配条件
|
||||
// +kubebuilder:object:generate=true
|
||||
type HTTPMatchRequest struct {
|
||||
// URI匹配
|
||||
// +optional
|
||||
URI *StringMatch `json:"uri,omitempty"`
|
||||
|
||||
// 方法匹配(GET, POST等)
|
||||
// +optional
|
||||
Method *StringMatch `json:"method,omitempty"`
|
||||
|
||||
// 头部匹配
|
||||
// +optional
|
||||
Headers map[string]StringMatch `json:"headers,omitempty"`
|
||||
}
|
||||
|
||||
// StringMatch 定义字符串匹配方式
|
||||
// +kubebuilder:object:generate=true
|
||||
// +kubebuilder:validation:XValidation:rule="has(self.exact) || has(self.prefix) || has(self.regex)",message="必须指定exact、prefix或regex中的一种匹配方式"
|
||||
type StringMatch struct {
|
||||
// 精确匹配
|
||||
// +optional
|
||||
Exact string `json:"exact,omitempty"`
|
||||
|
||||
// 前缀匹配
|
||||
// +optional
|
||||
Prefix string `json:"prefix,omitempty"`
|
||||
|
||||
// 正则匹配
|
||||
// +optional
|
||||
Regex string `json:"regex,omitempty"`
|
||||
}
|
||||
|
||||
// RouteDestination 定义路由目标
|
||||
// +kubebuilder:object:generate=true
|
||||
type RouteDestination struct {
|
||||
// 目标服务
|
||||
// +required
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
Host string `json:"host"`
|
||||
|
||||
// 目标子集
|
||||
// +optional
|
||||
Subset string `json:"subset,omitempty"`
|
||||
|
||||
// 目标端口
|
||||
// +optional
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=65535
|
||||
Port int32 `json:"port,omitempty"`
|
||||
}
|
||||
|
||||
// CanaryTraffic 金丝雀流量配置
|
||||
// +kubebuilder:object:generate=true
|
||||
type CanaryTraffic struct {
|
||||
// 是否启用金丝雀发布
|
||||
// +required
|
||||
Enabled bool `json:"enabled"`
|
||||
|
||||
// 主版本权重(如80),金丝雀版本自动为100-主版本
|
||||
// +optional
|
||||
// +kubebuilder:default=80
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
// +kubebuilder:validation:Maximum=100
|
||||
MainWeight int32 `json:"mainWeight,omitempty"`
|
||||
|
||||
// 金丝雀版本标签(如"v2")
|
||||
// +optional
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
CanaryVersion string `json:"canaryVersion,omitempty"`
|
||||
}
|
||||
|
||||
// TrafficPolicy 定义服务网格流量治理策略
|
||||
// +kubebuilder:object:generate=true
|
||||
type TrafficPolicy struct {
|
||||
// 金丝雀发布配置(已有)
|
||||
// +optional
|
||||
Canary *CanaryTraffic `json:"canary,omitempty"`
|
||||
|
||||
// 超时配置(毫秒)
|
||||
// +optional
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
Timeout int32 `json:"timeout,omitempty"`
|
||||
|
||||
// 重试策略
|
||||
// +optional
|
||||
Retry *RetryPolicy `json:"retry,omitempty"`
|
||||
|
||||
// 熔断配置
|
||||
// +optional
|
||||
CircuitBreaker *CircuitBreaker `json:"circuitBreaker,omitempty"`
|
||||
|
||||
// 流量镜像配置
|
||||
// +optional
|
||||
Mirror *MirrorConfig `json:"mirror,omitempty"`
|
||||
|
||||
// 负载均衡策略
|
||||
// +optional
|
||||
LoadBalancer *LoadBalancerSettings `json:"loadBalancer,omitempty"`
|
||||
|
||||
// 故障注入(用于测试)
|
||||
// +optional
|
||||
FaultInjection *FaultInjection `json:"faultInjection,omitempty"`
|
||||
}
|
||||
|
||||
// RetryPolicy 重试策略配置
|
||||
// +kubebuilder:object:generate=true
|
||||
type RetryPolicy struct {
|
||||
// 重试次数
|
||||
// +required
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
Attempts int32 `json:"attempts"`
|
||||
|
||||
// 每次重试超时时间(毫秒)
|
||||
// +optional
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
PerTryTimeout int32 `json:"perTryTimeout,omitempty"`
|
||||
|
||||
// 重试条件
|
||||
// +optional
|
||||
// +listType=set
|
||||
RetryOn []string `json:"retryOn,omitempty"`
|
||||
}
|
||||
|
||||
// CircuitBreaker 熔断器配置
|
||||
// +kubebuilder:object:generate=true
|
||||
type CircuitBreaker struct {
|
||||
// 连续错误阈值
|
||||
// +required
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
ConsecutiveErrors int32 `json:"consecutiveErrors"`
|
||||
|
||||
// 熔断恢复时间(秒)
|
||||
// +required
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
BaseEjectionTime int32 `json:"baseEjectionTime"`
|
||||
|
||||
// 最大熔断实例百分比(1-100)
|
||||
// +optional
|
||||
// +kubebuilder:default=100
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
// +kubebuilder:validation:Maximum=100
|
||||
MaxEjectionPercent int32 `json:"maxEjectionPercent,omitempty"`
|
||||
}
|
||||
|
||||
// MirrorConfig 流量镜像配置
|
||||
// +kubebuilder:object:generate=true
|
||||
type MirrorConfig struct {
|
||||
// 镜像目标服务
|
||||
// +required
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
TargetService string `json:"targetService"`
|
||||
|
||||
// 目标服务端口
|
||||
// +optional
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=65535
|
||||
TargetPort int32 `json:"targetPort,omitempty"`
|
||||
|
||||
// 镜像流量百分比(1-100)
|
||||
// +optional
|
||||
// +kubebuilder:default=100
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
// +kubebuilder:validation:Maximum=100
|
||||
Percentage int32 `json:"percentage,omitempty"`
|
||||
}
|
||||
|
||||
// LoadBalancerSettings 负载均衡设置
|
||||
// +kubebuilder:object:generate=true
|
||||
// +kubebuilder:validation:XValidation:rule="has(self.simple) != has(self.consistentHash)",message="必须指定simple或consistentHash其中之一,且只能指定一个"
|
||||
type LoadBalancerSettings struct {
|
||||
// 负载均衡模式
|
||||
// +optional
|
||||
// +kubebuilder:default="ROUND_ROBIN"
|
||||
// +kubebuilder:validation:Enum=ROUND_ROBIN;LEAST_CONN;RANDOM;PASSTHROUGH
|
||||
Simple string `json:"simple,omitempty"`
|
||||
|
||||
// 一致性哈希配置
|
||||
// +optional
|
||||
ConsistentHash *ConsistentHashLB `json:"consistentHash,omitempty"`
|
||||
}
|
||||
|
||||
// ConsistentHashLB 一致性哈希负载均衡
|
||||
// +kubebuilder:object:generate=true
|
||||
// +kubebuilder:validation:XValidation:rule="(has(self.httpHeaderName) ? 1 : 0) + (has(self.httpCookie) ? 1 : 0) + (self.useSourceIp ? 1 : 0) == 1",message="必须且只能指定httpHeaderName、httpCookie或useSourceIp其中之一"
|
||||
type ConsistentHashLB struct {
|
||||
// HTTP头部哈希
|
||||
// +optional
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
HttpHeaderName string `json:"httpHeaderName,omitempty"`
|
||||
|
||||
// HTTP Cookie哈希
|
||||
// +optional
|
||||
HttpCookie *HTTPCookie `json:"httpCookie,omitempty"`
|
||||
|
||||
// 使用源IP
|
||||
// +optional
|
||||
// +kubebuilder:default=false
|
||||
UseSourceIp bool `json:"useSourceIp,omitempty"`
|
||||
}
|
||||
|
||||
// HTTPCookie HTTP Cookie配置
|
||||
// +kubebuilder:object:generate=true
|
||||
type HTTPCookie struct {
|
||||
// Cookie名称
|
||||
// +required
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
Name string `json:"name"`
|
||||
|
||||
// Cookie路径
|
||||
// +optional
|
||||
Path string `json:"path,omitempty"`
|
||||
|
||||
// Cookie过期时间(秒)
|
||||
// +optional
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
Ttl int32 `json:"ttl,omitempty"`
|
||||
}
|
||||
|
||||
// FaultInjection 故障注入配置
|
||||
// +kubebuilder:object:generate=true
|
||||
type FaultInjection struct {
|
||||
// 延迟注入
|
||||
// +optional
|
||||
Delay *DelayInjection `json:"delay,omitempty"`
|
||||
|
||||
// 中止注入
|
||||
// +optional
|
||||
Abort *AbortInjection `json:"abort,omitempty"`
|
||||
}
|
||||
|
||||
// DelayInjection 延迟注入配置
|
||||
// +kubebuilder:object:generate=true
|
||||
type DelayInjection struct {
|
||||
// 固定延迟时间(毫秒)
|
||||
// +required
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
FixedDelay int32 `json:"fixedDelay"`
|
||||
|
||||
// 注入百分比(0-100)
|
||||
// +optional
|
||||
// +kubebuilder:default=100
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
// +kubebuilder:validation:Maximum=100
|
||||
Percentage int32 `json:"percentage,omitempty"`
|
||||
}
|
||||
|
||||
// AbortInjection 中止注入配置
|
||||
// +kubebuilder:object:generate=true
|
||||
type AbortInjection struct {
|
||||
// HTTP状态码
|
||||
// +required
|
||||
// +kubebuilder:validation:Minimum=100
|
||||
// +kubebuilder:validation:Maximum=599
|
||||
HttpStatus int32 `json:"httpStatus"`
|
||||
|
||||
// 注入百分比(0-100)
|
||||
// +optional
|
||||
// +kubebuilder:default=100
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
// +kubebuilder:validation:Maximum=100
|
||||
Percentage int32 `json:"percentage,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationTemplate defines the application template
|
||||
type ApplicationTemplate struct {
|
||||
// Image defines the container image
|
||||
// +required
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
Image string `json:"image"`
|
||||
|
||||
// Type defines the application type (stateless/stateful)
|
||||
// +optional
|
||||
// +kubebuilder:default="stateless"
|
||||
// +kubebuilder:validation:Enum=stateless;stateful
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
// Ports defines the container ports
|
||||
// +optional
|
||||
Ports []Port `json:"ports,omitempty"`
|
||||
|
||||
// HealthCheck defines health check configuration
|
||||
// +optional
|
||||
HealthCheck *HealthCheck `json:"healthCheck,omitempty"`
|
||||
|
||||
// Command defines the container command
|
||||
// +optional
|
||||
Command []string `json:"command,omitempty"`
|
||||
|
||||
// Args defines the container arguments
|
||||
// +optional
|
||||
Args []string `json:"args,omitempty"`
|
||||
}
|
||||
|
||||
// Port defines a port configuration
|
||||
type Port struct {
|
||||
// Name defines the port name
|
||||
// +required
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
Name string `json:"name"`
|
||||
|
||||
// Port defines the port number
|
||||
// +required
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=65535
|
||||
Port int32 `json:"port"`
|
||||
|
||||
// Protocol defines the port protocol
|
||||
// +optional
|
||||
// +kubebuilder:default="TCP"
|
||||
// +kubebuilder:validation:Enum=TCP;UDP
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
}
|
||||
|
||||
// HealthCheck defines health check configuration
|
||||
type HealthCheck struct {
|
||||
// HTTPGet defines HTTP health check
|
||||
// +optional
|
||||
HTTPGet *HTTPGetAction `json:"httpGet,omitempty"`
|
||||
}
|
||||
|
||||
// HTTPGetAction defines HTTP health check action
|
||||
type HTTPGetAction struct {
|
||||
// Path defines the HTTP path
|
||||
// +required
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
Path string `json:"path"`
|
||||
|
||||
// Port defines the HTTP port
|
||||
// +required
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=65535
|
||||
Port int32 `json:"port"`
|
||||
}
|
||||
|
||||
// ResourceRequirements defines resource requirements
|
||||
type ResourceRequirements struct {
|
||||
// CPU defines CPU resource requirement
|
||||
// +optional
|
||||
// +kubebuilder:validation:Pattern=`^(\d+m|\d+(\.\d+)?)$`
|
||||
CPU string `json:"cpu,omitempty"`
|
||||
|
||||
// Memory defines memory resource requirement
|
||||
// +optional
|
||||
// +kubebuilder:validation:Pattern=`^(\d+(Ki|Mi|Gi|Ti|Pi|Ei|k|M|G|T|P|E)?)$`
|
||||
Memory string `json:"memory,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceConfig defines service configuration
|
||||
type ServiceConfig struct {
|
||||
// Enabled defines whether to create service
|
||||
// +optional
|
||||
// +kubebuilder:default=false
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
|
||||
// Type defines the service type
|
||||
// +optional
|
||||
// +kubebuilder:default="ClusterIP"
|
||||
// +kubebuilder:validation:Enum=ClusterIP;NodePort;LoadBalancer;ExternalName
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
// Ports defines custom service ports (if not specified, uses template ports)
|
||||
// +optional
|
||||
Ports []ServicePort `json:"ports,omitempty"`
|
||||
|
||||
// NodePorts defines specific node ports for NodePort type services
|
||||
// +optional
|
||||
NodePorts map[string]int32 `json:"nodePorts,omitempty"`
|
||||
|
||||
// LoadBalancerIP defines the IP for LoadBalancer type services
|
||||
// +optional
|
||||
LoadBalancerIP string `json:"loadBalancerIP,omitempty"`
|
||||
|
||||
// LoadBalancerSourceRanges defines allowed source ranges for LoadBalancer
|
||||
// +optional
|
||||
LoadBalancerSourceRanges []string `json:"loadBalancerSourceRanges,omitempty"`
|
||||
|
||||
// ExternalName defines external service name for ExternalName type
|
||||
// +optional
|
||||
ExternalName string `json:"externalName,omitempty"`
|
||||
|
||||
// SessionAffinity defines session affinity
|
||||
// +optional
|
||||
// +kubebuilder:default="None"
|
||||
// +kubebuilder:validation:Enum=None;ClientIP
|
||||
SessionAffinity string `json:"sessionAffinity,omitempty"`
|
||||
|
||||
// Annotations defines additional annotations for service
|
||||
// +optional
|
||||
Annotations map[string]string `json:"annotations,omitempty"`
|
||||
|
||||
// Labels defines additional labels for service
|
||||
// +optional
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// ServicePort defines a service port configuration
|
||||
type ServicePort struct {
|
||||
// Name defines the port name
|
||||
// +required
|
||||
// +kubebuilder:validation:MinLength=1
|
||||
Name string `json:"name"`
|
||||
|
||||
// Port defines the service port
|
||||
// +required
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=65535
|
||||
Port int32 `json:"port"`
|
||||
|
||||
// TargetPort defines the target port (can be port number or name)
|
||||
// +optional
|
||||
TargetPort string `json:"targetPort,omitempty"`
|
||||
|
||||
// Protocol defines the port protocol
|
||||
// +optional
|
||||
// +kubebuilder:default="TCP"
|
||||
// +kubebuilder:validation:Enum=TCP;UDP;SCTP
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
|
||||
// NodePort defines the node port for NodePort type (30000-32767)
|
||||
// +optional
|
||||
// +kubebuilder:validation:Minimum=30000
|
||||
// +kubebuilder:validation:Maximum=32767
|
||||
NodePort int32 `json:"nodePort,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationStatus defines the observed state of Application
|
||||
type ApplicationStatus struct {
|
||||
// Phase defines the current phase of the application
|
||||
// +optional
|
||||
// +kubebuilder:validation:Enum=Pending;Running;Scaling;Failed
|
||||
Phase string `json:"phase,omitempty"`
|
||||
|
||||
// ReadyReplicas defines the number of ready replicas
|
||||
// +optional
|
||||
ReadyReplicas int32 `json:"readyReplicas,omitempty"`
|
||||
|
||||
// Replicas defines the total number of replicas
|
||||
// +optional
|
||||
Replicas int32 `json:"replicas,omitempty"`
|
||||
|
||||
// Message defines a human-readable message
|
||||
// +optional
|
||||
Message string `json:"message,omitempty"`
|
||||
|
||||
// LastUpdated defines when the status was last updated
|
||||
// +optional
|
||||
LastUpdated metav1.Time `json:"lastUpdated,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:resource:scope=Namespaced
|
||||
// +kubebuilder:printcolumn:name="Image",type=string,JSONPath=".spec.template.image"
|
||||
// +kubebuilder:printcolumn:name="Replicas",type=integer,JSONPath=".spec.replicas"
|
||||
// +kubebuilder:printcolumn:name="Ready",type=integer,JSONPath=".status.readyReplicas"
|
||||
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=".status.phase"
|
||||
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=".metadata.creationTimestamp"
|
||||
|
||||
// Application is the Schema for the applications API
|
||||
type Application struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
||||
// metadata is a standard object metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// spec defines the desired state of Application
|
||||
// +required
|
||||
Spec ApplicationSpec `json:"spec"`
|
||||
|
||||
// status defines the observed state of Application
|
||||
// +optional
|
||||
Status ApplicationStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ApplicationList contains a list of Application
|
||||
type ApplicationList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Application `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&Application{}, &ApplicationList{})
|
||||
}
|
36
modules/k8s/api/application/v1/groupversion_info.go
Normal file
36
modules/k8s/api/application/v1/groupversion_info.go
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
Copyright 2025.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
// Package v1 contains API Schema definitions for the application v1 API group.
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=application.devstar.cn
|
||||
package v1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
var (
|
||||
// GroupVersion is group version used to register these objects.
|
||||
GroupVersion = schema.GroupVersion{Group: "application.devstar.cn", Version: "v1"}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
|
||||
|
||||
// AddToScheme adds the types in this group-version to the given scheme.
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
774
modules/k8s/api/application/v1/zz_generated.deepcopy.go
Normal file
774
modules/k8s/api/application/v1/zz_generated.deepcopy.go
Normal file
@@ -0,0 +1,774 @@
|
||||
//go:build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2025.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by controller-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *AbortInjection) DeepCopyInto(out *AbortInjection) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AbortInjection.
|
||||
func (in *AbortInjection) DeepCopy() *AbortInjection {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(AbortInjection)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Application) DeepCopyInto(out *Application) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Application.
|
||||
func (in *Application) DeepCopy() *Application {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Application)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Application) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationList) DeepCopyInto(out *ApplicationList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Application, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationList.
|
||||
func (in *ApplicationList) DeepCopy() *ApplicationList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ApplicationList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationSpec) DeepCopyInto(out *ApplicationSpec) {
|
||||
*out = *in
|
||||
in.Template.DeepCopyInto(&out.Template)
|
||||
if in.Replicas != nil {
|
||||
in, out := &in.Replicas, &out.Replicas
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.Environment != nil {
|
||||
in, out := &in.Environment, &out.Environment
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
out.Resources = in.Resources
|
||||
if in.Service != nil {
|
||||
in, out := &in.Service, &out.Service
|
||||
*out = new(ServiceConfig)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.NetworkPolicy != nil {
|
||||
in, out := &in.NetworkPolicy, &out.NetworkPolicy
|
||||
*out = new(NetworkPolicy)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.TrafficPolicy != nil {
|
||||
in, out := &in.TrafficPolicy, &out.TrafficPolicy
|
||||
*out = new(TrafficPolicy)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationSpec.
|
||||
func (in *ApplicationSpec) DeepCopy() *ApplicationSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationStatus) DeepCopyInto(out *ApplicationStatus) {
|
||||
*out = *in
|
||||
in.LastUpdated.DeepCopyInto(&out.LastUpdated)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationStatus.
|
||||
func (in *ApplicationStatus) DeepCopy() *ApplicationStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationTemplate) DeepCopyInto(out *ApplicationTemplate) {
|
||||
*out = *in
|
||||
if in.Ports != nil {
|
||||
in, out := &in.Ports, &out.Ports
|
||||
*out = make([]Port, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.HealthCheck != nil {
|
||||
in, out := &in.HealthCheck, &out.HealthCheck
|
||||
*out = new(HealthCheck)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Command != nil {
|
||||
in, out := &in.Command, &out.Command
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Args != nil {
|
||||
in, out := &in.Args, &out.Args
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationTemplate.
|
||||
func (in *ApplicationTemplate) DeepCopy() *ApplicationTemplate {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationTemplate)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CanaryTraffic) DeepCopyInto(out *CanaryTraffic) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CanaryTraffic.
|
||||
func (in *CanaryTraffic) DeepCopy() *CanaryTraffic {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CanaryTraffic)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CircuitBreaker) DeepCopyInto(out *CircuitBreaker) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CircuitBreaker.
|
||||
func (in *CircuitBreaker) DeepCopy() *CircuitBreaker {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CircuitBreaker)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ConsistentHashLB) DeepCopyInto(out *ConsistentHashLB) {
|
||||
*out = *in
|
||||
if in.HttpCookie != nil {
|
||||
in, out := &in.HttpCookie, &out.HttpCookie
|
||||
*out = new(HTTPCookie)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConsistentHashLB.
|
||||
func (in *ConsistentHashLB) DeepCopy() *ConsistentHashLB {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ConsistentHashLB)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DelayInjection) DeepCopyInto(out *DelayInjection) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DelayInjection.
|
||||
func (in *DelayInjection) DeepCopy() *DelayInjection {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DelayInjection)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FaultInjection) DeepCopyInto(out *FaultInjection) {
|
||||
*out = *in
|
||||
if in.Delay != nil {
|
||||
in, out := &in.Delay, &out.Delay
|
||||
*out = new(DelayInjection)
|
||||
**out = **in
|
||||
}
|
||||
if in.Abort != nil {
|
||||
in, out := &in.Abort, &out.Abort
|
||||
*out = new(AbortInjection)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FaultInjection.
|
||||
func (in *FaultInjection) DeepCopy() *FaultInjection {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FaultInjection)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GatewayConfig) DeepCopyInto(out *GatewayConfig) {
|
||||
*out = *in
|
||||
if in.Ports != nil {
|
||||
in, out := &in.Ports, &out.Ports
|
||||
*out = make([]GatewayPort, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Hosts != nil {
|
||||
in, out := &in.Hosts, &out.Hosts
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.TLS != nil {
|
||||
in, out := &in.TLS, &out.TLS
|
||||
*out = make([]GatewayTLS, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.Annotations != nil {
|
||||
in, out := &in.Annotations, &out.Annotations
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayConfig.
|
||||
func (in *GatewayConfig) DeepCopy() *GatewayConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GatewayConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GatewayPort) DeepCopyInto(out *GatewayPort) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayPort.
|
||||
func (in *GatewayPort) DeepCopy() *GatewayPort {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GatewayPort)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GatewayTLS) DeepCopyInto(out *GatewayTLS) {
|
||||
*out = *in
|
||||
if in.Hosts != nil {
|
||||
in, out := &in.Hosts, &out.Hosts
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayTLS.
|
||||
func (in *GatewayTLS) DeepCopy() *GatewayTLS {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GatewayTLS)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HTTPCookie) DeepCopyInto(out *HTTPCookie) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPCookie.
|
||||
func (in *HTTPCookie) DeepCopy() *HTTPCookie {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HTTPCookie)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HTTPGetAction) DeepCopyInto(out *HTTPGetAction) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPGetAction.
|
||||
func (in *HTTPGetAction) DeepCopy() *HTTPGetAction {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HTTPGetAction)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HTTPMatchRequest) DeepCopyInto(out *HTTPMatchRequest) {
|
||||
*out = *in
|
||||
if in.URI != nil {
|
||||
in, out := &in.URI, &out.URI
|
||||
*out = new(StringMatch)
|
||||
**out = **in
|
||||
}
|
||||
if in.Method != nil {
|
||||
in, out := &in.Method, &out.Method
|
||||
*out = new(StringMatch)
|
||||
**out = **in
|
||||
}
|
||||
if in.Headers != nil {
|
||||
in, out := &in.Headers, &out.Headers
|
||||
*out = make(map[string]StringMatch, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPMatchRequest.
|
||||
func (in *HTTPMatchRequest) DeepCopy() *HTTPMatchRequest {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HTTPMatchRequest)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *HealthCheck) DeepCopyInto(out *HealthCheck) {
|
||||
*out = *in
|
||||
if in.HTTPGet != nil {
|
||||
in, out := &in.HTTPGet, &out.HTTPGet
|
||||
*out = new(HTTPGetAction)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HealthCheck.
|
||||
func (in *HealthCheck) DeepCopy() *HealthCheck {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(HealthCheck)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *LoadBalancerSettings) DeepCopyInto(out *LoadBalancerSettings) {
|
||||
*out = *in
|
||||
if in.ConsistentHash != nil {
|
||||
in, out := &in.ConsistentHash, &out.ConsistentHash
|
||||
*out = new(ConsistentHashLB)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancerSettings.
|
||||
func (in *LoadBalancerSettings) DeepCopy() *LoadBalancerSettings {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(LoadBalancerSettings)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MeshConfig) DeepCopyInto(out *MeshConfig) {
|
||||
*out = *in
|
||||
if in.Sidecar != nil {
|
||||
in, out := &in.Sidecar, &out.Sidecar
|
||||
*out = new(SidecarConfig)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Routes != nil {
|
||||
in, out := &in.Routes, &out.Routes
|
||||
*out = make([]RouteConfig, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.CircuitBreaker != nil {
|
||||
in, out := &in.CircuitBreaker, &out.CircuitBreaker
|
||||
*out = new(CircuitBreaker)
|
||||
**out = **in
|
||||
}
|
||||
if in.Retry != nil {
|
||||
in, out := &in.Retry, &out.Retry
|
||||
*out = new(RetryPolicy)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.FaultInjection != nil {
|
||||
in, out := &in.FaultInjection, &out.FaultInjection
|
||||
*out = new(FaultInjection)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.LoadBalancer != nil {
|
||||
in, out := &in.LoadBalancer, &out.LoadBalancer
|
||||
*out = new(LoadBalancerSettings)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MeshConfig.
|
||||
func (in *MeshConfig) DeepCopy() *MeshConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MeshConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *MirrorConfig) DeepCopyInto(out *MirrorConfig) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MirrorConfig.
|
||||
func (in *MirrorConfig) DeepCopy() *MirrorConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(MirrorConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NetworkPolicy) DeepCopyInto(out *NetworkPolicy) {
|
||||
*out = *in
|
||||
if in.Gateway != nil {
|
||||
in, out := &in.Gateway, &out.Gateway
|
||||
*out = new(GatewayConfig)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Mesh != nil {
|
||||
in, out := &in.Mesh, &out.Mesh
|
||||
*out = new(MeshConfig)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkPolicy.
|
||||
func (in *NetworkPolicy) DeepCopy() *NetworkPolicy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NetworkPolicy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Port) DeepCopyInto(out *Port) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Port.
|
||||
func (in *Port) DeepCopy() *Port {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Port)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourceRequirements) DeepCopyInto(out *ResourceRequirements) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceRequirements.
|
||||
func (in *ResourceRequirements) DeepCopy() *ResourceRequirements {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ResourceRequirements)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RetryPolicy) DeepCopyInto(out *RetryPolicy) {
|
||||
*out = *in
|
||||
if in.RetryOn != nil {
|
||||
in, out := &in.RetryOn, &out.RetryOn
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetryPolicy.
|
||||
func (in *RetryPolicy) DeepCopy() *RetryPolicy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RetryPolicy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RouteConfig) DeepCopyInto(out *RouteConfig) {
|
||||
*out = *in
|
||||
if in.Match != nil {
|
||||
in, out := &in.Match, &out.Match
|
||||
*out = new(HTTPMatchRequest)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
out.Destination = in.Destination
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteConfig.
|
||||
func (in *RouteConfig) DeepCopy() *RouteConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RouteConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RouteDestination) DeepCopyInto(out *RouteDestination) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteDestination.
|
||||
func (in *RouteDestination) DeepCopy() *RouteDestination {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RouteDestination)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceConfig) DeepCopyInto(out *ServiceConfig) {
|
||||
*out = *in
|
||||
if in.Ports != nil {
|
||||
in, out := &in.Ports, &out.Ports
|
||||
*out = make([]ServicePort, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.NodePorts != nil {
|
||||
in, out := &in.NodePorts, &out.NodePorts
|
||||
*out = make(map[string]int32, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.LoadBalancerSourceRanges != nil {
|
||||
in, out := &in.LoadBalancerSourceRanges, &out.LoadBalancerSourceRanges
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Annotations != nil {
|
||||
in, out := &in.Annotations, &out.Annotations
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.Labels != nil {
|
||||
in, out := &in.Labels, &out.Labels
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceConfig.
|
||||
func (in *ServiceConfig) DeepCopy() *ServiceConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServicePort) DeepCopyInto(out *ServicePort) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServicePort.
|
||||
func (in *ServicePort) DeepCopy() *ServicePort {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServicePort)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SidecarConfig) DeepCopyInto(out *SidecarConfig) {
|
||||
*out = *in
|
||||
if in.Resources != nil {
|
||||
in, out := &in.Resources, &out.Resources
|
||||
*out = new(ResourceRequirements)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SidecarConfig.
|
||||
func (in *SidecarConfig) DeepCopy() *SidecarConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SidecarConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *StringMatch) DeepCopyInto(out *StringMatch) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StringMatch.
|
||||
func (in *StringMatch) DeepCopy() *StringMatch {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(StringMatch)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TrafficPolicy) DeepCopyInto(out *TrafficPolicy) {
|
||||
*out = *in
|
||||
if in.Canary != nil {
|
||||
in, out := &in.Canary, &out.Canary
|
||||
*out = new(CanaryTraffic)
|
||||
**out = **in
|
||||
}
|
||||
if in.Retry != nil {
|
||||
in, out := &in.Retry, &out.Retry
|
||||
*out = new(RetryPolicy)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.CircuitBreaker != nil {
|
||||
in, out := &in.CircuitBreaker, &out.CircuitBreaker
|
||||
*out = new(CircuitBreaker)
|
||||
**out = **in
|
||||
}
|
||||
if in.Mirror != nil {
|
||||
in, out := &in.Mirror, &out.Mirror
|
||||
*out = new(MirrorConfig)
|
||||
**out = **in
|
||||
}
|
||||
if in.LoadBalancer != nil {
|
||||
in, out := &in.LoadBalancer, &out.LoadBalancer
|
||||
*out = new(LoadBalancerSettings)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.FaultInjection != nil {
|
||||
in, out := &in.FaultInjection, &out.FaultInjection
|
||||
*out = new(FaultInjection)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficPolicy.
|
||||
func (in *TrafficPolicy) DeepCopy() *TrafficPolicy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TrafficPolicy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
177
modules/k8s/api/devcontainer/v1/devcontainerapp_types.go
Normal file
177
modules/k8s/api/devcontainer/v1/devcontainerapp_types.go
Normal file
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
Copyright 2024.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
|
||||
// ExtraPortSpec 定义额外端口配置
|
||||
type ExtraPortSpec struct {
|
||||
// Name 是端口的名称
|
||||
// +optional
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// ContainerPort 是容器内的端口号
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=65535
|
||||
ContainerPort uint16 `json:"containerPort"`
|
||||
|
||||
// ServicePort 是服务暴露的端口号
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +kubebuilder:validation:Maximum=65535
|
||||
ServicePort uint16 `json:"servicePort"`
|
||||
}
|
||||
|
||||
// ExtraPortAssigned 定义已分配的额外端口信息
|
||||
type ExtraPortAssigned struct {
|
||||
// Name 是端口的名称
|
||||
// +optional
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// ContainerPort 是容器内的端口号
|
||||
ContainerPort uint16 `json:"containerPort"`
|
||||
|
||||
// ServicePort 是服务暴露的端口号
|
||||
ServicePort uint16 `json:"servicePort"`
|
||||
|
||||
// NodePort 是 Kubernetes 分配的 NodePort
|
||||
NodePort uint16 `json:"nodePort"`
|
||||
}
|
||||
|
||||
// DevcontainerAppSpec defines the desired state of DevcontainerApp
|
||||
type DevcontainerAppSpec struct {
|
||||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
|
||||
StatefulSet StatefulSetSpec `json:"statefulset"`
|
||||
// +optional
|
||||
Service ServiceSpec `json:"service"`
|
||||
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
|
||||
// Optional deadline in seconds for starting the job if it misses scheduled
|
||||
// time for any reason. Missed jobs executions will be counted as failed ones.
|
||||
// +optional
|
||||
StartingDeadlineSeconds *int64 `json:"startingDeadlineSeconds,omitempty"`
|
||||
|
||||
// This flag tells the controller to suspend subsequent executions, it does
|
||||
// not apply to already started executions. Defaults to false.
|
||||
// +optional
|
||||
Suspend *bool `json:"suspend,omitempty"`
|
||||
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
|
||||
// The number of successful finished jobs to retain.
|
||||
// This is a pointer to distinguish between explicit zero and not specified.
|
||||
// +optional
|
||||
SuccessfulJobsHistoryLimit *int32 `json:"successfulJobsHistoryLimit,omitempty"`
|
||||
|
||||
// +kubebuilder:validation:Minimum=0
|
||||
|
||||
// The number of failed finished jobs to retain.
|
||||
// This is a pointer to distinguish between explicit zero and not specified.
|
||||
// +optional
|
||||
FailedJobsHistoryLimit *int32 `json:"failedJobsHistoryLimit,omitempty"`
|
||||
}
|
||||
|
||||
// StatefulSetSpec specifies StatefulSet for DevContainer
|
||||
type StatefulSetSpec struct {
|
||||
Image string `json:"image"`
|
||||
Command []string `json:"command"`
|
||||
|
||||
GitRepositoryURL string `json:"gitRepositoryURL"`
|
||||
|
||||
// +kubebuilder:validation:MinItems=1
|
||||
// 至少包含一个 SSH Public Key 才能通过校验规则
|
||||
SSHPublicKeyList []string `json:"sshPublicKeyList"`
|
||||
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +optional
|
||||
ContainerPort uint16 `json:"containerPort,omitempty"`
|
||||
}
|
||||
|
||||
// ServiceSpec specifies Service for DevContainer
|
||||
type ServiceSpec struct {
|
||||
// +kubebuilder:validation:Minimum=30000
|
||||
// +kubebuilder:validation:Maximum=32767
|
||||
// +optional
|
||||
NodePort uint16 `json:"nodePort,omitempty"`
|
||||
|
||||
// +kubebuilder:validation:Minimum=1
|
||||
// +optional
|
||||
ServicePort uint16 `json:"servicePort,omitempty"`
|
||||
|
||||
// ExtraPorts 定义额外的端口配置
|
||||
// +optional
|
||||
ExtraPorts []ExtraPortSpec `json:"extraPorts,omitempty"`
|
||||
}
|
||||
|
||||
// DevcontainerAppStatus defines the observed state of DevcontainerApp
|
||||
type DevcontainerAppStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
|
||||
// A list of pointers to currently running jobs.
|
||||
// +optional
|
||||
Active []corev1.ObjectReference `json:"active,omitempty"`
|
||||
|
||||
// Information when was the last time the job was successfully scheduled.
|
||||
// +optional
|
||||
LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty"`
|
||||
|
||||
// NodePortAssigned 存储 DevcontainerApp CRD调度后集群分配的 NodePort
|
||||
// +optional
|
||||
NodePortAssigned uint16 `json:"nodePortAssigned"`
|
||||
|
||||
// ExtraPortsAssigned 存储额外端口映射的 NodePort
|
||||
// +optional
|
||||
ExtraPortsAssigned []ExtraPortAssigned `json:"extraPortsAssigned,omitempty"`
|
||||
|
||||
// Ready 标识 DevcontainerApp 管理的 Pod 的 Readiness Probe 是否达到就绪状态
|
||||
// +optional
|
||||
Ready bool `json:"ready"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:subresource:status
|
||||
|
||||
// DevcontainerApp is the Schema for the devcontainerapps API
|
||||
type DevcontainerApp struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec DevcontainerAppSpec `json:"spec,omitempty"`
|
||||
Status DevcontainerAppStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// DevcontainerAppList contains a list of DevcontainerApp
|
||||
type DevcontainerAppList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []DevcontainerApp `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&DevcontainerApp{}, &DevcontainerAppList{})
|
||||
}
|
36
modules/k8s/api/devcontainer/v1/groupversion_info.go
Normal file
36
modules/k8s/api/devcontainer/v1/groupversion_info.go
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
Copyright 2024.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
// Package v1 contains API Schema definitions for the devcontainer v1 API group
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=devcontainer.devstar.cn
|
||||
package v1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
var (
|
||||
// GroupVersion is group version used to register these objects
|
||||
GroupVersion = schema.GroupVersion{Group: "devcontainer.devstar.cn", Version: "v1"}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
|
||||
|
||||
// AddToScheme adds the types in this group-version to the given scheme.
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
226
modules/k8s/api/devcontainer/v1/zz_generated.deepcopy.go
Normal file
226
modules/k8s/api/devcontainer/v1/zz_generated.deepcopy.go
Normal file
@@ -0,0 +1,226 @@
|
||||
//go:build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2024.
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by controller-gen. DO NOT EDIT.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DevcontainerApp) DeepCopyInto(out *DevcontainerApp) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DevcontainerApp.
|
||||
func (in *DevcontainerApp) DeepCopy() *DevcontainerApp {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DevcontainerApp)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *DevcontainerApp) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DevcontainerAppList) DeepCopyInto(out *DevcontainerAppList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]DevcontainerApp, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DevcontainerAppList.
|
||||
func (in *DevcontainerAppList) DeepCopy() *DevcontainerAppList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DevcontainerAppList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *DevcontainerAppList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DevcontainerAppSpec) DeepCopyInto(out *DevcontainerAppSpec) {
|
||||
*out = *in
|
||||
in.StatefulSet.DeepCopyInto(&out.StatefulSet)
|
||||
in.Service.DeepCopyInto(&out.Service)
|
||||
if in.StartingDeadlineSeconds != nil {
|
||||
in, out := &in.StartingDeadlineSeconds, &out.StartingDeadlineSeconds
|
||||
*out = new(int64)
|
||||
**out = **in
|
||||
}
|
||||
if in.Suspend != nil {
|
||||
in, out := &in.Suspend, &out.Suspend
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
if in.SuccessfulJobsHistoryLimit != nil {
|
||||
in, out := &in.SuccessfulJobsHistoryLimit, &out.SuccessfulJobsHistoryLimit
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
if in.FailedJobsHistoryLimit != nil {
|
||||
in, out := &in.FailedJobsHistoryLimit, &out.FailedJobsHistoryLimit
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DevcontainerAppSpec.
|
||||
func (in *DevcontainerAppSpec) DeepCopy() *DevcontainerAppSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DevcontainerAppSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DevcontainerAppStatus) DeepCopyInto(out *DevcontainerAppStatus) {
|
||||
*out = *in
|
||||
if in.Active != nil {
|
||||
in, out := &in.Active, &out.Active
|
||||
*out = make([]corev1.ObjectReference, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.LastScheduleTime != nil {
|
||||
in, out := &in.LastScheduleTime, &out.LastScheduleTime
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
if in.ExtraPortsAssigned != nil {
|
||||
in, out := &in.ExtraPortsAssigned, &out.ExtraPortsAssigned
|
||||
*out = make([]ExtraPortAssigned, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DevcontainerAppStatus.
|
||||
func (in *DevcontainerAppStatus) DeepCopy() *DevcontainerAppStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DevcontainerAppStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ExtraPortAssigned) DeepCopyInto(out *ExtraPortAssigned) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtraPortAssigned.
|
||||
func (in *ExtraPortAssigned) DeepCopy() *ExtraPortAssigned {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ExtraPortAssigned)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ExtraPortSpec) DeepCopyInto(out *ExtraPortSpec) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExtraPortSpec.
|
||||
func (in *ExtraPortSpec) DeepCopy() *ExtraPortSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ExtraPortSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ServiceSpec) DeepCopyInto(out *ServiceSpec) {
|
||||
*out = *in
|
||||
if in.ExtraPorts != nil {
|
||||
in, out := &in.ExtraPorts, &out.ExtraPorts
|
||||
*out = make([]ExtraPortSpec, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceSpec.
|
||||
func (in *ServiceSpec) DeepCopy() *ServiceSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ServiceSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *StatefulSetSpec) DeepCopyInto(out *StatefulSetSpec) {
|
||||
*out = *in
|
||||
if in.Command != nil {
|
||||
in, out := &in.Command, &out.Command
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.SSHPublicKeyList != nil {
|
||||
in, out := &in.SSHPublicKeyList, &out.SSHPublicKeyList
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatefulSetSpec.
|
||||
func (in *StatefulSetSpec) DeepCopy() *StatefulSetSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(StatefulSetSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
Reference in New Issue
Block a user