Skip to content

Commit eb9538f

Browse files
committed
Store ansible execution summaries in status
Capture the AEE pod termination summary when jobs reach a terminal state and persist it on deployment/ nodeset status. This keeps host failure counts and failure percentages available after the ansible job pods are deleted. Depends-On: openstack-k8s-operators/edpm-ansible#1168 Change-Id: Ia9e4279307f2169405d91e34eb5342c7d3758663 Signed-off-by: rabi <ramishra@redhat.com>
1 parent d7452fc commit eb9538f

13 files changed

Lines changed: 541 additions & 4 deletions

api/bases/dataplane.openstack.org_openstackdataplanedeployments.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,38 @@ spec:
132132
type: string
133133
description: AnsibleEEHashes
134134
type: object
135+
ansibleExecutionSummaries:
136+
additionalProperties:
137+
description: |-
138+
AnsibleExecutionSummary captures the final ansible-runner execution result
139+
reported by the AEE pod.
140+
properties:
141+
failedHostList:
142+
description: FailedHostList contains the hosts that failed or
143+
were unreachable.
144+
items:
145+
type: string
146+
type: array
147+
failedHosts:
148+
description: FailedHosts is the number of hosts with Ansible
149+
task failures.
150+
type: integer
151+
failurePercent:
152+
description: FailurePercent is the percent of total hosts that
153+
failed or were unreachable.
154+
type: string
155+
totalHosts:
156+
description: TotalHosts is the number of hosts included in the
157+
Ansible execution summary.
158+
type: integer
159+
unreachableHosts:
160+
description: UnreachableHosts is the number of hosts that were
161+
unreachable.
162+
type: integer
163+
type: object
164+
description: AnsibleExecutionSummaries stores the most recent AEE
165+
execution summary per Job name.
166+
type: object
135167
bmhRefHashes:
136168
additionalProperties:
137169
type: string

api/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,6 +1925,41 @@ spec:
19251925
deployedVersion:
19261926
description: DeployedVersion
19271927
type: string
1928+
deploymentExecutionSummaries:
1929+
additionalProperties:
1930+
additionalProperties:
1931+
description: |-
1932+
AnsibleExecutionSummary captures the final ansible-runner execution result
1933+
reported by the AEE pod.
1934+
properties:
1935+
failedHostList:
1936+
description: FailedHostList contains the hosts that failed
1937+
or were unreachable.
1938+
items:
1939+
type: string
1940+
type: array
1941+
failedHosts:
1942+
description: FailedHosts is the number of hosts with Ansible
1943+
task failures.
1944+
type: integer
1945+
failurePercent:
1946+
description: FailurePercent is the percent of total hosts
1947+
that failed or were unreachable.
1948+
type: string
1949+
totalHosts:
1950+
description: TotalHosts is the number of hosts included in
1951+
the Ansible execution summary.
1952+
type: integer
1953+
unreachableHosts:
1954+
description: UnreachableHosts is the number of hosts that
1955+
were unreachable.
1956+
type: integer
1957+
type: object
1958+
type: object
1959+
description: |-
1960+
DeploymentExecutionSummaries stores the most recent AEE execution summary
1961+
per deployment and Job name.
1962+
type: object
19281963
deploymentStatuses:
19291964
additionalProperties:
19301965
description: Conditions provide observations of the operational

api/dataplane/v1beta1/openstackdataplanedeployment_types.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,21 @@ type OpenStackDataPlaneDeploymentSpec struct {
8080
AnsibleEEEnvConfigMapName string `json:"ansibleEEEnvConfigMapName,omitempty"`
8181
}
8282

83+
// AnsibleExecutionSummary captures the final ansible-runner execution result
84+
// reported by the AEE pod.
85+
type AnsibleExecutionSummary struct {
86+
// TotalHosts is the number of hosts included in the Ansible execution summary.
87+
TotalHosts int `json:"totalHosts,omitempty"`
88+
// FailedHosts is the number of hosts with Ansible task failures.
89+
FailedHosts int `json:"failedHosts,omitempty"`
90+
// UnreachableHosts is the number of hosts that were unreachable.
91+
UnreachableHosts int `json:"unreachableHosts,omitempty"`
92+
// FailurePercent is the percent of total hosts that failed or were unreachable.
93+
FailurePercent string `json:"failurePercent,omitempty"`
94+
// FailedHostList contains the hosts that failed or were unreachable.
95+
FailedHostList []string `json:"failedHostList,omitempty"`
96+
}
97+
8398
// OpenStackDataPlaneDeploymentStatus defines the observed state of OpenStackDataPlaneDeployment
8499
type OpenStackDataPlaneDeploymentStatus struct {
85100
// NodeSetConditions
@@ -88,6 +103,9 @@ type OpenStackDataPlaneDeploymentStatus struct {
88103
// AnsibleEEHashes
89104
AnsibleEEHashes map[string]string `json:"ansibleEEHashes,omitempty" optional:"true"`
90105

106+
// AnsibleExecutionSummaries stores the most recent AEE execution summary per Job name.
107+
AnsibleExecutionSummaries map[string]AnsibleExecutionSummary `json:"ansibleExecutionSummaries,omitempty" optional:"true"`
108+
91109
// ConfigMapHashes
92110
ConfigMapHashes map[string]string `json:"configMapHashes,omitempty" optional:"true"`
93111

@@ -192,6 +210,9 @@ func (instance *OpenStackDataPlaneDeployment) InitHashesAndImages() {
192210
if instance.Status.AnsibleEEHashes == nil {
193211
instance.Status.AnsibleEEHashes = make(map[string]string)
194212
}
213+
if instance.Status.AnsibleExecutionSummaries == nil {
214+
instance.Status.AnsibleExecutionSummaries = make(map[string]AnsibleExecutionSummary)
215+
}
195216
if instance.Status.ContainerImages == nil {
196217
instance.Status.ContainerImages = make(map[string]string)
197218
}

api/dataplane/v1beta1/openstackdataplanenodeset_types.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ type OpenStackDataPlaneNodeSetStatus struct {
117117
// DeploymentStatuses
118118
DeploymentStatuses map[string]condition.Conditions `json:"deploymentStatuses,omitempty" optional:"true"`
119119

120+
// DeploymentExecutionSummaries stores the most recent AEE execution summary
121+
// per deployment and Job name.
122+
DeploymentExecutionSummaries map[string]map[string]AnsibleExecutionSummary `json:"deploymentExecutionSummaries,omitempty" optional:"true"`
123+
120124
// AllHostnames
121125
AllHostnames map[string]map[infranetworkv1.NetNameStr]string `json:"allHostnames,omitempty" optional:"true"`
122126

@@ -187,6 +191,7 @@ func (instance OpenStackDataPlaneNodeSet) IsReady() bool {
187191
func (instance *OpenStackDataPlaneNodeSet) InitConditions() {
188192
instance.Status.Conditions = condition.Conditions{}
189193
instance.Status.DeploymentStatuses = make(map[string]condition.Conditions)
194+
instance.Status.DeploymentExecutionSummaries = make(map[string]map[string]AnsibleExecutionSummary)
190195

191196
cl := condition.CreateList(
192197
condition.UnknownCondition(condition.DeploymentReadyCondition, condition.InitReason, condition.DeploymentReadyInitMessage),
@@ -208,10 +213,10 @@ func (instance *OpenStackDataPlaneNodeSet) InitConditions() {
208213
// GetAnsibleEESpec - get the fields that will be passed to AEE Job
209214
func (instance OpenStackDataPlaneNodeSet) GetAnsibleEESpec() AnsibleEESpec {
210215
return AnsibleEESpec{
211-
NetworkAttachments: instance.Spec.NetworkAttachments,
212-
ExtraMounts: instance.Spec.NodeTemplate.ExtraMounts,
213-
Env: instance.Spec.Env,
214-
ServiceAccountName: instance.Name,
216+
NetworkAttachments: instance.Spec.NetworkAttachments,
217+
ExtraMounts: instance.Spec.NodeTemplate.ExtraMounts,
218+
Env: instance.Spec.Env,
219+
ServiceAccountName: instance.Name,
215220
}
216221
}
217222

api/dataplane/v1beta1/zz_generated.deepcopy.go

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

bindata/crds/crds.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19071,6 +19071,38 @@ spec:
1907119071
type: string
1907219072
description: AnsibleEEHashes
1907319073
type: object
19074+
ansibleExecutionSummaries:
19075+
additionalProperties:
19076+
description: |-
19077+
AnsibleExecutionSummary captures the final ansible-runner execution result
19078+
reported by the AEE pod.
19079+
properties:
19080+
failedHostList:
19081+
description: FailedHostList contains the hosts that failed or
19082+
were unreachable.
19083+
items:
19084+
type: string
19085+
type: array
19086+
failedHosts:
19087+
description: FailedHosts is the number of hosts with Ansible
19088+
task failures.
19089+
type: integer
19090+
failurePercent:
19091+
description: FailurePercent is the percent of total hosts that
19092+
failed or were unreachable.
19093+
type: string
19094+
totalHosts:
19095+
description: TotalHosts is the number of hosts included in the
19096+
Ansible execution summary.
19097+
type: integer
19098+
unreachableHosts:
19099+
description: UnreachableHosts is the number of hosts that were
19100+
unreachable.
19101+
type: integer
19102+
type: object
19103+
description: AnsibleExecutionSummaries stores the most recent AEE
19104+
execution summary per Job name.
19105+
type: object
1907419106
bmhRefHashes:
1907519107
additionalProperties:
1907619108
type: string
@@ -21131,6 +21163,41 @@ spec:
2113121163
deployedVersion:
2113221164
description: DeployedVersion
2113321165
type: string
21166+
deploymentExecutionSummaries:
21167+
additionalProperties:
21168+
additionalProperties:
21169+
description: |-
21170+
AnsibleExecutionSummary captures the final ansible-runner execution result
21171+
reported by the AEE pod.
21172+
properties:
21173+
failedHostList:
21174+
description: FailedHostList contains the hosts that failed
21175+
or were unreachable.
21176+
items:
21177+
type: string
21178+
type: array
21179+
failedHosts:
21180+
description: FailedHosts is the number of hosts with Ansible
21181+
task failures.
21182+
type: integer
21183+
failurePercent:
21184+
description: FailurePercent is the percent of total hosts
21185+
that failed or were unreachable.
21186+
type: string
21187+
totalHosts:
21188+
description: TotalHosts is the number of hosts included in
21189+
the Ansible execution summary.
21190+
type: integer
21191+
unreachableHosts:
21192+
description: UnreachableHosts is the number of hosts that
21193+
were unreachable.
21194+
type: integer
21195+
type: object
21196+
type: object
21197+
description: |-
21198+
DeploymentExecutionSummaries stores the most recent AEE execution summary
21199+
per deployment and Job name.
21200+
type: object
2113421201
deploymentStatuses:
2113521202
additionalProperties:
2113621203
description: Conditions provide observations of the operational

config/crd/bases/dataplane.openstack.org_openstackdataplanedeployments.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,38 @@ spec:
132132
type: string
133133
description: AnsibleEEHashes
134134
type: object
135+
ansibleExecutionSummaries:
136+
additionalProperties:
137+
description: |-
138+
AnsibleExecutionSummary captures the final ansible-runner execution result
139+
reported by the AEE pod.
140+
properties:
141+
failedHostList:
142+
description: FailedHostList contains the hosts that failed or
143+
were unreachable.
144+
items:
145+
type: string
146+
type: array
147+
failedHosts:
148+
description: FailedHosts is the number of hosts with Ansible
149+
task failures.
150+
type: integer
151+
failurePercent:
152+
description: FailurePercent is the percent of total hosts that
153+
failed or were unreachable.
154+
type: string
155+
totalHosts:
156+
description: TotalHosts is the number of hosts included in the
157+
Ansible execution summary.
158+
type: integer
159+
unreachableHosts:
160+
description: UnreachableHosts is the number of hosts that were
161+
unreachable.
162+
type: integer
163+
type: object
164+
description: AnsibleExecutionSummaries stores the most recent AEE
165+
execution summary per Job name.
166+
type: object
135167
bmhRefHashes:
136168
additionalProperties:
137169
type: string

config/crd/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,6 +1925,41 @@ spec:
19251925
deployedVersion:
19261926
description: DeployedVersion
19271927
type: string
1928+
deploymentExecutionSummaries:
1929+
additionalProperties:
1930+
additionalProperties:
1931+
description: |-
1932+
AnsibleExecutionSummary captures the final ansible-runner execution result
1933+
reported by the AEE pod.
1934+
properties:
1935+
failedHostList:
1936+
description: FailedHostList contains the hosts that failed
1937+
or were unreachable.
1938+
items:
1939+
type: string
1940+
type: array
1941+
failedHosts:
1942+
description: FailedHosts is the number of hosts with Ansible
1943+
task failures.
1944+
type: integer
1945+
failurePercent:
1946+
description: FailurePercent is the percent of total hosts
1947+
that failed or were unreachable.
1948+
type: string
1949+
totalHosts:
1950+
description: TotalHosts is the number of hosts included in
1951+
the Ansible execution summary.
1952+
type: integer
1953+
unreachableHosts:
1954+
description: UnreachableHosts is the number of hosts that
1955+
were unreachable.
1956+
type: integer
1957+
type: object
1958+
type: object
1959+
description: |-
1960+
DeploymentExecutionSummaries stores the most recent AEE execution summary
1961+
per deployment and Job name.
1962+
type: object
19281963
deploymentStatuses:
19291964
additionalProperties:
19301965
description: Conditions provide observations of the operational

internal/controller/dataplane/openstackdataplanenodeset_controller.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,13 @@ func checkDeployment(ctx context.Context, helper *helper.Helper,
539539
instance.Status.DeploymentStatuses = make(map[string]condition.Conditions)
540540
}
541541
instance.Status.DeploymentStatuses[deployment.Name] = deploymentConditions
542+
if len(deployment.Status.AnsibleExecutionSummaries) > 0 {
543+
if instance.Status.DeploymentExecutionSummaries == nil {
544+
instance.Status.DeploymentExecutionSummaries = make(map[string]map[string]dataplanev1.AnsibleExecutionSummary)
545+
}
546+
deploymentStatus := deployment.Status.DeepCopy()
547+
instance.Status.DeploymentExecutionSummaries[deployment.Name] = deploymentStatus.AnsibleExecutionSummaries
548+
}
542549

543550
// Apply filtering for overall nodeset deployment state logic
544551
isLatestDeployment := latestRelevantDeployment != nil && deployment.Name == latestRelevantDeployment.Name

0 commit comments

Comments
 (0)