mirror of
https://github.com/whyour/qinglong.git
synced 2026-09-22 19:29:13 +08:00
feat(ql3): establish 3.0 incubation baseline
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
# Example only. Discover the exact Kubernetes API endpoint used by Pods and
|
||||
# replace the documentation-only TEST-NET address in a private overlay.
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: ql3-worker-credential-executor
|
||||
namespace: qinglong3-system
|
||||
spec:
|
||||
egress:
|
||||
- to:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: kube-system
|
||||
podSelector:
|
||||
matchLabels:
|
||||
k8s-app: kube-dns
|
||||
ports:
|
||||
- protocol: UDP
|
||||
port: 53
|
||||
- protocol: TCP
|
||||
port: 53
|
||||
- to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
cnpg.io/cluster: ql3-postgres
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 5432
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: 192.0.2.1/32
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 443
|
||||
@@ -0,0 +1,169 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: ql3-worker-credential-executor
|
||||
namespace: qinglong3-system
|
||||
labels:
|
||||
app.kubernetes.io/name: ql3-worker-credential-executor
|
||||
app.kubernetes.io/component: worker-credential-executor
|
||||
app.kubernetes.io/part-of: qinglong3
|
||||
qinglong.io/execution-model: caller-driven
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
activeDeadlineSeconds: 600
|
||||
ttlSecondsAfterFinished: 600
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: ql3-worker-credential-executor
|
||||
app.kubernetes.io/component: worker-credential-executor
|
||||
app.kubernetes.io/part-of: qinglong3
|
||||
qinglong.io/execution-model: caller-driven
|
||||
spec:
|
||||
serviceAccountName: ql3-worker-credential-executor
|
||||
automountServiceAccountToken: false
|
||||
restartPolicy: Never
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 10001
|
||||
runAsGroup: 10001
|
||||
fsGroup: 10001
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
containers:
|
||||
- name: executor
|
||||
image: qinglong3-cluster-admin:3.0.0-alpha.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
command:
|
||||
- node
|
||||
- /opt/qinglong/node_modules/@qinglong/cluster-admin/dist/worker-credential/workerCredentialExecutorCli.js
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
env:
|
||||
- name: QL3_PROFILE
|
||||
value: cluster-admin
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_ENABLED
|
||||
value: 'true'
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_COMMAND_FILE
|
||||
value: /var/run/qinglong3/worker-credential-command/command.json
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_PEPPER_FILE
|
||||
value: /var/run/secrets/qinglong3/worker-credential-executor/pepper
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_CLUSTER_IDENTITY
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: ql3-worker-credential-executor-config
|
||||
key: cluster-identity
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_STAGE_NAMESPACE
|
||||
value: qinglong3-worker-credential-staging
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_TARGET_NAMESPACE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: ql3-worker-credential-executor-config
|
||||
key: target-namespace
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_TARGET_SECRET
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: ql3-worker-credential-executor-config
|
||||
key: target-secret
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_TARGET_DEPLOYMENT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: ql3-worker-credential-executor-config
|
||||
key: target-deployment
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_TARGET_DATA_KEY
|
||||
value: credential-token
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_DELIVERY_SERVICE_ACCOUNT
|
||||
value: ql3-worker-credential-admin
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_IDENTITY_SECRET
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: ql3-worker-credential-executor-config
|
||||
key: identity-secret
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_TLS_MODE
|
||||
value: verify-full
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_TLS_CA_FILE
|
||||
value: /var/run/secrets/qinglong3/postgres-worker-credential-executor/ca.crt
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_APPLICATION_NAME
|
||||
value: qinglong3-worker-credential-executor
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_MAX_CONNECTIONS
|
||||
value: '1'
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: ql3-cluster-worker-credential-executor-database
|
||||
key: postgres-worker-credential-executor-url
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_TLS_SERVERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: ql3-cluster-worker-credential-executor-database
|
||||
key: postgres-tls-servername
|
||||
resources:
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 64Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 256Mi
|
||||
volumeMounts:
|
||||
- name: tmp
|
||||
mountPath: /tmp
|
||||
- name: kube-api-access
|
||||
mountPath: /var/run/secrets/kubernetes.io/serviceaccount
|
||||
readOnly: true
|
||||
- name: command
|
||||
mountPath: /var/run/qinglong3/worker-credential-command
|
||||
readOnly: true
|
||||
- name: pepper
|
||||
mountPath: /var/run/secrets/qinglong3/worker-credential-executor
|
||||
readOnly: true
|
||||
- name: postgres-worker-credential-executor-ca
|
||||
mountPath: /var/run/secrets/qinglong3/postgres-worker-credential-executor
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: tmp
|
||||
emptyDir:
|
||||
medium: Memory
|
||||
sizeLimit: 8Mi
|
||||
- name: kube-api-access
|
||||
projected:
|
||||
defaultMode: 288
|
||||
sources:
|
||||
- serviceAccountToken:
|
||||
path: token
|
||||
expirationSeconds: 600
|
||||
- configMap:
|
||||
name: kube-root-ca.crt
|
||||
items:
|
||||
- key: ca.crt
|
||||
path: ca.crt
|
||||
- downwardAPI:
|
||||
items:
|
||||
- path: namespace
|
||||
fieldRef:
|
||||
apiVersion: v1
|
||||
fieldPath: metadata.namespace
|
||||
- name: command
|
||||
configMap:
|
||||
name: ql3-worker-credential-execution-command
|
||||
defaultMode: 292
|
||||
items:
|
||||
- key: command.json
|
||||
path: command.json
|
||||
- name: pepper
|
||||
secret:
|
||||
secretName: ql3-worker-credential-executor-pepper
|
||||
defaultMode: 288
|
||||
items:
|
||||
- key: worker-credential-pepper
|
||||
path: pepper
|
||||
- name: postgres-worker-credential-executor-ca
|
||||
secret:
|
||||
secretName: ql3-cluster-worker-credential-executor-database
|
||||
defaultMode: 292
|
||||
items:
|
||||
- key: postgres-ca.crt
|
||||
path: ca.crt
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- service-account.yaml
|
||||
- token-issuer-role-binding.yaml
|
||||
- job.yaml
|
||||
- network-policy.yaml
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: ql3-worker-credential-executor
|
||||
namespace: qinglong3-system
|
||||
labels:
|
||||
app.kubernetes.io/name: ql3-worker-credential-executor
|
||||
app.kubernetes.io/component: worker-credential-executor
|
||||
app.kubernetes.io/part-of: qinglong3
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: ql3-worker-credential-executor
|
||||
app.kubernetes.io/component: worker-credential-executor
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
ingress: []
|
||||
egress:
|
||||
- to:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: kube-system
|
||||
podSelector:
|
||||
matchLabels:
|
||||
k8s-app: kube-dns
|
||||
ports:
|
||||
- protocol: UDP
|
||||
port: 53
|
||||
- protocol: TCP
|
||||
port: 53
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: ql3-worker-credential-executor
|
||||
namespace: qinglong3-system
|
||||
labels:
|
||||
app.kubernetes.io/name: ql3-worker-credential-executor
|
||||
app.kubernetes.io/component: worker-credential-executor
|
||||
app.kubernetes.io/part-of: qinglong3
|
||||
automountServiceAccountToken: false
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: ql3-worker-credential-executor-token-issuer
|
||||
namespace: qinglong3-worker-credential-staging
|
||||
labels:
|
||||
app.kubernetes.io/name: ql3-worker-credential-executor
|
||||
app.kubernetes.io/component: worker-credential-executor
|
||||
app.kubernetes.io/part-of: qinglong3
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: ql3-worker-credential-token-issuer
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: ql3-worker-credential-executor
|
||||
namespace: qinglong3-system
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
- op: replace
|
||||
path: /spec/template/spec/containers/0/env
|
||||
value:
|
||||
- name: QL3_PROFILE
|
||||
value: cluster-admin
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_ENABLED
|
||||
value: 'true'
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_COMMAND_FILE
|
||||
value: /var/run/qinglong3/worker-credential-command/command.json
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_PEPPER_FILE
|
||||
value: /var/run/secrets/qinglong3/worker-credential-executor/pepper
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_CLUSTER_IDENTITY
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: ql3-worker-credential-executor-config
|
||||
key: cluster-identity
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_STAGE_NAMESPACE
|
||||
value: qinglong3-worker-credential-staging
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_TARGET_NAMESPACE
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: ql3-worker-credential-executor-config
|
||||
key: target-namespace
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_TARGET_SECRET
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: ql3-worker-credential-executor-config
|
||||
key: target-secret
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_TARGET_DEPLOYMENT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: ql3-worker-credential-executor-config
|
||||
key: target-deployment
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_TARGET_DATA_KEY
|
||||
value: credential-token
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_DELIVERY_SERVICE_ACCOUNT
|
||||
value: ql3-worker-credential-admin
|
||||
- name: QL3_WORKER_CREDENTIAL_EXECUTOR_IDENTITY_SECRET
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: ql3-worker-credential-executor-config
|
||||
key: identity-secret
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_TLS_MODE
|
||||
value: verify-full
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_TLS_CA_FILE
|
||||
value: /var/run/secrets/qinglong3/postgres-worker-credential-executor/ca.crt
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_APPLICATION_NAME
|
||||
value: qinglong3-worker-credential-executor
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_MAX_CONNECTIONS
|
||||
value: '1'
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_HOST
|
||||
value: ql3-postgres-rw.qinglong3-system.svc
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_PORT
|
||||
value: '5432'
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_DATABASE
|
||||
value: qinglong
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: ql3-postgres-worker-credential-executor-auth
|
||||
key: username
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: ql3-postgres-worker-credential-executor-auth
|
||||
key: password
|
||||
- name: QL3_POSTGRES_WORKER_CREDENTIAL_EXECUTOR_TLS_SERVERNAME
|
||||
value: ql3-postgres-rw.qinglong3-system.svc
|
||||
- op: replace
|
||||
path: /spec/template/spec/volumes/4/secret/secretName
|
||||
value: ql3-postgres-ca
|
||||
- op: replace
|
||||
path: /spec/template/spec/volumes/4/secret/items/0/key
|
||||
value: ca.crt
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- ../base
|
||||
|
||||
patches:
|
||||
- path: job-patch.yaml
|
||||
target:
|
||||
group: batch
|
||||
version: v1
|
||||
kind: Job
|
||||
name: ql3-worker-credential-executor
|
||||
- path: network-policy-patch.yaml
|
||||
target:
|
||||
group: networking.k8s.io
|
||||
version: v1
|
||||
kind: NetworkPolicy
|
||||
name: ql3-worker-credential-executor
|
||||
|
||||
images:
|
||||
- name: qinglong3-cluster-admin
|
||||
newName: registry.example.com/qinglong/qinglong3-cluster-admin
|
||||
digest: sha256:0000000000000000000000000000000000000000000000000000000000000000
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: ql3-worker-credential-executor
|
||||
namespace: qinglong3-system
|
||||
spec:
|
||||
egress:
|
||||
- to:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: kube-system
|
||||
podSelector:
|
||||
matchLabels:
|
||||
k8s-app: kube-dns
|
||||
ports:
|
||||
- protocol: UDP
|
||||
port: 53
|
||||
- protocol: TCP
|
||||
port: 53
|
||||
- to:
|
||||
- podSelector:
|
||||
matchLabels:
|
||||
cnpg.io/cluster: ql3-postgres
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 5432
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
# Example only. Copy these objects into a private, per-dispatch overlay.
|
||||
# Replace every placeholder, keep command.json exact, and never commit pepper.
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: ql3-worker-credential-executor-config
|
||||
namespace: qinglong3-system
|
||||
data:
|
||||
cluster-identity: REPLACE_WITH_CLUSTER_IDENTITY
|
||||
target-namespace: qinglong3-worker
|
||||
target-secret: ql3-worker-credential
|
||||
target-deployment: ql3-worker
|
||||
identity-secret: ql3-worker-identity
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: ql3-worker-credential-execution-command
|
||||
namespace: qinglong3-system
|
||||
immutable: true
|
||||
data:
|
||||
command.json: |
|
||||
{"schemaVersion":1,"actionRef":"REPLACE_WITH_APPROVED_ACTION_REF","approvalRequestId":"REPLACE_WITH_APPROVAL_REQUEST_ID","consumptionId":"REPLACE_WITH_UNIQUE_CONSUMPTION_ID","dispatchId":"REPLACE_WITH_APPROVED_DISPATCH_ID","auditEventId":"REPLACE_WITH_UNIQUE_AUDIT_EVENT_ID"}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: ql3-worker-credential-executor-pepper
|
||||
namespace: qinglong3-system
|
||||
type: Opaque
|
||||
stringData:
|
||||
worker-credential-pepper: REPLACE_WITH_DISTINCT_CANONICAL_32_BYTE_BASE64URL
|
||||
Reference in New Issue
Block a user