refactor: 폴더 구조 변경

This commit is contained in:
donghyeon-ka
2026-08-02 00:22:19 +09:00
parent f9c463f87a
commit be2f8e4863
1869 changed files with 4565 additions and 295591 deletions
@@ -0,0 +1,115 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: oauth2-proxy
spec:
replicas: 1
revisionHistoryLimit: 5
progressDeadlineSeconds: 600
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 25%
maxUnavailable: 0
selector:
matchLabels:
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: oauth2-proxy
template:
metadata:
labels:
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: oauth2-proxy
spec:
serviceAccountName: oauth2-proxy-sa
automountServiceAccountToken: false
terminationGracePeriodSeconds: 30
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: oauth2-proxy
securityContext:
runAsNonRoot: true
runAsUser: 65532
runAsGroup: 65532
fsGroup: 65532
fsGroupChangePolicy: OnRootMismatch
seccompProfile:
type: RuntimeDefault
containers:
- name: oauth2-proxy
image: quay.io/oauth2-proxy/oauth2-proxy:v7.15.2
imagePullPolicy: IfNotPresent
args:
- --config=/etc/oauth2-proxy/oauth2-proxy.cfg
ports:
- name: http
containerPort: 4180
protocol: TCP
- name: metrics
containerPort: 44180
protocol: TCP
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
memory: 256Mi
startupProbe:
httpGet:
path: /ping
port: http
periodSeconds: 5
failureThreshold: 12
timeoutSeconds: 3
readinessProbe:
httpGet:
path: /ready
port: http
periodSeconds: 10
failureThreshold: 3
timeoutSeconds: 3
livenessProbe:
httpGet:
path: /ping
port: http
periodSeconds: 15
failureThreshold: 3
timeoutSeconds: 3
securityContext:
runAsNonRoot: true
runAsUser: 65532
runAsGroup: 65532
allowPrivilegeEscalation: false
privileged: false
readOnlyRootFilesystem: true
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
volumeMounts:
- name: config
mountPath: /etc/oauth2-proxy
readOnly: true
- name: secrets
mountPath: /etc/oauth2-proxy-secrets
readOnly: true
- name: tmp
mountPath: /tmp
volumes:
- name: config
configMap:
name: oauth2-proxy-config
- name: secrets
secret:
secretName: oauth2-proxy-secrets
defaultMode: 0400
- name: tmp
emptyDir:
medium: Memory
sizeLimit: 64Mi
@@ -0,0 +1,18 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- serviceaccount.yaml
- service.yaml
- deployment.yaml
labels:
- pairs:
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: oauth2-proxy
app.kubernetes.io/version: "7.15.2"
app.kubernetes.io/component: auth-proxy
app.kubernetes.io/part-of: auth-platform
app.kubernetes.io/managed-by: kustomize
includeSelectors: false
includeTemplates: true
@@ -0,0 +1,20 @@
apiVersion: v1
kind: Service
metadata:
name: oauth2-proxy
spec:
type: ClusterIP
selector:
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: oauth2-proxy
ports:
- name: http
port: 4180
targetPort: http
protocol: TCP
appProtocol: http
- name: metrics
port: 44180
targetPort: metrics
protocol: TCP
appProtocol: http
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: oauth2-proxy-sa
automountServiceAccountToken: false
@@ -0,0 +1,18 @@
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
resources:
- ../base
- oauth2-proxy-config.yaml
- oauth2-proxy-ingress.yaml
- oauth2-proxy-middleware.yaml
- oauth2-proxy-networkpolicy.yaml
patches:
- target:
kind: Ingress
name: auth-server
patch: |-
- op: replace
path: /metadata/annotations/traefik.ingress.kubernetes.io~1router.middlewares
value: mnt-oauth2-proxy-errors@kubernetescrd,mnt-oauth2-proxy-auth@kubernetescrd,kube-system-security-headers@kubernetescrd
@@ -0,0 +1,46 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: oauth2-proxy-config
labels:
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: oauth2-proxy
app.kubernetes.io/version: "7.15.2"
app.kubernetes.io/component: auth-proxy
app.kubernetes.io/part-of: auth-platform
app.kubernetes.io/managed-by: kustomize
data:
oauth2-proxy.cfg: |
provider = "keycloak-oidc"
http_address = "0.0.0.0:4180"
metrics_address = "0.0.0.0:44180"
redirect_url = "http://auth.local.test/oauth2/callback"
oidc_issuer_url = "http://keycloak.local.test/realms/platform"
skip_oidc_discovery = true
login_url = "http://keycloak.local.test/realms/platform/protocol/openid-connect/auth"
redeem_url = "http://keycloak.mnt.svc.cluster.local/realms/platform/protocol/openid-connect/token"
profile_url = "http://keycloak.mnt.svc.cluster.local/realms/platform/protocol/openid-connect/userinfo"
validate_url = "http://keycloak.mnt.svc.cluster.local/realms/platform/protocol/openid-connect/userinfo"
oidc_jwks_url = "http://keycloak.mnt.svc.cluster.local/realms/platform/protocol/openid-connect/certs"
client_id = "auth-server-ingress"
client_secret_file = "/etc/oauth2-proxy-secrets/client-secret"
cookie_secret_file = "/etc/oauth2-proxy-secrets/cookie-secret"
reverse_proxy = true
upstreams = [ "static://202" ]
email_domains = [ "*" ]
scope = "openid profile email"
insecure_oidc_allow_unverified_email = true
skip_provider_button = true
cookie_secure = false
cookie_samesite = "lax"
cookie_csrf_per_request = true
cookie_refresh = "4m"
set_xauthrequest = true
set_authorization_header = true
pass_access_token = true
pass_authorization_header = true
ssl_insecure_skip_verify = false
whitelist_domains = [ "auth.local.test" ]
trusted_proxy_ips = [ "10.42.0.0/16" ]
@@ -0,0 +1,27 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: oauth2-proxy
labels:
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: oauth2-proxy
app.kubernetes.io/version: "7.15.2"
app.kubernetes.io/component: auth-proxy
app.kubernetes.io/part-of: auth-platform
app.kubernetes.io/managed-by: kustomize
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
traefik.ingress.kubernetes.io/router.middlewares: kube-system-security-headers@kubernetescrd
spec:
ingressClassName: traefik
rules:
- host: auth.local.test
http:
paths:
- path: /oauth2/
pathType: Prefix
backend:
service:
name: oauth2-proxy
port:
name: http
@@ -0,0 +1,45 @@
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: oauth2-proxy-auth
labels:
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: oauth2-proxy
app.kubernetes.io/version: "7.15.2"
app.kubernetes.io/component: auth-proxy
app.kubernetes.io/part-of: auth-platform
app.kubernetes.io/managed-by: kustomize
spec:
forwardAuth:
address: http://oauth2-proxy.mnt.svc.cluster.local:4180/oauth2/auth
trustForwardHeader: true
authResponseHeaders:
- Authorization
- X-Auth-Request-Access-Token
- X-Auth-Request-Email
- X-Auth-Request-Preferred-Username
- X-Auth-Request-User
- X-Forwarded-Email
- X-Forwarded-User
---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: oauth2-proxy-errors
labels:
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: oauth2-proxy
app.kubernetes.io/version: "7.15.2"
app.kubernetes.io/component: auth-proxy
app.kubernetes.io/part-of: auth-platform
app.kubernetes.io/managed-by: kustomize
spec:
errors:
status:
- "401"
statusRewrites:
"401": 302
service:
name: oauth2-proxy
port: 4180
query: /oauth2/start?rd={url}
@@ -0,0 +1,55 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: oauth2-proxy-ingress-traefik
labels:
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: oauth2-proxy
app.kubernetes.io/component: auth-proxy
app.kubernetes.io/part-of: auth-platform
app.kubernetes.io/managed-by: kustomize
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: oauth2-proxy
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
app.kubernetes.io/name: traefik
ports:
- protocol: TCP
port: 4180
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: oauth2-proxy-egress-keycloak
labels:
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: oauth2-proxy
app.kubernetes.io/component: auth-proxy
app.kubernetes.io/part-of: auth-platform
app.kubernetes.io/managed-by: kustomize
spec:
podSelector:
matchLabels:
app.kubernetes.io/name: oauth2-proxy
app.kubernetes.io/instance: oauth2-proxy
policyTypes:
- Egress
egress:
- to:
- podSelector:
matchLabels:
app.kubernetes.io/instance: keycloak
app.kubernetes.io/managed-by: keycloak-operator
ports:
- protocol: TCP
port: 8080
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: mnt
components:
- ../../component