github.com/oam-dev/cluster-gateway@v1.9.0/pkg/apis/proxy/v1alpha1/clustergatewayconfigurations.go (about)

     1  package v1alpha1
     2  
     3  import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     4  
     5  func init() {
     6  	SchemeBuilder.Register(&ClusterGatewayConfiguration{}, &ClusterGatewayConfigurationList{})
     7  }
     8  
     9  //+kubebuilder:object:root=true
    10  //+kubebuilder:subresource:status
    11  //+kubebuilder:resource:scope=Cluster
    12  
    13  // +genclient
    14  // +genclient:nonNamespaced
    15  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    16  type ClusterGatewayConfiguration struct {
    17  	metav1.TypeMeta   `json:",inline"`
    18  	metav1.ObjectMeta `json:"metadata,omitempty"`
    19  
    20  	Spec   ClusterGatewayConfigurationSpec   `json:"spec,omitempty"`
    21  	Status ClusterGatewayConfigurationStatus `json:"status,omitempty"`
    22  }
    23  
    24  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    25  type ClusterGatewayConfigurationList struct {
    26  	metav1.TypeMeta `json:",inline"`
    27  	metav1.ListMeta `json:"metadata,omitempty"`
    28  	Items           []ClusterGatewayConfiguration `json:"items"`
    29  }
    30  
    31  type ClusterGatewayConfigurationSpec struct {
    32  	// +required
    33  	Image string `json:"image"`
    34  	// +required
    35  	SecretNamespace string `json:"secretNamespace"`
    36  	// +required
    37  	InstallNamespace string `json:"installNamespace"`
    38  	// +required
    39  	SecretManagement ClusterGatewaySecretManagement `json:"secretManagement"`
    40  	// +required
    41  	Egress ClusterGatewayTrafficEgress `json:"egress"`
    42  }
    43  
    44  type ClusterGatewayConfigurationStatus struct {
    45  	// +optional
    46  	LastObservedGeneration int64 `json:"lastObservedGeneration,omitempty"`
    47  	// +optional
    48  	Conditions []metav1.Condition `json:"conditions,omitempty"`
    49  }
    50  
    51  type ClusterGatewayTrafficEgress struct {
    52  	Type         EgressType                               `json:"type"`
    53  	ClusterProxy *ClusterGatewayTrafficEgressClusterProxy `json:"clusterProxy,omitempty"`
    54  }
    55  
    56  type EgressType string
    57  
    58  const (
    59  	EgressTypeDirect       = "Direct"
    60  	EgressTypeClusterProxy = "ClusterProxy"
    61  )
    62  
    63  type ClusterGatewayTrafficEgressClusterProxy struct {
    64  	ProxyServerHost string                                            `json:"proxyServerHost"`
    65  	ProxyServerPort int32                                             `json:"proxyServerPort"`
    66  	Credentials     ClusterGatewayTrafficEgressClusterProxyCredential `json:"credentials"`
    67  }
    68  
    69  type ClusterGatewayTrafficEgressClusterProxyCredential struct {
    70  	Namespace               string `json:"namespace"`
    71  	ProxyClientSecretName   string `json:"proxyClientSecretName"`
    72  	ProxyClientCASecretName string `json:"proxyClientCASecretName"`
    73  }
    74  
    75  type ClusterGatewaySecretManagement struct {
    76  	// +optional
    77  	// +kubebuilder:default=ManagedServiceAccount
    78  	Type SecretManagementType `json:"type"`
    79  	// +optional
    80  	ManagedServiceAccount *SecretManagementManagedServiceAccount `json:"managedServiceAccount,omitempty"`
    81  }
    82  
    83  // +kubebuilder:validation:Enum=Manual;ManagedServiceAccount
    84  type SecretManagementType string
    85  
    86  const (
    87  	SecretManagementTypeManual                = "Manual"
    88  	SecretManagementTypeManagedServiceAccount = "ManagedServiceAccount"
    89  )
    90  
    91  type SecretManagementManagedServiceAccount struct {
    92  	// +optional
    93  	// +kubebuilder:default=cluster-gateway
    94  	Name string `json:"name"`
    95  }
    96  
    97  const (
    98  	ConditionTypeClusterGatewayDeployed = "ClusterGatewayDeployed"
    99  )