Skip to content
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
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \
#
# Example:
# make check
check: | verify test-unit
check: | verify verify-bindata test-unit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make sure -- CI will run check which means that bindata will also be verified, and in case there's a diff between the api copy and the local copy, we'll get a failed test, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at https://github.com/openshift/release/blob/master/ci-operator/config/openshift/cluster-authentication-operator/openshift-cluster-authentication-operator-master.yaml I don't actually think check is run in CI explicitly, but I added this here since it seemed like a natural fit.

I'll plan to add a new CI check to run this make target today (although it will fail until this PR is merged).

Copy link
Contributor Author

@everettraven everettraven Feb 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created openshift/release#61456 to add verify-bindata as an explicit CI check

.PHONY: check

IMAGE_REGISTRY?=registry.svc.ci.openshift.org
Expand Down Expand Up @@ -86,3 +86,16 @@ export TP_CMD_PATH ?=./cmd/authentication-operator
export TP_CMD_ARGS ?=operator --config=/var/run/configmaps/config/operator-config.yaml --v=2 --terminate-on-files=/var/run/configmaps/trusted-ca-bundle/ca-bundle.crt
export TP_LOCK_CONFIGMAP ?=cluster-authentication-operator-lock
export TP_BUILD_FLAGS ?=-tags ocp

# ensure the rolebindingrestriction CRD is included in bindata
RBR_CRD_SOURCE := vendor/github.com/openshift/api/authorization/v1/zz_generated.crd-manifests/0000_03_config-operator_01_rolebindingrestrictions.crd.yaml
RBR_CRD_TARGET := bindata/oauth-openshift/authorization.openshift.io_rolebindingrestrictions.yaml
update-bindata: $(RBR_CRD_TARGET)
$(RBR_CRD_TARGET): $(RBR_CRD_SOURCE)
cp $< $@

verify-bindata: verify-rbr-crd
.PHONY: verify-bindata

verify-rbr-crd:
diff -Naup $(RBR_CRD_SOURCE) $(RBR_CRD_TARGET)
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
api-approved.openshift.io: https://github.com/openshift/api/pull/470
api.openshift.io/merged-by-featuregates: "true"
include.release.openshift.io/ibm-cloud-managed: "true"
include.release.openshift.io/self-managed-high-availability: "true"
release.openshift.io/bootstrap-required: "true"
name: rolebindingrestrictions.authorization.openshift.io
spec:
group: authorization.openshift.io
names:
kind: RoleBindingRestriction
listKind: RoleBindingRestrictionList
plural: rolebindingrestrictions
singular: rolebindingrestriction
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: |-
RoleBindingRestriction is an object that can be matched against a subject
(user, group, or service account) to determine whether rolebindings on that
subject are allowed in the namespace to which the RoleBindingRestriction
belongs. If any one of those RoleBindingRestriction objects matches
a subject, rolebindings on that subject in the namespace are allowed.

Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: spec defines the matcher.
properties:
grouprestriction:
description: grouprestriction matches against group subjects.
nullable: true
properties:
groups:
description: |-
groups is a list of groups used to match against an individual user's
groups. If the user is a member of one of the whitelisted groups, the user
is allowed to be bound to a role.
items:
type: string
nullable: true
type: array
labels:
description: Selectors specifies a list of label selectors over
group labels.
items:
description: |-
A label selector is a label query over a set of resources. The result of matchLabels and
matchExpressions are ANDed. An empty label selector matches all objects. A null
label selector matches no objects.
properties:
matchExpressions:
description: matchExpressions is a list of label selector
requirements. The requirements are ANDed.
items:
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector
applies to.
type: string
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
nullable: true
type: array
type: object
serviceaccountrestriction:
description: serviceaccountrestriction matches against service-account
subjects.
nullable: true
properties:
namespaces:
description: namespaces specifies a list of literal namespace
names.
items:
type: string
type: array
serviceaccounts:
description: serviceaccounts specifies a list of literal service-account
names.
items:
description: |-
ServiceAccountReference specifies a service account and namespace by their
names.
properties:
name:
description: name is the name of the service account.
type: string
namespace:
description: |-
namespace is the namespace of the service account. Service accounts from
inside the whitelisted namespaces are allowed to be bound to roles. If
Namespace is empty, then the namespace of the RoleBindingRestriction in
which the ServiceAccountReference is embedded is used.
type: string
type: object
type: array
type: object
userrestriction:
description: userrestriction matches against user subjects.
nullable: true
properties:
groups:
description: groups specifies a list of literal group names.
items:
type: string
nullable: true
type: array
labels:
description: Selectors specifies a list of label selectors over
user labels.
items:
description: |-
A label selector is a label query over a set of resources. The result of matchLabels and
matchExpressions are ANDed. An empty label selector matches all objects. A null
label selector matches no objects.
properties:
matchExpressions:
description: matchExpressions is a list of label selector
requirements. The requirements are ANDed.
items:
description: |-
A label selector requirement is a selector that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector
applies to.
type: string
operator:
description: |-
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
type: string
values:
description: |-
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
x-kubernetes-list-type: atomic
required:
- key
- operator
type: object
type: array
x-kubernetes-list-type: atomic
matchLabels:
additionalProperties:
type: string
description: |-
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
type: object
x-kubernetes-map-type: atomic
nullable: true
type: array
users:
description: users specifies a list of literal user names.
items:
type: string
type: array
type: object
type: object
type: object
served: true
storage: true
2 changes: 2 additions & 0 deletions cmd/authentication-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/openshift/cluster-authentication-operator/pkg/cmd/mom"
"github.com/openshift/cluster-authentication-operator/pkg/cmd/operator"
"github.com/openshift/cluster-authentication-operator/pkg/cmd/render"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericiooptions"
"k8s.io/component-base/cli"
Expand Down Expand Up @@ -34,6 +35,7 @@ func NewAuthenticationOperatorCommand() *cobra.Command {
cmd.AddCommand(mom.NewApplyConfigurationCommand(ioStreams))
cmd.AddCommand(mom.NewInputResourcesCommand(ioStreams))
cmd.AddCommand(mom.NewOutputResourcesCommand(ioStreams))
cmd.AddCommand(render.NewRender())

return cmd
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ require (
github.com/openshift/library-go v0.0.0-20250113163708-355465391f40
github.com/openshift/multi-operator-manager v0.0.0-20241205181422-20aa3906b99d
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
go.etcd.io/etcd/client/v3 v3.5.14
golang.org/x/net v0.29.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.31.1
k8s.io/apiextensions-apiserver v0.31.1
k8s.io/apimachinery v0.31.1
k8s.io/apiserver v0.31.1
k8s.io/cli-runtime v0.31.1
Expand Down Expand Up @@ -81,7 +83,6 @@ require (
github.com/robfig/cron v1.2.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.etcd.io/etcd/api/v3 v3.5.14 // indirect
Expand Down Expand Up @@ -113,7 +114,6 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.31.1 // indirect
k8s.io/kms v0.31.1 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.30.3 // indirect
Expand Down
2 changes: 2 additions & 0 deletions pkg/cmd/mom/input_resources_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/openshift/multi-operator-manager/pkg/library/libraryinputresources"
"github.com/spf13/cobra"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/cli-runtime/pkg/genericiooptions"
)

Expand Down Expand Up @@ -63,6 +64,7 @@ func runInputResources(ctx context.Context) (*libraryinputresources.InputResourc
libraryinputresources.ExactServiceAccount("openshift-authentication", "oauth-openshift"),
libraryinputresources.ExactRoleBinding("openshift-config-managed", "system:openshift:oauth-servercert-trust"),
libraryinputresources.ExactRole("openshift-config-managed", "system:openshift:oauth-servercert-trust"),
libraryinputresources.ExactResource(apiextensionsv1.SchemeGroupVersion.Group, apiextensionsv1.SchemeGroupVersion.Version, "customresourcedefinitions", "", "rolebindingrestrictions.authorization.openshift.io"),
},
},
}, nil
Expand Down
3 changes: 3 additions & 0 deletions pkg/cmd/mom/output_resources_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/openshift/multi-operator-manager/pkg/library/libraryoutputresources"
"github.com/spf13/cobra"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/cli-runtime/pkg/genericiooptions"
)

Expand Down Expand Up @@ -56,6 +57,8 @@ func runOutputResources(ctx context.Context) (*libraryoutputresources.OutputReso
// these are used to access resources in the user workload cluster
libraryoutputresources.ExactServiceAccount("openshift-oauth-apiserver", "oauth-apiserver-sa"),
libraryoutputresources.ExactService("openshift-oauth-apiserver", "api"),

libraryoutputresources.ExactResource(apiextensionsv1.SchemeGroupVersion.Group, apiextensionsv1.SchemeGroupVersion.Version, "customresourcedefinitions", "", "rolebindingrestrictions.authorization.openshift.io"),
},
GeneratedNameResources: []libraryoutputresources.GeneratedResourceID{
libraryoutputresources.GeneratedCSR("system:openshift:openshift-authenticator-"),
Expand Down
Loading