Class: Kubernetes::V1beta1PodCertificateRequestSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb

Overview

PodCertificateRequestSpec describes the certificate request. All fields are immutable after creation.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ V1beta1PodCertificateRequestSpec

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 104

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Kubernetes::V1beta1PodCertificateRequestSpec` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Kubernetes::V1beta1PodCertificateRequestSpec`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'max_expiration_seconds')
    self.max_expiration_seconds = attributes[:'max_expiration_seconds']
  end

  if attributes.key?(:'node_name')
    self.node_name = attributes[:'node_name']
  end

  if attributes.key?(:'node_uid')
    self.node_uid = attributes[:'node_uid']
  end

  if attributes.key?(:'pkix_public_key')
    self.pkix_public_key = attributes[:'pkix_public_key']
  end

  if attributes.key?(:'pod_name')
    self.pod_name = attributes[:'pod_name']
  end

  if attributes.key?(:'pod_uid')
    self.pod_uid = attributes[:'pod_uid']
  end

  if attributes.key?(:'proof_of_possession')
    self.proof_of_possession = attributes[:'proof_of_possession']
  end

  if attributes.key?(:'service_account_name')
    self. = attributes[:'service_account_name']
  end

  if attributes.key?(:'service_account_uid')
    self. = attributes[:'service_account_uid']
  end

  if attributes.key?(:'signer_name')
    self.signer_name = attributes[:'signer_name']
  end

  if attributes.key?(:'stub_pkcs10_request')
    self.stub_pkcs10_request = attributes[:'stub_pkcs10_request']
  end

  if attributes.key?(:'unverified_user_annotations')
    if (value = attributes[:'unverified_user_annotations']).is_a?(Hash)
      self.unverified_user_annotations = value
    end
  end
end

Instance Attribute Details

#max_expiration_secondsObject

maxExpirationSeconds is the maximum lifetime permitted for the certificate. If omitted, kube-apiserver will set it to 86400(24 hours). kube-apiserver will reject values shorter than 3600 (1 hour). The maximum allowable value is 7862400 (91 days). The signer implementation is then free to issue a certificate with any lifetime shorter than MaxExpirationSeconds, but no shorter than 3600 seconds (1 hour). This constraint is enforced by kube-apiserver. ‘kubernetes.io` signers will never issue certificates with a lifetime longer than 24 hours.



20
21
22
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 20

def max_expiration_seconds
  @max_expiration_seconds
end

#node_nameObject

nodeName is the name of the node the pod is assigned to.



23
24
25
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 23

def node_name
  @node_name
end

#node_uidObject

nodeUID is the UID of the node the pod is assigned to.



26
27
28
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 26

def node_uid
  @node_uid
end

#pkix_public_keyObject

The PKIX-serialized public key the signer will issue the certificate to. The key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in the future. Signer implementations do not need to support all key types supported by kube-apiserver and kubelet. If a signer does not support the key type used for a given PodCertificateRequest, it must deny the request by setting a status.conditions entry with a type of "Denied" and a reason of "UnsupportedKeyType". It may also suggest a key type that it does support in the message field. Deprecated: This field is replaced by StubPKCS10Request. If StubPKCS10Request is set, this field must be empty. Signer implementations should extract the public key from the StubPKCS10Request field.



29
30
31
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 29

def pkix_public_key
  @pkix_public_key
end

#pod_nameObject

podName is the name of the pod into which the certificate will be mounted.



32
33
34
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 32

def pod_name
  @pod_name
end

#pod_uidObject

podUID is the UID of the pod into which the certificate will be mounted.



35
36
37
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 35

def pod_uid
  @pod_uid
end

#proof_of_possessionObject

A proof that the requesting kubelet holds the private key corresponding to pkixPublicKey. It is contructed by signing the ASCII bytes of the pod’s UID using ‘pkixPublicKey`. kube-apiserver validates the proof of possession during creation of the PodCertificateRequest. If the key is an RSA key, then the signature is over the ASCII bytes of the pod UID, using RSASSA-PSS from RFC 8017 (as implemented by the golang function crypto/rsa.SignPSS with nil options). If the key is an ECDSA key, then the signature is as described by [SEC 1, Version 2.0](www.secg.org/sec1-v2.pdf) (as implemented by the golang library function crypto/ecdsa.SignASN1) If the key is an ED25519 key, the the signature is as described by the [ED25519 Specification](ed25519.cr.yp.to/) (as implemented by the golang library crypto/ed25519.Sign). Deprecated: This field is replaced by StubPKCS10Request. If StubPKCS10Request is set, this field must be empty.



38
39
40
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 38

def proof_of_possession
  @proof_of_possession
end

#service_account_nameObject

serviceAccountName is the name of the service account the pod is running as.



41
42
43
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 41

def 
  @service_account_name
end

#service_account_uidObject

serviceAccountUID is the UID of the service account the pod is running as.



44
45
46
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 44

def 
  @service_account_uid
end

#signer_nameObject

signerName indicates the requested signer. All signer names beginning with ‘kubernetes.io` are reserved for use by the Kubernetes project. There is currently one well-known signer documented by the Kubernetes project, `kubernetes.io/kube-apiserver-client-pod`, which will issue client certificates understood by kube-apiserver. It is currently unimplemented.



47
48
49
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 47

def signer_name
  @signer_name
end

#stub_pkcs10_requestObject

A PKCS#10 certificate signing request (DER-serialized) generated by Kubelet using the subject private key. Most signer implementations will ignore the contents of the CSR except to extract the subject public key. The API server automatically verifies the CSR signature during admission, so the signer does not need to repeat the verification. CSRs generated by kubelet are completely empty. The subject public key must be one of RSA3072, RSA4096, ECDSAP256, ECDSAP384, ECDSAP521, or ED25519. Note that this list may be expanded in the future. Signer implementations do not need to support all key types supported by kube-apiserver and kubelet. If a signer does not support the key type used for a given PodCertificateRequest, it must deny the request by setting a status.conditions entry with a type of "Denied" and a reason of "UnsupportedKeyType". It may also suggest a key type that it does support in the message field.



50
51
52
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 50

def stub_pkcs10_request
  @stub_pkcs10_request
end

#unverified_user_annotationsObject

unverifiedUserAnnotations allow pod authors to pass additional information to the signer implementation. Kubernetes does not restrict or validate this metadata in any way. Entries are subject to the same validation as object metadata annotations, with the addition that all keys must be domain-prefixed. No restrictions are placed on values, except an overall size limitation on the entire field. Signers should document the keys and values they support. Signers should deny requests that contain keys they do not recognize.



53
54
55
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 53

def unverified_user_annotations
  @unverified_user_annotations
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



74
75
76
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 74

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 56

def self.attribute_map
  {
    :'max_expiration_seconds' => :'maxExpirationSeconds',
    :'node_name' => :'nodeName',
    :'node_uid' => :'nodeUID',
    :'pkix_public_key' => :'pkixPublicKey',
    :'pod_name' => :'podName',
    :'pod_uid' => :'podUID',
    :'proof_of_possession' => :'proofOfPossession',
    :'service_account_name' => :'serviceAccountName',
    :'service_account_uid' => :'serviceAccountUID',
    :'signer_name' => :'signerName',
    :'stub_pkcs10_request' => :'stubPKCS10Request',
    :'unverified_user_annotations' => :'unverifiedUserAnnotations'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



310
311
312
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 310

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



97
98
99
100
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 97

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 79

def self.openapi_types
  {
    :'max_expiration_seconds' => :'Integer',
    :'node_name' => :'String',
    :'node_uid' => :'String',
    :'pkix_public_key' => :'String',
    :'pod_name' => :'String',
    :'pod_uid' => :'String',
    :'proof_of_possession' => :'String',
    :'service_account_name' => :'String',
    :'service_account_uid' => :'String',
    :'signer_name' => :'String',
    :'stub_pkcs10_request' => :'String',
    :'unverified_user_annotations' => :'Hash<String, String>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 278

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      max_expiration_seconds == o.max_expiration_seconds &&
      node_name == o.node_name &&
      node_uid == o.node_uid &&
      pkix_public_key == o.pkix_public_key &&
      pod_name == o.pod_name &&
      pod_uid == o.pod_uid &&
      proof_of_possession == o.proof_of_possession &&
       == o. &&
       == o. &&
      signer_name == o.signer_name &&
      stub_pkcs10_request == o.stub_pkcs10_request &&
      unverified_user_annotations == o.unverified_user_annotations
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 340

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = Kubernetes.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 411

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 317

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{key}=", nil)
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


297
298
299
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 297

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



303
304
305
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 303

def hash
  [max_expiration_seconds, node_name, node_uid, pkix_public_key, pod_name, pod_uid, proof_of_possession, , , signer_name, stub_pkcs10_request, unverified_user_annotations].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 170

def list_invalid_properties
  invalid_properties = Array.new
  if @node_name.nil?
    invalid_properties.push('invalid value for "node_name", node_name cannot be nil.')
  end

  if @node_uid.nil?
    invalid_properties.push('invalid value for "node_uid", node_uid cannot be nil.')
  end

  pattern = Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
  if !@pkix_public_key.nil? && @pkix_public_key !~ pattern
    invalid_properties.push("invalid value for \"pkix_public_key\", must conform to the pattern #{pattern}.")
  end

  if @pod_name.nil?
    invalid_properties.push('invalid value for "pod_name", pod_name cannot be nil.')
  end

  if @pod_uid.nil?
    invalid_properties.push('invalid value for "pod_uid", pod_uid cannot be nil.')
  end

  pattern = Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
  if !@proof_of_possession.nil? && @proof_of_possession !~ pattern
    invalid_properties.push("invalid value for \"proof_of_possession\", must conform to the pattern #{pattern}.")
  end

  if @service_account_name.nil?
    invalid_properties.push('invalid value for "service_account_name", service_account_name cannot be nil.')
  end

  if @service_account_uid.nil?
    invalid_properties.push('invalid value for "service_account_uid", service_account_uid cannot be nil.')
  end

  if @signer_name.nil?
    invalid_properties.push('invalid value for "signer_name", signer_name cannot be nil.')
  end

  if @stub_pkcs10_request.nil?
    invalid_properties.push('invalid value for "stub_pkcs10_request", stub_pkcs10_request cannot be nil.')
  end

  pattern = Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
  if @stub_pkcs10_request !~ pattern
    invalid_properties.push("invalid value for \"stub_pkcs10_request\", must conform to the pattern #{pattern}.")
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



387
388
389
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 387

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 393

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



381
382
383
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 381

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/kubernetes/models/v1beta1_pod_certificate_request_spec.rb', line 224

def valid?
  return false if @node_name.nil?
  return false if @node_uid.nil?
  return false if !@pkix_public_key.nil? && @pkix_public_key !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
  return false if @pod_name.nil?
  return false if @pod_uid.nil?
  return false if !@proof_of_possession.nil? && @proof_of_possession !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
  return false if @service_account_name.nil?
  return false if @service_account_uid.nil?
  return false if @signer_name.nil?
  return false if @stub_pkcs10_request.nil?
  return false if @stub_pkcs10_request !~ Regexp.new(/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/)
  true
end