Skip to content

Commit 67ed5bc

Browse files
authored
chore(workflow-cli): pts add node selector and ps add status field (#55)
1 parent ad68561 commit 67ed5bc

3 files changed

Lines changed: 32 additions & 18 deletions

File tree

cmd/ps.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,16 @@ func (d *DryccCmd) PsDescribe(appID, podID string) error {
127127
for _, arg := range containerState.Args {
128128
table.Append([]string{"", fmt.Sprintf("- %v", arg)})
129129
}
130+
// Status/Reason/Message
131+
if containerState.Status != "" {
132+
table.Append([]string{"Status:", containerState.Status})
133+
}
134+
if containerState.Reason != "" {
135+
table.Append([]string{"Reason:", containerState.Reason})
136+
}
137+
if containerState.Message != "" {
138+
table.Append([]string{"Message:", containerState.Message})
139+
}
130140
// State
131141
for key := range containerState.State {
132142
table.Append([]string{"State:", key})

cmd/pts.go

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -140,47 +140,51 @@ func printProcessTypes(d *DryccCmd, appID string, ptypes api.Ptypes) {
140140
func printProcessTypeDetail(d *DryccCmd, ptypeStates api.PtypeStates, events api.AppEvents) {
141141
// table process type
142142
tpt := d.getDefaultFormatTable([]string{})
143-
for _, containerState := range ptypeStates {
144-
// tpt.Append([]string{"Container: " + containerState.Container})
145-
// tpt.Append([]string{"Image: " + containerState.Image})
146-
tpt.Append([]string{"Container:", containerState.Container})
147-
tpt.Append([]string{"Image:", containerState.Image})
148-
if len(containerState.Command) != 0 {
143+
for _, ptypeState := range ptypeStates {
144+
tpt.Append([]string{"Container:", ptypeState.Container})
145+
tpt.Append([]string{"Image:", ptypeState.Image})
146+
if len(ptypeState.Command) != 0 {
149147
tpt.Append([]string{"Command:"})
150-
for _, command := range containerState.Command {
148+
for _, command := range ptypeState.Command {
151149
tpt.Append([]string{"", fmt.Sprintf("- %v", command)})
152150
}
153151
}
154-
if len(containerState.Args) != 0 {
152+
if len(ptypeState.Args) != 0 {
155153
tpt.Append([]string{"Args:"})
156-
for _, arg := range containerState.Args {
154+
for _, arg := range ptypeState.Args {
157155
tpt.Append([]string{"", fmt.Sprintf("- %v", arg)})
158156
}
159157
}
160-
if containerState.Limits != nil {
158+
if len(ptypeState.Limits) != 0 {
161159
tpt.Append([]string{"Limits:"})
162-
for r, q := range containerState.Limits {
160+
for r, q := range ptypeState.Limits {
163161
tpt.Append([]string{"", fmt.Sprintf("%s %s", r, q)})
164162
}
165163
}
166-
if len(containerState.VolumeMounts) != 0 {
164+
if len(ptypeState.VolumeMounts) != 0 {
167165
tpt.Append([]string{"Mounts:"})
168-
for _, mount := range containerState.VolumeMounts {
166+
for _, mount := range ptypeState.VolumeMounts {
169167
tpt.Append([]string{"", fmt.Sprintf("%s from %s", mount.MountPath, mount.Name)})
170168
}
171169
}
172-
sp := getHealthcheckString("", "", &containerState.StartupProbe)
170+
sp := getHealthcheckString("", "", &ptypeState.StartupProbe)
173171
if sp != "" {
174172
tpt.Append([]string{"Startup:", strings.TrimSpace(sp)})
175173
}
176-
lp := getHealthcheckString("", "", &containerState.LivenessProbe)
174+
lp := getHealthcheckString("", "", &ptypeState.LivenessProbe)
177175
if lp != "" {
178176
tpt.Append([]string{"Liveness:", strings.TrimSpace(lp)})
179177
}
180-
rp := getHealthcheckString("", "", &containerState.ReadinessProbe)
178+
rp := getHealthcheckString("", "", &ptypeState.ReadinessProbe)
181179
if rp != "" {
182180
tpt.Append([]string{"Readiness:", strings.TrimSpace(rp)})
183181
}
182+
if len(ptypeState.NodeSelector) != 0 {
183+
tpt.Append([]string{"Node-Selectors:"})
184+
for k, v := range ptypeState.NodeSelector {
185+
tpt.Append([]string{"", fmt.Sprintf("%s=%s", k, v)})
186+
}
187+
}
184188

185189
}
186190
tpt.Render()

drycc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ Subcommands, use 'drycc help [subcommand]' to learn more:
6060
labels manage labels of application
6161
limits manage resource limits for your application
6262
perms manage permissions for applications
63-
ps manage processes inside an app container
64-
pts manage process types inside an app container
63+
ps manage processes inside an app
64+
pts manage process types inside an app
6565
registry manage private registry information for your application
6666
releases manage releases of an application
6767
routing manage routability of an application

0 commit comments

Comments
 (0)