Skip to content

Commit

Permalink
Merge pull request #1568 from vrutkovs/annotate-certs
Browse files Browse the repository at this point in the history
OCPBUGS-24213: Annotate managed certs
  • Loading branch information
openshift-merge-bot[bot] committed Nov 29, 2023
2 parents 7d69615 + 513d713 commit 2af4f6a
Show file tree
Hide file tree
Showing 13 changed files with 287 additions and 52 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/openshift/api v0.0.0-20231010075512-1ccc6058c62d
github.com/openshift/build-machinery-go v0.0.0-20230228230858-4cd708338479
github.com/openshift/client-go v0.0.0-20230926161409-848405da69e1
github.com/openshift/library-go v0.0.0-20231128084459-0dbbc2c74004
github.com/openshift/library-go v0.0.0-20231128230659-785a9313da6c
github.com/pkg/profile v1.5.0 // indirect
github.com/prometheus/client_golang v1.16.0
github.com/spf13/cobra v1.7.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ github.com/openshift/build-machinery-go v0.0.0-20230228230858-4cd708338479 h1:IU
github.com/openshift/build-machinery-go v0.0.0-20230228230858-4cd708338479/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE=
github.com/openshift/client-go v0.0.0-20230926161409-848405da69e1 h1:W1N/3nVciqmjPjn2xldHjb0AwwCQzlGxLvX5BCgE8H4=
github.com/openshift/client-go v0.0.0-20230926161409-848405da69e1/go.mod h1:ihUJrhBcYAGYQrJu/gP2OMgfVds5f5z5kbeLNBqjHLo=
github.com/openshift/library-go v0.0.0-20231128084459-0dbbc2c74004 h1:VQ0Ptz7yBMfe3DC9D1h0SMuh5VSP34NMZ9g4yBjgw5c=
github.com/openshift/library-go v0.0.0-20231128084459-0dbbc2c74004/go.mod h1:8UzmrBMCn7+GzouL8DVYkL9COBQTB1Ggd13/mHJQCUg=
github.com/openshift/library-go v0.0.0-20231128230659-785a9313da6c h1:L/nRp+uq0MKKvK14y18Ua84dYF860b1dCE973wSQ1do=
github.com/openshift/library-go v0.0.0-20231128230659-785a9313da6c/go.mod h1:8UzmrBMCn7+GzouL8DVYkL9COBQTB1Ggd13/mHJQCUg=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down
88 changes: 62 additions & 26 deletions pkg/operator/certrotationcontroller/certrotationcontroller.go

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions pkg/operator/targetconfigcontroller/targetconfigcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

"github.com/ghodss/yaml"

"github.com/openshift/api/annotations"
kubecontrolplanev1 "github.com/openshift/api/kubecontrolplane/v1"
operatorv1 "github.com/openshift/api/operator/v1"
"github.com/openshift/cluster-kube-apiserver-operator/bindata"
Expand Down Expand Up @@ -283,6 +284,8 @@ func ManageClientCABundle(ctx context.Context, lister corev1listers.ConfigMapLis
requiredConfigMap, err := resourcesynccontroller.CombineCABundleConfigMaps(
resourcesynccontroller.ResourceLocation{Namespace: operatorclient.TargetNamespace, Name: "client-ca"},
lister,
"kube-apiserver",
"",
// this is from the installer and contains the value to verify the admin.kubeconfig user
resourcesynccontroller.ResourceLocation{Namespace: operatorclient.GlobalUserSpecifiedConfigNamespace, Name: "admin-kubeconfig-client-ca"},
// this is from the installer and contains the value to verify the node bootstrapping cert that is baked into images
Expand All @@ -302,6 +305,10 @@ func ManageClientCABundle(ctx context.Context, lister corev1listers.ConfigMapLis
if err != nil {
return nil, false, err
}
if requiredConfigMap.Annotations == nil {
requiredConfigMap.Annotations = map[string]string{}
}
requiredConfigMap.Annotations[annotations.OpenShiftComponent] = "kube-apiserver"

return resourceapply.ApplyConfigMap(ctx, client, recorder, requiredConfigMap)
}
Expand All @@ -310,6 +317,8 @@ func manageKubeAPIServerCABundle(ctx context.Context, lister corev1listers.Confi
requiredConfigMap, err := resourcesynccontroller.CombineCABundleConfigMaps(
resourcesynccontroller.ResourceLocation{Namespace: operatorclient.TargetNamespace, Name: "kube-apiserver-server-ca"},
lister,
"kube-apiserver",
"",
// this bundle is what this operator uses to mint loadbalancers certs
resourcesynccontroller.ResourceLocation{Namespace: operatorclient.OperatorNamespace, Name: "loadbalancer-serving-ca"},
// this bundle is what this operator uses to mint localhost certs
Expand All @@ -322,6 +331,10 @@ func manageKubeAPIServerCABundle(ctx context.Context, lister corev1listers.Confi
if err != nil {
return nil, false, err
}
if requiredConfigMap.Annotations == nil {
requiredConfigMap.Annotations = map[string]string{}
}
requiredConfigMap.Annotations[annotations.OpenShiftComponent] = "kube-apiserver"

return resourceapply.ApplyConfigMap(ctx, client, recorder, requiredConfigMap)
}
Expand Down
34 changes: 34 additions & 0 deletions vendor/github.com/openshift/api/annotations/annotations.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2af4f6a

Please sign in to comment.