Skip to content

Commit cbe1f67

Browse files
committed
refactoring (and more changes in the copied kubernetes code)
1 parent 49d899e commit cbe1f67

28 files changed

+458
-483
lines changed

.golangci.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ linters:
3838
- unused
3939
- whitespace
4040

41+
issues:
42+
exclude-dirs:
43+
- internal/operator-controller/authorization/internal/kubernetes
44+
4145
linters-settings:
4246
gci:
4347
sections:

Makefile

-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ manifests: $(CONTROLLER_GEN) #EXHELP Generate WebhookConfiguration, ClusterRole,
136136
.PHONY: generate
137137
generate: $(CONTROLLER_GEN) #EXHELP Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
138138
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./api/..."
139-
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./catalogd/api/..."
140139

141140
.PHONY: verify
142141
verify: tidy fmt generate manifests crd-ref-docs #HELP Verify all generated code is up-to-date.

api/v1/clusterextension_types.go

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1
1818

1919
import (
20+
rbacv1 "k8s.io/api/rbac/v1"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
)
2223

@@ -454,6 +455,8 @@ type ClusterExtensionStatus struct {
454455
//
455456
// +optional
456457
Install *ClusterExtensionInstallStatus `json:"install,omitempty"`
458+
459+
MissingRules map[string][]rbacv1.PolicyRule `json:"missingRules,omitempty"`
457460
}
458461

459462
// ClusterExtensionInstallStatus is a representation of the status of the identified bundle.

api/v1/zz_generated.deepcopy.go

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/operator-controller/main.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,7 @@ func run() error {
415415
helmApplier := &applier.Helm{
416416
ActionClientGetter: acg,
417417
Preflights: preflights,
418-
Authorizer: authorization.NewRBACAuthorizer(mgr.GetClient()),
419-
RuleResolver: authorization.NewRBACRulesResolver(mgr.GetClient()),
420-
RestMapper: mgr.GetRESTMapper(),
418+
PreAuthorizer: authorization.NewRBACPreAuthorizer(mgr.GetClient()),
421419
}
422420

423421
cm := contentmanager.NewManager(clientRestConfigMapper, mgr.GetConfig(), mgr.GetRESTMapper())

config/base/operator-controller/crd/bases/olm.operatorframework.io_clusterextensions.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,58 @@ spec:
581581
required:
582582
- bundle
583583
type: object
584+
missingRules:
585+
additionalProperties:
586+
items:
587+
description: |-
588+
PolicyRule holds information that describes a policy rule, but does not contain information
589+
about who the rule applies to or which namespace the rule applies to.
590+
properties:
591+
apiGroups:
592+
description: |-
593+
APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of
594+
the enumerated resources in any API group will be allowed. "" represents the core API group and "*" represents all API groups.
595+
items:
596+
type: string
597+
type: array
598+
x-kubernetes-list-type: atomic
599+
nonResourceURLs:
600+
description: |-
601+
NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path
602+
Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding.
603+
Rules can either apply to API resources (such as "pods" or "secrets") or non-resource URL paths (such as "/api"), but not both.
604+
items:
605+
type: string
606+
type: array
607+
x-kubernetes-list-type: atomic
608+
resourceNames:
609+
description: ResourceNames is an optional white list of names
610+
that the rule applies to. An empty set means that everything
611+
is allowed.
612+
items:
613+
type: string
614+
type: array
615+
x-kubernetes-list-type: atomic
616+
resources:
617+
description: Resources is a list of resources this rule applies
618+
to. '*' represents all resources.
619+
items:
620+
type: string
621+
type: array
622+
x-kubernetes-list-type: atomic
623+
verbs:
624+
description: Verbs is a list of Verbs that apply to ALL the
625+
ResourceKinds contained in this rule. '*' represents all
626+
verbs.
627+
items:
628+
type: string
629+
type: array
630+
x-kubernetes-list-type: atomic
631+
required:
632+
- verbs
633+
type: object
634+
type: array
635+
type: object
584636
type: object
585637
type: object
586638
served: true

config/samples/crb.yaml

-1
This file was deleted.

config/samples/crb2.yaml

-24
This file was deleted.

config/samples/olm_v1_clusterextension.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,6 @@ apiVersion: olm.operatorframework.io/v1
276276
kind: ClusterExtension
277277
metadata:
278278
name: argocd
279-
annotations:
280-
rev: "1"
281279
spec:
282280
namespace: argocd
283281
serviceAccount:

config/samples/xx_olm_v1_clusterextension.yaml

-103
This file was deleted.

docs/api-reference/operator-controller-api-reference.md

+1
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ _Appears in:_
326326
| --- | --- | --- | --- |
327327
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#condition-v1-meta) array_ | The set of condition types which apply to all spec.source variations are Installed and Progressing.<br /><br />The Installed condition represents whether or not the bundle has been installed for this ClusterExtension.<br />When Installed is True and the Reason is Succeeded, the bundle has been successfully installed.<br />When Installed is False and the Reason is Failed, the bundle has failed to install.<br /><br />The Progressing condition represents whether or not the ClusterExtension is advancing towards a new state.<br />When Progressing is True and the Reason is Succeeded, the ClusterExtension is making progress towards a new state.<br />When Progressing is True and the Reason is Retrying, the ClusterExtension has encountered an error that could be resolved on subsequent reconciliation attempts.<br />When Progressing is False and the Reason is Blocked, the ClusterExtension has encountered an error that requires manual intervention for recovery.<br /><br />When the ClusterExtension is sourced from a catalog, if may also communicate a deprecation condition.<br />These are indications from a package owner to guide users away from a particular package, channel, or bundle.<br />BundleDeprecated is set if the requested bundle version is marked deprecated in the catalog.<br />ChannelDeprecated is set if the requested channel is marked deprecated in the catalog.<br />PackageDeprecated is set if the requested package is marked deprecated in the catalog.<br />Deprecated is a rollup condition that is present when any of the deprecated conditions are present. | | |
328328
| `install` _[ClusterExtensionInstallStatus](#clusterextensioninstallstatus)_ | install is a representation of the current installation status for this ClusterExtension. | | |
329+
| `missingRules` _object (keys:string, values:[PolicyRule](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#policyrule-v1-rbac))_ | | | |
329330

330331

331332
#### ImageSource

0 commit comments

Comments
 (0)