Skip to content

Commit dc4ea49

Browse files
committed
Added cluster issuer
1 parent 5b62280 commit dc4ea49

19 files changed

+449
-40
lines changed

PROJECT

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ resources:
88
- group: adcs
99
version: v1
1010
kind: AdcsIssuer
11+
- group: adcs
12+
version: v1
13+
kind: ClusterAdcsIssuer

adcs/util.go.bak

Lines changed: 0 additions & 25 deletions
This file was deleted.

api/v1/adcsissuer_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type AdcsIssuerStatus struct {
5858
}
5959

6060
// +kubebuilder:object:root=true
61+
// +kubebuilder:resource:path=adcsissuers,scope=Namespaced
6162
// +kubebuilder:subresource:status
6263

6364
// AdcsIssuer is the Schema for the adcsissuers API

api/v1/adcsrequest_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ const (
9595

9696
// +kubebuilder:object:root=true
9797
// +kubebuilder:subresource:status
98+
// +kubebuilder:resource:path=adcsrequests,scope=Namespaced
9899
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state"
99100

100101
// AdcsRequest is the Schema for the adcsrequests API

api/v1/clusteradcsissuer_types.go

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
*/
15+
16+
package v1
17+
18+
import (
19+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
20+
)
21+
22+
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
23+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
24+
25+
// ClusterAdcsIssuerSpec defines the desired state of ClusterAdcsIssuer
26+
type ClusterAdcsIssuerSpec struct {
27+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
28+
// Important: Run "make" to regenerate code after modifying this file
29+
30+
// URL is the base URL for the ADCS instance
31+
URL string `json:"url"`
32+
33+
// CredentialsRef is a reference to a Secret containing the username and
34+
// password for the ADCS server.
35+
// The secret must contain two keys, 'username' and 'password'.
36+
CredentialsRef LocalObjectReference `json:"credentialsRef"`
37+
38+
// CABundle is a PEM encoded TLS certifiate to use to verify connections to
39+
// the ADCS server.
40+
// +optional
41+
CABundle []byte `json:"caBundle,omitempty"`
42+
43+
// How often to check for request status in the server (in time.ParseDuration() format)
44+
// Default 6 hours.
45+
// +optional
46+
StatusCheckInterval string `json:"statusCheckInterval,omitempty"`
47+
48+
// How often to retry in case of communication errors (in time.ParseDuration() format)
49+
// Default 1 hour.
50+
// +optional
51+
RetryInterval string `json:"retryInterval,omitempty"`
52+
}
53+
54+
// ClusterAdcsIssuerStatus defines the observed state of ClusterAdcsIssuer
55+
type ClusterAdcsIssuerStatus struct {
56+
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
57+
// Important: Run "make" to regenerate code after modifying this file
58+
}
59+
60+
// +kubebuilder:object:root=true
61+
// +kubebuilder:resource:path=clusteradcsissuers,scope=Cluster
62+
// +kubebuilder:subresource:status
63+
64+
// ClusterAdcsIssuer is the Schema for the clusteradcsissuers API
65+
type ClusterAdcsIssuer struct {
66+
metav1.TypeMeta `json:",inline"`
67+
metav1.ObjectMeta `json:"metadata,omitempty"`
68+
69+
Spec ClusterAdcsIssuerSpec `json:"spec,omitempty"`
70+
Status ClusterAdcsIssuerStatus `json:"status,omitempty"`
71+
}
72+
73+
// +kubebuilder:object:root=true
74+
75+
// ClusterAdcsIssuerList contains a list of ClusterAdcsIssuer
76+
type ClusterAdcsIssuerList struct {
77+
metav1.TypeMeta `json:",inline"`
78+
metav1.ListMeta `json:"metadata,omitempty"`
79+
Items []ClusterAdcsIssuer `json:"items"`
80+
}
81+
82+
func init() {
83+
SchemeBuilder.Register(&ClusterAdcsIssuer{}, &ClusterAdcsIssuerList{})
84+
}

api/v1/zz_generated.deepcopy.go

Lines changed: 95 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/adcs.certmanager.csf.nokia.com_adcsissuers.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ spec:
1212
listKind: AdcsIssuerList
1313
plural: adcsissuers
1414
singular: adcsissuer
15-
scope: ""
15+
scope: Namespaced
1616
subresources:
1717
status: {}
1818
validation:

config/crd/bases/adcs.certmanager.csf.nokia.com_adcsrequests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ metadata:
77
name: adcsrequests.adcs.certmanager.csf.nokia.com
88
spec:
99
additionalPrinterColumns:
10-
- JSONPath: .spec.status.State
10+
- JSONPath: .status.state
1111
name: State
1212
type: string
1313
group: adcs.certmanager.csf.nokia.com
@@ -16,7 +16,7 @@ spec:
1616
listKind: AdcsRequestList
1717
plural: adcsrequests
1818
singular: adcsrequest
19-
scope: ""
19+
scope: Namespaced
2020
subresources:
2121
status: {}
2222
validation:
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
2+
---
3+
apiVersion: apiextensions.k8s.io/v1beta1
4+
kind: CustomResourceDefinition
5+
metadata:
6+
creationTimestamp: null
7+
name: clusteradcsissuers.adcs.certmanager.csf.nokia.com
8+
spec:
9+
group: adcs.certmanager.csf.nokia.com
10+
names:
11+
kind: ClusterAdcsIssuer
12+
listKind: ClusterAdcsIssuerList
13+
plural: clusteradcsissuers
14+
singular: clusteradcsissuer
15+
scope: Cluster
16+
subresources:
17+
status: {}
18+
validation:
19+
openAPIV3Schema:
20+
description: ClusterAdcsIssuer is the Schema for the clusteradcsissuers API
21+
properties:
22+
apiVersion:
23+
description: 'APIVersion defines the versioned schema of this representation
24+
of an object. Servers should convert recognized schemas to the latest
25+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
26+
type: string
27+
kind:
28+
description: 'Kind is a string value representing the REST resource this
29+
object represents. Servers may infer this from the endpoint the client
30+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
31+
type: string
32+
metadata:
33+
type: object
34+
spec:
35+
description: ClusterAdcsIssuerSpec defines the desired state of ClusterAdcsIssuer
36+
properties:
37+
caBundle:
38+
description: CABundle is a PEM encoded TLS certifiate to use to verify
39+
connections to the ADCS server.
40+
format: byte
41+
type: string
42+
credentialsRef:
43+
description: CredentialsRef is a reference to a Secret containing the
44+
username and password for the ADCS server. The secret must contain
45+
two keys, 'username' and 'password'.
46+
properties:
47+
name:
48+
description: Name of the referent.
49+
type: string
50+
required:
51+
- name
52+
type: object
53+
retryInterval:
54+
description: How often to retry in case of communication errors (in
55+
time.ParseDuration() format) Default 1 hour.
56+
type: string
57+
statusCheckInterval:
58+
description: How often to check for request status in the server (in
59+
time.ParseDuration() format) Default 6 hours.
60+
type: string
61+
url:
62+
description: URL is the base URL for the ADCS instance
63+
type: string
64+
required:
65+
- credentialsRef
66+
- url
67+
type: object
68+
status:
69+
description: ClusterAdcsIssuerStatus defines the observed state of ClusterAdcsIssuer
70+
type: object
71+
type: object
72+
version: v1
73+
versions:
74+
- name: v1
75+
served: true
76+
storage: true
77+
status:
78+
acceptedNames:
79+
kind: ""
80+
plural: ""
81+
conditions: []
82+
storedVersions: []

config/crd/kustomization.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@
44
resources:
55
- bases/adcs.certmanager.csf.nokia.com_adcsrequests.yaml
66
- bases/adcs.certmanager.csf.nokia.com_adcsissuers.yaml
7+
- bases/adcs.certmanager.csf.nokia.com_clusteradcsissuers.yaml
78
# +kubebuilder:scaffold:crdkustomizeresource
89

910
patchesStrategicMerge:
1011
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
1112
# patches here are for enabling the conversion webhook for each CRD
1213
#- patches/webhook_in_adcsrequests.yaml
1314
#- patches/webhook_in_adcsissuers.yaml
15+
#- patches/webhook_in_clusteradcsissuers.yaml
1416
# +kubebuilder:scaffold:crdkustomizewebhookpatch
1517

1618
# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
1719
# patches here are for enabling the CA injection for each CRD
1820
#- patches/cainjection_in_adcsrequests.yaml
1921
#- patches/cainjection_in_adcsissuers.yaml
22+
#- patches/cainjection_in_clusteradcsissuers.yaml
2023
# +kubebuilder:scaffold:crdkustomizecainjectionpatch
2124

2225
# the following config is for teaching kustomize how to do kustomization for CRDs.

0 commit comments

Comments
 (0)