Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #911 from StrongMonkey/fix-custom-domain
Browse files Browse the repository at this point in the history
Add custom domain and certs in CLI
  • Loading branch information
StrongMonkey committed Dec 10, 2019
2 parents 07f9491 + 3477e13 commit 5ed1a2a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cli/cmd/info/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package info
import (
"fmt"
"sort"
"strconv"
"strings"

"github.com/rancher/rio/cli/pkg/clicontext"
Expand Down Expand Up @@ -36,6 +37,12 @@ func info(ctx *clicontext.CLIContext) error {
return fmt.Errorf("no system information is generated")
}

var names []string
var certs []string
for _, cd := range clusterDomains.Items {
names = append(names, cd.Name)
certs = append(certs, fmt.Sprintf("%s(%s)", cd.Name, strconv.FormatBool(cd.Status.HTTPSSupported)))
}
clusterDomain := clusterDomains.Items[0]

var addresses []string
Expand All @@ -45,10 +52,10 @@ func info(ctx *clicontext.CLIContext) error {

builder.WriteString(fmt.Sprintf("Rio Version: %s (%s)\n", info.Status.Version, info.Status.GitCommit))
builder.WriteString(fmt.Sprintf("Rio CLI Version: %s (%s)\n", version.Version, version.GitCommit))
builder.WriteString(fmt.Sprintf("Cluster Domain: %s\n", clusterDomain.Name))
builder.WriteString(fmt.Sprintf("Cluster Domain: %v\n", strings.Join(names, ",")))
builder.WriteString(fmt.Sprintf("Cluster Domain IPs: %s\n", strings.Join(addresses, ",")))
builder.WriteString(fmt.Sprintf("System Namespace: %s\n", info.Status.SystemNamespace))
builder.WriteString(fmt.Sprintf("Wildcard certificates: %v\n", clusterDomain.Status.HTTPSSupported))
builder.WriteString(fmt.Sprintf("Wildcard certificates: %v\n", strings.Join(certs, ",")))

var keys []string
for k := range info.Status.SystemComponentReadyMap {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func (f *certsHandler) onCertChange(key string, obj *certmanagerv1alpha2.Certifi
func (f *certsHandler) Handle(obj *v1.ClusterDomain, status v1.ClusterDomainStatus) ([]runtime.Object, v1.ClusterDomainStatus, error) {
if obj.Spec.SecretName != "" {
status.AssignedSecretName = obj.Spec.SecretName
status.HTTPSSupported = true
return nil, status, nil
}

Expand Down

0 comments on commit 5ed1a2a

Please sign in to comment.