-
Notifications
You must be signed in to change notification settings - Fork 102
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
[Bug Fix] gke: enable basic auth #129
Conversation
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
@hasheddan Would it be possible to instead expose the master username (but not password) in our spec, and automatically generate a master password only if and when a master username is specified? This might be a little less surprising than automatically enabling basic auth when cert auth is enabled, but would still allow users to provision a cluster they can authenticate to by explicitly enabling basic auth and/or cert auth. |
@negz yes that would certainly be possible. The only downside to that is that it does change the API. However, since it is purely additive I don't believe it would require a version bump? |
That's my understanding. It would be additive and not change existing behaviour, and thus be backward compatible. |
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
@negz updates have been made. I also ran the same set of tests but with this additional configuration: ---
apiVersion: compute.crossplane.io/v1alpha1
kind: KubernetesCluster
metadata:
name: app-kubernetes-basicauth
labels:
basicauth: "true"
spec:
classSelector:
matchLabels:
basicauth: "true"
writeConnectionSecretToRef:
name: basicauthk8scluster
---
apiVersion: container.gcp.crossplane.io/v1beta1
kind: GKEClusterClass
metadata:
name: gkecluster-basicauth
labels:
basicauth: "true"
specTemplate:
forProvider:
location: us-central1 # indicates regional cluster
masterAuth:
username: myCoolUser
writeConnectionSecretsToNamespace: crossplane-system
providerRef:
name: gcp-provider
reclaimPolicy: Delete I confirmed that |
@hasheddan I was thinking we'd generate and set a random password if the admin user was specified. It seems that instead we submit only the username. What does this mean for basic auth - is it possible to authenticate by specifying the admin username and an empty password? |
@negz yep! If you provide a username and do not provide a password, GCP automatically generates it and then we propagate it back in the connection |
This works! Thank you @hasheddan ! |
@vadasambar glad to hear that! #133 will make this available in the next patch release :) |
Signed-off-by: hasheddan georgedanielmangum@gmail.com
Description of your changes
Currently the
v1beta1
GKECluster
is not usable from Crossplane due to the fact that the client certificate that is issued by GKE does not containcluster-admin
privileges. Basic auth with username / password is automatically enabled inv1alpha3
GKECluster
, which makes it impossible to turn off. This update enables basic auth only when a user provides ausername
. It is strictly additive to the API and ensures that connection is possible while still providing the ability to lock down a cluster by not issuing a client certificate or enabling basic auth.If merged, this should be backported to release-0.4 and patch release
v0.4.1
should be created.Fixes #128
References:
https://crossplane.slack.com/archives/CEG3T90A1/p1578059370045600
kubernetes/kubernetes#65400
https://issuetracker.google.com/u/0/issues/111101728
To test this fix I have done the following:
Dynamically provisioned a GKE cluster with
issueClientCertificate: true
and verified that basic auth is enabled and username / password are included in the connection secret:Dynamically provisioned a GKE cluster with
masterAuth
omitted and verified that basic auth is not enabled and username / password are not included in the connection secret:Dynamically provisioned a GKE cluster with
issueClientCertificate: false
and verified that basic auth is not enabled and username / password are not included in the connection secret:I have also scheduled
KubernetesApplications
to both the first and second examples above (after also provisioning node pools) and have confirmed that scheduling is successful for the first and fails for the second.Checklist
I have:
make reviewable
to ensure this PR is ready for review.app.yaml
to include any new role permissions.