Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit e47a291

Browse files
committed
(feat: certs) Remove RotationStage, update MRC state consts
Add additional MRC state constants to have all rollout and rollback stages. Remove RotationStage and keep only the single state. Signed-off-by: Sarah Christoff <[email protected]>
1 parent 7046cf2 commit e47a291

File tree

6 files changed

+24
-24
lines changed

6 files changed

+24
-24
lines changed

cmd/osm-bootstrap/crds/config_mesh_root_certificate.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,10 @@ spec:
3535
served: true
3636
storage: true
3737
additionalPrinterColumns:
38-
- description: Current state of the MeshRootCertificate config
38+
- description: Provider state of the MeshRootCertificate config
3939
jsonPath: .status.currentState
4040
name: State
4141
type: string
42-
- description: Current rotationStage of the MeshRootCertificate config
43-
jsonPath: .status.currentRotationStage
44-
name: RotationStage
45-
type: string
4642
schema:
4743
openAPIV3Schema:
4844
type: object

cmd/osm-bootstrap/osm-bootstrap.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,7 @@ func buildMeshRootCertificate(presetMeshRootCertificateConfigMap *corev1.ConfigM
423423
},
424424
Spec: presetMeshRootCertificateSpec,
425425
Status: configv1alpha2.MeshRootCertificateStatus{
426-
State: constants.MRCStateComplete,
427-
RotationStage: constants.MRCStageIssuing,
426+
State: constants.MRCStateActive,
428427
},
429428
}
430429

cmd/osm-bootstrap/osm-bootstrap_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ var testMeshRootCertificate *configv1alpha2.MeshRootCertificate = &configv1alpha
9797
},
9898
Spec: configv1alpha2.MeshRootCertificateSpec{},
9999
Status: configv1alpha2.MeshRootCertificateStatus{
100-
State: constants.MRCStateComplete,
101-
RotationStage: constants.MRCStageIssuing,
100+
State: constants.MRCStateActive,
102101
},
103102
}
104103

pkg/apis/config/v1alpha2/meshrootcertificate.go

+2-7
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,9 @@ type TresorCASpec struct {
113113

114114
// MeshRootCertificateStatus defines the status of the MeshRootCertificate resource
115115
type MeshRootCertificateStatus struct {
116-
// State specifies the state of the root certificate rotation
116+
// State specifies the state of the certificate provider
117+
// All states are specified in constants.go
117118
State string `json:"state"`
118-
119-
// RotationStage specifies the stage of the rotation indicating how a
120-
// root certificate is currently being used within the mesh. The exact
121-
// meaning of the RotationStage status is determined by the accompanying
122-
// State status
123-
RotationStage string `json:"rotationStage"`
124119
}
125120

126121
// MeshRootCertificateList defines the list of MeshRootCertificate objects

pkg/certificate/providers/config.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ func NewCertificateManager(kubeClient kubernetes.Interface, kubeConfig *rest.Con
6969
},
7070
// TODO(#4502): Detect if an actual MRC exists, and set the status accordingly.
7171
Status: v1alpha2.MeshRootCertificateStatus{
72-
State: constants.MRCStateComplete,
73-
RotationStage: constants.MRCStageIssuing,
72+
State: constants.MRCStateActive,
7473
},
7574
},
7675
}

pkg/constants/constants.go

+18-6
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,26 @@ const (
166166
// MRCVersionAnnotation is the annotation used for the version of the MeshRootCertificate
167167
MRCVersionAnnotation = "openservicemesh.io/mrc-version"
168168

169-
// MRCStageValidating is the validating status option for the rotation stage of the MeshRootCertificate
170-
MRCStageValidating = "validating"
169+
// MRCStateValidatingRollout is the validating rollout status option for the State of the MeshRootCertificate
170+
MRCStateValidatingRollout = "validatingRollout"
171171

172-
// MRCStageIssuing is the issuing status option for the rotation stage of the MeshRootCertificate
173-
MRCStageIssuing = "issuing"
172+
// MRCStateIssuingRollout is the issuing rollout status option for the State of the MeshRootCertificate
173+
MRCStateIssuingRollout = "issuingRollout"
174174

175-
// MRCStateComplete is the complete status option for the state of the MeshRootCertificate
176-
MRCStateComplete = "complete"
175+
// MRCStateActive is the active status option for the State of the MeshRootCertificate
176+
MRCStateActive = "active"
177+
178+
// MRCStateIssuingRollback is the issuing rollback status option for the State of the MeshRootCertificate
179+
MRCStateIssuingRollback = "issuingRollback"
180+
181+
// MRCStateValidatingRollback is the validating rollback status option for the State of the MeshRootCertificate
182+
MRCStateValidatingRollback = "validatingRollback"
183+
184+
// MRCStateInactive is the inactive status option for the State of the MeshRootCertificate
185+
MRCStateInactive = "inactive"
186+
187+
// MRCStateError is the error status option for the State of the MeshRootCertificate
188+
MRCStateError = "error"
177189
)
178190

179191
// Labels used by the control plane

0 commit comments

Comments
 (0)