Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Community Code Challenge - Let's set sail for Cloud Native Island!

KRiedelsheimer
Community Manager
Community Manager
We have a new code challenge for you as part of the Community Spotlight for the month of July. This time it's about setting sail for Cloud Native Island, where you will explore the treasures of Kubernetes, Containerization and the SAP BTP, Kyma runtime.
 
This thread is the place to share your experience with the challenge and your progress for the challenge. Feel free to ask any questions (technical or non-technical) and leave your comments.

 

We are very much looking forward to your ideas and contributions! 😃
105 REPLIES 105

ajmaradiaga
Developer Advocate
Developer Advocate

My week 4 submission:

URL: https://check-invoice-service.c-1e90315.kyma.ondemand.com/checkInvoice

You can invoke the command using curl:

 

curl --location --request POST 'https://check-invoice-service.c-1e90315.kyma.ondemand.com/checkInvoice' \
--header 'Content-Type: application/json' \
--data-raw '{
    "supplierId": "ccd955cbc7b3",
    "invoiceNumber": "0254863",
    "invoiceDate": "2022-03-02",
    "locale": "en"
}'

 

The check-invoice service is now running 10 pods...
Screenshot 2022-07-29 at 14.50.06.pngScreenshot 2022-07-29 at 14.49.52.png

PunithKumar
Explorer

Week3 Challenge Submission

API Access Strategy JWT Token
Unauthorized Endpoint: https://auth-service.a8a8425.kyma.ondemand.com

Below is the screenshot for Unauthorized Endpoint Access

PunithKumar_0-1659161645680.png

Get Request with JWT Access Token

PunithKumar_1-1659161806077.png

 

MioYasutake
Active Contributor

My week 4 submission.

https://my-service.a2985eb.kyma.shoot.live.k8s-hana.ondemand.com/

I haven't been able to put much of a load on it. Pods increased to a maximum of 3.

pods.png

 

 

 

0 Kudos

You can try and change the deployment.yaml and increase the ReplicaSet property 🙂 

0 Kudos

Hi @KRiedelsheimer ,

Thanks for your reply. In my submission above, I used below command to configure Horizontal Pod Autoscaler. Isn't this enough to achieve the goal?

kubectl autoscale deployment my-service --cpu-percent=50 --min=1 --max=10

I have increased spec.replicas in deployment.yaml to 10 and this indeed increased the pod count. But this is rather static declaration and not scaling according to the load, right?

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-service
  labels:
    app: my-service
spec:
  replicas: 10
  selector:
    matchLabels:
      app: my-service

Pods2.png

 

 

Ashok459
Participant

week 2 submission - React app 

https://reactfiori.c-154df33.kyma.ondemand.com/

Ashok_Easa_0-1659292325105.png

Deployment file

apiVersion: apps/v1
kind: Deployment
metadata:
  name: reactfiori
  labels:
    app: reactfiori
spec:
  replicas: 1
  selector:
    matchLabels:
      app: reactfiori
  template:
    metadata:
      labels:
        app: reactfiori
    spec:
      containers:
      - name: reactfiori
        image: docker.io/ashoksiva59/sapreactfiori-image:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 80
        resources:
            limits:
              memory: 550Mi
              cpu: 500m
            requests:
              cpu: 500m
              memory: 550Mi
      imagePullSecrets:
      - name: doeckerregcred
status: {}
     
---
apiVersion: v1
kind: Service
metadata:
  name: reactfiori
spec:
  selector:
    app: reactfiori
  ports:
  - port: 8080
    targetPort: 80
    protocol: TCP
status:
  loadBalancer: {}
---

apiVersion: gateway.kyma-project.io/v1alpha1
kind: APIRule
metadata:
  name: reactfiori
spec:
  gateway: kyma-gateway.kyma-system.svc.cluster.local
  service:
    name: reactfiori
    port: 8080
    host: reactfiori
  rules:
    - path: /.*
      methods: ["GET"]
      accessStrategies:
        - handler: allow
          config: {}

 

jacobahtan
Product and Topic Expert
Product and Topic Expert

Ashok459
Participant

kevin_hu
Active Participant

ec1
Active Participant

Week 2. It's a simple node js that returns current timestamp.

service_screenshot.jpg

apiVersion: apps/v1
kind: Deployment
metadata:
  name: simple-current-timestamp
  labels:
    app: simple-current-timestamp
spec:
  replicas: 1
  selector:
    matchLabels:
      app: simple-current-timestamp
  template:
    metadata:
      labels:
        app: simple-current-timestamp
    spec:
      containers:
      - name: simple-current-timestamp
        image: ghcr.io/stevanic/simple-current-timestamp:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        resources:
            limits:
              ephemeral-storage: 256M
              memory: 256M
              cpu: 100m
            requests:
              cpu: 100m
              ephemeral-storage: 256M
              memory: 256M
status: {}
      
---
apiVersion: v1
kind: Service
metadata:
  name: simple-current-timestamp
spec:
  selector:
    app: simple-current-timestamp
  ports:
  - port: 8080
    targetPort: 8080
    protocol: TCP

---

apiVersion: gateway.kyma-project.io/v1alpha1
kind: APIRule
metadata:
  name: simple-current-timestamp
spec:
  gateway: kyma-gateway.kyma-system.svc.cluster.local
  service:
    name: simple-current-timestamp
    port: 8080
    host: simple-current-timestamp
  rules:
    - path: /.*
      methods: ["GET"]
      accessStrategies:
        - handler: noop
          config: {}

KRiedelsheimer
Community Manager
Community Manager

Hi my friends!

Tomorrow is the last they for submitting your challenge submissions. After Wednesday, August 3rd we will close the Code Challenge for this month 😊.
Thank you all for the participation and all of your submissions! I am super excited that all of you put work and thought into solving each weeks challenge! 
The badges for your Code Challenge participation will go online after August 8th.

For more Cloud Native, Kyma, Kubernetes, etc. Content please visit our SAP Developer YouTube Channel

Vitaliy-R
Developer Advocate
Developer Advocate
0 Kudos

For week 2 I tried to deploy the same Python app that I deployed to CloudFoundry: https://blogs.sap.com/2022/06/09/sap-tech-bytes-cf-python-app-to-upload-csv-into-sap-hana-cloud-data...

It runs localy in my Docker container, but does not start when deployed to Kyma due to error "WebSocket connection to 'wss://loadfilemvp.c-0007af4.kyma.ondemand.com/stream' failed: WebSocket is closed before the connection is established.".

Is there any additional rule I need to include into deployment file to enable websockets? I searched documentation, but could not find it.

Screen Shot 2022-08-02 at 13.16.33.png

 

noravonthenen
Developer Advocate
Developer Advocate
0 Kudos

YoshiakiToma
Explorer
0 Kudos

Week 3

Follow the link, this a CAP Service with JSON Web Token.

https://orders.eacec52.kyma.ondemand.com/

YoshiakiToma_0-1659496604751.png

 

sunilchandra007
Active Contributor
0 Kudos

Week 3 submission :

https://httpbin-jwt.c-48bed44.kyma.ondemand.com

sunilchandra007_0-1659509629056.png

Regards,

Sunil Chandra

sunilchandra007
Active Contributor
0 Kudos

Week 4 submission:

https://httpbin.c-48bed44.kyma.ondemand.com

sunilchandra007_0-1659511142212.png

 

Regards,

Sunil Chandra

YoshiakiToma
Explorer
0 Kudos

PunithKumar
Explorer
0 Kudos

kadir_ozgur
Explorer
0 Kudos

My week 4 submission, had to skip week 3. 

kadir_ozgur_0-1659558596965.png

 

Tsuyoushi
Discoverer
0 Kudos

Week 3

I finished the challange of the week. 

https://agendacap-sample.ef5bceb.kyma.ondemand.com/

Tsuyoushi_0-1659567753167.png

 

Tsuyoushi
Discoverer
0 Kudos

Week 4

Follow the url for the week 4 challenge: https://agendacap-sample.ef5bceb.kyma.ondemand.com

Tsuyoushi_1-1659568734513.png