-
Notifications
You must be signed in to change notification settings - Fork 216
Expose metric endpoint on https #368
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
Expose metric endpoint on https #368
Conversation
91455eb
to
d9b290d
Compare
/test integration |
00c9a1c
to
cfacd9d
Compare
/test e2e-aws |
3 similar comments
/test e2e-aws |
/test e2e-aws |
/test e2e-aws |
cfacd9d
to
188be58
Compare
/test integration |
188be58
to
095437c
Compare
/test integration |
095437c
to
480ef2b
Compare
/test e2e-aws |
1 similar comment
/test e2e-aws |
- name: config | ||
mountPath: /etc/kube-rbac-proxy | ||
- name: machine-api-operator | ||
image: docker.io/openshift/origin-machine-api-operator:v4.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This image refers to v4.0 whereas the kube-rbac-proxy refers to 4.2.0. Is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mao image version is same as it is today in https://github.com/openshift/machine-api-operator/blob/master/install/0000_30_machine-api-operator_11_deployment.yaml#L22
kube-rbac-proxy image 4.2.0 is taken just to be latest. Not sure if these two should be same. I see both image streams 4.0.0 and 4.2.0 in the install/image-references, so chose to follow the same pattern and use 4.2.0
Do we care that we listen on IPv4 only? Why not explicitly use |
480ef2b
to
f8fb691
Compare
/retest |
134014d
to
e0ef43a
Compare
e0ef43a
to
5d2b38b
Compare
kind: Deployment | ||
metadata: | ||
name: machine-api-operator | ||
namespace: openshift-machine-api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you elaborate why we need this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is required for the k8s-e2e ci job which runs test against the k8s. In the original deployment, we are mounting a secret into the pod. Based on the annotation in the mao metrics service object, this secret
will get created automatically in the openshift cluster. With the minikube cluster, this secret will not be there and thus deployment will fail. To workaround this, in the k8s-e2e tests this deployment will be used which is not mounting secrets.
/test e2e-aws |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: enxebre The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
serviceAccountName: machine-api-operator | ||
containers: | ||
- name: kube-rbac-proxy | ||
image: quay.io/openshift/origin-kube-rbac-proxy:4.2.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be an image stream no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nevermind, it is
- name: kube-rbac-proxy | ||
image: quay.io/openshift/origin-kube-rbac-proxy:4.2.0 | ||
args: | ||
- "--secure-listen-address=0.0.0.0:8443" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will use an at startup generated self-signed cert, is that intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm |
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
/retest Please review the full test history for this PR and help us cut down flakes. |
@vikaschoudhary16: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
This PR is adding changes to expose metrics endpoint on https and also changes at other objects for integration with openshift-monitoring at https.
This PR is also restricting http port access only on loopback ip.
Approach for https support:
kube-rbac-proxy container is being run alongside operator container which runs metrics server in the same pod. kube-rbac -proxy validates authz and authn on behalf of the metrics server and if success, proxies the incoming https request to the metrics server(which is listening on 127.0.0.1 and http port 8080).
How authn and authz is being validated by kube-rbac-proxy
It uses
TokenReviews()
andSubjectAccessReviews()
apis internally for validation of token authentication and authorization respectively. These apis are used against a stub resource,namespace/metrics
which is passed as config to the kube-rbac-proxyRBAC permissions for this rule are defined same as that we expect for metrics endpoint.
So when a https request is received for metrics endpoint, token and rbac of the request user is validated against this stub resource. If it passes, proxied to the metrics endpoint.
How I tested it locally
prometheus-k8s
. I got this token using following command:This should return metrics