Use here.Doc() in a few more places that were begging for it
This commit is contained in:
parent
da7c981f14
commit
2cdc3defb7
@ -8,7 +8,6 @@ package issuerconfig
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -27,6 +26,7 @@ import (
|
|||||||
pinnipedfake "github.com/suzerain-io/pinniped/generated/1.19/client/clientset/versioned/fake"
|
pinnipedfake "github.com/suzerain-io/pinniped/generated/1.19/client/clientset/versioned/fake"
|
||||||
pinnipedinformers "github.com/suzerain-io/pinniped/generated/1.19/client/informers/externalversions"
|
pinnipedinformers "github.com/suzerain-io/pinniped/generated/1.19/client/informers/externalversions"
|
||||||
"github.com/suzerain-io/pinniped/internal/controllerlib"
|
"github.com/suzerain-io/pinniped/internal/controllerlib"
|
||||||
|
"github.com/suzerain-io/pinniped/internal/here"
|
||||||
"github.com/suzerain-io/pinniped/internal/testutil"
|
"github.com/suzerain-io/pinniped/internal/testutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -256,14 +256,15 @@ func TestSync(t *testing.T) {
|
|||||||
ObjectMeta: metav1.ObjectMeta{Name: "cluster-info", Namespace: "kube-public"},
|
ObjectMeta: metav1.ObjectMeta{Name: "cluster-info", Namespace: "kube-public"},
|
||||||
// Note that go fmt puts tabs in our file, which we must remove from our configmap yaml below.
|
// Note that go fmt puts tabs in our file, which we must remove from our configmap yaml below.
|
||||||
Data: map[string]string{
|
Data: map[string]string{
|
||||||
"kubeconfig": strings.ReplaceAll(`
|
"kubeconfig": here.Docf(`
|
||||||
kind: Config
|
kind: Config
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
clusters:
|
clusters:
|
||||||
- name: ""
|
- name: ""
|
||||||
cluster:
|
cluster:
|
||||||
certificate-authority-data: "`+caData+`"
|
certificate-authority-data: "%s"
|
||||||
server: "`+kubeServerURL+`"`, "\t", " "),
|
server: "%s"`,
|
||||||
|
caData, kubeServerURL),
|
||||||
"uninteresting-key": "uninteresting-value",
|
"uninteresting-key": "uninteresting-value",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import (
|
|||||||
"github.com/suzerain-io/pinniped/internal/controller/issuerconfig"
|
"github.com/suzerain-io/pinniped/internal/controller/issuerconfig"
|
||||||
"github.com/suzerain-io/pinniped/internal/controllermanager"
|
"github.com/suzerain-io/pinniped/internal/controllermanager"
|
||||||
"github.com/suzerain-io/pinniped/internal/downward"
|
"github.com/suzerain-io/pinniped/internal/downward"
|
||||||
|
"github.com/suzerain-io/pinniped/internal/here"
|
||||||
"github.com/suzerain-io/pinniped/internal/provider"
|
"github.com/suzerain-io/pinniped/internal/provider"
|
||||||
"github.com/suzerain-io/pinniped/internal/registry/credentialrequest"
|
"github.com/suzerain-io/pinniped/internal/registry/credentialrequest"
|
||||||
"github.com/suzerain-io/pinniped/pkg/config"
|
"github.com/suzerain-io/pinniped/pkg/config"
|
||||||
@ -62,10 +63,11 @@ func (a *App) Run() error {
|
|||||||
// Create the server command and save it into the App.
|
// Create the server command and save it into the App.
|
||||||
func (a *App) addServerCommand(ctx context.Context, args []string, stdout, stderr io.Writer) {
|
func (a *App) addServerCommand(ctx context.Context, args []string, stdout, stderr io.Writer) {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: `pinniped-server`,
|
Use: "pinniped-server",
|
||||||
Long: "pinniped-server provides a generic API for mapping an external\n" +
|
Long: here.Doc(`
|
||||||
"credential from somewhere to an internal credential to be used for\n" +
|
pinniped-server provides a generic API for mapping an external
|
||||||
"authenticating to the Kubernetes API.",
|
credential from somewhere to an internal credential to be used for
|
||||||
|
authenticating to the Kubernetes API.`),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error { return a.runServer(ctx) },
|
RunE: func(cmd *cobra.Command, args []string) error { return a.runServer(ctx) },
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/suzerain-io/pinniped/internal/client"
|
"github.com/suzerain-io/pinniped/internal/client"
|
||||||
|
"github.com/suzerain-io/pinniped/internal/here"
|
||||||
"github.com/suzerain-io/pinniped/test/library"
|
"github.com/suzerain-io/pinniped/test/library"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ Test certificate and private key that should get an authentication error. Genera
|
|||||||
[1]: https://github.com/cloudflare/cfssl
|
[1]: https://github.com/cloudflare/cfssl
|
||||||
*/
|
*/
|
||||||
var (
|
var (
|
||||||
testCert = strings.TrimSpace(`
|
testCert = here.Doc(`
|
||||||
-----BEGIN CERTIFICATE-----
|
-----BEGIN CERTIFICATE-----
|
||||||
MIICBDCCAaugAwIBAgIUeidKWlZQuoKfBGydObI1hMwzt9cwCgYIKoZIzj0EAwIw
|
MIICBDCCAaugAwIBAgIUeidKWlZQuoKfBGydObI1hMwzt9cwCgYIKoZIzj0EAwIw
|
||||||
SDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1TYW4gRnJhbmNp
|
SDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1TYW4gRnJhbmNp
|
||||||
@ -43,7 +44,8 @@ c2VyMAoGCCqGSM49BAMCA0cAMEQCIEwPZhPpYhYHndfTEsWOxnxzJkmhAcYIMCeJ
|
|||||||
d9kyq/fPAiBNCJw1MCLT8LjNlyUZCfwI2zuI3e0w6vuau89oj2zvVA==
|
d9kyq/fPAiBNCJw1MCLT8LjNlyUZCfwI2zuI3e0w6vuau89oj2zvVA==
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
||||||
`)
|
`)
|
||||||
testKey = maskKey(strings.TrimSpace(`
|
|
||||||
|
testKey = maskKey(here.Doc(`
|
||||||
-----BEGIN EC TESTING KEY-----
|
-----BEGIN EC TESTING KEY-----
|
||||||
MHcCAQEEIAqkBGGKTH5GzLx8XZLAHEFW2E8jT+jpy0p6w6MMR7DkoAoGCCqGSM49
|
MHcCAQEEIAqkBGGKTH5GzLx8XZLAHEFW2E8jT+jpy0p6w6MMR7DkoAoGCCqGSM49
|
||||||
AwEHoUQDQgAEZO1wQvjo2Jq1zoZu0WiYh1uEOVbBPojFfdAc6u2p7KgIW9OESOt2
|
AwEHoUQDQgAEZO1wQvjo2Jq1zoZu0WiYh1uEOVbBPojFfdAc6u2p7KgIW9OESOt2
|
||||||
|
Loading…
Reference in New Issue
Block a user