mirror of
https://github.com/ansible/awx-operator.git
synced 2026-03-26 21:33:14 +00:00
Upgrade operator-sdk to v1.40.0 and remove kube-rbac-proxy
Bump operator-sdk, ansible-operator, and OPM binaries to align with the OCP 4.20 / AAP 2.7 target. Replace the deprecated kube-rbac-proxy sidecar (removed in operator-sdk v1.38.0) with controller-runtime's built-in WithAuthenticationAndAuthorization for metrics endpoint protection. Changes: - Makefile: operator-sdk v1.36.1 → v1.40.0, OPM v1.26.0 → v1.55.0 - Dockerfile: ansible-operator base image v1.36.1 → v1.40.0 - Remove kube-rbac-proxy sidecar and auth_proxy_* RBAC manifests - Add metrics_auth_role, metrics_reader, and metrics_service resources - Add --metrics-secure, --metrics-require-rbac, --metrics-bind-address flags via JSON patch to serve metrics directly from the manager on port 8443 with TLS and RBAC authentication Ref: AAP-65254 Authored By: Christian M. Adams <chadams@redhat.com> Assisted By: Claude
This commit is contained in:
committed by
Dimitri Savineau
parent
0b4b5dd7fd
commit
5fb6bb7519
@@ -1,4 +1,4 @@
|
|||||||
FROM quay.io/operator-framework/ansible-operator:v1.36.1
|
FROM quay.io/operator-framework/ansible-operator:v1.40.0
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
RUN dnf update --security --bugfix -y --disableplugin=subscription-manager && \
|
RUN dnf update --security --bugfix -y --disableplugin=subscription-manager && \
|
||||||
|
|||||||
6
Makefile
6
Makefile
@@ -165,7 +165,7 @@ ifeq (,$(shell which operator-sdk 2>/dev/null))
|
|||||||
@{ \
|
@{ \
|
||||||
set -e ;\
|
set -e ;\
|
||||||
mkdir -p $(dir $(OPERATOR_SDK)) ;\
|
mkdir -p $(dir $(OPERATOR_SDK)) ;\
|
||||||
curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/v1.36.1/operator-sdk_$(OS)_$(ARCHA) ;\
|
curl -sSLo $(OPERATOR_SDK) https://github.com/operator-framework/operator-sdk/releases/download/v1.40.0/operator-sdk_$(OS)_$(ARCHA) ;\
|
||||||
chmod +x $(OPERATOR_SDK) ;\
|
chmod +x $(OPERATOR_SDK) ;\
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -181,7 +181,7 @@ ifeq (,$(shell which ansible-operator 2>/dev/null))
|
|||||||
@{ \
|
@{ \
|
||||||
set -e ;\
|
set -e ;\
|
||||||
mkdir -p $(dir $(ANSIBLE_OPERATOR)) ;\
|
mkdir -p $(dir $(ANSIBLE_OPERATOR)) ;\
|
||||||
curl -sSLo $(ANSIBLE_OPERATOR) https://github.com/operator-framework/ansible-operator-plugins/releases/download/v1.36.1/ansible-operator_$(OS)_$(ARCHA) ;\
|
curl -sSLo $(ANSIBLE_OPERATOR) https://github.com/operator-framework/ansible-operator-plugins/releases/download/v1.40.0/ansible-operator_$(OS)_$(ARCHA) ;\
|
||||||
chmod +x $(ANSIBLE_OPERATOR) ;\
|
chmod +x $(ANSIBLE_OPERATOR) ;\
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -212,7 +212,7 @@ ifeq (,$(shell which opm 2>/dev/null))
|
|||||||
@{ \
|
@{ \
|
||||||
set -e ;\
|
set -e ;\
|
||||||
mkdir -p $(dir $(OPM)) ;\
|
mkdir -p $(dir $(OPM)) ;\
|
||||||
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.26.0/$(OS)-$(ARCHA)-opm ;\
|
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.55.0/$(OS)-$(ARCHA)-opm ;\
|
||||||
chmod +x $(OPM) ;\
|
chmod +x $(OPM) ;\
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ resources:
|
|||||||
- ../manager
|
- ../manager
|
||||||
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
|
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
|
||||||
#- ../prometheus
|
#- ../prometheus
|
||||||
|
- metrics_service.yaml
|
||||||
|
|
||||||
# Protect the /metrics endpoint by putting it behind auth.
|
|
||||||
# If you want your controller-manager to expose the /metrics
|
|
||||||
# endpoint w/o any authn/z, please comment the following line.
|
|
||||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
kind: Kustomization
|
kind: Kustomization
|
||||||
patches:
|
patches:
|
||||||
- path: manager_auth_proxy_patch.yaml
|
- path: manager_metrics_patch.yaml
|
||||||
|
target:
|
||||||
|
kind: Deployment
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
# This patch inject a sidecar container which is a HTTP proxy for the
|
|
||||||
# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
|
|
||||||
apiVersion: apps/v1
|
|
||||||
kind: Deployment
|
|
||||||
metadata:
|
|
||||||
name: controller-manager
|
|
||||||
namespace: system
|
|
||||||
spec:
|
|
||||||
template:
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: kube-rbac-proxy
|
|
||||||
securityContext:
|
|
||||||
allowPrivilegeEscalation: false
|
|
||||||
capabilities:
|
|
||||||
drop:
|
|
||||||
- "ALL"
|
|
||||||
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.15.0
|
|
||||||
args:
|
|
||||||
- "--secure-listen-address=0.0.0.0:8443"
|
|
||||||
- "--upstream=http://127.0.0.1:8080/"
|
|
||||||
- "--logtostderr=true"
|
|
||||||
- "--v=0"
|
|
||||||
ports:
|
|
||||||
- containerPort: 8443
|
|
||||||
protocol: TCP
|
|
||||||
name: https
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpu: 500m
|
|
||||||
memory: 128Mi
|
|
||||||
requests:
|
|
||||||
cpu: 5m
|
|
||||||
memory: 64Mi
|
|
||||||
- name: awx-manager
|
|
||||||
args:
|
|
||||||
- "--health-probe-bind-address=:6789"
|
|
||||||
- "--metrics-bind-address=127.0.0.1:8080"
|
|
||||||
- "--leader-elect"
|
|
||||||
- "--leader-election-id=awx-operator"
|
|
||||||
12
config/default/manager_metrics_patch.yaml
Normal file
12
config/default/manager_metrics_patch.yaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# This patch adds the args to allow exposing the metrics endpoint using HTTPS
|
||||||
|
- op: add
|
||||||
|
path: /spec/template/spec/containers/0/args/0
|
||||||
|
value: --metrics-bind-address=:8443
|
||||||
|
# This patch adds the args to allow securing the metrics endpoint
|
||||||
|
- op: add
|
||||||
|
path: /spec/template/spec/containers/0/args/0
|
||||||
|
value: --metrics-secure
|
||||||
|
# This patch adds the args to allow RBAC-based authn/authz for the metrics endpoint
|
||||||
|
- op: add
|
||||||
|
path: /spec/template/spec/containers/0/args/0
|
||||||
|
value: --metrics-require-rbac
|
||||||
@@ -3,6 +3,8 @@ kind: Service
|
|||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
control-plane: controller-manager
|
control-plane: controller-manager
|
||||||
|
app.kubernetes.io/name: awx-operator
|
||||||
|
app.kubernetes.io/managed-by: kustomize
|
||||||
name: controller-manager-metrics-service
|
name: controller-manager-metrics-service
|
||||||
namespace: system
|
namespace: system
|
||||||
spec:
|
spec:
|
||||||
@@ -10,6 +12,7 @@ spec:
|
|||||||
- name: https
|
- name: https
|
||||||
port: 8443
|
port: 8443
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: https
|
targetPort: 8443
|
||||||
selector:
|
selector:
|
||||||
control-plane: controller-manager
|
control-plane: controller-manager
|
||||||
|
app.kubernetes.io/name: awx-operator
|
||||||
@@ -38,6 +38,7 @@ spec:
|
|||||||
- args:
|
- args:
|
||||||
- --leader-elect
|
- --leader-elect
|
||||||
- --leader-election-id=awx-operator
|
- --leader-election-id=awx-operator
|
||||||
|
- --health-probe-bind-address=:6789
|
||||||
image: controller:latest
|
image: controller:latest
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
name: awx-manager
|
name: awx-manager
|
||||||
|
|||||||
@@ -9,10 +9,6 @@ resources:
|
|||||||
- role_binding.yaml
|
- role_binding.yaml
|
||||||
- leader_election_role.yaml
|
- leader_election_role.yaml
|
||||||
- leader_election_role_binding.yaml
|
- leader_election_role_binding.yaml
|
||||||
# Comment the following 4 lines if you want to disable
|
- metrics_auth_role.yaml
|
||||||
# the auth proxy (https://github.com/brancz/kube-rbac-proxy)
|
- metrics_auth_role_binding.yaml
|
||||||
# which protects your /metrics endpoint.
|
- metrics_reader_role.yaml
|
||||||
- auth_proxy_service.yaml
|
|
||||||
- auth_proxy_role.yaml
|
|
||||||
- auth_proxy_role_binding.yaml
|
|
||||||
- auth_proxy_client_clusterrole.yaml
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
apiVersion: rbac.authorization.k8s.io/v1
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
kind: ClusterRole
|
kind: ClusterRole
|
||||||
metadata:
|
metadata:
|
||||||
name: proxy-role
|
name: metrics-auth-role
|
||||||
rules:
|
rules:
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
- authentication.k8s.io
|
- authentication.k8s.io
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
apiVersion: rbac.authorization.k8s.io/v1
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
kind: ClusterRoleBinding
|
kind: ClusterRoleBinding
|
||||||
metadata:
|
metadata:
|
||||||
name: proxy-rolebinding
|
name: metrics-auth-rolebinding
|
||||||
roleRef:
|
roleRef:
|
||||||
apiGroup: rbac.authorization.k8s.io
|
apiGroup: rbac.authorization.k8s.io
|
||||||
kind: ClusterRole
|
kind: ClusterRole
|
||||||
name: proxy-role
|
name: metrics-auth-role
|
||||||
subjects:
|
subjects:
|
||||||
- kind: ServiceAccount
|
- kind: ServiceAccount
|
||||||
name: controller-manager
|
name: controller-manager
|
||||||
Reference in New Issue
Block a user