Skip to content

Commit d4894ad

Browse files
committed
Improve docstring comments
1 parent a3d03a1 commit d4894ad

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

certs/ca.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func GetServiceCA(ctx context.Context, c client.Client, l logr.Logger, caNamespa
182182
return string(caBytes), nil
183183
}
184184

185-
// InitializeServiceCA checks that
185+
// initializeServiceCA checks that cert-manager CRDs exist and ensures that the service CA is setup
186186
func initializeServiceCA(ctx context.Context, l logr.Logger, c client.Client, caNamespace string) error {
187187
cmcrd := extv1.CustomResourceDefinition{}
188188
if err := c.Get(ctx, client.ObjectKey{Name: "certificates.cert-manager.io"}, &cmcrd); err != nil {

controllers/configmap_controller.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ const (
3636
InjectLabelKey = "service.syn.tools/inject-ca-bundle"
3737
)
3838

39-
// ConfigMapReconciler reconciles a ConfigMap object
39+
// ConfigMapReconciler injects the service CA certificate into field `ca.crt`
40+
// of ConfigMap objects which have the label
41+
// `service.syn.tools/inject-ca-bundle` set to `true`.
4042
type ConfigMapReconciler struct {
4143
client.Client
4244
Scheme *runtime.Scheme
@@ -47,8 +49,10 @@ type ConfigMapReconciler struct {
4749
//+kubebuilder:rbac:groups=core,resources=configmaps/status,verbs=get;update;patch
4850
//+kubebuilder:rbac:groups=core,resources=configmaps/finalizers,verbs=update
4951

50-
// Reconcile is part of the main kubernetes reconciliation loop which aims to
51-
// move the current state of the cluster closer to the desired state.
52+
// Reconcile injects the service CA certificate into ConfigMaps which have the
53+
// `service.syn.tools/inject-ca-bundle` label set to `true`.
54+
// Please note that the reconciler will requeue requests until the Service CA
55+
// is created an ready.
5256
func (r *ConfigMapReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
5357
l := log.FromContext(ctx).WithValues("namespace", req.Namespace, "name", req.Name)
5458

controllers/service_controller.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ const (
3838
ServingCertLabelKey = "service.syn.tools/serving-cert-secret-name"
3939
)
4040

41-
// ServiceReconciler reconciles a Service object
41+
// ServiceReconciler reconcile Service objects which have the label
42+
// `service.syn.tools/serving-cert-secret-name` set.
4243
type ServiceReconciler struct {
4344
client.Client
4445
Scheme *runtime.Scheme
@@ -51,8 +52,13 @@ type ServiceReconciler struct {
5152
//+kubebuilder:rbac:groups=cert-manager.io,resources=certificates,verbs=get;list;watch;create;update;patch;delete
5253
//+kubebuilder:rbac:groups=cert-manager.io,resources=certificates/status,verbs=get;update;patch;delete
5354

54-
// Reconcile is part of the main kubernetes reconciliation loop which aims to
55-
// move the current state of the cluster closer to the desired state.
55+
// Reconcile creates or updates a cert-manager Certificate resource for
56+
// services which have label `service.syn.tools/serving-cert-secret-name` set.
57+
// The Certificate resource is configured to use the Service CA cluster
58+
// issuer, and the value of the `service.syn.tools/serving-cert-secret-name`
59+
// label is used as the certificate secret name.
60+
// Please note that the reconciler will requeue requests until the Service CA
61+
// is created an ready.
5662
func (r *ServiceReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
5763
l := log.FromContext(ctx).WithValues("namespace", req.Namespace, "name", req.Name)
5864

0 commit comments

Comments
 (0)