From 0f25657a35bf01b917f83e537795e08c12c62e64 Mon Sep 17 00:00:00 2001 From: Matt Moyer Date: Fri, 30 Oct 2020 11:39:26 -0500 Subject: [PATCH] Rename WebhookIdentityProvider to WebhookAuthenticator. Signed-off-by: Matt Moyer --- apis/concierge/authentication/doc.go.tmpl | 2 +- .../authentication/v1alpha1/doc.go.tmpl | 2 +- .../authentication/v1alpha1/register.go.tmpl | 4 +- .../authentication/v1alpha1/types_tls.go.tmpl | 2 +- .../v1alpha1/types_webhook.go.tmpl | 30 +-- cmd/pinniped/cmd/exchange_credential.go | 2 +- cmd/pinniped/cmd/get_kubeconfig.go | 2 +- cmd/pinniped/cmd/get_kubeconfig_test.go | 6 +- ...e.pinniped.dev_webhookauthenticators.yaml} | 29 ++- deploy/concierge/z0_crd_overlay.yaml | 2 +- doc/demo.md | 4 +- generated/1.17/README.adoc | 38 ++-- .../1.17/apis/concierge/authentication/doc.go | 2 +- .../concierge/authentication/v1alpha1/doc.go | 2 +- .../authentication/v1alpha1/register.go | 4 +- .../authentication/v1alpha1/types_tls.go | 2 +- .../authentication/v1alpha1/types_webhook.go | 30 +-- .../v1alpha1/zz_generated.deepcopy.go | 38 ++-- .../v1alpha1/authentication_client.go | 6 +- .../fake/fake_authentication_client.go | 4 +- .../fake/fake_webhookauthenticator.go | 127 ++++++++++++ .../fake/fake_webhookidentityprovider.go | 127 ------------ .../v1alpha1/generated_expansion.go | 2 +- .../v1alpha1/webhookauthenticator.go | 178 +++++++++++++++++ .../v1alpha1/webhookidentityprovider.go | 178 ----------------- .../authentication/v1alpha1/interface.go | 10 +- .../v1alpha1/webhookauthenticator.go | 76 ++++++++ .../v1alpha1/webhookidentityprovider.go | 76 -------- .../informers/externalversions/generic.go | 4 +- .../v1alpha1/expansion_generated.go | 12 +- .../v1alpha1/webhookauthenticator.go | 81 ++++++++ .../v1alpha1/webhookidentityprovider.go | 81 -------- .../client/openapi/zz_generated.openapi.go | 176 ++++++++--------- ...ge.pinniped.dev_webhookauthenticators.yaml | 29 ++- generated/1.18/README.adoc | 38 ++-- .../1.18/apis/concierge/authentication/doc.go | 2 +- .../concierge/authentication/v1alpha1/doc.go | 2 +- .../authentication/v1alpha1/register.go | 4 +- .../authentication/v1alpha1/types_tls.go | 2 +- .../authentication/v1alpha1/types_webhook.go | 30 +-- .../v1alpha1/zz_generated.deepcopy.go | 38 ++-- .../v1alpha1/authentication_client.go | 6 +- .../fake/fake_authentication_client.go | 4 +- .../fake/fake_webhookauthenticator.go | 129 +++++++++++++ .../fake/fake_webhookidentityprovider.go | 129 ------------- .../v1alpha1/generated_expansion.go | 2 +- .../v1alpha1/webhookauthenticator.go | 182 ++++++++++++++++++ .../v1alpha1/webhookidentityprovider.go | 182 ------------------ .../authentication/v1alpha1/interface.go | 10 +- .../v1alpha1/webhookauthenticator.go | 77 ++++++++ .../v1alpha1/webhookidentityprovider.go | 77 -------- .../informers/externalversions/generic.go | 4 +- .../v1alpha1/expansion_generated.go | 12 +- .../v1alpha1/webhookauthenticator.go | 81 ++++++++ .../v1alpha1/webhookidentityprovider.go | 81 -------- .../client/openapi/zz_generated.openapi.go | 176 ++++++++--------- ...e.pinniped.dev_webhookauthenticators.yaml} | 29 ++- generated/1.19/README.adoc | 38 ++-- .../1.19/apis/concierge/authentication/doc.go | 2 +- .../concierge/authentication/v1alpha1/doc.go | 2 +- .../authentication/v1alpha1/register.go | 4 +- .../authentication/v1alpha1/types_tls.go | 2 +- .../authentication/v1alpha1/types_webhook.go | 30 +-- .../v1alpha1/zz_generated.deepcopy.go | 38 ++-- .../v1alpha1/authentication_client.go | 6 +- .../fake/fake_authentication_client.go | 4 +- .../fake/fake_webhookauthenticator.go | 129 +++++++++++++ .../fake/fake_webhookidentityprovider.go | 129 ------------- .../v1alpha1/generated_expansion.go | 2 +- .../v1alpha1/webhookauthenticator.go | 182 ++++++++++++++++++ .../v1alpha1/webhookidentityprovider.go | 182 ------------------ .../authentication/v1alpha1/interface.go | 10 +- .../v1alpha1/webhookauthenticator.go | 77 ++++++++ .../v1alpha1/webhookidentityprovider.go | 77 -------- .../informers/externalversions/generic.go | 4 +- .../v1alpha1/expansion_generated.go | 12 +- .../v1alpha1/webhookauthenticator.go | 86 +++++++++ .../v1alpha1/webhookidentityprovider.go | 86 --------- .../client/openapi/zz_generated.openapi.go | 178 ++++++++--------- ...e.pinniped.dev_webhookauthenticators.yaml} | 29 ++- ...pinniped.dev_webhookidentityproviders.yaml | 149 -------------- hack/lib/tilt/Tiltfile | 2 +- hack/update.sh | 2 +- internal/client/client_test.go | 4 +- .../identityprovider/idpcache/cache_test.go | 2 +- .../webhookcachecleaner.go | 10 +- .../webhookcachecleaner_test.go | 14 +- .../webhookcachefiller/webhookcachefiller.go | 16 +- .../webhookcachefiller_test.go | 20 +- .../controllermanager/prepare_controllers.go | 4 +- .../concierge_credentialrequest_test.go | 2 +- test/integration/kube_api_discovery_test.go | 9 +- test/library/client.go | 16 +- test/library/env.go | 24 +-- 94 files changed, 2043 insertions(+), 2205 deletions(-) rename deploy/concierge/{authentication.concierge.pinniped.dev_webhookidentityproviders.yaml => authentication.concierge.pinniped.dev_webhookauthenticators.yaml} (89%) create mode 100644 generated/1.17/client/clientset/versioned/typed/authentication/v1alpha1/fake/fake_webhookauthenticator.go delete mode 100644 generated/1.17/client/clientset/versioned/typed/authentication/v1alpha1/fake/fake_webhookidentityprovider.go create mode 100644 generated/1.17/client/clientset/versioned/typed/authentication/v1alpha1/webhookauthenticator.go delete mode 100644 generated/1.17/client/clientset/versioned/typed/authentication/v1alpha1/webhookidentityprovider.go create mode 100644 generated/1.17/client/informers/externalversions/authentication/v1alpha1/webhookauthenticator.go delete mode 100644 generated/1.17/client/informers/externalversions/authentication/v1alpha1/webhookidentityprovider.go create mode 100644 generated/1.17/client/listers/authentication/v1alpha1/webhookauthenticator.go delete mode 100644 generated/1.17/client/listers/authentication/v1alpha1/webhookidentityprovider.go rename deploy/concierge/idp.concierge.pinniped.dev_webhookidentityproviders.yaml => generated/1.17/crds/authentication.concierge.pinniped.dev_webhookauthenticators.yaml (89%) create mode 100644 generated/1.18/client/clientset/versioned/typed/authentication/v1alpha1/fake/fake_webhookauthenticator.go delete mode 100644 generated/1.18/client/clientset/versioned/typed/authentication/v1alpha1/fake/fake_webhookidentityprovider.go create mode 100644 generated/1.18/client/clientset/versioned/typed/authentication/v1alpha1/webhookauthenticator.go delete mode 100644 generated/1.18/client/clientset/versioned/typed/authentication/v1alpha1/webhookidentityprovider.go create mode 100644 generated/1.18/client/informers/externalversions/authentication/v1alpha1/webhookauthenticator.go delete mode 100644 generated/1.18/client/informers/externalversions/authentication/v1alpha1/webhookidentityprovider.go create mode 100644 generated/1.18/client/listers/authentication/v1alpha1/webhookauthenticator.go delete mode 100644 generated/1.18/client/listers/authentication/v1alpha1/webhookidentityprovider.go rename generated/{1.17/crds/authentication.concierge.pinniped.dev_webhookidentityproviders.yaml => 1.18/crds/authentication.concierge.pinniped.dev_webhookauthenticators.yaml} (89%) create mode 100644 generated/1.19/client/clientset/versioned/typed/authentication/v1alpha1/fake/fake_webhookauthenticator.go delete mode 100644 generated/1.19/client/clientset/versioned/typed/authentication/v1alpha1/fake/fake_webhookidentityprovider.go create mode 100644 generated/1.19/client/clientset/versioned/typed/authentication/v1alpha1/webhookauthenticator.go delete mode 100644 generated/1.19/client/clientset/versioned/typed/authentication/v1alpha1/webhookidentityprovider.go create mode 100644 generated/1.19/client/informers/externalversions/authentication/v1alpha1/webhookauthenticator.go delete mode 100644 generated/1.19/client/informers/externalversions/authentication/v1alpha1/webhookidentityprovider.go create mode 100644 generated/1.19/client/listers/authentication/v1alpha1/webhookauthenticator.go delete mode 100644 generated/1.19/client/listers/authentication/v1alpha1/webhookidentityprovider.go rename generated/{1.18/crds/authentication.concierge.pinniped.dev_webhookidentityproviders.yaml => 1.19/crds/authentication.concierge.pinniped.dev_webhookauthenticators.yaml} (89%) delete mode 100644 generated/1.19/crds/authentication.concierge.pinniped.dev_webhookidentityproviders.yaml diff --git a/apis/concierge/authentication/doc.go.tmpl b/apis/concierge/authentication/doc.go.tmpl index c8558463..78e81bd6 100644 --- a/apis/concierge/authentication/doc.go.tmpl +++ b/apis/concierge/authentication/doc.go.tmpl @@ -4,5 +4,5 @@ // +k8s:deepcopy-gen=package // +groupName=authentication.concierge.pinniped.dev -// Package authentication is the internal version of the Pinniped identity provider API. +// Package authentication is the internal version of the Pinniped concierge authentication API. package authentication diff --git a/apis/concierge/authentication/v1alpha1/doc.go.tmpl b/apis/concierge/authentication/v1alpha1/doc.go.tmpl index 4bd09774..f1ad1a86 100644 --- a/apis/concierge/authentication/v1alpha1/doc.go.tmpl +++ b/apis/concierge/authentication/v1alpha1/doc.go.tmpl @@ -7,5 +7,5 @@ // +k8s:defaulter-gen=TypeMeta // +groupName=authentication.concierge.pinniped.dev -// Package v1alpha1 is the v1alpha1 version of the Pinniped identity provider API. +// Package v1alpha1 is the v1alpha1 version of the Pinniped concierge authentication API. package v1alpha1 diff --git a/apis/concierge/authentication/v1alpha1/register.go.tmpl b/apis/concierge/authentication/v1alpha1/register.go.tmpl index b372270d..1a5163da 100644 --- a/apis/concierge/authentication/v1alpha1/register.go.tmpl +++ b/apis/concierge/authentication/v1alpha1/register.go.tmpl @@ -30,8 +30,8 @@ func init() { // Adds the list of known types to the given scheme. func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, - &WebhookIdentityProvider{}, - &WebhookIdentityProviderList{}, + &WebhookAuthenticator{}, + &WebhookAuthenticatorList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/apis/concierge/authentication/v1alpha1/types_tls.go.tmpl b/apis/concierge/authentication/v1alpha1/types_tls.go.tmpl index 2f2098c9..f882f2d6 100644 --- a/apis/concierge/authentication/v1alpha1/types_tls.go.tmpl +++ b/apis/concierge/authentication/v1alpha1/types_tls.go.tmpl @@ -3,7 +3,7 @@ package v1alpha1 -// Configuration for configuring TLS on various identity providers. +// Configuration for configuring TLS on various authenticators. type TLSSpec struct { // X.509 Certificate Authority (base64-encoded PEM bundle). If omitted, a default set of system roots will be trusted. // +optional diff --git a/apis/concierge/authentication/v1alpha1/types_webhook.go.tmpl b/apis/concierge/authentication/v1alpha1/types_webhook.go.tmpl index 6e476337..8124597a 100644 --- a/apis/concierge/authentication/v1alpha1/types_webhook.go.tmpl +++ b/apis/concierge/authentication/v1alpha1/types_webhook.go.tmpl @@ -5,9 +5,9 @@ package v1alpha1 import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -// Status of a webhook identity provider. -type WebhookIdentityProviderStatus struct { - // Represents the observations of an identity provider's current state. +// Status of a webhook authenticator. +type WebhookAuthenticatorStatus struct { + // Represents the observations of the authenticator's current state. // +patchMergeKey=type // +patchStrategy=merge // +listType=map @@ -15,8 +15,8 @@ type WebhookIdentityProviderStatus struct { Conditions []Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"` } -// Spec for configuring a webhook identity provider. -type WebhookIdentityProviderSpec struct { +// Spec for configuring a webhook authenticator. +type WebhookAuthenticatorSpec struct { // Webhook server endpoint URL. // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:Pattern=`^https://` @@ -27,27 +27,27 @@ type WebhookIdentityProviderSpec struct { TLS *TLSSpec `json:"tls,omitempty"` } -// WebhookIdentityProvider describes the configuration of a Pinniped webhook identity provider. +// WebhookAuthenticator describes the configuration of a webhook authenticator. // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// +kubebuilder:resource:categories=all;idp;idps,shortName=webhookidp;webhookidps +// +kubebuilder:resource:categories=all;authenticator;authenticators // +kubebuilder:printcolumn:name="Endpoint",type=string,JSONPath=`.spec.endpoint` -type WebhookIdentityProvider struct { +type WebhookAuthenticator struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - // Spec for configuring the identity provider. - Spec WebhookIdentityProviderSpec `json:"spec"` + // Spec for configuring the authenticator. + Spec WebhookAuthenticatorSpec `json:"spec"` - // Status of the identity provider. - Status WebhookIdentityProviderStatus `json:"status,omitempty"` + // Status of the authenticator. + Status WebhookAuthenticatorStatus `json:"status,omitempty"` } -// List of WebhookIdentityProvider objects. +// List of WebhookAuthenticator objects. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -type WebhookIdentityProviderList struct { +type WebhookAuthenticatorList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []WebhookIdentityProvider `json:"items"` + Items []WebhookAuthenticator `json:"items"` } diff --git a/cmd/pinniped/cmd/exchange_credential.go b/cmd/pinniped/cmd/exchange_credential.go index 0e8d99d7..481165fb 100644 --- a/cmd/pinniped/cmd/exchange_credential.go +++ b/cmd/pinniped/cmd/exchange_credential.go @@ -144,7 +144,7 @@ func exchangeCredential(envGetter envGetter, tokenExchanger tokenExchanger, outp switch strings.ToLower(idpType) { case "webhook": idp.APIGroup = &auth1alpha1.SchemeGroupVersion.Group - idp.Kind = "WebhookIdentityProvider" + idp.Kind = "WebhookAuthenticator" default: return fmt.Errorf(`%w: %q, supported values are "webhook"`, ErrInvalidIDPType, idpType) } diff --git a/cmd/pinniped/cmd/get_kubeconfig.go b/cmd/pinniped/cmd/get_kubeconfig.go index fa6935af..a0349eed 100644 --- a/cmd/pinniped/cmd/get_kubeconfig.go +++ b/cmd/pinniped/cmd/get_kubeconfig.go @@ -187,7 +187,7 @@ func getDefaultIDP(clientset pinnipedclientset.Interface, namespace string) (str ctx, cancelFunc := context.WithTimeout(context.Background(), time.Second*20) defer cancelFunc() - webhooks, err := clientset.AuthenticationV1alpha1().WebhookIdentityProviders(namespace).List(ctx, metav1.ListOptions{}) + webhooks, err := clientset.AuthenticationV1alpha1().WebhookAuthenticators(namespace).List(ctx, metav1.ListOptions{}) if err != nil { return "", "", err } diff --git a/cmd/pinniped/cmd/get_kubeconfig_test.go b/cmd/pinniped/cmd/get_kubeconfig_test.go index 23d920c5..43079173 100644 --- a/cmd/pinniped/cmd/get_kubeconfig_test.go +++ b/cmd/pinniped/cmd/get_kubeconfig_test.go @@ -256,8 +256,8 @@ func TestRun(t *testing.T) { cmd.flags.idpType = "" cmd.kubeClientCreator = func(_ *rest.Config) (pinnipedclientset.Interface, error) { return pinnipedfake.NewSimpleClientset( - &authv1alpha.WebhookIdentityProvider{ObjectMeta: metav1.ObjectMeta{Namespace: "test-namespace", Name: "webhook-one"}}, - &authv1alpha.WebhookIdentityProvider{ObjectMeta: metav1.ObjectMeta{Namespace: "test-namespace", Name: "webhook-two"}}, + &authv1alpha.WebhookAuthenticator{ObjectMeta: metav1.ObjectMeta{Namespace: "test-namespace", Name: "webhook-one"}}, + &authv1alpha.WebhookAuthenticator{ObjectMeta: metav1.ObjectMeta{Namespace: "test-namespace", Name: "webhook-two"}}, ), nil } }, @@ -349,7 +349,7 @@ func TestRun(t *testing.T) { cmd.kubeClientCreator = func(_ *rest.Config) (pinnipedclientset.Interface, error) { return pinnipedfake.NewSimpleClientset( - &authv1alpha.WebhookIdentityProvider{ObjectMeta: metav1.ObjectMeta{Namespace: "test-namespace", Name: "discovered-idp"}}, + &authv1alpha.WebhookAuthenticator{ObjectMeta: metav1.ObjectMeta{Namespace: "test-namespace", Name: "discovered-idp"}}, newCredentialIssuerConfig("pinniped-config", "test-namespace", "https://example.com", "test-ca"), ), nil } diff --git a/deploy/concierge/authentication.concierge.pinniped.dev_webhookidentityproviders.yaml b/deploy/concierge/authentication.concierge.pinniped.dev_webhookauthenticators.yaml similarity index 89% rename from deploy/concierge/authentication.concierge.pinniped.dev_webhookidentityproviders.yaml rename to deploy/concierge/authentication.concierge.pinniped.dev_webhookauthenticators.yaml index 5e7aba72..9ae6152e 100644 --- a/deploy/concierge/authentication.concierge.pinniped.dev_webhookidentityproviders.yaml +++ b/deploy/concierge/authentication.concierge.pinniped.dev_webhookauthenticators.yaml @@ -6,21 +6,18 @@ metadata: annotations: controller-gen.kubebuilder.io/version: v0.4.0 creationTimestamp: null - name: webhookidentityproviders.authentication.concierge.pinniped.dev + name: webhookauthenticators.authentication.concierge.pinniped.dev spec: group: authentication.concierge.pinniped.dev names: categories: - all - - idp - - idps - kind: WebhookIdentityProvider - listKind: WebhookIdentityProviderList - plural: webhookidentityproviders - shortNames: - - webhookidp - - webhookidps - singular: webhookidentityprovider + - authenticator + - authenticators + kind: WebhookAuthenticator + listKind: WebhookAuthenticatorList + plural: webhookauthenticators + singular: webhookauthenticator scope: Namespaced versions: - additionalPrinterColumns: @@ -30,8 +27,8 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: WebhookIdentityProvider describes the configuration of a Pinniped - webhook identity provider. + description: WebhookAuthenticator describes the configuration of a webhook + authenticator. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -46,7 +43,7 @@ spec: metadata: type: object spec: - description: Spec for configuring the identity provider. + description: Spec for configuring the authenticator. properties: endpoint: description: Webhook server endpoint URL. @@ -65,11 +62,11 @@ spec: - endpoint type: object status: - description: Status of the identity provider. + description: Status of the authenticator. properties: conditions: - description: Represents the observations of an identity provider's - current state. + description: Represents the observations of the authenticator's current + state. items: description: Condition status of a resource (mirrored from the metav1.Condition type added in Kubernetes 1.19). In a future API version we can diff --git a/deploy/concierge/z0_crd_overlay.yaml b/deploy/concierge/z0_crd_overlay.yaml index 61f4c93e..c5050f04 100644 --- a/deploy/concierge/z0_crd_overlay.yaml +++ b/deploy/concierge/z0_crd_overlay.yaml @@ -10,7 +10,7 @@ metadata: #@overlay/match missing_ok=True labels: #@ labels() -#@overlay/match by=overlay.subset({"kind": "CustomResourceDefinition", "metadata":{"name":"webhookidentityproviders.authentication.concierge.pinniped.dev"}}), expects=1 +#@overlay/match by=overlay.subset({"kind": "CustomResourceDefinition", "metadata":{"name":"webhookauthenticators.authentication.concierge.pinniped.dev"}}), expects=1 --- metadata: #@overlay/match missing_ok=True diff --git a/doc/demo.md b/doc/demo.md index 8b6cef40..4d6fcafe 100644 --- a/doc/demo.md +++ b/doc/demo.md @@ -118,12 +118,12 @@ as the identity provider. If you would prefer to customize the available options, please see [deploy/concierge/README.md](../deploy/concierge/README.md) for instructions on how to deploy using `ytt`. -1. Create a `WebhookIdentityProvider` object to configure Pinniped to authenticate using local-user-authenticator. +1. Create a `WebhookAuthenticator` object to configure Pinniped to authenticate using local-user-authenticator. ```bash cat <