Skip to content

Commit

Permalink
Update Instance CRD for DB and Operator patching (#253)
Browse files Browse the repository at this point in the history
Change-Id: Ie6fa87909cc781f5f1db6d88cda49a387749a99d
  • Loading branch information
akinfermo authored Sep 14, 2022
1 parent 1f4032a commit 8837e32
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 13 deletions.
12 changes: 9 additions & 3 deletions oracle/api/v1alpha1/instance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,6 @@ type InstanceStatus struct {
// +kubebuilder:validation:Format=date-time
LastRestoreTime *metav1.Time `json:"lastRestoreTime,omitempty"`

// CurrentServiceImage stores the image name used by the database instance.
CurrentServiceImage string `json:"currentServiceImage,omitempty"`

// CurrentParameters stores the last successfully set instance parameters.
CurrentParameters map[string]string `json:"currentParameters,omitempty"`

Expand All @@ -283,6 +280,15 @@ type InstanceStatus struct {
// parameter update loop.
LastFailedParameterUpdate map[string]string `json:"lastFailedParameterUpdate,omitempty"`

// ActiveImages stores the stable images used by the active containers.
ActiveImages map[string]string `json:"ActiveImages,omitempty"`

// LastFailedImages stores the images which failed the last patching workflow..
LastFailedImages map[string]string `json:"LastFailedImages,omitempty"`

// CurrentActiveStateMachine stores the name of the state machine currently active.
CurrentActiveStateMachine string `json:"CurrentActiveStateMachine,omitempty"`

// LockedByController is a shared lock field granting exclusive access
// to maintenance operations to only one controller.
// Empty value means unlocked.
Expand Down
14 changes: 14 additions & 0 deletions oracle/api/v1alpha1/zz_generated.deepcopy.go

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

20 changes: 16 additions & 4 deletions oracle/config/crd/bases/oracle.db.anthosapis.com_instances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,26 @@ spec:
status:
description: InstanceStatus defines the observed state of Instance.
properties:
ActiveImages:
additionalProperties:
type: string
description: ActiveImages stores the stable images used by the active
containers.
type: object
CurrentActiveStateMachine:
description: CurrentActiveStateMachine stores the name of the state
machine currently active.
type: string
DnfsEnabled:
description: DnfsEnabled stores whether dNFS has already been enabled
or not.
type: boolean
LastFailedImages:
additionalProperties:
type: string
description: LastFailedImages stores the images which failed the last
patching workflow..
type: object
adminUser:
description: AdminUser represents the observed state of the admin
user
Expand Down Expand Up @@ -742,10 +758,6 @@ spec:
- primaryServiceName
- primaryUser
type: object
currentServiceImage:
description: CurrentServiceImage stores the image name used by the
database instance.
type: string
dataGuardOutput:
description: DataGuardOutput stores the latest Data Guard utility
status output.
Expand Down
2 changes: 1 addition & 1 deletion oracle/controllers/backupcontroller/backup_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func (r *BackupReconciler) reconcileBackupCreation(ctx context.Context, backup *
if err := r.addBackupMetadata(ctx, backup, &oracleBackupMetadata{
incarnation: inst.Status.CurrentDatabaseIncarnation,
parentIncarnation: inst.Status.LastDatabaseIncarnation,
databaseImage: inst.Spec.Images["service"],
databaseImage: inst.Status.ActiveImages["service"],
}); err != nil {
return ctrl.Result{}, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func (r *InstanceReconciler) Reconcile(_ context.Context, req ctrl.Request) (_ c
r.Recorder.Eventf(&inst, corev1.EventTypeNormal, "InstanceReady", "Instance has been created successfully. Elapsed Time: %v", elapsed)
}
k8s.InstanceUpsertCondition(&inst.Status, k8s.Ready, v1.ConditionTrue, k8s.CreateComplete, "")
inst.Status.CurrentServiceImage = images["service"]
inst.Status.ActiveImages = CloneMap(sp.Images)
return ctrl.Result{}, nil
}
}
Expand Down
20 changes: 16 additions & 4 deletions oracle/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2313,10 +2313,26 @@ spec:
status:
description: InstanceStatus defines the observed state of Instance.
properties:
ActiveImages:
additionalProperties:
type: string
description: ActiveImages stores the stable images used by the active
containers.
type: object
CurrentActiveStateMachine:
description: CurrentActiveStateMachine stores the name of the state
machine currently active.
type: string
DnfsEnabled:
description: DnfsEnabled stores whether dNFS has already been enabled
or not.
type: boolean
LastFailedImages:
additionalProperties:
type: string
description: LastFailedImages stores the images which failed the last
patching workflow..
type: object
adminUser:
description: AdminUser represents the observed state of the admin
user
Expand Down Expand Up @@ -2506,10 +2522,6 @@ spec:
- primaryServiceName
- primaryUser
type: object
currentServiceImage:
description: CurrentServiceImage stores the image name used by the
database instance.
type: string
dataGuardOutput:
description: DataGuardOutput stores the latest Data Guard utility
status output.
Expand Down

0 comments on commit 8837e32

Please sign in to comment.