eclipse-jkube / jkube

Build and Deploy java applications on Kubernetes
https://www.eclipse.dev/jkube/
Eclipse Public License 2.0
774 stars 522 forks source link

openshift-maven-plugin ignoring deploymentconfig fragment #603

Open rafaeltuelho opened 3 years ago

rafaeltuelho commented 3 years ago

Description

oc:resource ignore my src/main/jkube/deploymentconfig.yml fragment

Info

I put a deploymentconfig.yml in src/main/jkube:

spec:
  containers:
    - resources: 
        requests:
          memory: "512Mi"
          cpu: "250m"
        limits:
          memory: "2Gi"
          cpu: "500m"
      readinessProbe:
        httpGet:
          path: /rest/server
          port: 8090
          scheme: HTTP
          httpHeaders:
            - name: Authorization
              value: Basic a2llc2VydmVyOmtpZXNlcnZlcjEh
        initialDelaySeconds: 20
        timeoutSeconds: 2
        periodSeconds: 10
        successThreshold: 1
        failureThreshold: 3
      livenessProbe:
        httpGet:
          path: /
          port: 8090
          scheme: HTTP

The generated dc does not contain my fragment.

manusa commented 3 years ago

Hi, I tried to reproduce your issue. This is the content of the fragment as of now in the repo:

spec:
  replicas: 2
  template:
    spec:
      containers:
        - resources: 
            requests:
              memory: "1Gi"
              cpu: "1000m"
            limits:
              memory: "2Gi"
              cpu: "2000m"
          readinessProbe:
            httpGet:
              path: /rest/server
              port: 8090
              scheme: HTTP
              httpHeaders:
                - name: Authorization
                  value: Basic a2llc2VydmVyOmtpZXNlcnZlcjEh
            initialDelaySeconds: 30
            timeoutSeconds: 3
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 5
          livenessProbe:
            httpGet:
              path: /
              port: 8090
              scheme: HTTP

This is what the generated DeploymentConfig looks like for me:

---
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
  annotations:
    app.openshift.io/vcs-ref: master
    jkube.io/git-url: git@github.com:rafaeltuelho/my-business-automation-showcase.git
    app.openshift.io/vcs-uri: git@github.com:rafaeltuelho/my-business-automation-showcase.git
    jkube.io/git-commit: e2766421b7ad26f2c16d3c353c9a38eb98f6c593
    jkube.io/git-branch: master
    jkube.io/scm-url: https://github.com/spring-projects/spring-boot/spring-boot-starter-parent/business-application-service
    jkube.io/scm-tag: HEAD
  labels:
    app: business-application-service
    provider: jkube
    version: 1.0-SNAPSHOT
    group: com.redhat.demos
  name: business-application-service
spec:
  replicas: 2
  revisionHistoryLimit: 2
  selector:
    app: business-application-service
    provider: jkube
    group: com.redhat.demos
  template:
    metadata:
      annotations:
        app.openshift.io/vcs-ref: master
        jkube.io/git-branch: master
        jkube.io/scm-url: https://github.com/spring-projects/spring-boot/spring-boot-starter-parent/business-application-service
        jkube.io/git-url: git@github.com:rafaeltuelho/my-business-automation-showcase.git
        app.openshift.io/vcs-uri: git@github.com:rafaeltuelho/my-business-automation-showcase.git
        jkube.io/scm-tag: HEAD
        jkube.io/git-commit: e2766421b7ad26f2c16d3c353c9a38eb98f6c593
      labels:
        app: business-application-service
        provider: jkube
        version: 1.0-SNAPSHOT
        group: com.redhat.demos
    spec:
      containers:
      - env:
        - name: KUBERNETES_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        image: business-application-service:latest
        imagePullPolicy: IfNotPresent
        livenessProbe:
          httpGet:
            path: /
            port: 8090
            scheme: HTTP
        name: comredhatdemos-business-application-service
        ports:
        - containerPort: 8090
          protocol: TCP
        readinessProbe:
          failureThreshold: 5
          httpGet:
            httpHeaders:
            - name: Authorization
              value: Basic a2llc2VydmVyOmtpZXNlcnZlcjEh
            path: /rest/server
            port: 8090
            scheme: HTTP
          initialDelaySeconds: 30
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 3
        resources:
          limits:
            memory: 2Gi
            cpu: 2000m
          requests:
            memory: 1Gi
            cpu: 1000m
        securityContext:
          privileged: false
  triggers:
  - imageChangeParams:
      automatic: true
      containerNames:
      - comredhatdemos-business-application-service
      from:
        kind: ImageStreamTag
        name: business-application-service:latest
    type: ImageChange

So, unless I missed something, I'm unable to reproduce.

rafaeltuelho commented 3 years ago

Hi @manusa ! Yeah, I just realized that my DC spec needs to be defined under template/spec node.

spec:
  template:
    spec:
      containers:

Maybe it worth highlighting this in the docs or provide a sample of an Openshift DC.

manusa commented 3 years ago

We have an external-resources quickstart.

Would you like to contribute a similar external-resources-openshift quickstart which provides OpenShift specific resource fragments?