Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1813894: Stop using service ca from service account token #102

Merged
merged 1 commit into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions manifests/04-service-ca-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
namespace: openshift-insights
name: service-ca-bundle
annotations:
release.openshift.io/create-only: "true"
service.beta.openshift.io/inject-cabundle: "true"
7 changes: 7 additions & 0 deletions manifests/06-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ spec:
configMap:
name: trusted-ca-bundle
optional: true
- name: service-ca-bundle
configMap:
name: service-ca-bundle
optional: true
- name: serving-cert
secret:
secretName: openshift-insights-serving-cert
Expand All @@ -56,6 +60,9 @@ spec:
- mountPath: /var/run/configmaps/trusted-ca-bundle
name: trusted-ca-bundle
readOnly: true
- mountPath: /var/run/configmaps/service-ca-bundle
name: service-ca-bundle
readOnly: true
- mountPath: /var/run/secrets/serving-cert
name: serving-cert
ports:
Expand Down
4 changes: 3 additions & 1 deletion pkg/cmd/start/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/openshift/insights-operator/pkg/controller"
)

const serviceCACertPath = "/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt"
const serviceCACertPath = "/var/run/configmaps/service-ca-bundle/service-ca.crt"

func NewOperator() *cobra.Command {
operator := &controller.Support{
Expand Down Expand Up @@ -55,6 +55,8 @@ func NewOperator() *cobra.Command {
// if the service CA is rotated, we want to restart
if data, err := ioutil.ReadFile(serviceCACertPath); err == nil {
startingFileContent[serviceCACertPath] = data
} else {
klog.V(4).Infof("Unable to read service ca bundle: %v", err)
}
observedFiles = append(observedFiles, serviceCACertPath)

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (s *Support) Run(ctx context.Context, controller *controllercmd.ControllerC
// TODO: the oauth-proxy and delegating authorizer do not support Impersonate-User,
// so we do not impersonate gather
metricsGatherKubeConfig := rest.CopyConfig(controller.KubeConfig)
metricsGatherKubeConfig.CAFile = "/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt"
metricsGatherKubeConfig.CAFile = "/var/run/configmaps/service-ca-bundle/service-ca.crt"
metricsGatherKubeConfig.NegotiatedSerializer = scheme.Codecs
metricsGatherKubeConfig.GroupVersion = &schema.GroupVersion{}
metricsGatherKubeConfig.APIPath = "/"
Expand Down