Skip to content

Commit

Permalink
optimize Kubefile
Browse files Browse the repository at this point in the history
  • Loading branch information
bxy4543 committed Nov 7, 2023
1 parent 11fe147 commit 33aaf35
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 4 deletions.
4 changes: 0 additions & 4 deletions controllers/admission/api/v1/pvc_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ func (v *PvcValidator) checkStorageCapacity(nodeNames []string, requestedStorage
return nil
}

//func (v *PvcValidator) ValidateDelete(ctx context.Context, obj runtime.Object) error {
// return nil
//}

func (v *PvcValidator) newLVMVgTotalFreeQuery(node string) (int64, error) {
prom, err := prometheus.NewPrometheus(v.PromoURL)
if err != nil {
Expand Down
29 changes: 29 additions & 0 deletions controllers/admission/config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,32 @@ webhooks:
resources:
- namespaces
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-opsrequest-sts-pvc
failurePolicy: Fail
name: vresources.kb.io
namespaceSelector:
matchExpressions:
- key: user.sealos.io/owner
operator: Exists
rules:
- apiGroups:
- apps.kubeblocks.io
- apps
apiVersions:
- v1alpha1
- v1
operations:
- CREATE
- UPDATE
- DELETE
resources:
- opsrequests
- statefulsets
sideEffects: None
2 changes: 2 additions & 0 deletions controllers/admission/deploy/Kubefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ ENV icpEnabled="false"
ENV icpEndpoint=""
ENV icpKey=""

ENV promoUrl=""

ENV namespaceWebhookEnabled="true"
ENV namespaceWebhookFailurePolicy="Fail"

Expand Down
31 changes: 31 additions & 0 deletions controllers/admission/deploy/manifests/deploy.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ spec:
value: '{{ .icpEndpoint }}'
- name: ICP_KEY
value: '{{ .icpKey }}'
- name: PROMO_URL
value: '{{ .promoUrl }}'
image: ghcr.io/labring/sealos-admission-controller:latest
livenessProbe:
httpGet:
Expand Down Expand Up @@ -543,4 +545,33 @@ webhooks:
resources:
- namespaces
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: admission-webhook-service
namespace: sealos-system
path: /validate-opsrequest-sts-pvc
failurePolicy: {{ .namespaceWebhookFailurePolicy }}
name: vresources.kb.io
namespaceSelector:
matchExpressions:
- key: user.sealos.io/owner
operator: Exists
rules:
- apiGroups:
- apps.kubeblocks.io
- apps
apiVersions:
- v1alpha1
- v1
operations:
- CREATE
- UPDATE
- DELETE
resources:
- opsrequests
- statefulsets
sideEffects: None
{{ end }}

0 comments on commit 33aaf35

Please sign in to comment.