kubernetes / kompose

Convert Compose to Kubernetes
http://kompose.io
Apache License 2.0
9.64k stars 763 forks source link

[BUG] build-config incompatible for openshift target #1875

Closed tbugfinder closed 1 month ago

tbugfinder commented 6 months ago

Expected Behavior

setting in buildconfig apiVersion: build.openshift.io/v1

Actual Behavior

setting in buildconfig: apiVersion: v1

Steps To Reproduce

kompose convert -f compose.yaml --provider=openshift --build build-config oc apply -f api-buildconfig.yaml

Kompose Version

1.33.0 (3ce457399)

Docker-Compose file

# Docker Compose file for preview environment and building docker images in pipelines

services:

  # Database service for local development
  database:
    build:
      args:
        NEO4J_IMAGE: ${NEO4J_IMAGE:-neo4j:5.10.0-enterprise}
        PYTHON_IMAGE: ${PYTHON_IMAGE:-python:3.11.3-slim}
        NEO4J_server_memory_heap_initial__size: "2G"
        NEO4J_server_memory_heap_max__size: "2G"
        NEO4J_server_memory_pagecache_size: "1G"
        CDISC_DATA_DIR: ${CDISC_DATA_DIR:-mdr_standards_import/container_booting/}
        NEO4J_MDR_AUTH_PASSWORD: "${NEO4J_PASSWORD:-changeme1234}"
        UID: ${UID:-1000}
      context: ./
      dockerfile: database.Dockerfile
    environment:
      NEO4J_ACCEPT_LICENSE_AGREEMENT: "yes"
      NEO4J_server_memory_heap_initial__size: "2G"
      NEO4J_server_memory_heap_max__size: "2G"
      NEO4J_server_memory_pagecache_size: "1G"
      NEO4J_server_default__listen__address: "0.0.0.0"
      NEO4J_server_default__advertised__address: "localhost"
      NEO4J_server_bolt_advertised__address: "localhost:5002"
      NEO4J_server_http_advertised__address: "localhost:5001"
    ports:
      - "${BIND_ADDRESS:-127.0.0.1}:${NEO4J_BOLT_PORT:-5002}:7687"
      - "${BIND_ADDRESS:-127.0.0.1}:${NEO4J_HTTP_PORT:-5001}:7474"
    volumes:
      - type: volume
        source: data
        target: /data
      # For database dumps, you can mount a folder into the container ex.:
      #- ./neo4j-dumps:/data/dumps

  # API image & service, distinct build stages for production and development
  api:
    build:
      context: ./clinical-mdr-api
      dockerfile: Dockerfile
      args:
        UVICORN_PORT: 5003
        UVICORN_ROOT_PATH: "/api"
        PYTHON_IMAGE: ${PYTHON_IMAGE:-python:3.11.3-slim}
        TARGET: ${BUILD_TARGET:-dev}
    image: ${API_IMAGE:-}
    depends_on:
      database:
        condition: service_healthy
    environment:
      NEO4J_DSN: "${NEO4J_DSN:-bolt://neo4j:changeme1234@database:7687/mdrdb}"
      ALLOW_ORIGIN_REGEX: "${ALLOW_ORIGIN_REGEX:-.*}"
      OAUTH_ENABLED: "${OAUTH_ENABLED:-False}"
      OAUTH_RBAC_ENABLED: "${OAUTH_RBAC_ENABLED:-False}"
      OAUTH_METADATA_URL: "${OAUTH_METADATA_URL:-}"
      OAUTH_API_APP_ID: "${OAUTH_API_APP_ID:-}"
      OAUTH_API_APP_SECRET: "${OAUTH_API_APP_SECRET:-}"
      OAUTH_SWAGGER_APP_ID: "${OAUTH_SWAGGER_APP_ID:-}"
      MS_GRAPH_INTEGRATION_ENABLED: "${MS_GRAPH_INTEGRATION_ENABLED:-}"
      MS_GRAPH_GROUPS_QUERY: "${MS_GRAPH_GROUPS_QUERY:-}"
      # deprecated #
      OAUTH_APP_ID: "${OAUTH_APP_ID:-}"
      OAUTH_APP_SECRET: "${OAUTH_APP_SECRET:-}"
      OAUTH_CLIENT_ID: "${OAUTH_CLIENT_ID:-}"
      OIDC_METADATA_DOCUMENT: "${OIDC_METADATA_DOCUMENT:-}"

  # Frontend image for production (see UI service for local development)
  frontend:
    build:
      args:
        NGINX_IMAGE: ${NGINX_IMAGE:-nginx:alpine}
        NODE_IMAGE: ${NODE_IMAGE:-node:lts-alpine}
      context: ./studybuilder
      dockerfile: Dockerfile
    image: ${FRONTEND_IMAGE:-}
    depends_on:
      # Nginx reverse-proxy configuration requires downstream services to be ready at startup
      api:
        condition: service_healthy
      documentation:
        condition: service_healthy
      neodash:
        condition: service_healthy
    ports:
      - "${BIND_ADDRESS:-127.0.0.1}:${FRONTEND_PORT:-5005}:5005"
    environment:
      API_BASE_URL: "${API_PATH:-}"
      DOC_BASE_URL: "${DOC_PATH:-}"
      NEODASH_BASE_URL: "${NEODASH_PATH:-}"
      OAUTH_ENABLED: "${OAUTH_ENABLED:-false}"
      OAUTH_METADATA_URL: "${OAUTH_METADATA_URL:-}"
      OAUTH_API_APP_ID: "${OAUTH_API_APP_ID:-}"
      OAUTH_UI_APP_ID: "${OAUTH_UI_APP_ID:-}"
      APPINSIGHTS_DISABLE: "true"

  # Documentation portal image for production (see docs service for local development)
  documentation:
    build:
      args:
        NGINX_IMAGE: ${NGINX_IMAGE:-nginx:alpine}
        NODE_IMAGE: ${NODE_IMAGE:-node:lts-alpine3.14}
      context: ./documentation-portal
      dockerfile: Dockerfile
    image: ${DOCUMENTATION_IMAGE:-}

  # Neodash service used with defined parameters
  neodash:
    image: neo4jlabs/neodash:latest
    depends_on:
      database:
        condition: service_healthy
    ports:
      - "${BIND_ADDRESS:-127.0.0.1}:${NEODASH_PORT:-5007}:5007"
    environment:
      - NGINX_PORT=5007
      - ssoEnabled=false
      - ssoDiscoveryUrl=https://localhost.com
      - standalone=true
      - standaloneProtocol=neo4j
      - standaloneHost=localhost
      - standalonePort=5002
      - standaloneDatabase=mdrdb
      - standaloneDashboardName=My dashboard
      - standaloneDashboardDatabase=neo4j
      - standaloneUsername=neo4j
      - standalonePassword=${NEO4J_PASSWORD:-changeme1234}

volumes:
  # Volume for storing the database on a local development environment
  data:
    name: studybuilder_database

Anything else?

Hello, I'm also running into this issue using oc apply. Openshift expects a proper apiVersion.

Steps:

kompose convert -f compose.yaml --provider=openshift --build build-config
grep apiVersion *buildconfig*
api-buildconfig.yaml:apiVersion: v1

oc apply -f api-buildconfig.yaml

error: resource mapping not found for name: "frontend" namespace: "" from "api-buildconfig.yaml": no matches for kind "BuildConfig" in version "v1"
ensure CRDs are installed first

Change apiVersion from v1 to openshift apiVersion: build.openshift.io/v1:

grep apiVersion *buildconfig*
api-buildconfig.yaml:apiVersion: build.openshift.io/v1

oc apply -f api-buildconfig.yaml
buildconfig.build.openshift.io/api created
oc version
Client Version: 4.13.0-202401292134.p0.g7780c37.assembly.stream-7780c37
Kustomize Version: v4.5.7
Kubernetes Version: v1.26.13+77e61a2
k8s-triage-robot commented 3 months ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

tbugfinder commented 3 months ago

/remove-lifecycle stale

k8s-triage-robot commented 2 months ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot commented 1 month ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-ci-robot commented 1 month ago

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to [this](https://github.com/kubernetes/kompose/issues/1875#issuecomment-2411984571): >The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs. > >This bot triages issues according to the following rules: >- After 90d of inactivity, `lifecycle/stale` is applied >- After 30d of inactivity since `lifecycle/stale` was applied, `lifecycle/rotten` is applied >- After 30d of inactivity since `lifecycle/rotten` was applied, the issue is closed > >You can: >- Reopen this issue with `/reopen` >- Mark this issue as fresh with `/remove-lifecycle rotten` >- Offer to help out with [Issue Triage][1] > >Please send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). > >/close not-planned > >[1]: https://www.kubernetes.dev/docs/guide/issue-triage/ Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.