Skip to content

Commit

Permalink
Merge pull request #798 from fluxcd/update-lastappliedrevision
Browse files Browse the repository at this point in the history
api: update description LastAppliedRevision
  • Loading branch information
hiddeco authored Feb 17, 2023
2 parents ef22027 + 0659a82 commit 5056fbf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 23 deletions.
10 changes: 1 addition & 9 deletions api/v1beta2/kustomization_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ type KustomizationStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty"`

// The last successfully applied revision.
// The revision format for Git sources is <branch|tag>/<commit-sha>.
// Equals the Revision of the applied Artifact from the referenced Source.
// +optional
LastAppliedRevision string `json:"lastAppliedRevision,omitempty"`

Expand Down Expand Up @@ -319,11 +319,3 @@ type KustomizationList struct {
func init() {
SchemeBuilder.Register(&Kustomization{}, &KustomizationList{})
}

func trimString(str string, limit int) string {
if len(str) <= limit {
return str
}

return str[0:limit] + "..."
}
Original file line number Diff line number Diff line change
Expand Up @@ -1098,8 +1098,8 @@ spec:
- entries
type: object
lastAppliedRevision:
description: The last successfully applied revision. The revision
format for Git sources is <branch|tag>/<commit-sha>.
description: The last successfully applied revision. Equals the Revision
of the applied Artifact from the referenced Source.
type: string
lastAttemptedRevision:
description: LastAttemptedRevision is the revision of the last reconciliation
Expand Down
2 changes: 1 addition & 1 deletion docs/api/kustomize.md
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ string
<td>
<em>(Optional)</em>
<p>The last successfully applied revision.
The revision format for Git sources is <branch|tag>/<commit-sha>.</p>
Equals the Revision of the applied Artifact from the referenced Source.</p>
</td>
</tr>
<tr>
Expand Down
22 changes: 11 additions & 11 deletions docs/spec/v1beta2/kustomization.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ You can run this example by saving the manifest into `podinfo.yaml`.

```console
NAME URL READY STATUS
podinfo https://github.com/stefanprodan/podinfo True stored artifact for revision 'master/450796ddb2ab6724ee1cc32a4be56da032d1cca0'
podinfo https://github.com/stefanprodan/podinfo True stored artifact for revision 'master@sha1:450796ddb2ab6724ee1cc32a4be56da032d1cca0'
```

3. Run `kubectl get kustomizations` to see the reconciliation status:

```console
NAME READY STATUS
podinfo True Applied revision: master/450796ddb2ab6724ee1cc32a4be56da032d1cca0
podinfo True Applied revision: master@sha1:450796ddb2ab6724ee1cc32a4be56da032d1cca0
```

4. Run `kubectl describe kustomization podinfo` to see the reconciliation status conditions and events:
Expand All @@ -78,7 +78,7 @@ You can run this example by saving the manifest into `podinfo.yaml`.
Status:
Conditions:
Last Transition Time: 2022-06-07T11:14:41Z
Message: Applied revision: master/450796ddb2ab6724ee1cc32a4be56da032d1cca0
Message: Applied revision: master@sha1:450796ddb2ab6724ee1cc32a4be56da032d1cca0
Reason: ReconciliationSucceeded
Status: True
Type: Ready
Expand Down Expand Up @@ -1398,7 +1398,7 @@ updates its message to report the action performed during a reconciliation run:
```yaml
conditions:
- lastTransitionTime: "2022-10-17T13:40:21Z"
message: Detecting drift for revision main/a1afe267b54f38b46b487f6e938a6fd508278c07 with a timeout of 50s
message: Detecting drift for revision main@sha1:a1afe267b54f38b46b487f6e938a6fd508278c07 with a timeout of 50s
observedGeneration: 2
reason: Progressing
status: "True"
Expand All @@ -1418,12 +1418,12 @@ and the `Ready` condition is set to `True`:
status:
conditions:
- lastTransitionTime: "2022-10-17T13:40:21Z"
message: "Applied revision: main/a1afe267b54f38b46b487f6e938a6fd508278c07"
message: "Applied revision: main@sha1:a1afe267b54f38b46b487f6e938a6fd508278c07"
reason: ReconciliationSucceeded
status: "True"
type: Ready
lastAppliedRevision: main/a1afe267b54f38b46b487f6e938a6fd508278c07
lastAttemptedRevision: main/a1afe267b54f38b46b487f6e938a6fd508278c07
lastAppliedRevision: main@sha1:a1afe267b54f38b46b487f6e938a6fd508278c07
lastAttemptedRevision: main@sha1:a1afe267b54f38b46b487f6e938a6fd508278c07
```

If `spec.wait` or `spec.healthChecks` is enabled, the health assessment result
Expand All @@ -1446,7 +1446,7 @@ The controller logs the Kubernetes objects:
"msg": "server-side apply completed",
"name": "backend",
"namespace": "default",
"revision": "main/a1afe267b54f38b46b487f6e938a6fd508278c07",
"revision": "main@sha1:a1afe267b54f38b46b487f6e938a6fd508278c07",
"output": {
"service/backend": "created",
"deployment.apps/backend": "created",
Expand All @@ -1465,8 +1465,8 @@ status:
reason: ValidationFailed
status: "False"
type: Ready
lastAppliedRevision: master/a1afe267b54f38b46b487f6e938a6fd508278c07
lastAttemptedRevision: master/7c500d302e38e7e4a3f327343a8a5c21acaaeb87
lastAppliedRevision: master@sha1:a1afe267b54f38b46b487f6e938a6fd508278c07
lastAttemptedRevision: master@sha1:7c500d302e38e7e4a3f327343a8a5c21acaaeb87
```

**Note:** The last applied revision is updated only on a successful reconciliation.
Expand All @@ -1481,7 +1481,7 @@ When a reconciliation fails, the controller logs the error and issues a Kubernet
"msg": "server-side apply completed",
"name": "backend",
"namespace": "default",
"revision": "main/a1afe267b54f38b46b487f6e938a6fd508278c07",
"revision": "main@sha1:a1afe267b54f38b46b487f6e938a6fd508278c07",
"error": "The Service 'backend' is invalid: spec.type: Unsupported value: 'Ingress'"
}
```

0 comments on commit 5056fbf

Please sign in to comment.