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

noravonthenen
Developer Advocate
Developer Advocate

🙂

Screen Shot 2022-07-15 at 12.48.11.png

jacobahtan
Product and Topic Expert
Product and Topic Expert

Week 2
https://ui5-walkthrough.c-5a642e4.kyma.ondemand.com/

challenge-week2.png

Deployed the famous SAPUI5 Walkthrough to Kyma😉

 

deployment.yaml

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

---

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

 

Week 2

 

based on https://cap.cloud.sap/docs/guides/deployment/deploy-to-kyma#build-cap-nodejs-image

 

akuller_0-1657966619484.png

 

global:

  domain: adeb271.kyma.ondemand.com

  imagePullSecret:

    name: regcred

srv:

  bindings: {}

  image:

    repository: ghcr.io/a-kuller/challenge-srv

    tag: latest

  resources:

    limits:

      cpu: 100m

      ephemeral-storage: 1G

      memory: 500M

    requests:

      cpu: 100m

      ephemeral-storage: 1G

      memory: 500M

  health_check:

    liveness:

      path: /

    readiness:

      path: /

 

MioYasutake
Active Contributor

I'm on week challenge and have an issue. I am new to Kyma, so I just started with a similar setting with week1.

My GitHub repository is below and "myservice" is the folder that contains my week2 app.

https://github.com/miyasuta/sap-community-code-challenge-cloud-native/tree/week2

Deployment to Kyma was successful as shown below.

api-rules.png

However, when I open the API url, I see the following error.

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

upstream connect error or disconnect/reset before headers. reset reason: connection failure, transport failure reason: delayed connect error: 111

In cloud foundry I would see application logs with `cf logs <appname>`. Where should I start looking to troubleshoot with Kyma? 

The issue has been resolved. There seems to be a problem with the port mapping.

My week2 submission

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

kyma-week2.png

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-service
  labels:
    app: my-service
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-service
  template:
    metadata:
      labels:
        app: my-service
    spec:
      containers:
      - name: my-service
        image: ghcr.io/miyasuta/sap-community-code-challenge-cloud-native/my-service:latest
        # image: miyasuta/my-service:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        resources:
            limits:
              ephemeral-storage: 256M
              memory: 256M
              cpu: 100m
            requests:
              cpu: 100m
              ephemeral-storage: 256M
              memory: 256M
      imagePullSecrets:
      - name: regcred
status: {}
      
---
apiVersion: v1
kind: Service
metadata:
  name: my-service
spec:
  selector:
    app: my-service
  ports:
  - port: 8081
    targetPort: 8080
    protocol: TCP

---

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

 

 

 

 

0 Kudos

Hi @MioYasutake ,

I am sorry that I didn't reply, I was out sick. I am glad you could solve the issue!

SUNIL_JOHN
Explorer

Week:2

https://hello-world.c-415359f.kyma.ondemand.com/say/hello(to='there')

image (1).png

apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-world 
  labels:
    app: hello-world 
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hello-world 
  template:
    metadata:
      labels: # labels to select/identify the deployment
        app: hello-world  
    spec:     # pod spec                  
      containers: 
      - image: jsunil0101/hello-world:latest # image we pushed
        name: hello-world  
        imagePullPolicy: Always
        ports:
        - name: http
          containerPort: 4004
        resources:
            limits:
              ephemeral-storage: 256M
              memory: 256M
              cpu: 100m
            requests:
              cpu: 100m
              ephemeral-storage: 256M
              memory: 256M
      imagePullSecrets:
      - name: regcred
status: {}

---
apiVersion: v1
kind: Service
metadata:
  name: hello-world 
  labels:
    app: hello-world
spec:
  ports:
  - name: http
    port: 4004
    targetPort: 4004
  selector:
    app: hello-world

---

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

 

 

PunithKumar
Explorer

Week2 Challenge Submission:

https://hello-world-week2.a8a8425.kyma.ondemand.com/greeting/Punith

PunithKumar_0-1658077787951.png

Deployment.yaml file

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

---

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

 

Week 2:

Kanag_0-1658155730164.png

 

 

deployment.yaml

 

apiVersion: apps/v1
kind: Deployment
metadata:
  name: statichtml
  labels:
    app: statichtml
spec:
  replicas: 1
  selector:
    matchLabels:
      app: statichtml
  template:
    metadata:
      labels:
        app: statichtml
    spec:
      containers:
      - name: statichtml
        image: kanagasabapathib021/statichtml:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 80
          name: http
status: {}
      
---
apiVersion: v1
kind: Service
metadata:
  name: statichtml
spec:
  selector:
    app: statichtml
  ports:
  - port: 80
    name: http

---

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

 

 

 

 

YoshiakiToma
Explorer

Hi!

Week 2, I made a development CAP in Kyma:

YoshiakiToma_0-1658200876379.png

apiVersion: apps/v1
kind: Deployment
metadata:
  name: orders
  labels:
    app: orders
spec:
  replicas: 1
  selector:
    matchLabels:
      app: orders
  template:
    metadata:
      labels:
        app: orders
    spec:
      containers:
      - name: orders
        image: yoshiakitoma/cpapp:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 4004
        resources:
            limits:
              ephemeral-storage: 256M
              memory: 256M
              cpu: 100m
            requests:
              cpu: 100m
              ephemeral-storage: 256M
              memory: 256M
      imagePullSecrets:
      - name: regcred
status: {}
      
---
apiVersion: v1
kind: Service
metadata:
  name: orders
spec:
  selector:
    app: orders
  ports:
  - port: 8080
    targetPort: 4004
    protocol: TCP

---

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

LucasPires230
Explorer

Hello!

Here is my week 2 challenge. I made a CAP in Kyma

https://orders.c-410cfea.kyma.ondemand.com/

LucasPires230_0-1658277130095.png

 

 

apiVersion: apps/v1
kind: Deployment
metadata:
  name: orders
  labels:
    app: orders
spec:
  replicas: 1
  selector:
    matchLabels:
      app: orders
  template:
    metadata:
      labels:
        app: orders
    spec:
      containers:
      - name: orders
        image: phantom230/ordersapp:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 4004
        resources:
            limits:
              ephemeral-storage: 256M
              memory: 256M
              cpu: 100m
            requests:
              cpu: 100m
              ephemeral-storage: 256M
              memory: 256M
      imagePullSecrets:
      - name: regcred
status: {}
      
---
apiVersion: v1
kind: Service
metadata:
  name: orders
spec:
  selector:
    app: orders
  ports:
  - port: 8080
    targetPort: 4004
    protocol: TCP

---

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

 

 

Tsuyoushi
Discoverer

Hi!

I finished week 2 using CAP as service for deployment.

https://agendacap-sample.ef5bceb.kyma.ondemand.com/ - URL Service
https://github.com/Tsuyoushi/agendacap-sample-kyma.git - Git Repository

Tsuyoushi_0-1658281299650.png

 

ec1
Active Participant

I'm late to join the fun but this is my week 1 submission

week1.jpg

https://hello-community.c9122d8.kyma.ondemand.com/greeting/Stev

 

AthiraLekshmi
Associate
Associate

AthiraLekshmi
Associate
Associate

Hello

Please find week2 submission here.

https://statichtml.c-08e0512.kyma.ondemand.com/

Screen Shot 2022-07-22 at 2.10.01 PM.png

 

Week 3

Hello all,

I have been looking for the specified buttons for half an hour. Environment: BTP Free Tier with Default idendity provider

Where can I find the item "Go to Applications & Resources Applications and select Create."? (src 1a https://help.sap.com/docs/BTP/65de2977205c403bbc107264b8eccf4b/44bb2d3596554bf4b94ea344e40937dd.html...)

I don't necessarily want to create my own idendity provider.

Thanks a lot

Week:3 

Seems the Cloud Identity service may not available for use in trial. So will have to skip this week challenge , or wait for an alternate approach from community.

Initial Setup | SAP Help Portal

https://iamtenants.accounts.cloud.sap/ will list your the IAS/IPS.

MioYasutake
Active Contributor

Week3

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

I don't have a Free Tier account nor IAS tenant, so I used an XSUAA service instance in my BTP CF environment. Not sure if this is the right thing to do, but it seems to be working.

I refereed to the following blog post.

https://blogs.sap.com/2022/03/03/security-in-kyma-environment-whats-new-for-sap-btp-kyma-runtime/

My access strategy is configured as below.

 

      accessStrategies:
        - handler: jwt
          config:
            jwks_urls:
            - https://9e9ab65etrial.authentication.eu10.hana.ondemand.com/token_keys

 

I have tested with Postman. If you provide authorization header, the API gets authenticated and you'll see the response.

postman1.png

 

SUNIL_JOHN
Explorer

Week 3 . Securing the endpoint , Implemented it using OAuth2.

Updated the API Access Strategy to OAuth2.

suniljohn_2-1658618327836.png

OAuth Token endpoint : https://oauth2.c-415359f.kyma.ondemand.com/oauth2/token

You should get a 401 here ->  https://hello-world.c-415359f.kyma.ondemand.com/say/hello(to='OAuth')

 

suniljohn_3-1658618440244.png

AthiraLekshmi
Associate
Associate

Hello

Please find week 3 submission below.

Used OAuth2 access strategy.

Unauthorized endpoint: https://oauthcheck.c-08e0512.kyma.ondemand.com/

GET call with OAuth token: 

Screen Shot 2022-07-24 at 10.18.01 PM.png

 

 

 

 

noravonthenen
Developer Advocate
Developer Advocate

Thanks Kevin! I've learned so much already and had a lot of fun!

Submission week 2:

Screen Shot 2022-07-25 at 14.52.20.png

apiVersion: v1
kind: Service
metadata:
  name: code-challenge-helloworld
  labels:
    app: code-challenge-helloworld
spec:
  ports:
  - name: http
    port: 3333
  selector:
    app: code-challenge-helloworld

---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: hcode-challenge-elloworld
spec:
  selector:
    matchLabels:
      app: code-challenge-helloworld
  replicas: 1
  template:
    metadata:
      labels:
        app: code-challenge-helloworld
    spec:
      containers:
        - image: noravth/code-challenge-hello-world-python-image
          name: code-challenge-helloworld
          ports:
          - containerPort: 3333

 

 

sainithesh21
Active Participant

Here is my Week 2 Submission.

https://py-flask-kubernetes.c-5ff4ab7.kyma.shoot.live.k8s-hana.ondemand.com/getTime 

sainithesh_0-1658766380477.png

sainithesh_1-1658766860444.png

deployment.yaml

 

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


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

 

Regards,

Sai Nithesh

 

kevin_hu
Active Participant

Week 3

updated deployment.yaml, ideally should be in seperate files, doesn't it.

Create xsuaa service
Create xsuaa service binding
Update API rule

################### UPDATED API RULE ###################
---
apiVersion: gateway.kyma-project.io/v1alpha1
kind: APIRule
metadata:
  name: go-hello
spec:
  gateway: kyma-gateway.kyma-system.svc.cluster.local
  service:
    name: go-hello
    port: 8080
    host: go-hello
  rules:
    - accessStrategies:
        - config:
            jwks_urls:
              - >-
                https://<my-sub-domain>.authentication.eu10.hana.ondemand.com/token_keys
          handler: jwt
      methods:
        - GET
      path: /.*

################### XSUAA ###################
---
apiVersion: services.cloud.sap.com/v1
kind: ServiceInstance
metadata:
  name: xsuaa-oidc
spec:
  serviceOfferingName: xsuaa
  servicePlanName: application

################### XSUAA SERVICE BINDING ###################
---
apiVersion: services.cloud.sap.com/v1
kind: ServiceBinding
metadata:
  name: xsuaa-service-binding
spec:
  serviceInstanceName: xsuaa-oidc
  secretName: xsuaa-service-binding

P,S. Interestingly to see the recent Kyma upgrade made a lot of tutorials a bit out of date. 😀

kevin_hu
Active Participant

For Week 3, in case of using IAS as the openid connect provider, the jwks_urls looks like this
https://<your-ias-tenant>.accounts.ondemand.com/oauth2/certs

Hi!!

Here is my submission for week 3 --> https://rick-and-morty.e51816a.kyma.ondemand.com

¡Happy Coding!

Mattias
Active Participant

Naguco
Explorer

week 1 solutionCaptura de Pantalla 2022-07-27 a las 20.13.53.png

Naguco
Explorer

Week 2 challengeCaptura de Pantalla 2022-07-27 a las 21.22.45.png

apiVersion: apps/v1
kind: Deployment
metadata:
  name: sap-own-service-example
  labels:
    app: sap-own-service-example
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sap-own-service-example
  template:
    metadata:
      labels:
        app: sap-own-service-example
    spec:
      containers:
      - name: sap-own-service-example
        image: docker.io/naguco/sap-own-service-example:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        resources:
            limits:
              ephemeral-storage: 256M
              memory: 256M
              cpu: 100m
            requests:
              cpu: 100m
              ephemeral-storage: 256M
              memory: 256M
      imagePullSecrets:
      - name: regcred
status: {}
      
---
apiVersion: v1
kind: Service
metadata:
  name: sap-own-service-example
spec:
  selector:
    app: sap-own-service-example
  ports:
  - port: 8080
    targetPort: 8080
    protocol: TCP

---

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

 

Hi!!

Here is my submission for week 4 --> https://rick-and-morty.e51816a.kyma.ondemand.com/character/1

The command I used is: "kubectl  -n dev autoscale deployment <name> --cpu-percent=10--min=1 --max=10" --> doc: link

sgonzmot95_0-1658998094841.png  sgonzmot95_1-1658998111726.png

¡Happy Coding!

 

Mattias
Active Participant

Week 4 submission, lets see how the UI5 walkthrough stands up to your load test

https://week4.c-65c082c.kyma.ondemand.com/

Mattias_0-1659032535159.png

 

kadir_ozgur
Explorer

Here is my 2. week submission, a simple user API (only GET Method for now) with github link for the deployment files.

https://github.com/ozgurkadir/go-kyma-user-api.git

Service URL : https://ee.d716b36.kyma.ondemand.com/users

kadir_ozgur_2-1659049233799.png

 

sainithesh21
Active Participant

sainithesh21
Active Participant

Hi..,

Here is my Week 4 submission.

 

URL : https://py-flask-kubernetes.c-5ff4ab7.kyma.shoot.live.k8s-hana.ondemand.com/getTime

sainithesh_1-1659080607757.png

 

 

Regards,

Sai Nithesh

ajmaradiaga
Developer Advocate
Developer Advocate

My week 2 submission:

Deployment file:

apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: default
  name: check-invoice
  annotations:
    sidecar.istio.io/inject: "true"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: check-invoice
  template:
    metadata:
      labels:
        app: check-invoice
        version: v1
    spec:
      containers:
        - name: check-invoice
          image: registry.mycompany.com/check-invoice:0.3
          ports:
            - containerPort: 8080
      imagePullSecrets:
        - name: docker-registry-secret

Calling service

Screenshot 2022-07-29 at 14.40.18.png

ajmaradiaga
Developer Advocate
Developer Advocate

My week 3 submission:

URL: https://mlb-roster.c-1e90315.kyma.ondemand.com

401 error screenshot:

Screenshot 2022-07-29 at 14.43.19.png