From db9ad593141b02b602caea8bc38ac0f66e47b2b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20M=C3=A9sz=C3=A1ros?= Date: Wed, 24 Jan 2024 17:08:14 +0100 Subject: [PATCH] Web Page Sample Skeleton MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Attila Mészáros --- .../samples/webpage/web-page-operator.yaml | 82 +++++++++++++++++++ .../samples/webpage/webpages.crd.yml | 34 ++++++++ 2 files changed, 116 insertions(+) create mode 100644 src/test/resources/samples/webpage/web-page-operator.yaml create mode 100644 src/test/resources/samples/webpage/webpages.crd.yml diff --git a/src/test/resources/samples/webpage/web-page-operator.yaml b/src/test/resources/samples/webpage/web-page-operator.yaml new file mode 100644 index 0000000..02072f3 --- /dev/null +++ b/src/test/resources/samples/webpage/web-page-operator.yaml @@ -0,0 +1,82 @@ +apiVersion: io.csviri.operator.resourceflow/v1beta1 +kind: ResourceFlowOperator +metadata: + name: rfo1 +spec: + parent: + apiVersion: resourceflow.sample/v1 + kind: WebPage + resources: + - name: html-config-map + resource: + apiVersion: v1 + kind: ConfigMap + metadata: + name: "{{parent.metadata.name}}" + data: + index.html: "{{{parent.spec.html}}}" + - name: deployment + resource: + apiVersion: apps/v1 # + kind: Deployment + metadata: + name: "{{parent.metadata.name}}" + spec: + selector: + matchLabels: + app: "{{parent.metadata.name}}" + replicas: 1 + template: + metadata: + labels: + app: "{{parent.metadata.name}}" + spec: + containers: + - name: nginx + image: nginx:1.17.0 + ports: + - containerPort: 80 + volumeMounts: + - name: html-volume + mountPath: /usr/share/nginx/html + volumes: + - name: html-volume + configMap: + name: "{{parent.metadata.name}}" + - name: service + resource: + apiVersion: v1 + kind: Service + metadata: + name: "{{parent.metadata.name}}" + spec: + selector: + app: "{{parent.metadata.name}}" + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: NodePort + - name: ingress + condition: + type: JSCondition + script: | + parent.spec.exposed == "true"; + resource: + apiVersion: networking.k8s.io/v1 + kind: Ingress + metadata: + name: "{{parent.metadata.name}}" + annotations: + nginx.ingress.kubernetes.io/rewrite-target: /$1 + spec: + rules: + - http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: "{{parent.metadata.name}}" + port: + number: 80 diff --git a/src/test/resources/samples/webpage/webpages.crd.yml b/src/test/resources/samples/webpage/webpages.crd.yml new file mode 100644 index 0000000..b0079b5 --- /dev/null +++ b/src/test/resources/samples/webpage/webpages.crd.yml @@ -0,0 +1,34 @@ +# Generated by Fabric8 CRDGenerator, manual edits might get overwritten! +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: resourceflow.sample.webpage +spec: + group: resourceflow.sample + names: + kind: WebPage + plural: webpages + singular: webpage + scope: Namespaced + versions: + - name: v1 + schema: + openAPIV3Schema: + properties: + spec: + properties: + exposed: + type: boolean + html: + type: string + type: object + status: + properties: + observedGeneration: + type: integer + type: object + type: object + served: true + storage: true + subresources: + status: {}