From 36308ae891a11a7c4f11839f87d98889c95954fa Mon Sep 17 00:00:00 2001 From: James Munnelly Date: Wed, 19 Jul 2017 09:39:13 +0100 Subject: [PATCH] initial commit --- .gitignore | 1 + Dockerfile | 0 Makefile | 0 README.md | 0 cmd/controller/main.go | 21 +++++++ docs/certificate.yaml | 33 ++++++++++ pkg/apis/certmanager/doc.go | 21 +++++++ pkg/apis/certmanager/types.go | 80 ++++++++++++++++++++++++ pkg/apis/certmanager/v1alpha1/types.go | 84 ++++++++++++++++++++++++++ pkg/apis/doc.go | 20 ++++++ 10 files changed, 260 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 README.md create mode 100644 cmd/controller/main.go create mode 100644 docs/certificate.yaml create mode 100644 pkg/apis/certmanager/doc.go create mode 100644 pkg/apis/certmanager/types.go create mode 100644 pkg/apis/certmanager/v1alpha1/types.go create mode 100644 pkg/apis/doc.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..e43b0f988 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..e69de29bb diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..e69de29bb diff --git a/README.md b/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/cmd/controller/main.go b/cmd/controller/main.go new file mode 100644 index 000000000..0aa277281 --- /dev/null +++ b/cmd/controller/main.go @@ -0,0 +1,21 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package main + +func main() { + +} diff --git a/docs/certificate.yaml b/docs/certificate.yaml new file mode 100644 index 000000000..22c30003e --- /dev/null +++ b/docs/certificate.yaml @@ -0,0 +1,33 @@ +# Example ACME certificate using DNS +apiVersion: certmanager.kubernetes.io/v1 +kind: Certificate +metadata: + name: my-certificate +spec: + domains: + - www.google.com + acme: + challenge: dns-01 + url: https://... + email: test@example.com + dns: + clouddns: {} +status: + state: Pending +--- +# Example ACME certificate using Ingress +apiVersion: certmanager.kubernetes.io/v1 +kind: Certificate +metadata: + name: my-certificate +spec: + domains: + - www.google.com + acme: + challenge: http-01 + url: https://... + email: test@example.com + ingressRef: + name: something +status: + state: Pending \ No newline at end of file diff --git a/pkg/apis/certmanager/doc.go b/pkg/apis/certmanager/doc.go new file mode 100644 index 000000000..d27cd4b72 --- /dev/null +++ b/pkg/apis/certmanager/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +k8s:deepcopy-gen=package,register +// +groupName=certmanager.kubernetes.io + +// Package api is the internal version of the API. +package certmanager diff --git a/pkg/apis/certmanager/types.go b/pkg/apis/certmanager/types.go new file mode 100644 index 000000000..2e515ba77 --- /dev/null +++ b/pkg/apis/certmanager/types.go @@ -0,0 +1,80 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package certmanager + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Certificate is a type to represent a Certificate from ACME +type Certificate struct { + metav1.TypeMeta + metav1.ObjectMeta + + Spec CertificateSpec + Status CertificateStatus +} + +// CertificateSpec defines the desired state of Certificate +type CertificateSpec struct { + Domains []string + + ProviderConfig +} + +// ProviderConfig is a wrapping struct for the different types of supported +// providers configuration. In future, additional providers may be added here +// (eg. cfssl, AWS etc) +type ProviderConfig struct { + ACME *ACME +} + +// ACME contains the configuration for the ACME certificate provider +type ACME struct { + Challenge ACMEChallengeType + URL string + Email string + DNS *ACMEDNSConfig +} + +// ACMEChallengeType is the challenge type that should be used for ACME +// challenge verifications +type ACMEChallengeType string + +var ( + // ACMEChallengeTypeHTTP01 is the ACME http-01 challenge type + ACMEChallengeTypeHTTP01 ACMEChallengeType = "HTTP-01" + // ACMEChallengeTypeDNS01 is the ACME dns-01 challenge type + ACMEChallengeTypeDNS01 ACMEChallengeType = "DNS-01" + // ACMEChallengeTypeTLSSNI01 is the ACME tls-sni-01 challenge type + ACMEChallengeTypeTLSSNI01 ACMEChallengeType = "TLS-SNI-01" +) + +// ACMEDNSConfig is a structure containing the ACME DNS configuration option. +// One and only one of the fields within it should be set, when the ACME +// challenge type is set to dns-01 +type ACMEDNSConfig struct { + CloudDNS *ACMEDNSConfigCloudDNS +} + +// ACMEDNSConfigCloudDNS is a structure containing the DNS configuration for +// Google Cloud DNS +type ACMEDNSConfigCloudDNS struct{} + +// CertificateStatus defines the observed state of Certificate +type CertificateStatus struct { +} diff --git a/pkg/apis/certmanager/v1alpha1/types.go b/pkg/apis/certmanager/v1alpha1/types.go new file mode 100644 index 000000000..b80a0ea40 --- /dev/null +++ b/pkg/apis/certmanager/v1alpha1/types.go @@ -0,0 +1,84 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient=true +// +k8s:openapi-gen=true +// +resource:path=certificates,strategy=CertificateStrategy + +// Certificate is a type to represent a Certificate from ACME +type Certificate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec CertificateSpec `json:"spec,omitempty"` + Status CertificateStatus `json:"status,omitempty"` +} + +// CertificateSpec defines the desired state of Certificate +type CertificateSpec struct { + Domains []string `json:"domains"` + + ProviderConfig +} + +// ProviderConfig is a wrapping struct for the different types of supported +// providers configuration. In future, additional providers may be added here +// (eg. cfssl, AWS etc) +type ProviderConfig struct { + ACME *ACME `json:"acme"` +} + +// ACME contains the configuration for the ACME certificate provider +type ACME struct { + Challenge ACMEChallengeType `json:"challenge"` + URL string `json:"url"` + Email string `json:"email"` + DNS *ACMEDNSConfig `json:"dns"` +} + +// ACMEChallengeType is the challenge type that should be used for ACME +// challenge verifications +type ACMEChallengeType string + +var ( + // ACMEChallengeTypeHTTP01 is the ACME http-01 challenge type + ACMEChallengeTypeHTTP01 ACMEChallengeType = "HTTP-01" + // ACMEChallengeTypeDNS01 is the ACME dns-01 challenge type + ACMEChallengeTypeDNS01 ACMEChallengeType = "DNS-01" + // ACMEChallengeTypeTLSSNI01 is the ACME tls-sni-01 challenge type + ACMEChallengeTypeTLSSNI01 ACMEChallengeType = "TLS-SNI-01" +) + +// ACMEDNSConfig is a structure containing the ACME DNS configuration option. +// One and only one of the fields within it should be set, when the ACME +// challenge type is set to dns-01 +type ACMEDNSConfig struct { + CloudDNS *ACMEDNSConfigCloudDNS `json:"clouddns"` +} + +// ACMEDNSConfigCloudDNS is a structure containing the DNS configuration for +// Google Cloud DNS +type ACMEDNSConfigCloudDNS struct{} + +// CertificateStatus defines the observed state of Certificate +type CertificateStatus struct { +} diff --git a/pkg/apis/doc.go b/pkg/apis/doc.go new file mode 100644 index 000000000..c9d55190a --- /dev/null +++ b/pkg/apis/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2017 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// +// +domain=kubernetes.io + +package apis