github.com/codeready-toolchain/api@v0.0.0-20240507023248-73662d6db2c5/api/v1alpha1/proxyplugin_types.go (about)

     1  package v1alpha1
     2  
     3  import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     4  
     5  // OpenShiftRouteTarget captures the look up information for retrieving an OpenShift Route object in the member cluster.
     6  type OpenShiftRouteTarget struct {
     7  	Namespace string `json:"namespace"`
     8  	Name      string `json:"name"`
     9  }
    10  
    11  // ProxyPluginSpec defines the desired state of ProxyPlugin
    12  // +k8s:openapi-gen=true
    13  type ProxyPluginSpec struct {
    14  	// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
    15  	// Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html
    16  
    17  	// OpenShiftRouteTargetEndpoint is an optional field that represents the look up information for an OpenShift Route
    18  	// as the endpoint for the registration service to proxy requests to that have the https://<proxy-host>/plugins/<ProxyPlugin.ObjectMeta.Name>
    19  	// in its incoming URL.  As we add more types besides OpenShift Routes, we will add more optional fields to this spec
    20  	// object
    21  	// +optional
    22  	OpenShiftRouteTargetEndpoint *OpenShiftRouteTarget `json:"openShiftRouteTargetEndpoint,omitempty"`
    23  }
    24  
    25  // ProxyPluginStatus defines the observed state of ProxyPlugin
    26  // +k8s:openapi-gen=true
    27  type ProxyPluginStatus struct {
    28  	// Important: Run "operator-sdk generate k8s" to regenerate code after modifying this file
    29  	// Add custom validation using kubebuilder tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html
    30  
    31  	// Conditions is an array of current Proxy Plugin conditions
    32  	// Supported condition types: ConditionReady
    33  	// +optional
    34  	// +patchMergeKey=type
    35  	// +patchStrategy=merge
    36  	// +listType=map
    37  	// +listMapKey=type
    38  	Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
    39  }
    40  
    41  //+kubebuilder:object:root=true
    42  //+kubebuilder:subresource:status
    43  
    44  // ProxyPlugin represents the configuration to handle GET's to k8s services in member clusters that first route through
    45  // the registration service running in the sandbox host cluster.  Two forms of URL are supported:
    46  // https://<proxy-host>/plugins/<ProxyPlugin.ObjectMeta.Name>/v1alpha2/<namespace-name>/
    47  // https://<proxy-host>/plugins/<ProxyPlugin.ObjectMeta.Name>/workspaces/<workspace-name>/v1alpha2/<namespace-name>
    48  // +k8s:openapi-gen=true
    49  // +kubebuilder:subresource:status
    50  // +kubebuilder:resource:scope=Namespaced
    51  // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=`.status.conditions[?(@.type=="Ready")].status`
    52  // +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=`.status.conditions[?(@.type=="Ready")].reason`
    53  // +kubebuilder:validation:XPreserveUnknownFields
    54  // +operator-sdk:gen-csv:customresourcedefinitions.displayName="Proxy Plugin"
    55  type ProxyPlugin struct {
    56  	metav1.TypeMeta   `json:",inline"`
    57  	metav1.ObjectMeta `json:"metadata,omitempty"`
    58  
    59  	Spec   ProxyPluginSpec   `json:"spec,omitempty"`
    60  	Status ProxyPluginStatus `json:"status,omitempty"`
    61  }
    62  
    63  //+kubebuilder:object:root=true
    64  
    65  // ProxyPluginList contains a list of ProxyPlugin
    66  type ProxyPluginList struct {
    67  	metav1.TypeMeta `json:",inline"`
    68  	metav1.ListMeta `json:"metadata,omitempty"`
    69  	Items           []ProxyPlugin `json:"items"`
    70  }
    71  
    72  func init() {
    73  	SchemeBuilder.Register(&ProxyPlugin{}, &ProxyPluginList{})
    74  }