Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Remove EnvoyFilter and use WasmPlugin #152

Merged
merged 7 commits into from
Jun 3, 2022
Merged
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
8 changes: 4 additions & 4 deletions .github/workflows/building.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
name: Build manager
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16.x
- name: Set up Go 1.17.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x
go-version: 1.17.x
id: go
- name: Check out code
uses: actions/checkout@v2
Expand All @@ -36,10 +36,10 @@ jobs:
name: Build image
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16.x
- name: Set up Go 1.17.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x
go-version: 1.17.x
id: go
- name: Check out code
uses: actions/checkout@v2
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/code-style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:
importpath: golang.org/x/tools/cmd/goimports

steps:
- name: Set up Go 1.16.x
- name: Set up Go 1.17.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x
go-version: 1.17.x
id: go

- name: Check out code
Expand Down Expand Up @@ -90,10 +90,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Set up Go 1.16.x
- name: Set up Go 1.17.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x
go-version: 1.17.x
id: go

- name: Check out code
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ jobs:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16.x
- name: Set up Go 1.17.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x
go-version: 1.17.x
id: go
- name: Check out code
uses: actions/checkout@v2
Expand All @@ -39,10 +39,10 @@ jobs:
name: Run integration tests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16.x
- name: Set up Go 1.17.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x
go-version: 1.17.x
id: go
- name: Check out code
uses: actions/checkout@v2
Expand All @@ -67,10 +67,10 @@ jobs:
name: Verify istio manifests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16.x
- name: Set up Go 1.17.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x
go-version: 1.17.x
id: go
- name: Check out code
uses: actions/checkout@v2
Expand All @@ -82,10 +82,10 @@ jobs:
name: Verify Gateway API manifests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16.x
- name: Set up Go 1.17.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x
go-version: 1.17.x
id: go
- name: Check out code
uses: actions/checkout@v2
Expand All @@ -97,10 +97,10 @@ jobs:
name: Verify kuadrant manifests
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.16.x
- name: Set up Go 1.17.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x
go-version: 1.17.x
id: go
- name: Check out code
uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ vendor
*.swp
*.swo
*~
.vscode/*

kuadrant-controller
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.16 as builder
FROM golang:1.17 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi

CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.7.0)
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.8.0)

KUSTOMIZE = $(shell pwd)/bin/kustomize
kustomize: ## Download kustomize locally if necessary.
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])

ENVTEST = $(shell pwd)/bin/setup-envtest
envtest: ## Download envtest-setup locally if necessary.
Expand All @@ -234,7 +234,7 @@ TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
go mod init tmp ;\
echo "Downloading $(2)" ;\
GOBIN=$(PROJECT_DIR)/bin go get $(2) ;\
GOBIN=$(PROJECT_DIR)/bin go install $(2) ;\
rm -rf $$TMP_DIR ;\
}
endef
Expand Down Expand Up @@ -306,7 +306,7 @@ kind: ## Download kind locally if necessary.
$(call go-get-tool,$(KIND),sigs.k8s.io/[email protected])

$(GOLANGCI-LINT):
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(PROJECT_PATH)/bin v1.41.1
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(PROJECT_PATH)/bin v1.46.1

.PHONY: golangci-lint
golangci-lint: $(GOLANGCI-LINT) ## Download golangci-lint locally if necessary.
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,13 @@ spec:
EOF
```

To verify wasm envoyfilter has been created:
To verify wasm wasmplugin has been created:

```
kubectl get envoyfilter -A
NAMESPACE NAME AGE
kuadrant-system kuadrant-kuadrant-gwapi-gateway-wasm-ratelimits 3m4s
kubectl get wasmplugin -A
NAMESPACE NAME AGE
kuadrant-system kuadrant-kuadrant-gwapi-gateway-wasm-postauth 16s
kuadrant-system kuadrant-kuadrant-gwapi-gateway-wasm-preauth 16s
```

To verify Limitador's RateLimit resources have been created:
Expand Down
19 changes: 17 additions & 2 deletions apis/apim/v1alpha1/authpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,25 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

securityv1beta1 "istio.io/api/security/v1beta1"
gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
)

type OperationWrapper struct {
Hosts []string `json:"hosts,omitempty"`
NotHosts []string `json:"not_hosts,omitempty"`
Ports []string `json:"ports,omitempty"`
NotPorts []string `json:"not_ports,omitempty"`
Methods []string `json:"methods,omitempty"`
NotMethods []string `json:"not_methods,omitempty"`
Paths []string `json:"paths,omitempty"`
NotPaths []string `json:"not_paths,omitempty"`
}

// TODO(rahul): remove the following wrappers once https://github.com/istio/api/issues/2352 is fixed.
type RuleWrapper struct {
Operations []*OperationWrapper `json:"from,omitempty"`
}

// +kubebuilder:validation:Enum=ALLOW;CUSTOM;DENY;AUDIT
type AuthPolicyAction string

Expand All @@ -18,7 +33,7 @@ type AuthPolicyConfig struct {
Action AuthPolicyAction `json:"action"`

// A list of rules to match the request. A match occurs when at least one rule matches the request.
Rules []securityv1beta1.Rule `json:"rules,omitempty"`
Rules []*RuleWrapper `json:"rules,omitempty"`

// +kubebuilder:default=""
// Specifies detailed configuration of the CUSTOM action. Must be used only with CUSTOM action.
Expand Down
91 changes: 88 additions & 3 deletions apis/apim/v1alpha1/zz_generated.deepcopy.go

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

Loading