1+ // Copyright 2021 VMware, Inc. All Rights Reserved.
2+ // SPDX-License-Identifier: Apache-2.0
13package client
24
35import (
@@ -14,6 +16,7 @@ import (
1416 "github.com/pkg/errors"
1517)
1618
19+ // GetClusterPinnipedInfoOptions contains options supported by GetPinnipedSupervisorDiscovery
1720type GetPinnipedSupervisorDiscoveryOptions struct {
1821 // the .well-known/openid-configuration discovery endpoint for a pinniped supervisor
1922 Endpoint string
@@ -25,6 +28,7 @@ type PinnipedSupervisorDiscoveryV1Alpha1 struct {
2528 PinnipedIdentityProvidersEndpoint string `json:"pinniped_identity_providers_endpoint,omitempty"`
2629}
2730
31+ // ClusterPinnipedInfo defines the fields of discovery object returned from the pinniped supervisor .well-known endpoint
2832type PinnipedSupervisorDiscoveryInfo struct {
2933 Issuer string `json:"issuer,omitempty"`
3034 AuthorizationEndpoint string `json:"authorization_endpoint,omitempty"`
@@ -39,9 +43,9 @@ type PinnipedSupervisorDiscoveryInfo struct {
3943 DiscoveryV1Aplha1 PinnipedSupervisorDiscoveryV1Alpha1 `json:"discovery.supervisor.pinniped.dev/v1alpha1,omitempty"`
4044}
4145
42- // There is only one supervisor on the mgmt cluster, unlike GetClusterPinnipedInfo() which may look for the
43- // configmap on either a mgmt cluster or a workload cluster. In this case we are always looking to the mgmt
44- // cluster to get the resource we need .
46+ // GetPinnipedSupervisorDiscovery() gets the discovery information from the pinniped supervisor .well-known endpoint.
47+ // The pinniped supervisor always is always on a supervisor/management style cluster, never on a workload cluster,
48+ // unlike the GetClusterPinnipedInfo() func which may look for the info file on the workload cluster .
4549func (c * TkgClient ) GetPinnipedSupervisorDiscovery (options GetPinnipedSupervisorDiscoveryOptions ) (* PinnipedSupervisorDiscoveryInfo , error ) {
4650
4751 fmt .Println ("tkgClient.GetPinnipedSupervisorDiscovery()" )
@@ -58,7 +62,7 @@ func (c *TkgClient) GetPinnipedSupervisorDiscovery(options GetPinnipedSupervisor
5862 // check to see if the caBundle is usable, if the user custom configured anything, etc.
5963 // basically, if we have a value we have to try to use it
6064 if caBundle != "" {
61- // TODO(BEN): should this be done in the pinniped-info function? to the value that it returns, rather than returning a string to
65+ // TODO(BEN): should this be done in the pinniped-info function? Ought it decode before returning so we don't do this here?
6266 decoded , err := base64 .StdEncoding .DecodeString (caBundle )
6367 if err != nil {
6468 return nil , errors .Wrap (err , "unable to decode the base64-encoded custom registry CA certificate string" )
0 commit comments