Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
7 changes: 7 additions & 0 deletions api/adc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ func (g *GlobalRule) DeepCopy() GlobalRule {
return GlobalRule(copied)
}

// +k8s:deepcopy-gen=true
type GlobalRuleItem struct {
Metadata `json:",inline" yaml:",inline"`

Plugins Plugins `json:"plugins" yaml:"plugins"`
}

type PluginMetadata Plugins

func (p *PluginMetadata) DeepCopy() PluginMetadata {
Expand Down
17 changes: 17 additions & 0 deletions api/adc/zz_generated.deepcopy.go

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

3 changes: 3 additions & 0 deletions api/v2/apisixroute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,13 @@ type ApisixRoutePlugin struct {
// The plugin name.
Name string `json:"name" yaml:"name"`
// Whether this plugin is in use, default is true.
// +kubebuilder:default=true
Enable bool `json:"enable" yaml:"enable"`
// Plugin configuration.
// +kubebuilder:validation:Optional
Config ApisixRoutePluginConfig `json:"config" yaml:"config"`
// Plugin configuration secretRef.
// +kubebuilder:validation:Optional
SecretRef string `json:"secretRef" yaml:"secretRef"`
}

Expand Down
3 changes: 1 addition & 2 deletions config/crd/bases/apisix.apache.org_apisixglobalrules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ spec:
description: Plugin configuration.
type: object
enable:
default: true
description: Whether this plugin is in use, default is true.
type: boolean
name:
Expand All @@ -64,10 +65,8 @@ spec:
description: Plugin configuration secretRef.
type: string
required:
- config
- enable
- name
- secretRef
type: object
type: array
required:
Expand Down
3 changes: 1 addition & 2 deletions config/crd/bases/apisix.apache.org_apisixpluginconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ spec:
description: Plugin configuration.
type: object
enable:
default: true
description: Whether this plugin is in use, default is true.
type: boolean
name:
Expand All @@ -65,10 +66,8 @@ spec:
description: Plugin configuration secretRef.
type: string
required:
- config
- enable
- name
- secretRef
type: object
type: array
required:
Expand Down
6 changes: 2 additions & 4 deletions config/crd/bases/apisix.apache.org_apisixroutes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ spec:
description: Plugin configuration.
type: object
enable:
default: true
description: Whether this plugin is in use, default is
true.
type: boolean
Expand All @@ -265,10 +266,8 @@ spec:
description: Plugin configuration secretRef.
type: string
required:
- config
- enable
- name
- secretRef
type: object
type: array
priority:
Expand Down Expand Up @@ -374,6 +373,7 @@ spec:
description: Plugin configuration.
type: object
enable:
default: true
description: Whether this plugin is in use, default is
true.
type: boolean
Expand All @@ -384,10 +384,8 @@ spec:
description: Plugin configuration secretRef.
type: string
required:
- config
- enable
- name
- secretRef
type: object
type: array
protocol:
Expand Down
61 changes: 25 additions & 36 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,6 @@ rules:
resources:
- apisixconsumers
- apisixglobalrules
- apisixpluginconfigs
- apisixroutes
- apisixtls
- apisixupstreams
- backendtrafficpolicies
- consumers
- gatewayproxies
- httproutepolicies
- pluginconfigs
verbs:
- get
- list
- watch
- apiGroups:
- apisix.apache.org
resources:
- apisixconsumers/status
- apisixglobalrules/status
- apisixpluginconfigs/status
- apisixroutes/status
- apisixtls/status
- apisixupstreams/status
- backendtrafficpolicies/status
- consumers/status
- httproutepolicies/status
verbs:
- get
- update
- apiGroups:
- apisix.apache.org.github.com
resources:
- apisixconsumers
- apisixglobalrules
- apisixroutes
- apisixtls
- apisixupstreams
Expand All @@ -71,17 +38,16 @@ rules:
- update
- watch
- apiGroups:
- apisix.apache.org.github.com
- apisix.apache.org
resources:
- apisixconsumers/finalizers
- apisixglobalrules/finalizers
- apisixroutes/finalizers
- apisixtls/finalizers
- apisixupstreams/finalizers
verbs:
- update
- apiGroups:
- apisix.apache.org.github.com
- apisix.apache.org
resources:
- apisixconsumers/status
- apisixglobalrules/status
Expand All @@ -92,6 +58,29 @@ rules:
- get
- patch
- update
- apiGroups:
- apisix.apache.org
resources:
- apisixpluginconfigs
- backendtrafficpolicies
- consumers
- gatewayproxies
- httproutepolicies
- pluginconfigs
verbs:
- get
- list
- watch
- apiGroups:
- apisix.apache.org
resources:
- apisixpluginconfigs/status
- backendtrafficpolicies/status
- consumers/status
- httproutepolicies/status
verbs:
- get
- update
- apiGroups:
- coordination.k8s.io
resources:
Expand Down
2 changes: 1 addition & 1 deletion config/samples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ enable_http2: false # Whether to enable HTTP/2 for the serve
probe_addr: ":8081" # The address the probe endpoint binds to.
# The default value is ":8081".

secure_metrics: "" # The secure metrics configuration.
secure_metrics: false # The secure metrics configuration.
# The default value is "" (empty).

exec_adc_timeout: 15s # The timeout for the ADC to execute.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ require (
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/net v0.28.0
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v3 v3.0.1
helm.sh/helm/v3 v3.15.4
k8s.io/api v0.31.1
Expand Down Expand Up @@ -202,6 +201,7 @@ require (
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240701130421-f6361c86f094 // indirect
google.golang.org/grpc v1.66.2 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand Down
6 changes: 3 additions & 3 deletions internal/controller/apisixconsumer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ type ApisixConsumerReconciler struct {
Log logr.Logger
}

// +kubebuilder:rbac:groups=apisix.apache.org.github.com,resources=apisixconsumers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=apisix.apache.org.github.com,resources=apisixconsumers/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=apisix.apache.org.github.com,resources=apisixconsumers/finalizers,verbs=update
// +kubebuilder:rbac:groups=apisix.apache.org,resources=apisixconsumers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=apisix.apache.org,resources=apisixconsumers/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=apisix.apache.org,resources=apisixconsumers/finalizers,verbs=update

// Reconcile FIXME: implement the reconcile logic (For now, it dose nothing other than directly accepting)
func (r *ApisixConsumerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
Expand Down
Loading
Loading