2 Copyright 2016 The Kubernetes Authors.
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
22 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
26 // +genclient:nonNamespaced
27 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
29 // Describes a certificate signing request
30 type CertificateSigningRequest struct {
31 metav1.TypeMeta `json:",inline"`
33 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
35 // The certificate request itself and any additional information.
37 Spec CertificateSigningRequestSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
39 // Derived information about the request.
41 Status CertificateSigningRequestStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
44 // This information is immutable after the request is created. Only the Request
45 // and Usages fields can be set on creation, other fields are derived by
46 // Kubernetes and cannot be modified by users.
47 type CertificateSigningRequestSpec struct {
48 // Base64-encoded PKCS#10 CSR data
49 Request []byte `json:"request" protobuf:"bytes,1,opt,name=request"`
51 // allowedUsages specifies a set of usage contexts the key will be
53 // See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3
54 // https://tools.ietf.org/html/rfc5280#section-4.2.1.12
55 Usages []KeyUsage `json:"usages,omitempty" protobuf:"bytes,5,opt,name=usages"`
57 // Information about the requesting user.
58 // See user.Info interface for details.
60 Username string `json:"username,omitempty" protobuf:"bytes,2,opt,name=username"`
61 // UID information about the requesting user.
62 // See user.Info interface for details.
64 UID string `json:"uid,omitempty" protobuf:"bytes,3,opt,name=uid"`
65 // Group information about the requesting user.
66 // See user.Info interface for details.
68 Groups []string `json:"groups,omitempty" protobuf:"bytes,4,rep,name=groups"`
69 // Extra information about the requesting user.
70 // See user.Info interface for details.
72 Extra map[string]ExtraValue `json:"extra,omitempty" protobuf:"bytes,6,rep,name=extra"`
75 // ExtraValue masks the value so protobuf can generate
76 // +protobuf.nullable=true
77 // +protobuf.options.(gogoproto.goproto_stringer)=false
78 type ExtraValue []string
80 func (t ExtraValue) String() string {
81 return fmt.Sprintf("%v", []string(t))
84 type CertificateSigningRequestStatus struct {
85 // Conditions applied to the request, such as approval or denial.
87 Conditions []CertificateSigningRequestCondition `json:"conditions,omitempty" protobuf:"bytes,1,rep,name=conditions"`
89 // If request was approved, the controller will place the issued certificate here.
91 Certificate []byte `json:"certificate,omitempty" protobuf:"bytes,2,opt,name=certificate"`
94 type RequestConditionType string
96 // These are the possible conditions for a certificate request.
98 CertificateApproved RequestConditionType = "Approved"
99 CertificateDenied RequestConditionType = "Denied"
102 type CertificateSigningRequestCondition struct {
103 // request approval state, currently Approved or Denied.
104 Type RequestConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=RequestConditionType"`
105 // brief reason for the request state
107 Reason string `json:"reason,omitempty" protobuf:"bytes,2,opt,name=reason"`
108 // human readable message with details about the request state
110 Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"`
111 // timestamp for the last update to this condition
113 LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty" protobuf:"bytes,4,opt,name=lastUpdateTime"`
116 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
118 type CertificateSigningRequestList struct {
119 metav1.TypeMeta `json:",inline"`
121 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
123 Items []CertificateSigningRequest `json:"items" protobuf:"bytes,2,rep,name=items"`
126 // KeyUsages specifies valid usage contexts for keys.
127 // See: https://tools.ietf.org/html/rfc5280#section-4.2.1.3
128 // https://tools.ietf.org/html/rfc5280#section-4.2.1.12
132 UsageSigning KeyUsage = "signing"
133 UsageDigitalSignature KeyUsage = "digital signature"
134 UsageContentCommittment KeyUsage = "content commitment"
135 UsageKeyEncipherment KeyUsage = "key encipherment"
136 UsageKeyAgreement KeyUsage = "key agreement"
137 UsageDataEncipherment KeyUsage = "data encipherment"
138 UsageCertSign KeyUsage = "cert sign"
139 UsageCRLSign KeyUsage = "crl sign"
140 UsageEncipherOnly KeyUsage = "encipher only"
141 UsageDecipherOnly KeyUsage = "decipher only"
142 UsageAny KeyUsage = "any"
143 UsageServerAuth KeyUsage = "server auth"
144 UsageClientAuth KeyUsage = "client auth"
145 UsageCodeSigning KeyUsage = "code signing"
146 UsageEmailProtection KeyUsage = "email protection"
147 UsageSMIME KeyUsage = "s/mime"
148 UsageIPsecEndSystem KeyUsage = "ipsec end system"
149 UsageIPsecTunnel KeyUsage = "ipsec tunnel"
150 UsageIPsecUser KeyUsage = "ipsec user"
151 UsageTimestamping KeyUsage = "timestamping"
152 UsageOCSPSigning KeyUsage = "ocsp signing"
153 UsageMicrosoftSGC KeyUsage = "microsoft sgc"
154 UsageNetscapSGC KeyUsage = "netscape sgc"