在 client-go 中创建 types.go 时遇到问题。
kind: Kafka
metadata:
name: my-cluster
namespace: sample-system
spec:
kafka:
version: 2.5.0
replicas: 3
listeners:
plain:
authentiation:
type: scram-sha-512
tls:
authentiation:
type: tls
按照下面的“卡夫卡”种类......
我有 Kafka Kind 的架构如下
// Kafka is the Schema for the kafkas API
type Kafka struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec KafkaSpec `json:"spec,omitempty"`
Status KafkaStatus `json:"status,omitempty"`
}
而当我需要定义 Spec.kafka 类型时
// KafkaSpec defines the desired state of KafkaBundle
type KafkaSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
Kafka *Kafka `json:"kafka"`
// Foo is an example field of Kafka. Edit Kafka_types.go to remove/update
Foo string `json:"foo,omitempty"`
}
我面临两种 kafka 结构类型的问题。这是错误的。