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

(feat: certs) MeshRootStatus -> ProviderState #4812

Merged
merged 2 commits into from
Jun 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions cmd/osm-bootstrap/crds/config_mesh_root_certificate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,10 @@ spec:
served: true
storage: true
additionalPrinterColumns:
- description: Current state of the MeshRootCertificate config
- description: Provider state of the MeshRootCertificate config
jsonPath: .status.currentState
name: State
type: string
- description: Current rotationStage of the MeshRootCertificate config
jsonPath: .status.currentRotationStage
name: RotationStage
type: string
schema:
openAPIV3Schema:
type: object
Expand Down
3 changes: 1 addition & 2 deletions cmd/osm-bootstrap/osm-bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,7 @@ func buildMeshRootCertificate(presetMeshRootCertificateConfigMap *corev1.ConfigM
},
Spec: presetMeshRootCertificateSpec,
Status: configv1alpha2.MeshRootCertificateStatus{
State: constants.MRCStateComplete,
RotationStage: constants.MRCStageIssuing,
State: constants.MRCStateActive,
},
}

Expand Down
3 changes: 1 addition & 2 deletions cmd/osm-bootstrap/osm-bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ var testMeshRootCertificate *configv1alpha2.MeshRootCertificate = &configv1alpha
},
Spec: configv1alpha2.MeshRootCertificateSpec{},
Status: configv1alpha2.MeshRootCertificateStatus{
State: constants.MRCStateComplete,
RotationStage: constants.MRCStageIssuing,
State: constants.MRCStateActive,
},
}

Expand Down
9 changes: 2 additions & 7 deletions pkg/apis/config/v1alpha2/meshrootcertificate.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,9 @@ type TresorCASpec struct {

// MeshRootCertificateStatus defines the status of the MeshRootCertificate resource
type MeshRootCertificateStatus struct {
// State specifies the state of the root certificate rotation
// State specifies the state of the certificate provider
// All states are specified in constants.go
State string `json:"state"`

// RotationStage specifies the stage of the rotation indicating how a
// root certificate is currently being used within the mesh. The exact
// meaning of the RotationStage status is determined by the accompanying
// State status
RotationStage string `json:"rotationStage"`
}

// MeshRootCertificateList defines the list of MeshRootCertificate objects
Expand Down
3 changes: 1 addition & 2 deletions pkg/certificate/providers/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ func NewCertificateManager(kubeClient kubernetes.Interface, kubeConfig *rest.Con
},
// TODO(#4502): Detect if an actual MRC exists, and set the status accordingly.
Status: v1alpha2.MeshRootCertificateStatus{
State: constants.MRCStateComplete,
RotationStage: constants.MRCStageIssuing,
State: constants.MRCStateActive,
},
},
}
Expand Down
24 changes: 18 additions & 6 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,26 @@ const (
// MRCVersionAnnotation is the annotation used for the version of the MeshRootCertificate
MRCVersionAnnotation = "openservicemesh.io/mrc-version"

// MRCStageValidating is the validating status option for the rotation stage of the MeshRootCertificate
MRCStageValidating = "validating"
// MRCStateValidatingRollout is the validating rollout status option for the State of the MeshRootCertificate
MRCStateValidatingRollout = "validatingRollout"

// MRCStageIssuing is the issuing status option for the rotation stage of the MeshRootCertificate
MRCStageIssuing = "issuing"
// MRCStateIssuingRollout is the issuing rollout status option for the State of the MeshRootCertificate
MRCStateIssuingRollout = "issuingRollout"

// MRCStateComplete is the complete status option for the state of the MeshRootCertificate
MRCStateComplete = "complete"
// MRCStateActive is the active status option for the State of the MeshRootCertificate
MRCStateActive = "active"

// MRCStateIssuingRollback is the issuing rollback status option for the State of the MeshRootCertificate
MRCStateIssuingRollback = "issuingRollback"

// MRCStateValidatingRollback is the validating rollback status option for the State of the MeshRootCertificate
MRCStateValidatingRollback = "validatingRollback"

// MRCStateInactive is the inactive status option for the State of the MeshRootCertificate
MRCStateInactive = "inactive"

// MRCStateError is the error status option for the State of the MeshRootCertificate
MRCStateError = "error"
)

// Labels used by the control plane
Expand Down