Skip to content

Commit fbeaa69

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: I2dd2aa5af4587a6ed514628c462e957d63d8a1a7 Signed-off-by: rabi <ramishra@redhat.com>
1 parent d7452fc commit fbeaa69

13 files changed

Lines changed: 623 additions & 4 deletions

api/bases/dataplane.openstack.org_openstackdataplanedeployments.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,43 @@ 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.
143+
items:
144+
type: string
145+
type: array
146+
failedHosts:
147+
description: FailedHosts is the number of hosts with Ansible
148+
task failures.
149+
type: integer
150+
failurePercent:
151+
description: FailurePercent is the percent of total hosts that
152+
failed or were unreachable.
153+
type: integer
154+
totalHosts:
155+
description: TotalHosts is the number of hosts included in the
156+
Ansible execution summary.
157+
type: integer
158+
unreachableHostList:
159+
description: UnreachableHostList contains the hosts that were
160+
unreachable.
161+
items:
162+
type: string
163+
type: array
164+
unreachableHosts:
165+
description: UnreachableHosts is the number of hosts that were
166+
unreachable.
167+
type: integer
168+
type: object
169+
description: AnsibleExecutionSummaries stores the most recent AEE
170+
execution summary per Job name.
171+
type: object
135172
bmhRefHashes:
136173
additionalProperties:
137174
type: string

api/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,6 +1925,46 @@ 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+
items:
1938+
type: string
1939+
type: array
1940+
failedHosts:
1941+
description: FailedHosts is the number of hosts with Ansible
1942+
task failures.
1943+
type: integer
1944+
failurePercent:
1945+
description: FailurePercent is the percent of total hosts
1946+
that failed or were unreachable.
1947+
type: integer
1948+
totalHosts:
1949+
description: TotalHosts is the number of hosts included in
1950+
the Ansible execution summary.
1951+
type: integer
1952+
unreachableHostList:
1953+
description: UnreachableHostList contains the hosts that were
1954+
unreachable.
1955+
items:
1956+
type: string
1957+
type: array
1958+
unreachableHosts:
1959+
description: UnreachableHosts is the number of hosts that
1960+
were unreachable.
1961+
type: integer
1962+
type: object
1963+
type: object
1964+
description: |-
1965+
DeploymentExecutionSummaries stores the most recent AEE execution summary
1966+
per deployment and Job name.
1967+
type: object
19281968
deploymentStatuses:
19291969
additionalProperties:
19301970
description: Conditions provide observations of the operational

api/dataplane/v1beta1/openstackdataplanedeployment_types.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,23 @@ 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" optional:"true"`
88+
// FailedHosts is the number of hosts with Ansible task failures.
89+
FailedHosts *int `json:"failedHosts,omitempty" optional:"true"`
90+
// UnreachableHosts is the number of hosts that were unreachable.
91+
UnreachableHosts *int `json:"unreachableHosts,omitempty" optional:"true"`
92+
// FailurePercent is the percent of total hosts that failed or were unreachable.
93+
FailurePercent *int `json:"failurePercent,omitempty" optional:"true"`
94+
// FailedHostList contains the hosts that failed.
95+
FailedHostList *[]string `json:"failedHostList,omitempty" optional:"true"`
96+
// UnreachableHostList contains the hosts that were unreachable.
97+
UnreachableHostList *[]string `json:"unreachableHostList,omitempty" optional:"true"`
98+
}
99+
83100
// OpenStackDataPlaneDeploymentStatus defines the observed state of OpenStackDataPlaneDeployment
84101
type OpenStackDataPlaneDeploymentStatus struct {
85102
// NodeSetConditions
@@ -88,6 +105,9 @@ type OpenStackDataPlaneDeploymentStatus struct {
88105
// AnsibleEEHashes
89106
AnsibleEEHashes map[string]string `json:"ansibleEEHashes,omitempty" optional:"true"`
90107

108+
// AnsibleExecutionSummaries stores the most recent AEE execution summary per Job name.
109+
AnsibleExecutionSummaries map[string]AnsibleExecutionSummary `json:"ansibleExecutionSummaries,omitempty" optional:"true"`
110+
91111
// ConfigMapHashes
92112
ConfigMapHashes map[string]string `json:"configMapHashes,omitempty" optional:"true"`
93113

@@ -192,6 +212,9 @@ func (instance *OpenStackDataPlaneDeployment) InitHashesAndImages() {
192212
if instance.Status.AnsibleEEHashes == nil {
193213
instance.Status.AnsibleEEHashes = make(map[string]string)
194214
}
215+
if instance.Status.AnsibleExecutionSummaries == nil {
216+
instance.Status.AnsibleExecutionSummaries = make(map[string]AnsibleExecutionSummary)
217+
}
195218
if instance.Status.ContainerImages == nil {
196219
instance.Status.ContainerImages = make(map[string]string)
197220
}

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: 78 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: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19071,6 +19071,43 @@ 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.
19082+
items:
19083+
type: string
19084+
type: array
19085+
failedHosts:
19086+
description: FailedHosts is the number of hosts with Ansible
19087+
task failures.
19088+
type: integer
19089+
failurePercent:
19090+
description: FailurePercent is the percent of total hosts that
19091+
failed or were unreachable.
19092+
type: integer
19093+
totalHosts:
19094+
description: TotalHosts is the number of hosts included in the
19095+
Ansible execution summary.
19096+
type: integer
19097+
unreachableHostList:
19098+
description: UnreachableHostList contains the hosts that were
19099+
unreachable.
19100+
items:
19101+
type: string
19102+
type: array
19103+
unreachableHosts:
19104+
description: UnreachableHosts is the number of hosts that were
19105+
unreachable.
19106+
type: integer
19107+
type: object
19108+
description: AnsibleExecutionSummaries stores the most recent AEE
19109+
execution summary per Job name.
19110+
type: object
1907419111
bmhRefHashes:
1907519112
additionalProperties:
1907619113
type: string
@@ -21131,6 +21168,46 @@ spec:
2113121168
deployedVersion:
2113221169
description: DeployedVersion
2113321170
type: string
21171+
deploymentExecutionSummaries:
21172+
additionalProperties:
21173+
additionalProperties:
21174+
description: |-
21175+
AnsibleExecutionSummary captures the final ansible-runner execution result
21176+
reported by the AEE pod.
21177+
properties:
21178+
failedHostList:
21179+
description: FailedHostList contains the hosts that failed.
21180+
items:
21181+
type: string
21182+
type: array
21183+
failedHosts:
21184+
description: FailedHosts is the number of hosts with Ansible
21185+
task failures.
21186+
type: integer
21187+
failurePercent:
21188+
description: FailurePercent is the percent of total hosts
21189+
that failed or were unreachable.
21190+
type: integer
21191+
totalHosts:
21192+
description: TotalHosts is the number of hosts included in
21193+
the Ansible execution summary.
21194+
type: integer
21195+
unreachableHostList:
21196+
description: UnreachableHostList contains the hosts that were
21197+
unreachable.
21198+
items:
21199+
type: string
21200+
type: array
21201+
unreachableHosts:
21202+
description: UnreachableHosts is the number of hosts that
21203+
were unreachable.
21204+
type: integer
21205+
type: object
21206+
type: object
21207+
description: |-
21208+
DeploymentExecutionSummaries stores the most recent AEE execution summary
21209+
per deployment and Job name.
21210+
type: object
2113421211
deploymentStatuses:
2113521212
additionalProperties:
2113621213
description: Conditions provide observations of the operational

0 commit comments

Comments
 (0)