|
| 1 | +package v1alpha2 |
| 2 | + |
| 3 | +import ( |
| 4 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 5 | +) |
| 6 | + |
| 7 | +// MeshRootCertificate defines the configuration for certificate issuing |
| 8 | +// by the mesh control plane |
| 9 | +// +genclient |
| 10 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 11 | +type MeshRootCertificate struct { |
| 12 | + // Object's type metadata |
| 13 | + metav1.TypeMeta `json:",inline"` |
| 14 | + |
| 15 | + // Object's metadata |
| 16 | + // +optional |
| 17 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 18 | + |
| 19 | + // Spec is the MeshRootCertificate config specification |
| 20 | + // +optional |
| 21 | + Spec MeshRootCertificateSpec `json:"spec,omitempty"` |
| 22 | + |
| 23 | + // Status of the MeshRootCertificate resource |
| 24 | + // +optional |
| 25 | + Status MeshRootCertificateStatus `json:"status,omitempty"` |
| 26 | +} |
| 27 | + |
| 28 | +// MeshRootCertificateSpec defines the mesh root certificate specification |
| 29 | +type MeshRootCertificateSpec struct { |
| 30 | + // Provider specifies the mesh certificate provider |
| 31 | + Provider ProviderSpec `json:"provider"` |
| 32 | +} |
| 33 | + |
| 34 | +// ProviderSpec defines the certificate provider used by the mesh control plane |
| 35 | +type ProviderSpec struct { |
| 36 | + // CertManager specifies the cert-manager provider configuration |
| 37 | + // +optional |
| 38 | + CertManager *CertManagerProviderSpec `json:"certManager,omitempty"` |
| 39 | + |
| 40 | + // Vault specifies the vault provider configuration |
| 41 | + // +optional |
| 42 | + Vault *VaultProviderSpec `json:"vault,omitempty"` |
| 43 | + |
| 44 | + // Tresor specifies the Tresor provider configuration |
| 45 | + // +optional |
| 46 | + Tresor *TresorProviderSpec `json:"tresor,omitempty"` |
| 47 | +} |
| 48 | + |
| 49 | +// CertManagerProviderSpec defines the configuration of the cert-manager provider |
| 50 | +type CertManagerProviderSpec struct { |
| 51 | + // SecretName specifies the name of the k8s secret containing the root certificate |
| 52 | + SecretName string `json:"secretName"` |
| 53 | + |
| 54 | + // IssuerName specifies the name of the Issuer resource |
| 55 | + IssuerName string `json:"issuerName"` |
| 56 | + |
| 57 | + // IssuerKind specifies the kind of Issuer |
| 58 | + IssuerKind string `json:"issuerKind"` |
| 59 | + |
| 60 | + // IssuerGroup specifies the group the Issuer belongs to |
| 61 | + IssuerGroup string `json:"issuerGroup"` |
| 62 | +} |
| 63 | + |
| 64 | +// VaultProviderSpec defines the configuration of the Vault provider |
| 65 | +type VaultProviderSpec struct { |
| 66 | + // Host specifies the name of the Vault server |
| 67 | + Host string `json:"host"` |
| 68 | + |
| 69 | + // Role specifies the name of the role for use by mesh control plane |
| 70 | + Role string `json:"role"` |
| 71 | + |
| 72 | + // Protocol specifies the protocol for connections to Vault |
| 73 | + Protocol string `json:"protocol"` |
| 74 | + |
| 75 | + // Token specifies the name of the token to be used by mesh control plane |
| 76 | + // to connect to Vault |
| 77 | + Token string `json:"token"` |
| 78 | +} |
| 79 | + |
| 80 | +// TresorProviderSpec defines the configuration of the Tresor provider |
| 81 | +type TresorProviderSpec struct { |
| 82 | + // SecretName specifies the name of the secret storing the root certificate |
| 83 | + SecretName string `json:"secretName"` |
| 84 | +} |
| 85 | + |
| 86 | +// MeshRootCertificateStatus defines the status of the MeshRootCertificate resource |
| 87 | +type MeshRootCertificateStatus struct { |
| 88 | + // State specifies the state of the root certificate rotation |
| 89 | + State string `json:"state"` |
| 90 | + |
| 91 | + // RotationStage specifies the stage of the rotation indicating how a |
| 92 | + // root certificate is currently being used within the mesh. The exact |
| 93 | + // meaning of the RotationStage status is determined by the accompanying |
| 94 | + // State status |
| 95 | + RotationStage string `json:"rotationStage"` |
| 96 | +} |
| 97 | + |
| 98 | +// MeshRootCertificateList defines the list of MeshRootCertificate objects |
| 99 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 100 | +type MeshRootCertificateList struct { |
| 101 | + metav1.TypeMeta `json:",inline"` |
| 102 | + metav1.ListMeta `json:"metadata"` |
| 103 | + |
| 104 | + Items []MeshRootCertificate `json:"items"` |
| 105 | +} |
0 commit comments