tokers commented on a change in pull request #694:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/694#discussion_r754163982



##########
File path: pkg/kube/apisix/apis/config/v2beta2/types.go
##########
@@ -195,3 +195,40 @@ type ApisixRouteList struct {
        metav1.ListMeta `json:"metadata" yaml:"metadata"`
        Items           []ApisixRoute `json:"items,omitempty" 
yaml:"items,omitempty"`
 }
+
+// +genclient
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+// +kubebuilder:subresource:status
+
+// ApisixPluginConfig is the Schema for the ApisixPluginConfig resource.
+// An ApisixPluginConfig is used to support a group of plugin configs
+type ApisixPluginConfig struct {
+       metav1.TypeMeta   `json:",inline" yaml:",inline"`
+       metav1.ObjectMeta `json:"metadata" yaml:"metadata"`
+
+       // Spec defines the desired state of ApisixPluginConfigSpec.
+       Spec   ApisixPluginConfigSpec `json:"spec" yaml:"spec"`
+       Status v2alpha1.ApisixStatus  `json:"status,omitempty" 
yaml:"status,omitempty"`

Review comment:
       I think the reference from `v2beta2` to `v2alpha1` is not so elegant. Of 
course it doesn't affect this PR's review.
   
   cc @tao12345666333 .

##########
File path: samples/deploy/crd/v1/ApisixPluginConfig.yaml
##########
@@ -0,0 +1,270 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+  name: apisixpluginconfigs.apisix.apache.org
+spec:
+  group: apisix.apache.org
+  scope: Namespaced
+  names:
+    plural: apisixpluginconfigs
+    singular: apisixpluginconfig
+    kind: ApisixPluginConfig
+    shortNames:
+      - apc
+  versions:
+    - name: v1
+      served: true
+      storage: false
+      deprecated: true
+      subresources:
+        status: {}
+      additionalPrinterColumns:
+        - jsonPath: .spec.desc
+          name: Desc
+          type: string
+          priority: 0
+        - jsonPath: .metadata.creationTimestamp
+          name: Age
+          type: date
+          priority: 0
+      schema:
+        openAPIV3Schema:
+          type: object
+          properties:
+            spec:
+              type: object
+              required:
+                - plugins
+              properties:
+                desc:
+                  type: string
+                  minLength: 1
+                plugins:
+                  type: array
+                  items:
+                    type: object
+                    properties:
+                      name:
+                        type: string
+                        minLength: 1
+                      enable:
+                        type: boolean
+                      config:
+                        type: object
+                  required:
+                    - name
+                    - enable
+            status:
+              type: object
+              properties:
+                conditions:
+                  type: array
+                  items:
+                    type: object
+                    properties:
+                      "type":
+                        type: string
+                      reason:
+                        type: string
+                      status:
+                        type: string
+                      message:
+                        type: string
+                      observedGeneration:
+                        type: integer
+    - name: v2alpha1
+      served: true
+      storage: false
+      deprecated: true
+      subresources:
+        status: {}
+      additionalPrinterColumns:
+        - jsonPath: .spec.desc
+          name: Desc
+          type: string
+          priority: 0
+        - jsonPath: .metadata.creationTimestamp
+          name: Age
+          type: date
+          priority: 0
+      schema:
+        openAPIV3Schema:
+          type: object
+          properties:
+            spec:
+              type: object
+              required:
+                - plugins
+              properties:
+                desc:
+                  type: string
+                  minLength: 1
+                plugins:
+                  type: array
+                  items:
+                    type: object
+                    properties:
+                      name:
+                        type: string
+                        minLength: 1
+                      enable:
+                        type: boolean
+                      config:
+                        type: object
+                  required:
+                    - name
+                    - enable
+            status:
+              type: object
+              properties:
+                conditions:
+                  type: array
+                  items:
+                    type: object
+                    properties:
+                      "type":
+                        type: string
+                      reason:
+                        type: string
+                      status:
+                        type: string
+                      message:
+                        type: string
+                      observedGeneration:
+                        type: integer
+    - name: v2beta1
+      served: true
+      storage: false
+      deprecated: true
+      subresources:
+        status: {}
+      additionalPrinterColumns:
+        - jsonPath: .spec.desc
+          name: Desc
+          type: string
+          priority: 0
+        - jsonPath: .metadata.creationTimestamp
+          name: Age
+          type: date
+          priority: 0
+      schema:
+        openAPIV3Schema:
+          type: object
+          properties:
+            spec:
+              type: object
+              required:
+                - plugins
+              properties:
+                desc:
+                  type: string
+                  minLength: 1
+                plugins:
+                  type: array
+                  items:
+                    type: object
+                    properties:
+                      name:
+                        type: string
+                        minLength: 1
+                      enable:
+                        type: boolean
+                      config:
+                        type: object
+                  required:
+                    - name
+                    - enable
+            status:
+              type: object
+              properties:
+                conditions:
+                  type: array
+                  items:
+                    type: object
+                    properties:
+                      "type":
+                        type: string
+                      reason:
+                        type: string
+                      status:
+                        type: string
+                      message:
+                        type: string
+                      observedGeneration:
+                        type: integer
+    - name: v2beta2
+      served: true
+      storage: true
+      subresources:
+        status: {}
+      additionalPrinterColumns:
+        - jsonPath: .spec.desc
+          name: Desc
+          type: string
+          priority: 0
+        - jsonPath: .metadata.creationTimestamp
+          name: Age
+          type: date
+          priority: 0
+      schema:
+        openAPIV3Schema:
+          type: object
+          properties:
+            spec:
+              type: object
+              required:
+                - plugins
+              properties:
+                desc:
+                  type: string
+                  minLength: 1
+                plugins:
+                  type: array
+                  items:
+                    type: object
+                    properties:
+                      name:
+                        type: string
+                        minLength: 1
+                      enable:
+                        type: boolean
+                      config:
+                        type: object
+                  required:
+                    - name
+                    - enable
+            status:
+              type: object
+              properties:
+                conditions:
+                  type: array
+                  items:
+                    type: object
+                    properties:
+                      "type":
+                        type: string
+                      reason:
+                        type: string
+                      status:
+                        type: string
+                      message:
+                        type: string
+                      observedGeneration:
+                        type: integer

Review comment:
       Please add the EOL symbol.

##########
File path: samples/deploy/crd/v1/ApisixPluginConfig.yaml
##########
@@ -0,0 +1,270 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+  name: apisixpluginconfigs.apisix.apache.org
+spec:
+  group: apisix.apache.org
+  scope: Namespaced
+  names:
+    plural: apisixpluginconfigs
+    singular: apisixpluginconfig
+    kind: ApisixPluginConfig
+    shortNames:
+      - apc
+  versions:
+    - name: v1

Review comment:
       Shall we keep the old `v1` version for new objects?

##########
File path: pkg/kube/apisix/apis/config/v2beta2/types.go
##########
@@ -195,3 +195,40 @@ type ApisixRouteList struct {
        metav1.ListMeta `json:"metadata" yaml:"metadata"`
        Items           []ApisixRoute `json:"items,omitempty" 
yaml:"items,omitempty"`
 }
+
+// +genclient
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+// +kubebuilder:subresource:status
+
+// ApisixPluginConfig is the Schema for the ApisixPluginConfig resource.
+// An ApisixPluginConfig is used to support a group of plugin configs
+type ApisixPluginConfig struct {
+       metav1.TypeMeta   `json:",inline" yaml:",inline"`
+       metav1.ObjectMeta `json:"metadata" yaml:"metadata"`
+
+       // Spec defines the desired state of ApisixPluginConfigSpec.
+       Spec   ApisixPluginConfigSpec `json:"spec" yaml:"spec"`
+       Status v2alpha1.ApisixStatus  `json:"status,omitempty" 
yaml:"status,omitempty"`
+}
+
+// ApisixPluginConfigSpec defines the desired state of ApisixPluginConfigSpec.
+type ApisixPluginConfigSpec struct {
+       // +kubebuilder:validation:MinLength=1
+       Desc string `json:"desc,omitempty" yaml:"desc,omitempty"`

Review comment:
       Is this necessary? The `Desc` for the underlying `plugin_config` object 
is used for the management purpose, I think it's not useful for users, they can 
add descriptions from the annotations.




-- 
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.

To unsubscribe, e-mail: [email protected]

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


Reply via email to