Skip to content

Commit

Permalink
Merge branch 'main' into auth_config_removal
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoszmajsak committed Dec 4, 2023
2 parents 29547c0 + 6d05fa7 commit 0ace964
Show file tree
Hide file tree
Showing 16 changed files with 221 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.19.x
go-version: '1.20'
- run: make
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Go env
uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: '1.20'
- uses: actions/checkout@v4
with:
fetch-depth: 1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.19.x
go-version: '1.20'
- run: make image
11 changes: 10 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
linters-settings:
gci:
sections:
- standard
- default
- blank
- prefix(github.com/maistra/odh-project-controller)
- blank
- dot
govet:
check-shadowing: true
golint:
Expand Down Expand Up @@ -67,7 +75,8 @@ linters:
- exhaustruct
- exhaustivestruct
- forbidigo
- gofmt # We use goimports and when using them both leads to contradicting errors
- goimports
- gofmt # We use gci and when using them both leads to contradicting errors
- gofumpt
- gomnd
- paralleltest
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GOLANG_VERSION=1.19
ARG GOLANG_VERSION=1.20
FROM golang:${GOLANG_VERSION} as builder

WORKDIR /workspace
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ $(LOCALBIN)/goimports:
$(call header,"Installing $(notdir $@)")
GOBIN=$(LOCALBIN) go install -mod=readonly golang.org/x/tools/cmd/goimports

LINT_VERSION=v1.53.3
LINT_VERSION=v1.55.2
$(LOCALBIN)/golangci-lint:
$(call header,"Installing $(notdir $@)")
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(LOCALBIN) $(LINT_VERSION)
133 changes: 130 additions & 3 deletions config/crd/external/authorino.kuadrant.io_authconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.13.0
name: authconfigs.authorino.kuadrant.io
spec:
group: authorino.kuadrant.io
Expand Down Expand Up @@ -295,6 +295,20 @@ spec:
for the request to be authorized.
items:
properties:
all:
description: A list of pattern expressions to be evaluated
as a logical AND.
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
any:
description: A list of pattern expressions to be evaluated
as a logical OR.
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
operator:
description: 'The binary operator to be applied to
the content fetched from the authorization JSON,
Expand Down Expand Up @@ -642,6 +656,20 @@ spec:
enforced; otherwise, the config will be skipped.
items:
properties:
all:
description: A list of pattern expressions to be evaluated
as a logical AND.
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
any:
description: A list of pattern expressions to be evaluated
as a logical OR.
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
operator:
description: 'The binary operator to be applied to the
content fetched from the authorization JSON, for comparison
Expand Down Expand Up @@ -846,7 +874,7 @@ spec:
description: OAuth2 Client ID.
type: string
clientSecretRef:
description: Reference to a Kuberentes Secret key that
description: Reference to a Kubernetes Secret key that
stores that OAuth2 Client Secret.
properties:
key:
Expand Down Expand Up @@ -925,6 +953,20 @@ spec:
be attempted; otherwise, the callback will be skipped.
items:
properties:
all:
description: A list of pattern expressions to be evaluated
as a logical AND.
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
any:
description: A list of pattern expressions to be evaluated
as a logical OR.
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
operator:
description: 'The binary operator to be applied to the
content fetched from the authorization JSON, for comparison
Expand Down Expand Up @@ -1295,6 +1337,11 @@ spec:
name:
description: The name of the JSON property
type: string
overwrite:
default: false
description: Whether the value should overwrite the value
of an existing property with the same name.
type: boolean
value:
description: Static value of the JSON property
x-kubernetes-preserve-unknown-fields: true
Expand Down Expand Up @@ -1470,6 +1517,20 @@ spec:
enforced; otherwise, the config will be skipped.
items:
properties:
all:
description: A list of pattern expressions to be evaluated
as a logical AND.
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
any:
description: A list of pattern expressions to be evaluated
as a logical OR.
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
operator:
description: 'The binary operator to be applied to the
content fetched from the authorization JSON, for comparison
Expand Down Expand Up @@ -1713,7 +1774,7 @@ spec:
description: OAuth2 Client ID.
type: string
clientSecretRef:
description: Reference to a Kuberentes Secret key that
description: Reference to a Kubernetes Secret key that
stores that OAuth2 Client Secret.
properties:
key:
Expand Down Expand Up @@ -1827,6 +1888,20 @@ spec:
applied; otherwise, the config will be skipped.
items:
properties:
all:
description: A list of pattern expressions to be evaluated
as a logical AND.
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
any:
description: A list of pattern expressions to be evaluated
as a logical OR.
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
operator:
description: 'The binary operator to be applied to the
content fetched from the authorization JSON, for comparison
Expand Down Expand Up @@ -1985,6 +2060,30 @@ spec:
description: Name of the custom response. It can be used to
refer to the resolved response object in other configs.
type: string
plain:
description: StaticOrDynamicValue is either a constant static
string value or a config for fetching a value from a dynamic
source (e.g. a path pattern of authorization JSON)
properties:
value:
description: Static value
type: string
valueFrom:
description: Dynamic value
properties:
authJSON:
description: 'Selector to fetch a value from the authorization
JSON. It can be any path pattern to fetch from the
authorization JSON (e.g. ''context.request.http.host'')
or a string template with variable placeholders that
resolve to patterns (e.g. "Hello, {auth.identity.name}!").
Any patterns supported by https://pkg.go.dev/github.com/tidwall/gjson
can be used. The following string modifiers are available:
@extract:{sep:" ",pos:0}, @replace{old:"",new:""},
@case:upper|lower, @base64:encode|decode and @strip.'
type: string
type: object
type: object
priority:
default: 0
description: Priority group of the config. All configs in the
Expand All @@ -1998,6 +2097,20 @@ spec:
config to be enforced; otherwise, the config will be skipped.
items:
properties:
all:
description: A list of pattern expressions to be evaluated
as a logical AND.
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
any:
description: A list of pattern expressions to be evaluated
as a logical OR.
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
operator:
description: 'The binary operator to be applied to the
content fetched from the authorization JSON, for comparison
Expand Down Expand Up @@ -2130,6 +2243,20 @@ spec:
OK.
items:
properties:
all:
description: A list of pattern expressions to be evaluated as
a logical AND.
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
any:
description: A list of pattern expressions to be evaluated as
a logical OR.
items:
type: object
x-kubernetes-preserve-unknown-fields: true
type: array
operator:
description: 'The binary operator to be applied to the content
fetched from the authorization JSON, for comparison with "value".
Expand Down
2 changes: 1 addition & 1 deletion config/crd/external/route.openshift.io_routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
controller-gen.kubebuilder.io/version: v0.13.0
name: routes.route.openshift.io
spec:
group: route.openshift.io
Expand Down
12 changes: 7 additions & 5 deletions controllers/controller_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"testing"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/opendatahub-io/odh-project-controller/controllers"
"github.com/opendatahub-io/odh-project-controller/test/labels"
"go.uber.org/zap/zapcore"
Expand All @@ -20,6 +18,10 @@ import (
"sigs.k8s.io/controller-runtime/pkg/envtest"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/metrics/server"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var (
Expand Down Expand Up @@ -71,9 +73,9 @@ var _ = SynchronizedBeforeSuite(func() {
Expect(cli).NotTo(BeNil())

mgr, err := ctrl.NewManager(cfg, ctrl.Options{
Scheme: testScheme,
LeaderElection: false,
MetricsBindAddress: "0",
Scheme: testScheme,
LeaderElection: false,
Metrics: server.Options{BindAddress: "0"},
})
Expect(err).NotTo(HaveOccurred())

Expand Down
7 changes: 4 additions & 3 deletions controllers/project_mesh_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ import (
"os"
"time"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/opendatahub-io/odh-project-controller/controllers"
. "github.com/opendatahub-io/odh-project-controller/test/cluster"
"github.com/opendatahub-io/odh-project-controller/test/labels"
openshiftv1 "github.com/openshift/api/route/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
maistrav1 "maistra.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/opendatahub-io/odh-project-controller/test/cluster"
)

const (
Expand Down
5 changes: 3 additions & 2 deletions controllers/unit_test.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package controllers_test

import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/opendatahub-io/odh-project-controller/controllers"
"github.com/opendatahub-io/odh-project-controller/test/labels"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var _ = Describe("Controller helper functions", Label(labels.Unit), func() {
Expand Down
Loading

0 comments on commit 0ace964

Please sign in to comment.