Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requirements for Prometheus #46

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
$(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found -f -

deploy: kustomize edit-image ## Deploy controller to the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/begin | kubectl apply -f -
./deploy.sh deploy $(KUSTOMIZE) config/begin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the "deploy" lines, the "config/begin" isn't used because it's hard coded into the deploy.sh script. Does it have to be included on this line? Same for all the other PRs too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hadn't meant for it to be hardcoded. I'll adjust that.


undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found -f -
./deploy.sh undeploy $(KUSTOMIZE) config/default

installer: kustomize edit-image

Expand Down
3 changes: 3 additions & 0 deletions config/prometheus/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Adds namespace to all resources.
namespace: nnf-lustre-fs-system

resources:
- monitor.yaml
1 change: 1 addition & 0 deletions config/prometheus/monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ kind: ServiceMonitor
metadata:
labels:
control-plane: controller-manager
prometheus-app: rabbit-nnf
name: controller-manager-metrics-monitor
namespace: system
spec:
Expand Down
12 changes: 12 additions & 0 deletions config/rbac/auth_proxy_client_clusterrole_binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: metrics-reader-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: metrics-reader
subjects:
- kind: ServiceAccount
name: controller-manager
namespace: system
4 changes: 4 additions & 0 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ resources:
- auth_proxy_role.yaml
- auth_proxy_role_binding.yaml
- auth_proxy_client_clusterrole.yaml
- auth_proxy_client_clusterrole_binding.yaml

configurations:
- kustomizeconfig.yaml
4 changes: 4 additions & 0 deletions config/rbac/kustomizeconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
namePrefix:
- path: metadata/annotations/kubernetes.io\/service-account.name
namespace:
- path: metadata/annotations/kubernetes.io\/service-account.namespace
43 changes: 43 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# Copyright 2023 Hewlett Packard Enterprise Development LP
# Other additional copyright holders may be indicated within.
#
# The entirety of this work is licensed under the Apache License,
# Version 2.0 (the "License"); you may not use this file except
# in compliance with the License.
#
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

# Deploy/undeploy controller to the K8s cluster specified in ~/.kube/config.

CMD=$1
KUSTOMIZE=$2
OVERLAY_DIR=$3

if [[ $CMD == 'deploy' ]]; then
$KUSTOMIZE build $OVERLAY_DIR | kubectl apply -f -

# Deploy the ServiceMonitor resource if its CRD is found. The CRD would
# have been installed by a metrics service such as Prometheus.
if kubectl get crd servicemonitors.monitoring.coreos.com > /dev/null 2>&1; then
$KUSTOMIZE build config/prometheus | kubectl apply -f-
fi
fi

if [[ $CMD == 'undeploy' ]]; then
$KUSTOMIZE build config/prometheus | kubectl delete --ignore-not-found -f-
$KUSTOMIZE build $OVERLAY_DIR | kubectl delete --ignore-not-found -f -
fi

exit 0
Loading