Skip to content

Commit

Permalink
Merge pull request #722 from Vandit1604/fix/update-kube-state-metrics…
Browse files Browse the repository at this point in the history
…-unknown-configuration-flag

Fix manifest failures and other small errors while deploying the application
  • Loading branch information
jesusvazquez authored Aug 18, 2024
2 parents cf77f51 + 9e6f2a6 commit 6c417c5
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 95 deletions.
7 changes: 3 additions & 4 deletions pkg/provider/k8s/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
appsV1 "k8s.io/api/apps/v1"
batchV1 "k8s.io/api/batch/v1"
apiCoreV1 "k8s.io/api/core/v1"
apiExtensionsV1beta1 "k8s.io/api/extensions/v1beta1"
apiNetworkingV1 "k8s.io/api/networking/v1"
rbac "k8s.io/api/rbac/v1"
apiServerExtensionsV1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
Expand Down Expand Up @@ -1183,15 +1182,15 @@ func (c *K8s) customResourceDelete(resource runtime.Object) error {
}

func (c *K8s) ingressDelete(resource runtime.Object) error {
req := resource.(*apiExtensionsV1beta1.Ingress)
req := resource.(*apiNetworkingV1.Ingress)
kind := resource.GetObjectKind().GroupVersionKind().Kind
if len(req.Namespace) == 0 {
req.Namespace = "default"
}

switch v := resource.GetObjectKind().GroupVersionKind().Version; v {
case "v1beta1":
client := c.clt.ExtensionsV1beta1().Ingresses(req.Namespace)
case "v1":
client := c.clt.NetworkingV1().Ingresses(req.Namespace)
delPolicy := apiMetaV1.DeletePropagationForeground
if err := client.Delete(c.ctx, req.Name, apiMetaV1.DeleteOptions{PropagationPolicy: &delPolicy}); err != nil {
return errors.Wrapf(err, "resource delete failed - kind: %v, name: %v", kind, req.Name)
Expand Down
18 changes: 17 additions & 1 deletion prombench/docs/kind.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,28 @@ Run prombench tests in [Kubernetes In Docker](https://kind.sigs.k8s.io/).

### Create the KIND Cluster

- Build the `infra` CLI tool

```
cd infra/
# build the CLI tool - Infra
go build .
cd ../prombench/
```

- Create multi node KIND cluster
- Set the following environment variables and deploy the cluster.
- Set the following environment variables

```
export CLUSTER_NAME=prombench
export PR_NUMBER=<PR to benchmark against the selected $RELEASE>
```

- Deploy the cluster.

```
../infra/infra kind cluster create -v PR_NUMBER:$PR_NUMBER -v CLUSTER_NAME:$CLUSTER_NAME \
-f manifests/cluster_kind.yaml
```
Expand Down Expand Up @@ -44,6 +59,7 @@ export GITHUB_ORG=prometheus
export GITHUB_REPO=prometheus
export SERVICEACCOUNT_CLIENT_EMAIL=<Your Email address>
```

- Deploy the [nginx-ingress-controller](https://github.com/kubernetes/ingress-nginx), Prometheus-Meta, Loki, Grafana, Alertmanager & Github Notifier.

```
Expand Down
179 changes: 90 additions & 89 deletions prombench/manifests/cluster-infra/2_ingress-nginx-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,57 @@ spec:
app.kubernetes.io/name: ingress-nginx
type: ClusterIP
---
apiVersion: batch/v1
kind: Job
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.10.1
name: ingress-nginx-admission-create
namespace: ingress-nginx
spec:
template:
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.10.1
name: ingress-nginx-admission-create
spec:
containers:
- args:
- create
- --host=ingress-nginx-controller-admission,ingress-nginx-controller-admission.$(POD_NAMESPACE).svc
- --namespace=$(POD_NAMESPACE)
- --secret-name=ingress-nginx-admission
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.4.1@sha256:36d05b4077fb8e3d13663702fa337f124675ba8667cbd949c03a8e8ea6fa4366
imagePullPolicy: IfNotPresent
name: create
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65532
seccompProfile:
type: RuntimeDefault
nodeSelector:
kubernetes.io/os: linux
restartPolicy: OnFailure
serviceAccountName: ingress-nginx-admission
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -515,56 +566,51 @@ spec:
secret:
secretName: ingress-nginx-admission
---
apiVersion: batch/v1
kind: Job
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.10.1
name: ingress-nginx-admission-create
namespace: ingress-nginx
name: nginx
spec:
template:
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.10.1
name: ingress-nginx-admission-create
spec:
containers:
- args:
- create
- --host=ingress-nginx-controller-admission,ingress-nginx-controller-admission.$(POD_NAMESPACE).svc
- --namespace=$(POD_NAMESPACE)
- --secret-name=ingress-nginx-admission
env:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.4.1@sha256:36d05b4077fb8e3d13663702fa337f124675ba8667cbd949c03a8e8ea6fa4366
imagePullPolicy: IfNotPresent
name: create
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 65532
seccompProfile:
type: RuntimeDefault
nodeSelector:
kubernetes.io/os: linux
restartPolicy: OnFailure
serviceAccountName: ingress-nginx-admission
controller: k8s.io/ingress-nginx
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.10.1
name: ingress-nginx-admission
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: ingress-nginx-controller-admission
namespace: ingress-nginx
path: /networking/v1/ingresses
failurePolicy: Fail
matchPolicy: Equivalent
name: validate.nginx.ingress.kubernetes.io
rules:
- apiGroups:
- networking.k8s.io
apiVersions:
- v1
operations:
- CREATE
- UPDATE
resources:
- ingresses
sideEffects: None
---
apiVersion: batch/v1
kind: Job
Expand Down Expand Up @@ -618,49 +664,4 @@ spec:
kubernetes.io/os: linux
restartPolicy: OnFailure
serviceAccountName: ingress-nginx-admission
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.10.1
name: nginx
spec:
controller: k8s.io/ingress-nginx
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
labels:
app.kubernetes.io/component: admission-webhook
app.kubernetes.io/instance: ingress-nginx
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/part-of: ingress-nginx
app.kubernetes.io/version: 1.10.1
name: ingress-nginx-admission
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: ingress-nginx-controller-admission
namespace: ingress-nginx
path: /networking/v1/ingresses
failurePolicy: Fail
matchPolicy: Equivalent
name: validate.nginx.ingress.kubernetes.io
rules:
- apiGroups:
- networking.k8s.io
apiVersions:
- v1
operations:
- CREATE
- UPDATE
resources:
- ingresses
sideEffects: None

Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ spec:
- name: kube-state-metrics
image: registry.k8s.io/kube-state-metrics/kube-state-metrics:v2.10.1
args:
- "--collectors=namespaces"
- "--resources=namespaces"
ports:
- name: http-metrics
containerPort: 8080
Expand Down

0 comments on commit 6c417c5

Please sign in to comment.