apiVersion: v1
kind: Namespace
metadata:
  name: crossplane-system
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: crossplane-provider-proxmox
  namespace: crossplane-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: crossplane-provider-proxmox
  template:
    metadata:
      labels:
        app: crossplane-provider-proxmox
    spec:
      serviceAccountName: crossplane-provider-proxmox
      containers:
      - name: provider
        image: crossplane-provider-proxmox:latest
        imagePullPolicy: Never
        ports:
        - containerPort: 8080
          name: metrics
        - containerPort: 8081
          name: health
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        resources:
          requests:
            cpu: 100m
            memory: 128Mi
          limits:
            cpu: 500m
            memory: 512Mi
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8081
          initialDelaySeconds: 30
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /readyz
            port: 8081
          initialDelaySeconds: 10
          periodSeconds: 5
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: crossplane-provider-proxmox
  namespace: crossplane-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  name: crossplane-provider-proxmox
rules:
- apiGroups: [""]
  resources: ["secrets"]
  verbs: ["get", "list", "watch"]
- apiGroups: ["proxmox.sankofa.nexus"]
  resources: ["*"]
  verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: crossplane-provider-proxmox
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: crossplane-provider-proxmox
subjects:
- kind: ServiceAccount
  name: crossplane-provider-proxmox
  namespace: crossplane-system

