2 * ============LICENSE_START=======================================================
3 * oom-certservice-k8s-external-provider
4 * ================================================================================
5 * Copyright (c) 2019 Smallstep Labs, Inc.
6 * Copyright (C) 2021 Nokia. All rights reserved.
7 * ================================================================================
8 * This source code was copied from the following git repository:
9 * https://github.com/smallstep/step-issuer
10 * The source code was modified for usage in the ONAP project.
11 * ================================================================================
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
16 * http://www.apache.org/licenses/LICENSE-2.0
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 * ============LICENSE_END=========================================================
29 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
33 SchemeBuilder.Register(&CMPv2Issuer{}, &CMPv2IssuerList{})
36 // CMPv2IssuerSpec defines the desired state of CMPv2Issuer
37 type CMPv2IssuerSpec struct {
38 // URL is the base URL for the CertService certificates instance.
39 URL string `json:"url"`
40 // Path to health check endpoint.
41 HealthEndpoint string `json:"healthEndpoint"`
42 // Path to certificate signing endpoint.
43 CertEndpoint string `json:"certEndpoint"`
44 // Path to certificate update endpoint.
45 UpdateEndpoint string `json:"updateEndpoint"`
46 // CaName is the name of the external CA server
47 CaName string `json:"caName"`
48 // KeyRef is a reference to a Secret containing the provisioner
49 CertSecretRef SecretKeySelector `json:"certSecretRef"`
52 // CMPv2IssuerStatus defines the observed state of CMPv2Issuer
53 type CMPv2IssuerStatus struct {
56 Conditions []CMPv2IssuerCondition `json:"conditions,omitempty"`
59 type CMPv2Issuer struct {
60 metav1.TypeMeta `json:",inline"`
61 metav1.ObjectMeta `json:"metadata,omitempty"`
63 Spec CMPv2IssuerSpec `json:"spec,omitempty"`
64 Status CMPv2IssuerStatus `json:"status,omitempty"`
67 // +kubebuilder:object:root=true
69 // CMPv2IssuerList contains a list of CMPv2Issuer
70 type CMPv2IssuerList struct {
71 metav1.TypeMeta `json:",inline"`
72 metav1.ListMeta `json:"metadata,omitempty"`
73 Items []CMPv2Issuer `json:"items"`
76 // SecretKeySelector contains the reference to a secret.
77 type SecretKeySelector struct {
78 // The name of the secret in the pod's namespace to select from.
79 Name string `json:"name"`
81 // The key of the secret to select private key from. Must be a valid secret key.
82 KeyRef string `json:"keyRef,omitempty"`
83 // The key of the secret to select cert from. Must be a valid secret key.
84 CertRef string `json:"certRef,omitempty"`
85 // The key of the secret to select cacert from. Must be a valid secret key.
86 CacertRef string `json:"cacertRef,omitempty"`
89 // ConditionType represents a CMPv2Issuer condition type.
90 // +kubebuilder:validation:Enum=Ready
91 type ConditionType string
94 // ConditionReady indicates that a CMPv2Issuer is ready for use.
95 ConditionReady ConditionType = "Ready"
98 // ConditionStatus represents a condition's status.
99 // +kubebuilder:validation:Enum=True;False;Unknown
100 type ConditionStatus string
102 // These are valid condition statuses. "ConditionTrue" means a resource is in
103 // the condition; "ConditionFalse" means a resource is not in the condition;
104 // "ConditionUnknown" means kubernetes can't decide if a resource is in the
105 // condition or not. In the future, we could add other intermediate
106 // conditions, e.g. ConditionDegraded.
108 // ConditionTrue represents the fact that a given condition is true
109 ConditionTrue ConditionStatus = "True"
111 // ConditionFalse represents the fact that a given condition is false
112 ConditionFalse ConditionStatus = "False"
114 // ConditionUnknown represents the fact that a given condition is unknown
115 ConditionUnknown ConditionStatus = "Unknown"
118 // CMPv2IssuerCondition contains condition information for the CertService issuer.
119 type CMPv2IssuerCondition struct {
120 // Type of the condition, currently ('Ready').
121 Type ConditionType `json:"type"`
123 // Status of the condition, one of ('True', 'False', 'Unknown').
124 // +kubebuilder:validation:Enum=True;False;Unknown
125 Status ConditionStatus `json:"status"`
127 // LastTransitionTime is the timestamp corresponding to the last status
128 // change of this condition.
130 LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"`
132 // Reason is a brief machine readable explanation for the condition's last
135 Reason string `json:"reason,omitempty"`
137 // Message is a human readable description of the details of the last
138 // transition, complementing reason.
140 Message string `json:"message,omitempty"`