Skip to content

[public-api-server] Add k8s deployment into installer #9258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2022

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented Apr 12, 2022

Description

Generates a deployment config for k8s, including rolebinding and service account:

With experimental config
experimental:
  webapp:
    publicApi:
      enabled: true

generates

# apps/v1/Deployment public-api-server
apiVersion: apps/v1
kind: Deployment
metadata:
  creationTimestamp: null
  labels:
    app: gitpod
    component: public-api-server
  name: public-api-server
  namespace: default
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gitpod
      component: public-api-server
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
    type: RollingUpdate
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: gitpod
        component: public-api-server
      name: public-api-server
      namespace: default
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: gitpod.io/workload_meta
                operator: Exists
      containers:
      - env:
        - name: GITPOD_DOMAIN
          value: dev.gitpod.io
        - name: GITPOD_INSTALLATION_LONGNAME
          value: dev.gitpod.io
        - name: GITPOD_INSTALLATION_SHORTNAME
          value: dev.gitpod.io
        - name: GITPOD_REGION
          value: local
        - name: HOST_URL
          value: https://dev.gitpod.io
        - name: KUBE_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: KUBE_DOMAIN
          value: svc.cluster.local
        - name: LOG_LEVEL
          value: info
        image: eu.gcr.io/gitpod-core-dev/build/public-api-server:commit-01b3dc2371dea9f079043566c6f296d19d30c1c0
        imagePullPolicy: IfNotPresent
        name: public-api-server
        ports:
        - containerPort: 9000
          name: http
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /
            port: 9000
            scheme: HTTP
          successThreshold: 1
          timeoutSeconds: 1
        resources:
          requests:
            cpu: 100m
            memory: 32Mi
        securityContext:
          privileged: false
      dnsPolicy: ClusterFirst
      enableServiceLinks: false
      restartPolicy: Always
      serviceAccountName: public-api-server
      terminationGracePeriodSeconds: 30
status: {}

Without experimental config, no public-api-server is rendered

Related Issue(s)

Depends on #9252
Part of #9229

How to test

 go run main.go render --config "./installer.conf.yaml" --use-experimental-config --debug-version-file versions.yaml > rendered.yaml

Inspect rendered.yaml it contains the config.

Release Notes

NONE

Documentation

/uncc
/hold

 Please enter the commit message for your changes. Lines starting
@easyCZ easyCZ force-pushed the mp/papi-installer-deployment branch from 642b33d to 1854bac Compare April 13, 2022 08:43
"k8s.io/apimachinery/pkg/runtime"
)

func rolebinding(ctx *common.RenderContext) ([]runtime.Object, error) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Largely a mirror of dashboard config.

@@ -26,5 +33,68 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
publicAPIConfig := experimentalCfg.WebApp.PublicAPI
log.Debug("Detected experimental.WebApp.PublicApi configuration", publicAPIConfig)

return nil, nil
labels := common.DefaultLabels(Component)
return []runtime.Object{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mirror of dashboard deployment config

@easyCZ
Copy link
Member Author

easyCZ commented Apr 13, 2022

/unhold

@roboquat roboquat merged commit a75b4cf into main Apr 13, 2022
@roboquat roboquat deleted the mp/papi-installer-deployment branch April 13, 2022 11:29
@roboquat roboquat added deployed: webapp Meta team change is running in production deployed Change is completely running in production labels Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production deployed Change is completely running in production release-note-none size/L team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants