-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1934 from JoshVanL/cr-vault
Vault CertificateRequest controller
- Loading branch information
Showing
36 changed files
with
2,428 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = ["util.go"], | ||
importpath = "github.com/jetstack/cert-manager/pkg/controller/certificaterequests/test", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//pkg/controller/test:go_default_library", | ||
"//pkg/issuer:go_default_library", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "package-srcs", | ||
srcs = glob(["**"]), | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
filegroup( | ||
name = "all-srcs", | ||
srcs = [":package-srcs"], | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
Copyright 2019 The Jetstack cert-manager contributors. | ||
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 test | ||
|
||
import ( | ||
"reflect" | ||
|
||
testpkg "github.com/jetstack/cert-manager/pkg/controller/test" | ||
"github.com/jetstack/cert-manager/pkg/issuer" | ||
) | ||
|
||
// Ensure issuer response from test is nil. | ||
func MustNoResponse(builder *testpkg.Builder, args ...interface{}) { | ||
resp, ok := args[0].(*issuer.IssueResponse) | ||
if !ok { | ||
builder.T.Errorf("unexpected argument to be of type IssuerResponse: %+v", args[0]) | ||
} | ||
|
||
if resp != nil { | ||
builder.T.Errorf("unexpected response, exp='nil' got='%+v'", resp) | ||
} | ||
} | ||
|
||
// Ensure no private key exists in test response. | ||
// Ensure no signed certificate or CA certificate in test response. | ||
func NoPrivateKeyCertificatesFieldsSetCheck(expectedCA []byte) func(builder *testpkg.Builder, args ...interface{}) { | ||
return func(builder *testpkg.Builder, args ...interface{}) { | ||
resp := args[0].(*issuer.IssueResponse) | ||
|
||
if resp == nil { | ||
builder.T.Errorf("no response given, got=%s", resp) | ||
return | ||
} | ||
|
||
if len(resp.PrivateKey) > 0 { | ||
builder.T.Errorf("expected no new private key to be generated but got: %s", | ||
resp.PrivateKey) | ||
} | ||
|
||
CertificatesFieldsSetCheck(expectedCA)(builder, args...) | ||
} | ||
} | ||
|
||
// Ensure no signed certificate or CA certificate in test response. | ||
func CertificatesFieldsSetCheck(expectedCA []byte) func(builder *testpkg.Builder, args ...interface{}) { | ||
return func(builder *testpkg.Builder, args ...interface{}) { | ||
resp := args[0].(*issuer.IssueResponse) | ||
|
||
if resp.Certificate == nil { | ||
builder.T.Errorf("expected new certificate to be issued") | ||
} | ||
if resp.CA == nil || !reflect.DeepEqual(expectedCA, resp.CA) { | ||
builder.T.Errorf("expected CA certificate to be returned") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = ["vault.go"], | ||
importpath = "github.com/jetstack/cert-manager/pkg/controller/certificaterequests/vault", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//pkg/api/util:go_default_library", | ||
"//pkg/apis/certmanager/v1alpha1:go_default_library", | ||
"//pkg/controller:go_default_library", | ||
"//pkg/controller/certificaterequests:go_default_library", | ||
"//pkg/controller/certificaterequests/util:go_default_library", | ||
"//pkg/internal/vault:go_default_library", | ||
"//pkg/issuer:go_default_library", | ||
"//pkg/logs:go_default_library", | ||
"//pkg/util/api:go_default_library", | ||
"//vendor/k8s.io/apimachinery/pkg/api/errors:go_default_library", | ||
"//vendor/k8s.io/client-go/listers/core/v1:go_default_library", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "package-srcs", | ||
srcs = glob(["**"]), | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
filegroup( | ||
name = "all-srcs", | ||
srcs = [":package-srcs"], | ||
tags = ["automanaged"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
go_test( | ||
name = "go_default_test", | ||
srcs = ["vault_test.go"], | ||
embed = [":go_default_library"], | ||
deps = [ | ||
"//pkg/apis/certmanager:go_default_library", | ||
"//pkg/apis/certmanager/v1alpha1:go_default_library", | ||
"//pkg/controller/certificaterequests/test:go_default_library", | ||
"//pkg/controller/test:go_default_library", | ||
"//pkg/internal/vault:go_default_library", | ||
"//pkg/internal/vault/fake:go_default_library", | ||
"//pkg/util/pki:go_default_library", | ||
"//test/unit/gen:go_default_library", | ||
"//vendor/k8s.io/api/core/v1:go_default_library", | ||
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library", | ||
"//vendor/k8s.io/apimachinery/pkg/runtime:go_default_library", | ||
"//vendor/k8s.io/client-go/listers/core/v1:go_default_library", | ||
], | ||
) |
Oops, something went wrong.