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

feat: add network-observability-operator #957

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
23 changes: 23 additions & 0 deletions charts/network-observability-operator/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/network-observability-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: network-observability-operator
description: A Helm chart for Kubernetes
appVersion: 1.0.5
type: application
version: 0.1.0

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions charts/network-observability-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "network-observability-operator.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "network-observability-operator.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "network-observability-operator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "network-observability-operator.labels" -}}
helm.sh/chart: {{ include "network-observability-operator.chart" . }}
{{ include "network-observability-operator.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "network-observability-operator.selectorLabels" -}}
app.kubernetes.io/name: {{ include "network-observability-operator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "network-observability-operator.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "network-observability-operator.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
25 changes: 25 additions & 0 deletions charts/network-observability-operator/templates/cert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: selfsigned-issuer
spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ include "network-observability-operator.fullname" . }}-ca
spec:
isCA: true
commonName: {{ include "network-observability-operator.fullname" . }}-ca
subject:
organizations:
- Plural
secretName: webhook-server-cert
privateKey:
algorithm: ECDSA
size: 256
issuerRef:
name: selfsigned-issuer
kind: Issuer
group: cert-manager.io
19 changes: 19 additions & 0 deletions charts/network-observability-operator/templates/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
data:
controller_manager_config.yaml: |
apiVersion: controller-runtime.sigs.k8s.io/v1alpha1
kind: ControllerManagerConfig
health:
healthProbeBindAddress: :8081
metrics:
bindAddress: 127.0.0.1:8080
webhook:
port: 9443
leaderElection:
leaderElect: true
resourceName: 7a7ecdcd.netobserv.io
kind: ConfigMap
metadata:
labels:
{{- include "network-observability-operator.labels" . | nindent 4 }}
name: netobserv-manager-config
195 changes: 195 additions & 0 deletions charts/network-observability-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "network-observability-operator.fullname" . }}
labels:
{{- include "network-observability-operator.labels" . | nindent 4 }}
spec:
progressDeadlineSeconds: 600
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "network-observability-operator.selectorLabels" . | nindent 6 }}
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "network-observability-operator.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- args:
- --health-probe-bind-address=:8081
- --metrics-bind-address=127.0.0.1:8080
- --leader-elect
- --ebpf-agent-image=$(RELATED_IMAGE_EBPF_AGENT)
- --flowlogs-pipeline-image=$(RELATED_IMAGE_FLOWLOGS_PIPELINE)
- --console-plugin-image=$(RELATED_IMAGE_CONSOLE_PLUGIN)
- --downstream-deployment=$(DOWNSTREAM_DEPLOYMENT)
- --profiling-bind-address=$(PROFILING_BIND_ADDRESS)
- --enable-http2=false
command:
- /manager
env:
- name: ENABLE_WEBHOOKS
value: "false"
- name: RELATED_IMAGE_EBPF_AGENT
value: quay.io/netobserv/netobserv-ebpf-agent:v0.3.3
- name: RELATED_IMAGE_FLOWLOGS_PIPELINE
value: quay.io/netobserv/flowlogs-pipeline:v0.1.11
- name: RELATED_IMAGE_CONSOLE_PLUGIN
value: quay.io/netobserv/network-observability-console-plugin:v0.1.12
- name: DOWNSTREAM_DEPLOYMENT
value: "false"
- name: PROFILING_BIND_ADDRESS
- name: OPERATOR_CONDITION_NAME
value: netobserv-operator.v1.0.5
image: quay.io/netobserv/network-observability-operator:1.0.5
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 8081
scheme: HTTP
initialDelaySeconds: 15
periodSeconds: 20
successThreshold: 1
timeoutSeconds: 1
name: manager
ports:
- containerPort: 9443
name: webhook-server
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /readyz
port: 8081
scheme: HTTP
initialDelaySeconds: 5
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources:
limits:
memory: 400Mi
requests:
cpu: 100m
memory: 100Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
volumeMounts:
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: cert
readOnly: true
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
- args:
- --secure-listen-address=0.0.0.0:8443
- --upstream=http://127.0.0.1:8080/
- --logtostderr=true
- --v=10
- --http2-disable
env:
- name: OPERATOR_CONDITION_NAME
value: netobserv-operator.v1.0.5
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.15.0
imagePullPolicy: IfNotPresent
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
protocol: TCP
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 5m
memory: 64Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext:
Copy link
Member

Choose a reason for hiding this comment

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

forgot about this, but we should allow customizability of the security context for both containers and the overall pod

runAsNonRoot: true
serviceAccount: {{ include "network-observability-operator.serviceAccountName" . }}
serviceAccountName: {{ include "network-observability-operator.serviceAccountName" . }}
terminationGracePeriodSeconds: 10
volumes:
- name: cert
secret:
defaultMode: 420
secretName: webhook-server-cert
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
annotations:
service.beta.openshift.io/inject-cabundle: "true"
name: netobserv-validating-webhook-configuration
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: netobserv-webhook-service
namespace: '{{ .Release.Namespace }}'
path: /validate-netobserv-io-v1beta2-flowcollector
failurePolicy: Fail
name: flowcollectorconversionwebhook.netobserv.io
rules:
- apiGroups:
- netobserv.io
apiVersions:
- v1beta2
operations:
- CREATE
- UPDATE
resources:
- flowcollectors
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: netobserv-webhook-service
namespace: '{{ .Release.Namespace }}'
path: /validate-flows-netobserv-io-v1alpha1-flowmetric
failurePolicy: Fail
name: flowmetricvalidationwebhook.netobserv.io
rules:
- apiGroups:
- flows.netobserv.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- flowmetrics
sideEffects: None
Loading
Loading