Skip to content

Commit

Permalink
fix: use Time to define lastAwakeTime
Browse files Browse the repository at this point in the history
  • Loading branch information
waveywaves committed Sep 11, 2023
1 parent 6515426 commit 7912506
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include tests/e2e/Makefile

VERSION ?= 1.3.2
VERSION ?= 1.3.3

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/uffizzicluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ type UffizziClusterStatus struct {
Host *string `json:"host,omitempty"`
LastAppliedConfiguration *string `json:"lastAppliedConfiguration,omitempty"`
LastAppliedHelmReleaseSpec *string `json:"lastAppliedHelmReleaseSpec,omitempty"`
LastAwakeTime *string `json:"lastAwakeTime,omitempty"`
LastAwakeTime metav1.Time `json:"lastAwakeTime,omitempty"`
}

// VClusterKubeConfig is the KubeConfig SecretReference of the related VCluster
Expand Down
6 changes: 1 addition & 5 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version: 1.3.1
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v1.3.2"
appVersion: "v1.3.3"
dependencies:
- name: common
repository: https://charts.bitnami.com/bitnami
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ spec:
lastAppliedHelmReleaseSpec:
type: string
lastAwakeTime:
format: date-time
type: string
type: object
type: object
Expand Down
3 changes: 1 addition & 2 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

image:
repository: docker.io/uffizzi/uffizzi-cluster-operator
tag: v1.3.2
tag: v1.3.3
# `flux` dependency values
flux:
helmController:
Expand All @@ -31,7 +31,6 @@ flux:
# controller:
# extraArgs:
# enable-ssl-passthrough: true

# To install nginx-ingress and cert-manager charts
# along with the rest apply the following tags (enabled by default)
#tags:
Expand Down
1 change: 1 addition & 0 deletions config/crd/bases/uffizzi.com_uffizziclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ spec:
lastAppliedHelmReleaseSpec:
type: string
lastAwakeTime:
format: date-time
type: string
type: object
type: object
Expand Down
7 changes: 3 additions & 4 deletions controllers/uffizzicluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ func (r *UffizziClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reque
kubeConfig = uclusteruffizzicomv1alpha1.VClusterKubeConfig{
SecretRef: &meta.SecretKeyReference{},
}
lastAwakeTime = metav1.Now().String()
lastAwakeTime = metav1.Now().Rfc3339Copy()
)
uCluster.Status = uclusteruffizzicomv1alpha1.UffizziClusterStatus{
Conditions: intialConditions,
HelmReleaseRef: &helmReleaseRef,
Host: &host,
KubeConfig: kubeConfig,
LastAwakeTime: &lastAwakeTime,
LastAwakeTime: lastAwakeTime,
}
if err := r.Status().Update(ctx, uCluster); err != nil {
logger.Error(err, "Failed to update the default UffizziCluster status")
Expand Down Expand Up @@ -322,8 +322,7 @@ func (r *UffizziClusterReconciler) reconcileSleepState(ctx context.Context, uClu
}
// set status for vcluster waking up
lastAwakeTime := metav1.Now().Rfc3339Copy()
lastAwakeTimeString := lastAwakeTime.String()
uCluster.Status.LastAwakeTime = &lastAwakeTimeString
uCluster.Status.LastAwakeTime = lastAwakeTime
setCondition(uCluster, Awoken(lastAwakeTime))
}
if err := r.Status().Update(ctx, uCluster); err != nil {
Expand Down

0 comments on commit 7912506

Please sign in to comment.