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,27 +29,28 @@ 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
|
||||||
c2NvMRQwEgYDVQQDEwtleGFtcGxlLm5ldDAeFw0yMDA3MjgxOTI3MDBaFw0yMTA3
|
c2NvMRQwEgYDVQQDEwtleGFtcGxlLm5ldDAeFw0yMDA3MjgxOTI3MDBaFw0yMTA3
|
||||||
MjgxOTI3MDBaMEgxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMN
|
MjgxOTI3MDBaMEgxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMN
|
||||||
U2FuIEZyYW5jaXNjbzEUMBIGA1UEAxMLZXhhbXBsZS5uZXQwWTATBgcqhkjOPQIB
|
U2FuIEZyYW5jaXNjbzEUMBIGA1UEAxMLZXhhbXBsZS5uZXQwWTATBgcqhkjOPQIB
|
||||||
BggqhkjOPQMBBwNCAARk7XBC+OjYmrXOhm7RaJiHW4Q5VsE+iMV90Bzq7ansqAhb
|
BggqhkjOPQMBBwNCAARk7XBC+OjYmrXOhm7RaJiHW4Q5VsE+iMV90Bzq7ansqAhb
|
||||||
04RI63Y7YPwu1aExutjLvnkWCrgf2ze8KB+8djUBo3MwcTAOBgNVHQ8BAf8EBAMC
|
04RI63Y7YPwu1aExutjLvnkWCrgf2ze8KB+8djUBo3MwcTAOBgNVHQ8BAf8EBAMC
|
||||||
BaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAw
|
BaAwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMAwGA1UdEwEB/wQCMAAw
|
||||||
HQYDVR0OBBYEFG0oZxV+LHUKfE4gQ67xfHJuGQ/4MBMGA1UdEQQMMAqCCHRlc3R1
|
HQYDVR0OBBYEFG0oZxV+LHUKfE4gQ67xfHJuGQ/4MBMGA1UdEQQMMAqCCHRlc3R1
|
||||||
c2VyMAoGCCqGSM49BAMCA0cAMEQCIEwPZhPpYhYHndfTEsWOxnxzJkmhAcYIMCeJ
|
c2VyMAoGCCqGSM49BAMCA0cAMEQCIEwPZhPpYhYHndfTEsWOxnxzJkmhAcYIMCeJ
|
||||||
d9kyq/fPAiBNCJw1MCLT8LjNlyUZCfwI2zuI3e0w6vuau89oj2zvVA==
|
d9kyq/fPAiBNCJw1MCLT8LjNlyUZCfwI2zuI3e0w6vuau89oj2zvVA==
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
||||||
`)
|
`)
|
||||||
testKey = maskKey(strings.TrimSpace(`
|
|
||||||
-----BEGIN EC TESTING KEY-----
|
testKey = maskKey(here.Doc(`
|
||||||
MHcCAQEEIAqkBGGKTH5GzLx8XZLAHEFW2E8jT+jpy0p6w6MMR7DkoAoGCCqGSM49
|
-----BEGIN EC TESTING KEY-----
|
||||||
AwEHoUQDQgAEZO1wQvjo2Jq1zoZu0WiYh1uEOVbBPojFfdAc6u2p7KgIW9OESOt2
|
MHcCAQEEIAqkBGGKTH5GzLx8XZLAHEFW2E8jT+jpy0p6w6MMR7DkoAoGCCqGSM49
|
||||||
O2D8LtWhMbrYy755Fgq4H9s3vCgfvHY1AQ==
|
AwEHoUQDQgAEZO1wQvjo2Jq1zoZu0WiYh1uEOVbBPojFfdAc6u2p7KgIW9OESOt2
|
||||||
-----END EC TESTING KEY-----
|
O2D8LtWhMbrYy755Fgq4H9s3vCgfvHY1AQ==
|
||||||
|
-----END EC TESTING KEY-----
|
||||||
`))
|
`))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user