for me to test 
default-file-config-map.yaml
4.03 KiB
apiVersion: v1
kind: ConfigMap
metadata:
  name: default-file-config
  labels:
    app: freeradius
data:
  default : |
    server default {
        listen {
            type = auth
            ipaddr = *
            port = 0
            limit {
                max_connections = 16
                lifetime = 0
                idle_timeout = 30
            }
        }
        listen {
            type = auth
            ipv6addr = ::
            port = 0
            limit {
                max_connections = 16
                lifetime = 0
                idle_timeout = 30
            }
        }
        listen {
            ipaddr = *
            port = 0
            type = acct
            limit {
            }
        }
        listen {
            ipv6addr = ::
            port = 0
            type = acct
            limit {
            }
        }
        authorize {
            filter_username
            filter_password
            preprocess
            suffix
            group {
                sql{
                    fail =1
                }
                if (fail){
                    files
                    if (noop) {
                        update control {
                            Framed-Pool:= "200"
                        }
                        accept
                        ok
                    }
                }
            }
            if (&control:Framed-Pool=="300"){
                accept
                ok
            }
            pap
            chap
        }
        authenticate {
            Auth-Type PAP {
                pap
            }
            Auth-Type CHAP {
                chap
            }
        }
        post-auth {
            switch &control:Framed-Pool {
                case ""{
                  rest{
                    fail =1
                  }
                    if ("%{reply:REST-HTTP-Status-Code}" == 200){
                        reject
                    }
                    update  {
                    reply:Framed-IP-Address := &control:Framed-IP-Address
                    reply:Framed-Route := &control:Framed-Route
                    reply:Framed-Pool := "NULL"
                    }
                }
                case  "200" {
                  rest{
                    fail =1
                  }
                    if ("%{reply:REST-HTTP-Status-Code}" ==200){
                        reject
                    }
                    update  {
                    reply:Framed-Pool := "200"
                    reply:Service-Type := "Framed"
                    }
                }
                #
                case "400" {
                  rest{
                    fail =1
                  }
                    if ("%{reply:REST-HTTP-Status-Code}" ==200){
                        reject
                    }
                  update {
                  reply:Framed-Pool := "400"
                  reply:Service-Type := "Framed"
                  }
                }
                #
                case  "300" {
                    update  {
                    reply:Framed-Pool := "300"
                    }
                }
                #
                case "600" {
                  update {
                  reply:Framed-Pool := "600"
                  }
                }
            }
            update reply {
                Framed-IP-Netmask := 255.255.255.255
                Framed-Protocol:= "PPP"
                Framed-MTU := 1500
                ERX-Ingress-Policy-Name := &control:ERX-Ingress-Policy-Name
                ERX-Egress-Policy-Name := &control:ERX-Egress-Policy-Name
                Class := "AAA-$ENV{REGION}"
                Session-Timeout := &control:Session-Timeout
            }
            # if ("%{reply:REST-HTTP-Status-Code}" ==201){
            #             ok
            # }
        }
        accounting {
            rest{
                    fail =1
                  }
            detail
            update control {
              Replicate-To-Realm := "DEFAULT"
            }
            replicate
        }
    }
radius-proxy-config.yaml
413 B
apiVersion: v1
kind: ConfigMap
metadata:
  name: proxy-config
  labels:
    app: freeradius
data:
  proxy.conf: |
    
    realm DEFAULT {
      acct_pool = my_acct_failover
    }
      home_server SRP {
        type = acct
        ipaddr = just adress example 
        port = 1818
        secret = testing123
      }
      home_server_pool my_acct_failover {
        type = load-balance
        home_server = SRP
      }












      radius-accounting-tn1-deployment.yaml
3.54 KiB
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: radius-accounting-site1
  name: radius-accounting-site1
spec:
  replicas: 1
  selector:
    matchLabels:
      name: radius-accounting-site1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        name: radius-accounting-site1
      annotations: 
        prometheus.io/scrape: "true"
        prometheus.io/path: "/metrics"
        prometheus.io/port: "9812"
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: region
                operator: In
                values:
                - tn1
      containers:
        - image: git.pyxis.com.tn:5000/radius/freeradius:1.0
          imagePullPolicy: Always
          name: radius-accounting
          env:
            - name: REGION
              value: TN1
          ports:
            - containerPort: 1813
              protocol: UDP
            - containerPort: 80
            - containerPort: 9812
              protocol: TCP
          resources: {}
          volumeMounts:
            - name: tz
              mountPath: /etc/localtime
              subPath: Tunis
            - mountPath: /etc/raddb/sites-enabled/default
              name: default-file-config
              subPath: default
            - mountPath: /etc/raddb/mods-config/sql/main/mysql/queries.conf
              name: sql-queries-config
              subPath: queries.conf
            - mountPath: /etc/raddb/mods-enabled/sql
              name: sql-connection
              subPath: sql
            - mountPath: /etc/raddb/mods-config/files/authorize
              name: authorize-file
              subPath: authorize
            - mountPath: /etc/raddb/proxy.conf
              name: proxy-config
              subPath: proxy.conf
            - mountPath: /etc/raddb/clients.conf
              name: clients-config
              subPath: clients.conf
            - mountPath: /etc/raddb/mods-enabled/rest
              name: rest-config-tn1
              subPath: rest
      restartPolicy: Always
      volumes:
        - name: tz
          configMap:
            name: tz
        - name:  init-script
          configMap:
            name: freeradius-init-config-map
            items:
              - key: check_volume.sh
                path: check_volume.sh
        - name:  default-file-config
          configMap:
            name: default-file-config
            items:
              - key: default
                path: default
        - name:  sql-queries-config
          configMap:
            name: sql-queries-config
            items:
              - key: queries.conf
                path: queries.conf
        - name: sql-connection
          configMap:
            name: sql-connection-config-tns1
            items:
              - key: sql
                path: sql
        - name: authorize-file
          configMap:
            name: authorize-file
            items:
              - key: authorize
                path: authorize
        - name:  rest-config-tn1
          configMap:
            name: rest-config-tn1
            items:
              - key: rest
                path: rest
        - name:  proxy-config
          configMap:
            name: proxy-config
            items:
              - key: proxy.conf
                path: proxy.conf
        - name:  clients-config
          configMap:
            name: clients-config
            items:
              - key: clients.conf
                path: clients.conf
status: {}










radius-exporter-accounting.yaml
468 B
apiVersion: v1
kind: Service
metadata:
  labels:
    name: radius-exporter
  annotations:
    prometheus.io/scrape: "true"
    prometheus.io.scheme: "http"
    prometheus.io/path: "/metrics"
    prometheus.io/port: "9812"
  name: radius-accounting-exporter
spec:
  ports:
    - name: "freeradius-exporter"
      port: 9812
      targetPort: 9812
  selector:
    name: radius-accounting
  externalIPs:
   just adress example 






  radius-tn1-accounting-service.yml
698 B
apiVersion: v1
kind: Service
metadata:
  labels:
    name: radius-accounting-site1
    prometheus.io/scrape: "true"
    prometheus.io/port: "9812"
    app_kubernetes_io_instance: freeradius-exporter
    app_kubernetes_io_managed_by: Safwen
    app_kubernetes_io_name: freeradius-exporter
  name: radius-accounting-site1
spec:
  ports:
    - name: "accounting-port"
      port: 1815
      protocol: UDP
      targetPort: 1813
    - name: "8080"
      port: 8080
      targetPort: 80
    - name: "freeradius-exporter"
      port: 9812
      targetPort: 9812
  selector:
    name: radius-accounting-site1
  externalIPs:
   just example cause addreses are private 





















so you will use these just as a guide when i ask something 
so i want just to creae ta combined yml file taht has 2 pods 1 generator other recieve trafic and return response wit hattributes thaso take one that is standard i mean it adds something to ther packet from generator and adds an attrubtes to it and i can see the log that she have a response 
so you will aslo take that syntax i gaved you in consideration to not make erreur in configs espesially the  yamls i gaved yoiu 
so give full completed updated yml that is combined in 1 yml