apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.14.0
  name: modules.cyclops-ui.com
spec:
  group: cyclops-ui.com
  names:
    kind: Module
    listKind: ModuleList
    plural: modules
    singular: module
  scope: Namespaced
  versions:
    - name: v1alpha1
      schema:
        openAPIV3Schema:
          description: Module is the Schema for the modules API
          properties:
            apiVersion:
              description: |-
                APIVersion defines the versioned schema of this representation of an object.
                Servers should convert recognized schemas to the latest internal value, and
                may reject unrecognized values.
                More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
              type: string
            history:
              items:
                properties:
                  generation:
                    format: int64
                    type: integer
                  template:
                    properties:
                      path:
                        type: string
                      repo:
                        type: string
                      sourceType:
                        enum:
                          - git
                          - helm
                          - oci
                        type: string
                      version:
                        type: string
                    required:
                      - path
                      - repo
                      - version
                    type: object
                  values:
                    x-kubernetes-preserve-unknown-fields: true
                required:
                  - generation
                  - template
                  - values
                type: object
              type: array
            kind:
              description: |-
                Kind is a string value representing the REST resource this object represents.
                Servers may infer this from the endpoint the client submits requests to.
                Cannot be updated.
                In CamelCase.
                More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
              type: string
            metadata:
              type: object
            spec:
              description: ModuleSpec defines the desired state of Module
              properties:
                targetNamespace:
                  type: string
                template:
                  properties:
                    path:
                      type: string
                    repo:
                      type: string
                    sourceType:
                      enum:
                        - git
                        - helm
                        - oci
                      type: string
                    version:
                      type: string
                  required:
                    - path
                    - repo
                    - version
                  type: object
                values:
                  x-kubernetes-preserve-unknown-fields: true
              required:
                - template
                - values
              type: object
            status:
              description: ModuleStatus defines the observed state of Module
              properties:
                iconURL:
                  type: string
                managedGVRs:
                  items:
                    properties:
                      group:
                        type: string
                      resource:
                        type: string
                      version:
                        type: string
                    required:
                      - group
                      - resource
                      - version
                    type: object
                  type: array
                reconciliationStatus:
                  properties:
                    errors:
                      items:
                        type: string
                      type: array
                    reason:
                      type: string
                    status:
                      default: unknown
                      enum:
                        - unknown
                        - succeeded
                        - failed
                      type: string
                  type: object
                templateResolvedVersion:
                  type: string
              required:
                - reconciliationStatus
                - templateResolvedVersion
              type: object
          type: object
      served: true
      storage: true
      subresources:
        status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.14.0
  name: templateauthrules.cyclops-ui.com
spec:
  group: cyclops-ui.com
  names:
    kind: TemplateAuthRule
    listKind: TemplateAuthRuleList
    plural: templateauthrules
    singular: templateauthrule
  scope: Namespaced
  versions:
    - name: v1alpha1
      schema:
        openAPIV3Schema:
          description: TemplateAuthRule is the Schema for the modules API
          properties:
            apiVersion:
              description: |-
                APIVersion defines the versioned schema of this representation of an object.
                Servers should convert recognized schemas to the latest internal value, and
                may reject unrecognized values.
                More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
              type: string
            kind:
              description: |-
                Kind is a string value representing the REST resource this object represents.
                Servers may infer this from the endpoint the client submits requests to.
                Cannot be updated.
                In CamelCase.
                More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
              type: string
            metadata:
              type: object
            spec:
              description: TemplateAuthRuleSpec defines the desired state of TemplateAuthRule
              properties:
                password:
                  description: SecretKeySelector selects a key of a Secret.
                  properties:
                    key:
                      description: The key of the secret to select from.  Must be a
                        valid secret key.
                      type: string
                    name:
                      default: ""
                      description: |-
                        Name of the referent.
                        This field is effectively required, but due to backwards compatibility is
                        allowed to be empty. Instances of this type with an empty value here are
                        almost certainly wrong.
                        TODO: Add other useful fields. apiVersion, kind, uid?
                        More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
                        TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
                      type: string
                    optional:
                      description: Specify whether the Secret or its key must be defined
                      type: boolean
                  required:
                    - key
                  type: object
                  x-kubernetes-map-type: atomic
                repo:
                  type: string
                username:
                  description: SecretKeySelector selects a key of a Secret.
                  properties:
                    key:
                      description: The key of the secret to select from.  Must be a
                        valid secret key.
                      type: string
                    name:
                      default: ""
                      description: |-
                        Name of the referent.
                        This field is effectively required, but due to backwards compatibility is
                        allowed to be empty. Instances of this type with an empty value here are
                        almost certainly wrong.
                        TODO: Add other useful fields. apiVersion, kind, uid?
                        More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
                        TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
                      type: string
                    optional:
                      description: Specify whether the Secret or its key must be defined
                      type: boolean
                  required:
                    - key
                  type: object
                  x-kubernetes-map-type: atomic
              required:
                - password
                - repo
                - username
              type: object
          type: object
      served: true
      storage: true
      subresources:
        status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.14.0
  name: templatestores.cyclops-ui.com
spec:
  group: cyclops-ui.com
  names:
    kind: TemplateStore
    listKind: TemplateStoreList
    plural: templatestores
    singular: templatestore
  scope: Namespaced
  versions:
    - name: v1alpha1
      schema:
        openAPIV3Schema:
          description: TemplateStore holds reference to a template that can be offered
            as a starting point
          properties:
            apiVersion:
              description: |-
                APIVersion defines the versioned schema of this representation of an object.
                Servers should convert recognized schemas to the latest internal value, and
                may reject unrecognized values.
                More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
              type: string
            kind:
              description: |-
                Kind is a string value representing the REST resource this object represents.
                Servers may infer this from the endpoint the client submits requests to.
                Cannot be updated.
                In CamelCase.
                More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
              type: string
            metadata:
              type: object
            spec:
              properties:
                path:
                  type: string
                repo:
                  type: string
                sourceType:
                  enum:
                    - git
                    - helm
                    - oci
                  type: string
                version:
                  type: string
              required:
                - path
                - repo
                - version
              type: object
          type: object
      served: true
      storage: true
---
apiVersion: v1
kind: Namespace
metadata:
  name: cyclops
---
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    app.kubernetes.io/component: ctrl
    app.kubernetes.io/name: cyclops-ctrl
    app.kubernetes.io/part-of: cyclops
  name: cyclops-ctrl
  namespace: cyclops
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  labels:
    app.kubernetes.io/component: ctrl
    app.kubernetes.io/name: cyclops-ctrl
    app.kubernetes.io/part-of: cyclops
  name: cyclops-ctrl
  namespace: cyclops
rules:
  - apiGroups:
      - '*'
    resources:
      - '*'
    verbs:
      - '*'
  - nonResourceURLs:
      - '*'
    verbs:
      - '*'
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  labels:
    app.kubernetes.io/component: ctrl
    app.kubernetes.io/name: cyclops-ctrl
    app.kubernetes.io/part-of: cyclops
  name: cyclops-ctrl
  namespace: cyclops
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cyclops-ctrl
subjects:
  - kind: ServiceAccount
    name: cyclops-ctrl
    namespace: cyclops
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cyclops-ui
  namespace: cyclops
  labels:
    app: cyclops-ui
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cyclops-ui
  template:
    metadata:
      labels:
        app: cyclops-ui
    spec:
      containers:
        - name: cyclops-ui
          image: cyclopsui/cyclops-ui:v0.18.0
          ports:
            - containerPort: 80
          env:
            - name: REACT_APP_CYCLOPS_CTRL_HOST
              value: http://cyclops-ctrl.cyclops:8080
            - name: REACT_APP_ENABLE_STREAMING
              value: "true"
            - name: NODE_ENV
              value: production
            - name: NODE_OPTIONS
              value: --openssl-legacy-provider
      restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
  name: cyclops-ui
  namespace: cyclops
spec:
  type: ClusterIP
  ports:
    - port: 3000
      targetPort: 80
      protocol: TCP
  selector:
    app: cyclops-ui
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: cyclops-ui
  namespace: cyclops
spec:
  podSelector:
    matchLabels:
      app: cyclops-ui
  ingress:
    - {}
  egress:
    - {}
  policyTypes:
    - Ingress
    - Egress
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cyclops-ctrl
  namespace: cyclops
  labels:
    app: cyclops-ctrl
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cyclops-ctrl
  template:
    metadata:
      labels:
        app: cyclops-ctrl
    spec:
      serviceAccountName: cyclops-ctrl
      containers:
        - name: cyclops-ctrl
          image: cyclopsui/cyclops-ctrl:v0.18.0
          ports:
            - containerPort: 8080
          env:
            - name: PORT
              value: "8080"
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8082
            initialDelaySeconds: 15
            periodSeconds: 20
          readinessProbe:
            httpGet:
              path: /readyz
              port: 8082
            initialDelaySeconds: 5
            periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
  name: cyclops-ctrl
  namespace: cyclops
  labels:
    app: cyclops-ctrl
spec:
  type: ClusterIP
  ports:
    - port: 8080
      protocol: TCP
      targetPort: 8080
  selector:
    app: cyclops-ctrl
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: cyclops-ctrl
  namespace: cyclops
spec:
  podSelector:
    matchLabels:
      app: cyclops-ctrl
  ingress:
    - from:
      - podSelector:
          matchLabels:
            app: cyclops-ui
      ports:
        - protocol: TCP
          port: 8080
  egress:
    - {}
  policyTypes:
  - Ingress
  - Egress