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

integrate konflux-ui with namespace-lister #5297

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
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
38 changes: 38 additions & 0 deletions components/konflux-ui/staging/base/proxy/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ http {
'' close;
}

map $request_method $ns_target {
GET namespacelister;
default kubeapi;
}

server {
listen 9443 ssl;
ssl_certificate /mnt/tls.crt;
Expand Down Expand Up @@ -161,6 +166,39 @@ http {
include /mnt/nginx-generated-config/bearer.conf;
}

# GET requests to the following endpoints are handled from the namespace-lister.
# * /api/k8s/api/v1/namespaces
# * /api/k8s/api/v1/namespaces/
#
# Requests with other methods are handled by the Kube-API
location ~* ^/api/k8s/api/v1/namespaces(/?)$ {
try_files $uri @$ns_target;
}

location @namespacelister {
auth_request_set $email $upstream_http_x_auth_request_email;
auth_request /oauth2/auth;
proxy_read_timeout 30m;
proxy_set_header X-Email $email;

rewrite ^.*$ /api/v1/namespaces break;

proxy_pass http://namespace-lister.namespace-lister.svc.cluster.local:8080;
}

location @kubeapi {
auth_request_set $email $upstream_http_x_auth_request_email;
auth_request /oauth2/auth;
proxy_read_timeout 30m;
proxy_set_header X-Email $email;

rewrite ^/api/k8s/(.*)/$ /$1 break;

proxy_pass https://kubernetes.default.svc;
proxy_set_header Impersonate-User $email;
filariow marked this conversation as resolved.
Show resolved Hide resolved
include /mnt/nginx-generated-config/bearer.conf;
}

location /health {
# Used for liveness probes
return 200;
Expand Down
16 changes: 8 additions & 8 deletions components/namespace-lister/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ resources:
- deployment.yaml
- namespace.yaml
- rbac.yaml
- proxy.yaml
- route.yaml
- service.yaml
- network_policy.yaml
namespace: namespace-lister
configMapGenerator:
- files:
- nginx.conf=nginx.conf
name: proxy-konflux
options:
disableNameSuffixHash: true
images:
- name: namespace-lister
newName: quay.io/konflux-ci/namespace-lister
newTag: fd195c941b3151c165ddf376ce5f44d57db3f071
patches:
- path: ./patches/with-header-auth-email.yaml
target:
group: apps
kind: Deployment
name: namespace-lister
namespace: namespace-lister
22 changes: 22 additions & 0 deletions components/namespace-lister/base/network_policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: namespace-lister
namespace: namespace-lister
spec:
podSelector:
matchLabels:
apps: namespace-lister
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: konflux-ui
- podSelector:
matchLabels:
app: proxy
ports:
- protocol: TCP
port: 8080
59 changes: 0 additions & 59 deletions components/namespace-lister/base/nginx.conf

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
path: /spec/template/spec/containers/0/env/-
value:
name: AUTH_USERNAME_HEADER
value: Impersonate-User
value: X-Email
105 changes: 0 additions & 105 deletions components/namespace-lister/base/proxy.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions components/namespace-lister/base/route.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions components/namespace-lister/base/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ metadata:
namespace: namespace-lister
spec:
selector:
app: namespace-lister-proxy
apps: namespace-lister
type: ClusterIP
ports:
- name: http
targetPort: 8080
port: 12000
port: 8080
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base/
- rbac.yaml
13 changes: 0 additions & 13 deletions components/namespace-lister/staging/stone-stg-rh01/rbac.yaml

This file was deleted.

Loading