RP tool generated configs, migration from statefulsets


#1

If you happen to have production ready kubernetes configs with kafka/cassandra endpoints, vars defined, please share. Very appreciated, thanks!


(Alan Klikic) #2

deployment and service:

---
apiVersion: "apps/v1beta2"
kind: Deployment
metadata:
  name: "organization-service-v3-0-0-snapshot"
  labels:
    appName: "organization-service"
    appNameVersion: "organization-service-v3-0-0-snapshot"
  namespace: test
spec:
  replicas: 2
  selector:
    matchLabels:
      appNameVersion: "organization-service-v3-0-0-snapshot"
  template:
    metadata:
      labels:
        appName: "organization-service"
        appNameVersion: "organization-service-v3-0-0-snapshot"
    spec:
      restartPolicy: Always
      containers:
        - name: "organization-service"
          image: "564786938889.dkr.ecr.eu-west-1.amazonaws.com/organization_impl:3.0.0-SNAPSHOT"
          imagePullPolicy: IfNotPresent
          env:
            - name: "JAVA_OPTS"
              value: "-Dplay.http.secret.key=changeme -Dconfig.resource=production.conf -Dlogger.resource=logback-prod.xml -Xms128M -Xmx256M"
            - name: "RP_APP_NAME"
              value: "organization_service"
            - name: "RP_APP_TYPE"
              value: lagom
            - name: "RP_APP_VERSION"
              value: "3.0.0-SNAPSHOT"
            - name: "RP_DYN_JAVA_OPTS"
              value: "-Dakka.discovery.kubernetes-api.pod-namespace=$RP_NAMESPACE"
            - name: "RP_ENDPOINTS"
              value: "HTTP,AKKA_REMOTE,AKKA_MGMT_HTTP"
            - name: "RP_ENDPOINTS_COUNT"
              value: "3"
            - name: "RP_ENDPOINT_0_BIND_HOST"
              valueFrom:
                fieldRef:
                  fieldPath: "status.podIP"
            - name: "RP_ENDPOINT_0_BIND_PORT"
              value: "10000"
            - name: "RP_ENDPOINT_0_HOST"
              valueFrom:
                fieldRef:
                  fieldPath: "status.podIP"
            - name: "RP_ENDPOINT_0_PORT"
              value: "10000"
            - name: "RP_ENDPOINT_1_BIND_HOST"
              valueFrom:
                fieldRef:
                  fieldPath: "status.podIP"
            - name: "RP_ENDPOINT_1_BIND_PORT"
              value: "10001"
            - name: "RP_ENDPOINT_1_HOST"
              valueFrom:
                fieldRef:
                  fieldPath: "status.podIP"
            - name: "RP_ENDPOINT_1_PORT"
              value: "10001"
            - name: "RP_ENDPOINT_2_BIND_HOST"
              valueFrom:
                fieldRef:
                  fieldPath: "status.podIP"
            - name: "RP_ENDPOINT_2_BIND_PORT"
              value: "10002"
            - name: "RP_ENDPOINT_2_HOST"
              valueFrom:
                fieldRef:
                  fieldPath: "status.podIP"
            - name: "RP_ENDPOINT_2_PORT"
              value: "10002"
            - name: "RP_ENDPOINT_AKKA_MGMT_HTTP_BIND_HOST"
              valueFrom:
                fieldRef:
                  fieldPath: "status.podIP"
            - name: "RP_ENDPOINT_AKKA_MGMT_HTTP_BIND_PORT"
              value: "10002"
            - name: "RP_ENDPOINT_AKKA_MGMT_HTTP_HOST"
              valueFrom:
                fieldRef:
                  fieldPath: "status.podIP"
            - name: "RP_ENDPOINT_AKKA_MGMT_HTTP_PORT"
              value: "10002"
            - name: "RP_ENDPOINT_AKKA_REMOTE_BIND_HOST"
              valueFrom:
                fieldRef:
                  fieldPath: "status.podIP"
            - name: "RP_ENDPOINT_AKKA_REMOTE_BIND_PORT"
              value: "10001"
            - name: "RP_ENDPOINT_AKKA_REMOTE_HOST"
              valueFrom:
                fieldRef:
                  fieldPath: "status.podIP"
            - name: "RP_ENDPOINT_AKKA_REMOTE_PORT"
              value: "10001"
            - name: "RP_ENDPOINT_HTTP_BIND_HOST"
              valueFrom:
                fieldRef:
                  fieldPath: "status.podIP"
            - name: "RP_ENDPOINT_HTTP_BIND_PORT"
              value: "10000"
            - name: "RP_ENDPOINT_HTTP_HOST"
              valueFrom:
                fieldRef:
                  fieldPath: "status.podIP"
            - name: "RP_ENDPOINT_HTTP_PORT"
              value: "10000"
            - name: "RP_JAVA_OPTS"
              value: "-Dconfig.resource=rp-application.conf -Dakka.discovery.method=kubernetes-api -Dakka.management.cluster.bootstrap.contact-point-discovery.effective-name=organization-service -Dakka.management.cluster.bootstrap.contact-point-discovery.required-contact-point-nr=2 -Dakka.discovery.kubernetes-api.pod-label-selector=appName=%s -Dcom.lightbend.platform-tooling.service-discovery.external-service-addresses.cas_native.0=_cql._tcp.cassandra.test.svc.cluster.local -Dcom.lightbend.platform-tooling.service-discovery.external-service-addresses.kafka_native.0=_broker._tcp.kafka.test.svc.cluster.local -Dcom.lightbend.platform-tooling.service-discovery.external-service-addresses.elastic-search.0=_http._tcp.elasticsearch.test.svc.cluster.local"
            - name: "RP_KUBERNETES_POD_IP"
              valueFrom:
                fieldRef:
                  fieldPath: "status.podIP"
            - name: "RP_KUBERNETES_POD_NAME"
              valueFrom:
                fieldRef:
                  fieldPath: "metadata.name"
            - name: "RP_MODULES"
              value: "akka-cluster-bootstrapping,akka-management,common,play-http-binding,service-discovery,status"
            - name: "RP_NAMESPACE"
              valueFrom:
                fieldRef:
                  fieldPath: "metadata.namespace"
            - name: "RP_PLATFORM"
              value: kubernetes
          ports:
            - containerPort: 10000
              name: http
            - containerPort: 10001
              name: "akka-remote"
            - containerPort: 10002
              name: "akka-mgmt-http"
          volumeMounts: []
          command:
            - "/rp-start"
          args:
            - "bin/organization_impl"
          readinessProbe:
            httpGet:
              path: "/platform-tooling/ready"
              port: "akka-mgmt-http"
            periodSeconds: 10
          livenessProbe:
            httpGet:
              path: "/platform-tooling/healthy"
              port: "akka-mgmt-http"
            periodSeconds: 10
            initialDelaySeconds: 60
          resources:
            limits:
              cpu: 0.500000
              memory: 134217728
            requests:
              cpu: 0.500000
              memory: 134217728
      volumes: []
---
apiVersion: v1
kind: Service
metadata:
  labels:
    appName: "organization-service"
  name: "organization-service"
  namespace: test
spec:
  ports:
    - name: http
      port: 10000
      protocol: TCP
      targetPort: 10000
    - name: "akka-remote"
      port: 10001
      protocol: TCP
      targetPort: 10001
    - name: "akka-mgmt-http"
      port: 10002
      protocol: TCP
      targetPort: 10002
  selector:
    appName: "organization-service"

ingress:

---
apiVersion: "extensions/v1beta1"
kind: Ingress
metadata:
  name: "organization-impl"
  namespace: test
spec:
  rules:
    - http:
        paths:
          - path: "/api/organizations"
            backend:
              serviceName: "organization-service"
              servicePort: 10000