lingsamuel commented on a change in pull request #492:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/492#discussion_r642164982



##########
File path: pkg/kube/apisix/apis/config/v1/types.go
##########
@@ -268,30 +270,58 @@ func (p *Config) DeepCopy() *Config {
 
 // +genclient
 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+// +kubebuilder:resource:shortName=atls
 // +kubebuilder:subresource:status
 // ApisixTls defines SSL resource in APISIX.
 type ApisixTls struct {
        metav1.TypeMeta   `json:",inline" yaml:",inline"`
        metav1.ObjectMeta `json:"metadata,omitempty" yaml:"metadata,omitempty"`
-       Spec              *ApisixTlsSpec        `json:"spec,omitempty" 
yaml:"spec,omitempty"`
-       Status            v2alpha1.ApisixStatus `json:"status,omitempty" 
yaml:"status,omitempty"`
+       Spec              *ApisixTlsSpec `json:"spec,omitempty" 
yaml:"spec,omitempty"`
+       // +optional
+       Status v2alpha1.ApisixStatus `json:"status,omitempty" 
yaml:"status,omitempty"`
 }
 
 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+// +kubebuilder:printcolumn:name="SNIs",type=string,JSONPath=`.spec.hosts`
+// +kubebuilder:printcolumn:name="Secret 
Name",type=string,JSONPath=`.spec.secret.name`
+// +kubebuilder:printcolumn:name="Secret 
Namespace",type=string,JSONPath=`.spec.secret.namespace`
+// 
+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
+// +kubebuilder:printcolumn:name="Client CA Secret 
Name",type=string,JSONPath=`.spec.client.ca.name`
+// +kubebuilder:printcolumn:name="Client CA Secret 
Namespace",type=string,JSONPath=`.spec.client.ca.namespace`
 type ApisixTlsList struct {
        metav1.TypeMeta `json:",inline" yaml:",inline"`
        metav1.ListMeta `json:"metadata" yaml:"metadata"`
        Items           []ApisixTls `json:"items,omitempty" 
yaml:"items,omitempty"`
 }
 
+// +kubebuilder:validation:Pattern="^\\*?[0-9a-zA-Z-.]+$"
+type HostType string
+
 // ApisixTlsSpec is the specification of ApisixSSL.
 type ApisixTlsSpec struct {
-       Hosts  []string     `json:"hosts,omitempty" yaml:"hosts,omitempty"`
-       Secret ApisixSecret `json:"secret,omitempty" yaml:"secret,omitempty"`
+       // +required
+       // +kubebuilder:validation:Required
+       // +kubebuilder:validation:MinItems=1
+       Hosts []HostType `json:"hosts" yaml:"hosts,omitempty"`
+       // +required
+       // +kubebuilder:validation:Required
+       Secret ApisixSecret `json:"secret" yaml:"secret"`
+       // +optional
+       Client *ApisixMutualTlsClientConfig `json:"client,omitempty" 
yaml:"client,omitempty"`
 }
 
 // ApisixSecret describes the Kubernetes Secret name and namespace.
 type ApisixSecret struct {
-       Name      string `json:"name,omitempty" yaml:"name,omitempty"`
-       Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
+       // +kubebuilder:validation:MinLength=1
+       // +kubebuilder:validation:Required
+       Name string `json:"name" yaml:"name"`
+       // +kubebuilder:validation:MinLength=1
+       // +kubebuilder:validation:Required
+       Namespace string `json:"namespace" yaml:"namespace"`
+}
+
+// ApisixMutualTlsClientConfig describes the mutual TLS CA and verify depth
+type ApisixMutualTlsClientConfig struct {
+       CA    ApisixSecret `json:"ca,omitempty" yaml:"ca,omitempty"`

Review comment:
       Trailing `Ref` is unnecessary since we can only "reference" other 
objects.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to