enforce-deployment-max-pods

command module
v0.0.0-...-58c5ca6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2021 License: MIT Imports: 14 Imported by: 0

README

enforce-deployment-max-pods

使用方式

# create serviceaccount
apiVersion: v1
kind: ServiceAccount
metadata:
  name: enforce-deployment-max-pods
  namespace: autoops
---
# create clusterrole
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
  name: enforce-deployment-max-pods
rules:
  - apiGroups: [ "apps" ]
    resources: [ "deployments", "replicasets" ]
    verbs: [ "get" ]
  - apiGroups: [ "" ]
    resources: [ "pods" ]
    verbs: [ "list" ]
---
# create clusterrolebinding
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: enforce-deployment-max-pods
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: enforce-deployment-max-pods
subjects:
  - kind: ServiceAccount
    name: enforce-deployment-max-pods
    namespace: autoops
---
# create job
apiVersion: batch/v1
kind: Job
metadata:
  name: install-enforce-deployment-max-pods
  namespace: autoops
spec:
  template:
    spec:
      serviceAccount: admission-bootstrapper
      containers:
        - name: admission-bootstrapper
          image: autoops/admission-bootstrapper
          env:
            - name: ADMISSION_NAME
              value: enforce-deployment-max-pods
            - name: ADMISSION_IMAGE
              value: autoops/enforce-deployment-max-pods
            - name: ADMISSION_ENVS
              value: "MAX_PODS=50"
            - name: ADMISSION_SERVICE_ACCOUNT
              value: "enforce-deployment-max-pods"
            - name: ADMISSION_MUTATING
              value: "true"
            - name: ADMISSION_IGNORE_FAILURE
              value: "true"
            - name: ADMISSION_SIDE_EFFECT
              value: "None"
            - name: ADMISSION_RULES
              value: '[{"operations":["CREATE"],"apiGroups":[""], "apiVersions":["*"], "resources":["pods"]}]'
      restartPolicy: OnFailure

Credits

Guo Y.K., MIT License

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL