Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add(): add CRD for GCPAuthEngineConfig #242

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -425,4 +425,4 @@ resources:
defaulting: true
validation: true
webhookVersion: v1
version: "3"
version: "3"
2 changes: 1 addition & 1 deletion api/v1alpha1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ var _ = BeforeSuite(func() {
Expect(err).NotTo(HaveOccurred())

err = (&GCPAuthEngineConfig{}).SetupWebhookWithManager(mgr)
Expect(err).NotTo(HaveOccurred())
Expect(err).NotTo(HaveOccurred())

err = (&GCPAuthEngineRole{}).SetupWebhookWithManager(mgr)
Expect(err).NotTo(HaveOccurred())
Expand Down
3 changes: 3 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,4 @@ spec:
served: true
storage: true
subresources:
status: {}
status: {}
3 changes: 0 additions & 3 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,6 @@ rules:
- get
- patch
- update
- apiGroups:
Copy link
Collaborator

Choose a reason for hiding this comment

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

there is a problem here, again please generate this file with make config.

- redhatcop.redhat.io
resources:
- githubsecretengineconfigs
verbs:
- create
Expand Down
1 change: 0 additions & 1 deletion config/samples/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ resources:
- redhatcop_v1alpha1_azureauthenginerole.yaml
- redhatcop_v1alpha1_gcpauthengineconfig.yaml
- redhatcop_v1alpha1_gcpauthenginerole.yaml

#+kubebuilder:scaffold:manifestskustomizesamples
45 changes: 42 additions & 3 deletions config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ webhooks:
service:
name: webhook-service
namespace: system
path: /mutate-redhatcop-redhat-io-v1alpha1-databasesecretengineconfig
path: /mutate-redhatcop-redhat-io-v1alpha1-gcpauthengineconfig
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this correct, it seems you are replacing the databasesecretengineconfig, this file is automatically generated, just run make manifests

failurePolicy: Fail
name: mdatabasesecretengineconfig.kb.io
Copy link
Collaborator

Choose a reason for hiding this comment

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

also these substitutions look suspicious, please regenerate this file with make manifests

name: mgcpauthengineconfig.kb.io
rules:
- apiGroups:
- redhatcop.redhat.io
Expand All @@ -100,7 +100,26 @@ webhooks:
operations:
- CREATE
resources:
- databasesecretengineconfigs
- gcpauthengineconfigs
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-redhatcop-redhat-io-v1alpha1-gcpauthenginerole
failurePolicy: Fail
name: mgcpauthenginerole.kb.io
rules:
- apiGroups:
- redhatcop.redhat.io
apiVersions:
- v1alpha1
operations:
- CREATE
resources:
- gcpauthengineroles
sideEffects: None
- admissionReviewVersions:
- v1
Expand Down Expand Up @@ -179,6 +198,26 @@ webhooks:
resources:
- gcpauthengineroles
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: webhook-service
namespace: system
path: /mutate-redhatcop-redhat-io-v1alpha1-gcpauthengineconfig
failurePolicy: Fail
name: mgcpauthengineconfig.kb.io
rules:
- apiGroups:
- redhatcop.redhat.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- gcpauthengineconfigs
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
Expand Down
1 change: 0 additions & 1 deletion docs/auth-engines.md
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ spec:

The endpoint value provided for a given key has the form of scheme://host:port. The scheme:// and :port portions of the endpoint value are optional.


## GCPAuthEngineRole
The `GCPAuthEngineRole` CRD allows a user to register a role in an authentication engine mount of type [Google Cloud](https://developer.hashicorp.com/vault/api-docs/auth/gcp#create-update-role).

Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,12 @@ func main() {
setupLog.Error(err, "unable to create controller", "controller", "GCPAuthEngineConfig")
os.Exit(1)
}

if err = (&controllers.GCPAuthEngineRoleReconciler{ReconcilerBase: vaultresourcecontroller.NewFromManager(mgr, "GCPAuthEngineRole")}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "GCPAuthEngineRole")
os.Exit(1)
}

if err = (&controllers.VaultSecretReconciler{ReconcilerBase: vaultresourcecontroller.NewFromManager(mgr, "VaultSecret")}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "VaultSecret")
os.Exit(1)
Expand Down Expand Up @@ -307,6 +309,7 @@ func main() {
setupLog.Error(err, "unable to create webhook", "webhook", "GCPAuthEngineConfig")
os.Exit(1)
}

if err = (&redhatcopv1alpha1.GCPAuthEngineRole{}).SetupWebhookWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create webhook", "webhook", "GCPAuthEngineRole")
os.Exit(1)
Expand Down
Loading