Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Hepto
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ACIDES
Hepto
Commits
c3084796
Commit
c3084796
authored
1 year ago
by
kaiyou
Browse files
Options
Downloads
Patches
Plain Diff
Output cluster info as yaml for helm
parent
9e4e302f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmd/hepto/hepto.go
+19
-13
19 additions, 13 deletions
cmd/hepto/hepto.go
with
19 additions
and
13 deletions
cmd/hepto/hepto.go
+
19
−
13
View file @
c3084796
...
@@ -7,10 +7,10 @@ import (
...
@@ -7,10 +7,10 @@ import (
"os"
"os"
"path"
"path"
"strings"
"strings"
"text/tabwriter"
"go.acides.org/dolly"
"go.acides.org/dolly"
"go.acides.org/hepto/services"
"go.acides.org/hepto/services"
"gopkg.in/yaml.v3"
)
)
// The main hepto command
// The main hepto command
...
@@ -38,18 +38,24 @@ func Hepto() error {
...
@@ -38,18 +38,24 @@ func Hepto() error {
manager
:=
services
.
NewManager
(
&
config
.
Cluster
,
&
config
.
Node
,
config
.
Logger
)
manager
:=
services
.
NewManager
(
&
config
.
Cluster
,
&
config
.
Node
,
config
.
Logger
)
// If displaying info was required, go for it
// If displaying info was required, go for it
if
config
.
Info
{
if
config
.
Info
{
w
:=
tabwriter
.
NewWriter
(
os
.
Stdout
,
2
,
3
,
1
,
' '
,
0
)
info
:=
map
[
string
]
map
[
string
]
string
{
fmt
.
Fprintf
(
w
,
"cluster
\t
name
\t
%s
\n
"
,
config
.
Cluster
.
Name
)
"cluster"
:
{
fmt
.
Fprintf
(
w
,
"cluster
\t
vpn CIDR
\t
%s
\n
"
,
manager
.
State
.
Networking
()
.
NodeNet
)
"name"
:
config
.
Cluster
.
Name
,
fmt
.
Fprintf
(
w
,
"cluster
\t
pod CIDR
\t
%s
\n
"
,
manager
.
State
.
Networking
()
.
PodNet
)
"podCIDR"
:
manager
.
State
.
Networking
()
.
PodNet
.
String
(),
fmt
.
Fprintf
(
w
,
"cluster
\t
service CIDR
\t
%s
\n
"
,
manager
.
State
.
Networking
()
.
ServiceNet
)
"serviceCIDR"
:
manager
.
State
.
Networking
()
.
ServiceNet
.
String
(),
fmt
.
Fprintf
(
w
,
"node
\t
name
\t
%s
\n
"
,
config
.
Node
.
Name
)
},
fmt
.
Fprintf
(
w
,
"node
\t
role
\t
%s
\n
"
,
config
.
Node
.
Role
)
"services"
:
{
fmt
.
Fprintf
(
w
,
"node
\t
vpn IP
\t
%s
\n
"
,
manager
.
State
.
Networking
()
.
NodeAddress
)
"api"
:
manager
.
State
.
Networking
()
.
NodeAddress
.
String
(),
fmt
.
Fprintf
(
w
,
"node
\t
data
\t
%s
\n
"
,
dataPath
)
"dns"
:
manager
.
State
.
Networking
()
.
DNSAddress
.
String
(),
fmt
.
Fprintf
(
w
,
"service
\t
API IP
\t
%s
\n
"
,
manager
.
State
.
Networking
()
.
APIAddress
)
},
fmt
.
Fprintf
(
w
,
"service
\t
DNS IP
\t
%s
\n
"
,
manager
.
State
.
Networking
()
.
DNSAddress
)
"node"
:
{
return
w
.
Flush
()
"name"
:
config
.
Node
.
Name
,
"ip"
:
manager
.
State
.
Networking
()
.
NodeAddress
.
String
(),
},
}
str
,
_
:=
yaml
.
Marshal
(
info
)
os
.
Stdout
.
Write
(
str
)
os
.
Exit
(
0
)
}
}
// Otherwise create a container and start the manager
// Otherwise create a container and start the manager
c
:=
dolly
.
NewForking
(
!
config
.
Daemonize
)
c
:=
dolly
.
NewForking
(
!
config
.
Daemonize
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment