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

Fix RBAC issues with postgresqluser CRD #1131

Merged
merged 9 commits into from
Jun 4, 2020
1 change: 0 additions & 1 deletion api/v1alpha1/postgresqluser_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ type PostgreSQLUserSpec struct {
// +kubebuilder:subresource:status

// PostgreSQLUser is the Schema for the postgresqlusers API
// +kubebuilder:resource:shortName=psqlu,path=psqluser
// +kubebuilder:printcolumn:name="Provisioned",type="string",JSONPath=".status.provisioned"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.message"
type PostgreSQLUser struct {
Expand Down
2 changes: 2 additions & 0 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ patches:
#- patches/webhook_in_postgresqldatabases.yaml
#- patches/webhook_in_postgresqlfirewallrules.yaml
#- patches/webhook_in_postgresqlvnetrules.yaml
#- patches/webhook_in_postgresqlusers.yaml
#- patches/webhook_in_apimservices.yaml
#- patches/webhook_in_apimgmtapis.yaml
#- patches/webhook_in_virtualnetworks.yaml
Expand Down Expand Up @@ -102,6 +103,7 @@ patches:
#- patches/cainjection_in_postgresqldatabases.yaml
#- patches/cainjection_in_postgresqlfirewallrules.yaml
#- patches/cainjection_in_postgresqlvnetrules.yaml
#- patches/cainjection_in_postgresqlusers.yaml
#- patches/cainjection_in_apimservices.yaml
#- patches/cainjection_in_apimgmtapis.yaml
#- patches/cainjection_in_virtualnetworks.yaml
Expand Down
2 changes: 1 addition & 1 deletion config/crd/patches/cainjection_in_postgresqlusers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
name: psqlusers.azure.microsoft.com
name: postgresqlusers.azure.microsoft.com
7 changes: 2 additions & 5 deletions config/rbac/postgresqluser_editor_role.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# permissions to do edit mysqlusers.
# permissions for end users to edit postgresqlusers.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
Expand All @@ -19,9 +19,6 @@ rules:
- apiGroups:
- azure.microsoft.com
resources:
- postgre
sqlusers/status
- postgresqlusers/status
verbs:
- get
- patch
- update
2 changes: 1 addition & 1 deletion config/rbac/postgresqluser_viewer_role.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# permissions to do viewer mysqlusers.
# permissions for end users to view postgresqlusers.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/google/uuid v1.1.1
github.com/hashicorp/go-multierror v1.0.0
github.com/lib/pq v1.6.0 // indirect
github.com/lib/pq v1.6.0
github.com/marstr/randname v0.0.0-20181206212954-d5b0f288ab8c
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/mapstructure v1.3.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ func init() {
// +kubebuilder:rbac:groups=core,resources=events,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=azure.microsoft.com,resources=events,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=azure.microsoft.com,resources=azuresqlusers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=azure.microsoft.com,resources=postgresqlusers,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=azure.microsoft.com,resources=postgresqlusers/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=apps,resources=deployments/status,verbs=get;update;patch

Expand Down