Rename project

This commit is contained in:
Ryan Richard
2020-08-20 10:54:15 -07:00
parent 43888e9e0a
commit 3929fa672e
121 changed files with 1641 additions and 1652 deletions
+7 -7
View File
@@ -31,10 +31,10 @@ var (
const (
// credentialRequestsAPIPath is the API path for the v1alpha1 CredentialRequest API.
credentialRequestsAPIPath = "/apis/placeholder.suzerain-io.github.io/v1alpha1/credentialrequests"
credentialRequestsAPIPath = "/apis/pinniped.dev/v1alpha1/credentialrequests"
// userAgent is the user agent header value sent with requests.
userAgent = "placeholder-name"
userAgent = "pinniped"
)
func credentialRequest(ctx context.Context, apiEndpoint *url.URL, token string) (*http.Request, error) {
@@ -54,7 +54,7 @@ func credentialRequest(ctx context.Context, apiEndpoint *url.URL, token string)
Spec CredentialRequestSpec `json:"spec"`
Status struct{} `json:"status"`
}{
APIVersion: "placeholder.suzerain-io.github.io/v1alpha1",
APIVersion: "pinniped.dev/v1alpha1",
Kind: "CredentialRequest",
Spec: CredentialRequestSpec{Type: "token", Token: &CredentialRequestTokenCredential{Value: token}},
}
@@ -99,8 +99,8 @@ func ExchangeToken(ctx context.Context, token, caBundle, apiEndpoint string) (*C
}
// Form the CredentialRequest API URL by appending the API path to the main API endpoint.
placeholderEndpointURL := *endpointURL
placeholderEndpointURL.Path = filepath.Join(placeholderEndpointURL.Path, credentialRequestsAPIPath)
pinnipedEndpointURL := *endpointURL
pinnipedEndpointURL.Path = filepath.Join(pinnipedEndpointURL.Path, credentialRequestsAPIPath)
// Initialize a TLS client configuration from the provided CA bundle.
tlsConfig := tls.Config{
@@ -111,8 +111,8 @@ func ExchangeToken(ctx context.Context, token, caBundle, apiEndpoint string) (*C
return nil, fmt.Errorf("%w: no certificates found", ErrInvalidCABundle)
}
// Create a request object for the "POST /apis/placeholder.suzerain-io.github.io/v1alpha1/credentialrequests" request.
req, err := credentialRequest(ctx, &placeholderEndpointURL, token)
// Create a request object for the "POST /apis/pinniped.dev/v1alpha1/credentialrequests" request.
req, err := credentialRequest(ctx, &pinnipedEndpointURL, token)
if err != nil {
return nil, fmt.Errorf("could not build request: %w", err)
}
+5 -5
View File
@@ -136,7 +136,7 @@ func TestExchangeToken(t *testing.T) {
_, _ = w.Write([]byte(`
{
"kind": "CredentialRequest",
"apiVersion": "placeholder.suzerain-io.github.io/v1alpha1",
"apiVersion": "pinniped.dev/v1alpha1",
"metadata": {
"creationTimestamp": null
},
@@ -161,7 +161,7 @@ func TestExchangeToken(t *testing.T) {
_, _ = w.Write([]byte(`
{
"kind": "CredentialRequest",
"apiVersion": "placeholder.suzerain-io.github.io/v1alpha1",
"apiVersion": "pinniped.dev/v1alpha1",
"metadata": {
"creationTimestamp": null
},
@@ -185,7 +185,7 @@ func TestExchangeToken(t *testing.T) {
// Start a test server that returns successfully and asserts various properties of the request.
caBundle, endpoint := startTestServer(t, func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPost, r.Method)
require.Equal(t, "/apis/placeholder.suzerain-io.github.io/v1alpha1/credentialrequests", r.URL.Path)
require.Equal(t, "/apis/pinniped.dev/v1alpha1/credentialrequests", r.URL.Path)
require.Equal(t, "application/json", r.Header.Get("content-type"))
body, err := ioutil.ReadAll(r.Body)
@@ -193,7 +193,7 @@ func TestExchangeToken(t *testing.T) {
require.JSONEq(t,
`{
"kind": "CredentialRequest",
"apiVersion": "placeholder.suzerain-io.github.io/v1alpha1",
"apiVersion": "pinniped.dev/v1alpha1",
"metadata": {
"creationTimestamp": null
},
@@ -213,7 +213,7 @@ func TestExchangeToken(t *testing.T) {
_, _ = w.Write([]byte(`
{
"kind": "CredentialRequest",
"apiVersion": "placeholder.suzerain-io.github.io/v1alpha1",
"apiVersion": "pinniped.dev/v1alpha1",
"metadata": {
"creationTimestamp": null
},
+1 -1
View File
@@ -1,4 +1,4 @@
module github.com/suzerain-io/placeholder-name/pkg/client
module github.com/suzerain-io/pinniped/pkg/client
go 1.14
+10 -10
View File
@@ -5,16 +5,16 @@ SPDX-License-Identifier: Apache-2.0
package api
// Config contains knobs to setup an instance of placeholder-name.
// Config contains knobs to setup an instance of pinniped.
type Config struct {
WebhookConfig WebhookConfigSpec `json:"webhook"`
DiscoveryConfig DiscoveryConfigSpec `json:"discovery"`
WebhookConfig WebhookConfigSpec `json:"webhook"`
DiscoveryInfo DiscoveryInfoSpec `json:"discovery"`
}
// WebhookConfig contains configuration knobs specific to placeholder-name's use
// WebhookConfig contains configuration knobs specific to Pinniped's use
// of a webhook for token validation.
type WebhookConfigSpec struct {
// URL contains the URL of the webhook that placeholder-name will use
// URL contains the URL of the webhook that pinniped will use
// to validate external credentials.
URL string `json:"url"`
@@ -23,11 +23,11 @@ type WebhookConfigSpec struct {
CABundle []byte `json:"caBundle"`
}
// DiscoveryConfigSpec contains configuration knobs specific to
// placeholder-name's publishing of discovery information. These values can be
// viewed as overrides, i.e., if these are set, then placeholder-name will
// DiscoveryInfoSpec contains configuration knobs specific to
// pinniped's publishing of discovery information. These values can be
// viewed as overrides, i.e., if these are set, then pinniped will
// publish these values in its discovery document instead of the ones it finds.
type DiscoveryConfigSpec struct {
// URL contains the URL at which placeholder-name can be contacted.
type DiscoveryInfoSpec struct {
// URL contains the URL at which pinniped can be contacted.
URL *string `json:"url,omitempty"`
}
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"sigs.k8s.io/yaml"
"github.com/suzerain-io/placeholder-name/pkg/config/api"
"github.com/suzerain-io/pinniped/pkg/config/api"
)
// FromPath loads an api.Config from a provided local file path.
+3 -3
View File
@@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/suzerain-io/placeholder-name/pkg/config/api"
"github.com/suzerain-io/pinniped/pkg/config/api"
)
func TestFromPath(t *testing.T) {
@@ -23,7 +23,7 @@ func TestFromPath(t *testing.T) {
name: "Happy",
path: "testdata/happy.yaml",
wantConfig: &api.Config{
DiscoveryConfig: api.DiscoveryConfigSpec{
DiscoveryInfo: api.DiscoveryInfoSpec{
URL: stringPtr("https://some.discovery/url"),
},
WebhookConfig: api.WebhookConfigSpec{
@@ -36,7 +36,7 @@ func TestFromPath(t *testing.T) {
name: "NoDiscovery",
path: "testdata/no-discovery.yaml",
wantConfig: &api.Config{
DiscoveryConfig: api.DiscoveryConfigSpec{
DiscoveryInfo: api.DiscoveryInfoSpec{
URL: nil,
},
WebhookConfig: api.WebhookConfigSpec{
+2 -2
View File
@@ -18,13 +18,13 @@ import (
"k8s.io/client-go/tools/clientcmd"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
"github.com/suzerain-io/placeholder-name/pkg/config/api"
"github.com/suzerain-io/pinniped/pkg/config/api"
)
// NewWebhook creates a webhook from the provided API server url and caBundle
// used to validate TLS connections.
func NewWebhook(spec api.WebhookConfigSpec) (*webhook.WebhookTokenAuthenticator, error) {
kubeconfig, err := ioutil.TempFile("", "placeholder-name-webhook-kubeconfig-*")
kubeconfig, err := ioutil.TempFile("", "pinniped-webhook-kubeconfig-*")
if err != nil {
return nil, fmt.Errorf("create temp file: %w", err)
}
+1 -1
View File
@@ -17,7 +17,7 @@ import (
func TestAnonymousKubeconfig(t *testing.T) {
expect := require.New(t)
f, err := ioutil.TempFile("", "placeholder-name-anonymous-kubeconfig-test-*")
f, err := ioutil.TempFile("", "pinniped-anonymous-kubeconfig-test-*")
expect.NoError(err)
defer os.Remove(f.Name())