Skip to content
This repository was archived by the owner on Oct 10, 2023. It is now read-only.

Commit 05e6369

Browse files
tweaks
1 parent 211363c commit 05e6369

3 files changed

Lines changed: 88 additions & 5 deletions

File tree

‎tkg/client/client.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ type Client interface {
196196
UpdateCredentialsCluster(options *UpdateCredentialsOptions) error
197197
// GetClusterPinnipedInfo returns the cluster and pinniped info
198198
GetClusterPinnipedInfo(options GetClusterPinnipedInfoOptions) (*ClusterPinnipedInfo, error)
199-
// DescribeCluster describes all the objects in the Cluster
200199
// GetPinnipedSupervisorDiscovery returns the discovery information from the pinniped supervisor
201200
GetPinnipedSupervisorDiscovery(options GetPinnipedSupervisorDiscoveryOptions) (*PinnipedSupervisorDiscoveryInfo, error)
201+
// DescribeCluster describes all the objects in the Cluster
202202
DescribeCluster(options DescribeTKGClustersOptions) (*clusterctltree.ObjectTree, *capi.Cluster, *clusterctlv1.ProviderList, error)
203203
// DescribeProvider describes all the installed providers
204204
DescribeProvider() (*clusterctlv1.ProviderList, error)

‎tkg/client/get_cluster_pinniped_supervisor_discovery.go‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Copyright 2021 VMware, Inc. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
13
package client
24

35
import (
@@ -14,6 +16,7 @@ import (
1416
"github.com/pkg/errors"
1517
)
1618

19+
// GetClusterPinnipedInfoOptions contains options supported by GetPinnipedSupervisorDiscovery
1720
type 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
2832
type 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.
4549
func (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")

‎tkg/fakes/client.go‎

Lines changed: 79 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)