Skip to content

Commit b07691f

Browse files
committed
Adds disable approved condition flag to README.md
Signed-off-by: joshvanl <[email protected]>
1 parent 062e83a commit b07691f

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,15 @@ This controller is implemented using [kubebuilder](https://github.com/kubernetes
150150
Generated CRD manifests are stored in `config/crd`. RBAC roles and bindings can be found in config/rbac. There's also a Make target to build controller's Docker image and
151151
store it in local docker repo (Docker must be installed).
152152

153+
154+
### Disable Approval Check
155+
156+
The ADCS Issuer will wait for CertificateRequests to have an [approved condition
157+
set](https://cert-manager.io/docs/concepts/certificaterequest/#approval) before
158+
signing. If using an older version of cert-manager (pre v1.3), you can disable
159+
this check by supplying the command line flag `-enable-approved-check=false` to
160+
the Issuer Deployment.
161+
153162
## Testing considerations
154163

155164
### ADCS Simulator
@@ -182,4 +191,4 @@ More then one directive can be used at a time. e.g. to simulate rejecting the ce
182191

183192
## License
184193

185-
This project is licensed under the BSD-3-Clause license - see the [LICENSE](https://github.com/nokia/adcs-issuer/blob/master/LICENSE).
194+
This project is licensed under the BSD-3-Clause license - see the [LICENSE](https://github.com/nokia/adcs-issuer/blob/master/LICENSE).

main.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
3131
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
3232
"k8s.io/klog"
33+
"k8s.io/utils/clock"
3334
ctrl "sigs.k8s.io/controller-runtime"
3435
"sigs.k8s.io/controller-runtime/pkg/log/zap"
3536
// +kubebuilder:scaffold:imports
@@ -63,9 +64,13 @@ func main() {
6364
var webhooksPort string
6465
var enableLeaderElection bool
6566
var clusterResourceNamespace string
67+
var disableApprovedCheck bool
6668
flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
6769
flag.StringVar(&healthcheckAddr, "healthcheck-addr", ":8081", "The address the healthcheck endpoints binds to.")
6870
flag.StringVar(&webhooksPort, "webhooks-port", strconv.Itoa(defaultWebhooksPort), "Port for webhooks requests.")
71+
flag.BoolVar(&disableApprovedCheck, "disable-approved-check", false,
72+
"Disables waiting for CertificateRequests to have an approved condition before signing.")
73+
6974
port, err := strconv.Atoi(webhooksPort)
7075
if err != nil {
7176
setupLog.Error(err, "invalid webhooks port. Using default.")
@@ -74,9 +79,14 @@ func main() {
7479
flag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
7580
"Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.")
7681
flag.StringVar(&clusterResourceNamespace, "cluster-resource-namespace", "kube-system", "Namespace where cluster-level resources are stored.")
82+
83+
// Options for configuring logging
84+
opts := zap.Options{}
85+
opts.BindFlags(flag.CommandLine)
86+
7787
flag.Parse()
7888

79-
ctrl.SetLogger(zap.Logger(false))
89+
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
8090

8191
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
8292
Scheme: scheme,
@@ -96,6 +106,9 @@ func main() {
96106
Client: mgr.GetClient(),
97107
Log: ctrl.Log.WithName("controllers").WithName("CertificateRequest"),
98108
Recorder: mgr.GetEventRecorderFor("adcs-certificaterequests-controller"),
109+
110+
Clock: clock.RealClock{},
111+
CheckApprovedCondition: !disableApprovedCheck,
99112
}
100113
if err = (certificateRequestReconciler).SetupWithManager(mgr); err != nil {
101114
setupLog.Error(err, "unable to create controller", "controller", "CertificateRequest")

0 commit comments

Comments
 (0)