Skip to content

chore: add codegen #2488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,11 @@ controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessar
$(CONTROLLER_GEN): $(LOCALBIN)
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))

.PHONY: update-codegen
update-codegen:
@echo "Updating codegen"
./scripts/update-codegen.sh

.PHONY: envtest
envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
$(ENVTEST): $(LOCALBIN)
Expand Down
26 changes: 14 additions & 12 deletions api/adc/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions api/v1alpha1/backendtrafficpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// BackendTrafficPolicy defines configuration for traffic handling policies applied to backend services.
Expand Down Expand Up @@ -124,7 +125,3 @@ type BackendTrafficPolicyList struct {
metav1.ListMeta `json:"metadata,omitempty"`
Items []BackendTrafficPolicy `json:"items"`
}

func init() {
SchemeBuilder.Register(&BackendTrafficPolicy{}, &BackendTrafficPolicyList{})
}
5 changes: 1 addition & 4 deletions api/v1alpha1/consumer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// Consumer defines configuration for a consumer.
Expand Down Expand Up @@ -89,7 +90,3 @@ type ConsumerList struct {
metav1.ListMeta `json:"metadata,omitempty"`
Items []Consumer `json:"items"`
}

func init() {
SchemeBuilder.Register(&Consumer{}, &ConsumerList{})
}
22 changes: 4 additions & 18 deletions api/v1alpha1/groupversion_info.go → api/v1alpha1/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions api/v1alpha1/gatewayproxy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,3 @@ type GatewayProxyPlugin struct {
// Config defines the plugin's configuration details.
Config apiextensionsv1.JSON `json:"config,omitempty"`
}

func init() {
SchemeBuilder.Register(&GatewayProxy{}, &GatewayProxyList{})
}
4 changes: 0 additions & 4 deletions api/v1alpha1/httproutepolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,3 @@ type HTTPRoutePolicyList struct {
metav1.ListMeta `json:"metadata,omitempty"`
Items []HTTPRoutePolicy `json:"items"`
}

func init() {
SchemeBuilder.Register(&HTTPRoutePolicy{}, &HTTPRoutePolicyList{})
}
4 changes: 0 additions & 4 deletions api/v1alpha1/pluginconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,3 @@ type Plugin struct {
// Config is plugin configuration details.
Config apiextensionsv1.JSON `json:"config,omitempty" yaml:"config,omitempty"`
}

func init() {
SchemeBuilder.Register(&PluginConfig{}, &PluginConfigList{})
}
26 changes: 14 additions & 12 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 79 additions & 0 deletions api/v1alpha1/zz_generated.register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 18 additions & 26 deletions api/v2/apisixconsumer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,27 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// ApisixConsumerSpec defines the desired state of ApisixConsumer.
type ApisixConsumerSpec struct {
// IngressClassName is the name of an IngressClass cluster resource.
// The controller uses this field to decide whether the resource should be managed.
IngressClassName string `json:"ingressClassName,omitempty" yaml:"ingressClassName,omitempty"`

// AuthParameter defines the authentication credentials and configuration for this consumer.
AuthParameter ApisixConsumerAuthParameter `json:"authParameter" yaml:"authParameter"`
}

// ApisixConsumerStatus defines the observed state of ApisixConsumer.
type ApisixConsumerStatus = ApisixStatus

// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=ac

// ApisixConsumer defines configuration of a consumer and their authentication details.
// ApisixConsumer is the Schema for the apisixconsumers API.
type ApisixConsumer struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// ApisixConsumerSpec defines the consumer authentication configuration.
Spec ApisixConsumerSpec `json:"spec,omitempty"`
Status ApisixConsumerStatus `json:"status,omitempty"`
Spec ApisixConsumerSpec `json:"spec,omitempty"`
Status ApisixStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
// ApisixConsumerSpec defines the desired state of ApisixConsumer.
type ApisixConsumerSpec struct {
// IngressClassName is the name of an IngressClass cluster resource.
// The controller uses this field to decide whether the resource should be managed.
IngressClassName string `json:"ingressClassName,omitempty" yaml:"ingressClassName,omitempty"`

// ApisixConsumerList contains a list of ApisixConsumer.
type ApisixConsumerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ApisixConsumer `json:"items"`
// AuthParameter defines the authentication credentials and configuration for this consumer.
AuthParameter ApisixConsumerAuthParameter `json:"authParameter" yaml:"authParameter"`
}

type ApisixConsumerAuthParameter struct {
Expand Down Expand Up @@ -194,6 +181,11 @@ type ApisixConsumerLDAPAuthValue struct {
UserDN string `json:"user_dn" yaml:"user_dn"`
}

func init() {
SchemeBuilder.Register(&ApisixConsumer{}, &ApisixConsumerList{})
// +kubebuilder:object:root=true

// ApisixConsumerList contains a list of ApisixConsumer.
type ApisixConsumerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ApisixConsumer `json:"items"`
}
36 changes: 14 additions & 22 deletions api/v2/apisixglobalrule_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,27 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// ApisixGlobalRuleSpec defines configuration for global plugins.
type ApisixGlobalRuleSpec struct {
// IngressClassName is the name of an IngressClass cluster resource.
// The controller uses this field to decide whether the resource should be managed.
IngressClassName string `json:"ingressClassName,omitempty" yaml:"ingressClassName,omitempty"`
// Plugins contain a list of global plugins.
// +kubebuilder:validation:Required
Plugins []ApisixRoutePlugin `json:"plugins" yaml:"plugins"`
}

// ApisixGlobalRuleStatus defines the observed state of ApisixGlobalRule.
type ApisixGlobalRuleStatus = ApisixStatus

// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=agr

// ApisixGlobalRule defines configuration for global plugins.
// ApisixGlobalRule is the Schema for the apisixglobalrules API.
type ApisixGlobalRule struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// ApisixGlobalRuleSpec defines the global plugin configuration.
Spec ApisixGlobalRuleSpec `json:"spec,omitempty"`
Status ApisixGlobalRuleStatus `json:"status,omitempty"`
Spec ApisixGlobalRuleSpec `json:"spec,omitempty"`
Status ApisixStatus `json:"status,omitempty"`
}

// ApisixGlobalRuleSpec defines the desired state of ApisixGlobalRule.
type ApisixGlobalRuleSpec struct {
// IngressClassName is the name of an IngressClass cluster resource.
// The controller uses this field to decide whether the resource should be managed.
IngressClassName string `json:"ingressClassName,omitempty" yaml:"ingressClassName,omitempty"`
// Plugins contain a list of global plugins.
// +kubebuilder:validation:Required
Plugins []ApisixRoutePlugin `json:"plugins" yaml:"plugins"`
}

// +kubebuilder:object:root=true
Expand All @@ -56,7 +52,3 @@ type ApisixGlobalRuleList struct {
metav1.ListMeta `json:"metadata,omitempty"`
Items []ApisixGlobalRule `json:"items"`
}

func init() {
SchemeBuilder.Register(&ApisixGlobalRule{}, &ApisixGlobalRuleList{})
}
Loading