Add ephemeral and persistent yaml files.
| ... | ... |
@@ -3,8 +3,9 @@ |
| 3 | 3 |
# |
| 4 | 4 |
# The standard name for this image is openshift/origin-gitserver |
| 5 | 5 |
# |
| 6 |
-FROM openshift/origin |
|
| 6 |
+FROM openshift/origin-base |
|
| 7 | 7 |
|
| 8 |
+COPY bin/oc /usr/bin/oc |
|
| 8 | 9 |
COPY bin/gitserver /usr/bin/gitserver |
| 9 | 10 |
COPY hooks/ /var/lib/git-hooks/ |
| 10 | 11 |
COPY gitconfig /var/lib/gitconfig/.gitconfig |
| ... | ... |
@@ -14,6 +14,9 @@ repository's source. |
| 14 | 14 |
|
| 15 | 15 |
The Dockerfile built by this example is published as openshift/origin-gitserver |
| 16 | 16 |
|
| 17 |
+Persistent and ephemeral templates are provided. For OpenShift Online you need to use |
|
| 18 |
+the persistent one. |
|
| 19 |
+ |
|
| 17 | 20 |
Quick Start |
| 18 | 21 |
----------- |
| 19 | 22 |
|
| ... | ... |
@@ -21,7 +24,7 @@ Prerequisites: |
| 21 | 21 |
|
| 22 | 22 |
* You have an OpenShift v3 server running |
| 23 | 23 |
* You are logged in and have access to a project |
| 24 |
-* You have the `gitserver.yaml` from this directory |
|
| 24 |
+* You have the `gitserver-ephemeral.yaml` or `gitserver-persistent.yaml` from this directory |
|
| 25 | 25 |
* You can create externally accessible routes on your server |
| 26 | 26 |
|
| 27 | 27 |
### Deploy the Git Server |
| ... | ... |
@@ -29,7 +32,13 @@ Prerequisites: |
| 29 | 29 |
1. Create the Git Server |
| 30 | 30 |
|
| 31 | 31 |
```sh |
| 32 |
- $ oc create -f gitserver.yaml |
|
| 32 |
+ $ oc create -f gitserver-ephemeral.yaml |
|
| 33 |
+ ``` |
|
| 34 |
+ |
|
| 35 |
+ OR |
|
| 36 |
+ |
|
| 37 |
+ ```sh |
|
| 38 |
+ $ oc create -f gitserver-persistent.yaml |
|
| 33 | 39 |
``` |
| 34 | 40 |
|
| 35 | 41 |
2. Grant `edit` access to the `git` service account |
| 36 | 42 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,198 @@ |
| 0 |
+apiVersion: v1 |
|
| 1 |
+kind: List |
|
| 2 |
+items: |
|
| 3 |
+ |
|
| 4 |
+# The git server is deployed as a singleton pod and uses a very small amount |
|
| 5 |
+# of resources. It can host or transiently serve Git repositories, as well |
|
| 6 |
+# as automatically integrate with builds in a namespace. |
|
| 7 |
+- apiVersion: v1 |
|
| 8 |
+ kind: DeploymentConfig |
|
| 9 |
+ metadata: |
|
| 10 |
+ name: git |
|
| 11 |
+ labels: |
|
| 12 |
+ app: git |
|
| 13 |
+ spec: |
|
| 14 |
+ replicas: 1 # the git server is not HA and should not be scaled past 1 |
|
| 15 |
+ selector: |
|
| 16 |
+ run-container: git |
|
| 17 |
+ template: |
|
| 18 |
+ metadata: |
|
| 19 |
+ labels: |
|
| 20 |
+ run-container: git |
|
| 21 |
+ spec: |
|
| 22 |
+ serviceAccountName: git |
|
| 23 |
+ containers: |
|
| 24 |
+ - name: git |
|
| 25 |
+ image: openshift/origin-gitserver:latest |
|
| 26 |
+ ports: |
|
| 27 |
+ - containerPort: 8080 |
|
| 28 |
+ readinessProbe: |
|
| 29 |
+ httpGet: |
|
| 30 |
+ path: /_/healthz |
|
| 31 |
+ port: 8080 |
|
| 32 |
+ |
|
| 33 |
+ env: |
|
| 34 |
+ # Each environment variable matching GIT_INITIAL_CLONE_* will |
|
| 35 |
+ # be cloned when the process starts; failures will be logged. |
|
| 36 |
+ # <name> must be [A-Z0-9_\-\.], the cloned directory name will |
|
| 37 |
+ # be lowercased. If the name is invalid the pod will halt. If |
|
| 38 |
+ # the repository already exists on disk, it will be updated |
|
| 39 |
+ # from the remote. |
|
| 40 |
+ # |
|
| 41 |
+ #- name: GIT_INITIAL_CLONE_1 |
|
| 42 |
+ # value: <url>[;<name>] |
|
| 43 |
+ |
|
| 44 |
+ |
|
| 45 |
+ # The namespace of the pod is required for implicit config |
|
| 46 |
+ # (passing '-' to AUTOLINK_KUBECONFIG or REQUIRE_SERVER_AUTH) |
|
| 47 |
+ # and can also be used to target a specific namespace. |
|
| 48 |
+ - name: POD_NAMESPACE |
|
| 49 |
+ valueFrom: |
|
| 50 |
+ fieldRef: |
|
| 51 |
+ fieldPath: metadata.namespace |
|
| 52 |
+ |
|
| 53 |
+ # The URL that builds must use to access the Git repositories |
|
| 54 |
+ # stored in this app. |
|
| 55 |
+ # TOOD: support HTTPS |
|
| 56 |
+ - name: PUBLIC_URL |
|
| 57 |
+ value: http://git.$(POD_NAMESPACE).svc.cluster.local:8080 |
|
| 58 |
+ # If INTERNAL_URL is specified, then it's used to point |
|
| 59 |
+ # BuildConfigs to the internal service address of the git |
|
| 60 |
+ # server |
|
| 61 |
+ - name: INTERNAL_URL |
|
| 62 |
+ value: http://git:8080 |
|
| 63 |
+ |
|
| 64 |
+ # The directory to store Git repositories in. If not backed |
|
| 65 |
+ # by a persistent volume, repositories will be lost when |
|
| 66 |
+ # deployments occur. Use INITIAL_GIT_CLONE and AUTOLINK_* |
|
| 67 |
+ # to remove the need to use a persistent volume. |
|
| 68 |
+ - name: GIT_HOME |
|
| 69 |
+ value: /var/lib/git |
|
| 70 |
+ |
|
| 71 |
+ # The directory to use as the default hook directory for any |
|
| 72 |
+ # cloned or autolinked directories. |
|
| 73 |
+ - name: HOOK_PATH |
|
| 74 |
+ value: /var/lib/git-hooks |
|
| 75 |
+ |
|
| 76 |
+ # If 'true' new-app will be invoked on push for repositories |
|
| 77 |
+ # for which a matching BuildConfig is not found. |
|
| 78 |
+ - name: GENERATE_ARTIFACTS |
|
| 79 |
+ value: "true" |
|
| 80 |
+ |
|
| 81 |
+ # The script to use for custom language detection on a |
|
| 82 |
+ # repository. See hooks/detect-language for an example. |
|
| 83 |
+ # To use new-app's default detection, leave this variable |
|
| 84 |
+ # blank. |
|
| 85 |
+ - name: DETECTION_SCRIPT |
|
| 86 |
+ # value: detect-language |
|
| 87 |
+ |
|
| 88 |
+ # Authentication and authorization |
|
| 89 |
+ |
|
| 90 |
+ # If 'true', clients may push to the server with git push. |
|
| 91 |
+ - name: ALLOW_GIT_PUSH |
|
| 92 |
+ value: "true" |
|
| 93 |
+ # If 'true', clients may set hooks via the API. However, unless |
|
| 94 |
+ # the Git home is backed by a persistent volume, any deployment |
|
| 95 |
+ # will result in the hooks being lost. |
|
| 96 |
+ - name: ALLOW_GIT_HOOKS |
|
| 97 |
+ value: "true" |
|
| 98 |
+ # If 'true', clients can create new git repositories on demand |
|
| 99 |
+ # by pushing. If the data on disk is not backed by a persistent |
|
| 100 |
+ # volume, the Git repo will be deleted if the deployment is |
|
| 101 |
+ # updated. |
|
| 102 |
+ - name: ALLOW_LAZY_CREATE |
|
| 103 |
+ value: "true" |
|
| 104 |
+ # If 'true', clients can pull without being authenticated. |
|
| 105 |
+ - name: ALLOW_ANON_GIT_PULL |
|
| 106 |
+ value: "true" |
|
| 107 |
+ |
|
| 108 |
+ # Provides the path to a kubeconfig file in the image that |
|
| 109 |
+ # should be used to authorize against the server. The value |
|
| 110 |
+ # '-' will use the pod's service account. |
|
| 111 |
+ # May not be used in combination with REQUIRE_GIT_AUTH |
|
| 112 |
+ - name: REQUIRE_SERVER_AUTH |
|
| 113 |
+ value: "-" |
|
| 114 |
+ # The namespace to check authorization against when |
|
| 115 |
+ # REQUIRE_SERVICE_AUTH is used. Users must have 'get' on |
|
| 116 |
+ # 'pods' to pull and 'create' on 'pods' to push. |
|
| 117 |
+ - name: AUTH_NAMESPACE |
|
| 118 |
+ value: $(POD_NAMESPACE) |
|
| 119 |
+ # Require BASIC authentication with a username and password |
|
| 120 |
+ # to push or pull. |
|
| 121 |
+ # May not be used in combination with REQUIRE_SERVER_AUTH |
|
| 122 |
+ - name: REQUIRE_GIT_AUTH |
|
| 123 |
+ # value: <username>:<password> |
|
| 124 |
+ |
|
| 125 |
+ # Autolinking: |
|
| 126 |
+ # |
|
| 127 |
+ # The git server can automatically clone Git repositories |
|
| 128 |
+ # associated with a build config and replace the URL with |
|
| 129 |
+ # a link to the repo on PUBLIC_URL. The default post-receive |
|
| 130 |
+ # hook on the cloned repo will then trigger a build. You |
|
| 131 |
+ # may customize the hook with AUTOLINK_HOOK (path to hook). |
|
| 132 |
+ # To autolink, the account the pod runs under must have 'edit' |
|
| 133 |
+ # on the AUTOLINK_NAMESPACE: |
|
| 134 |
+ # |
|
| 135 |
+ # oc policy add-role-to-user -z git edit |
|
| 136 |
+ # |
|
| 137 |
+ # Links are checked every time the pod starts. |
|
| 138 |
+ |
|
| 139 |
+ # The location to read auth configuration from for autolinking. |
|
| 140 |
+ # If '-', use the service account token to link. The account |
|
| 141 |
+ # represented by this config must have the edit role on the |
|
| 142 |
+ # namespace. |
|
| 143 |
+ - name: AUTOLINK_KUBECONFIG |
|
| 144 |
+ value: "-" |
|
| 145 |
+ |
|
| 146 |
+ # The namespace to autolink |
|
| 147 |
+ - name: AUTOLINK_NAMESPACE |
|
| 148 |
+ value: $(POD_NAMESPACE) |
|
| 149 |
+ |
|
| 150 |
+ # The path to a script in the image to use as the default |
|
| 151 |
+ # post-receive hook - only set during link, so has no effect |
|
| 152 |
+ # on cloned repositories. See the "hooks" directory in the |
|
| 153 |
+ # image for examples. |
|
| 154 |
+ - name: AUTOLINK_HOOK |
|
| 155 |
+ |
|
| 156 |
+ volumeMounts: |
|
| 157 |
+ - mountPath: /var/lib/git/ |
|
| 158 |
+ name: git |
|
| 159 |
+ volumes: |
|
| 160 |
+ - name: git |
|
| 161 |
+ emptyDir: {}
|
|
| 162 |
+ triggers: |
|
| 163 |
+ - type: ConfigChange |
|
| 164 |
+ |
|
| 165 |
+# The git server service is required for DNS resolution |
|
| 166 |
+- apiVersion: v1 |
|
| 167 |
+ kind: Service |
|
| 168 |
+ metadata: |
|
| 169 |
+ name: git |
|
| 170 |
+ labels: |
|
| 171 |
+ app: git |
|
| 172 |
+ spec: |
|
| 173 |
+ ports: |
|
| 174 |
+ - port: 8080 |
|
| 175 |
+ targetPort: 8080 |
|
| 176 |
+ selector: |
|
| 177 |
+ run-container: git |
|
| 178 |
+ |
|
| 179 |
+# The service account for the git server must be granted the view role to |
|
| 180 |
+# automatically start builds, edit role to create objects and autolink |
|
| 181 |
+- apiVersion: v1 |
|
| 182 |
+ kind: ServiceAccount |
|
| 183 |
+ metadata: |
|
| 184 |
+ name: git |
|
| 185 |
+ labels: |
|
| 186 |
+ app: git |
|
| 187 |
+ |
|
| 188 |
+# Default route for git service |
|
| 189 |
+- apiVersion: v1 |
|
| 190 |
+ kind: Route |
|
| 191 |
+ metadata: |
|
| 192 |
+ labels: |
|
| 193 |
+ app: git |
|
| 194 |
+ name: git |
|
| 195 |
+ spec: |
|
| 196 |
+ to: |
|
| 197 |
+ name: git |
| 0 | 198 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,211 @@ |
| 0 |
+apiVersion: v1 |
|
| 1 |
+kind: List |
|
| 2 |
+items: |
|
| 3 |
+ |
|
| 4 |
+# The git server is deployed as a singleton pod and uses a very small amount |
|
| 5 |
+# of resources. It can host or transiently serve Git repositories, as well |
|
| 6 |
+# as automatically integrate with builds in a namespace. |
|
| 7 |
+- apiVersion: v1 |
|
| 8 |
+ kind: DeploymentConfig |
|
| 9 |
+ metadata: |
|
| 10 |
+ name: git |
|
| 11 |
+ labels: |
|
| 12 |
+ app: git |
|
| 13 |
+ spec: |
|
| 14 |
+ replicas: 1 # the git server is not HA and should not be scaled past 1 |
|
| 15 |
+ selector: |
|
| 16 |
+ run-container: git |
|
| 17 |
+ template: |
|
| 18 |
+ metadata: |
|
| 19 |
+ labels: |
|
| 20 |
+ run-container: git |
|
| 21 |
+ spec: |
|
| 22 |
+ serviceAccountName: git |
|
| 23 |
+ containers: |
|
| 24 |
+ - name: git |
|
| 25 |
+ image: openshift/origin-gitserver:latest |
|
| 26 |
+ ports: |
|
| 27 |
+ - containerPort: 8080 |
|
| 28 |
+ readinessProbe: |
|
| 29 |
+ httpGet: |
|
| 30 |
+ path: /_/healthz |
|
| 31 |
+ port: 8080 |
|
| 32 |
+ |
|
| 33 |
+ env: |
|
| 34 |
+ # Each environment variable matching GIT_INITIAL_CLONE_* will |
|
| 35 |
+ # be cloned when the process starts; failures will be logged. |
|
| 36 |
+ # <name> must be [A-Z0-9_\-\.], the cloned directory name will |
|
| 37 |
+ # be lowercased. If the name is invalid the pod will halt. If |
|
| 38 |
+ # the repository already exists on disk, it will be updated |
|
| 39 |
+ # from the remote. |
|
| 40 |
+ # |
|
| 41 |
+ #- name: GIT_INITIAL_CLONE_1 |
|
| 42 |
+ # value: <url>[;<name>] |
|
| 43 |
+ |
|
| 44 |
+ |
|
| 45 |
+ # The namespace of the pod is required for implicit config |
|
| 46 |
+ # (passing '-' to AUTOLINK_KUBECONFIG or REQUIRE_SERVER_AUTH) |
|
| 47 |
+ # and can also be used to target a specific namespace. |
|
| 48 |
+ - name: POD_NAMESPACE |
|
| 49 |
+ valueFrom: |
|
| 50 |
+ fieldRef: |
|
| 51 |
+ fieldPath: metadata.namespace |
|
| 52 |
+ |
|
| 53 |
+ # The URL that builds must use to access the Git repositories |
|
| 54 |
+ # stored in this app. |
|
| 55 |
+ # TOOD: support HTTPS |
|
| 56 |
+ - name: PUBLIC_URL |
|
| 57 |
+ value: http://git.$(POD_NAMESPACE).svc.cluster.local:8080 |
|
| 58 |
+ # If INTERNAL_URL is specified, then it's used to point |
|
| 59 |
+ # BuildConfigs to the internal service address of the git |
|
| 60 |
+ # server |
|
| 61 |
+ - name: INTERNAL_URL |
|
| 62 |
+ value: http://git:8080 |
|
| 63 |
+ |
|
| 64 |
+ # The directory to store Git repositories in. If not backed |
|
| 65 |
+ # by a persistent volume, repositories will be lost when |
|
| 66 |
+ # deployments occur. Use INITIAL_GIT_CLONE and AUTOLINK_* |
|
| 67 |
+ # to remove the need to use a persistent volume. |
|
| 68 |
+ - name: GIT_HOME |
|
| 69 |
+ value: /var/lib/git |
|
| 70 |
+ |
|
| 71 |
+ # The directory to use as the default hook directory for any |
|
| 72 |
+ # cloned or autolinked directories. |
|
| 73 |
+ - name: HOOK_PATH |
|
| 74 |
+ value: /var/lib/git-hooks |
|
| 75 |
+ |
|
| 76 |
+ # If 'true' new-app will be invoked on push for repositories |
|
| 77 |
+ # for which a matching BuildConfig is not found. |
|
| 78 |
+ - name: GENERATE_ARTIFACTS |
|
| 79 |
+ value: "true" |
|
| 80 |
+ |
|
| 81 |
+ # The script to use for custom language detection on a |
|
| 82 |
+ # repository. See hooks/detect-language for an example. |
|
| 83 |
+ # To use new-app's default detection, leave this variable |
|
| 84 |
+ # blank. |
|
| 85 |
+ - name: DETECTION_SCRIPT |
|
| 86 |
+ # value: detect-language |
|
| 87 |
+ |
|
| 88 |
+ # Authentication and authorization |
|
| 89 |
+ |
|
| 90 |
+ # If 'true', clients may push to the server with git push. |
|
| 91 |
+ - name: ALLOW_GIT_PUSH |
|
| 92 |
+ value: "true" |
|
| 93 |
+ # If 'true', clients may set hooks via the API. However, unless |
|
| 94 |
+ # the Git home is backed by a persistent volume, any deployment |
|
| 95 |
+ # will result in the hooks being lost. |
|
| 96 |
+ - name: ALLOW_GIT_HOOKS |
|
| 97 |
+ value: "true" |
|
| 98 |
+ # If 'true', clients can create new git repositories on demand |
|
| 99 |
+ # by pushing. If the data on disk is not backed by a persistent |
|
| 100 |
+ # volume, the Git repo will be deleted if the deployment is |
|
| 101 |
+ # updated. |
|
| 102 |
+ - name: ALLOW_LAZY_CREATE |
|
| 103 |
+ value: "true" |
|
| 104 |
+ # If 'true', clients can pull without being authenticated. |
|
| 105 |
+ - name: ALLOW_ANON_GIT_PULL |
|
| 106 |
+ value: "true" |
|
| 107 |
+ |
|
| 108 |
+ # Provides the path to a kubeconfig file in the image that |
|
| 109 |
+ # should be used to authorize against the server. The value |
|
| 110 |
+ # '-' will use the pod's service account. |
|
| 111 |
+ # May not be used in combination with REQUIRE_GIT_AUTH |
|
| 112 |
+ - name: REQUIRE_SERVER_AUTH |
|
| 113 |
+ value: "-" |
|
| 114 |
+ # The namespace to check authorization against when |
|
| 115 |
+ # REQUIRE_SERVICE_AUTH is used. Users must have 'get' on |
|
| 116 |
+ # 'pods' to pull and 'create' on 'pods' to push. |
|
| 117 |
+ - name: AUTH_NAMESPACE |
|
| 118 |
+ value: $(POD_NAMESPACE) |
|
| 119 |
+ # Require BASIC authentication with a username and password |
|
| 120 |
+ # to push or pull. |
|
| 121 |
+ # May not be used in combination with REQUIRE_SERVER_AUTH |
|
| 122 |
+ - name: REQUIRE_GIT_AUTH |
|
| 123 |
+ # value: <username>:<password> |
|
| 124 |
+ |
|
| 125 |
+ # Autolinking: |
|
| 126 |
+ # |
|
| 127 |
+ # The git server can automatically clone Git repositories |
|
| 128 |
+ # associated with a build config and replace the URL with |
|
| 129 |
+ # a link to the repo on PUBLIC_URL. The default post-receive |
|
| 130 |
+ # hook on the cloned repo will then trigger a build. You |
|
| 131 |
+ # may customize the hook with AUTOLINK_HOOK (path to hook). |
|
| 132 |
+ # To autolink, the account the pod runs under must have 'edit' |
|
| 133 |
+ # on the AUTOLINK_NAMESPACE: |
|
| 134 |
+ # |
|
| 135 |
+ # oc policy add-role-to-user -z git edit |
|
| 136 |
+ # |
|
| 137 |
+ # Links are checked every time the pod starts. |
|
| 138 |
+ |
|
| 139 |
+ # The location to read auth configuration from for autolinking. |
|
| 140 |
+ # If '-', use the service account token to link. The account |
|
| 141 |
+ # represented by this config must have the edit role on the |
|
| 142 |
+ # namespace. |
|
| 143 |
+ - name: AUTOLINK_KUBECONFIG |
|
| 144 |
+ value: "-" |
|
| 145 |
+ |
|
| 146 |
+ # The namespace to autolink |
|
| 147 |
+ - name: AUTOLINK_NAMESPACE |
|
| 148 |
+ value: $(POD_NAMESPACE) |
|
| 149 |
+ |
|
| 150 |
+ # The path to a script in the image to use as the default |
|
| 151 |
+ # post-receive hook - only set during link, so has no effect |
|
| 152 |
+ # on cloned repositories. See the "hooks" directory in the |
|
| 153 |
+ # image for examples. |
|
| 154 |
+ - name: AUTOLINK_HOOK |
|
| 155 |
+ |
|
| 156 |
+ volumeMounts: |
|
| 157 |
+ - mountPath: /var/lib/git |
|
| 158 |
+ name: git-data |
|
| 159 |
+ volumes: |
|
| 160 |
+ - name: git-data |
|
| 161 |
+ persistentVolumeClaim: |
|
| 162 |
+ claimName: git |
|
| 163 |
+ triggers: |
|
| 164 |
+ - type: ConfigChange |
|
| 165 |
+ |
|
| 166 |
+# The git server service is required for DNS resolution |
|
| 167 |
+- apiVersion: v1 |
|
| 168 |
+ kind: Service |
|
| 169 |
+ metadata: |
|
| 170 |
+ name: git |
|
| 171 |
+ labels: |
|
| 172 |
+ app: git |
|
| 173 |
+ spec: |
|
| 174 |
+ ports: |
|
| 175 |
+ - port: 8080 |
|
| 176 |
+ targetPort: 8080 |
|
| 177 |
+ selector: |
|
| 178 |
+ run-container: git |
|
| 179 |
+ |
|
| 180 |
+# The service account for the git server must be granted the view role to |
|
| 181 |
+# automatically start builds, edit role to create objects and autolink |
|
| 182 |
+- apiVersion: v1 |
|
| 183 |
+ kind: ServiceAccount |
|
| 184 |
+ metadata: |
|
| 185 |
+ name: git |
|
| 186 |
+ labels: |
|
| 187 |
+ app: git |
|
| 188 |
+ |
|
| 189 |
+# Default route for git service |
|
| 190 |
+- apiVersion: v1 |
|
| 191 |
+ kind: Route |
|
| 192 |
+ metadata: |
|
| 193 |
+ labels: |
|
| 194 |
+ app: git |
|
| 195 |
+ name: git |
|
| 196 |
+ spec: |
|
| 197 |
+ to: |
|
| 198 |
+ name: git |
|
| 199 |
+ |
|
| 200 |
+# Persistent volume claim |
|
| 201 |
+- apiVersion: v1 |
|
| 202 |
+ kind: PersistentVolumeClaim |
|
| 203 |
+ metadata: |
|
| 204 |
+ name: git |
|
| 205 |
+ spec: |
|
| 206 |
+ accessModes: |
|
| 207 |
+ - ReadWriteOnce |
|
| 208 |
+ resources: |
|
| 209 |
+ requests: |
|
| 210 |
+ storage: 1G |
| 0 | 211 |
deleted file mode 100644 |
| ... | ... |
@@ -1,194 +0,0 @@ |
| 1 |
-apiVersion: v1 |
|
| 2 |
-kind: List |
|
| 3 |
-items: |
|
| 4 |
- |
|
| 5 |
-# The git server is deployed as a singleton pod and uses a very small amount |
|
| 6 |
-# of resources. It can host or transiently serve Git repositories, as well |
|
| 7 |
-# as automatically integrate with builds in a namespace. |
|
| 8 |
-- apiVersion: v1 |
|
| 9 |
- kind: DeploymentConfig |
|
| 10 |
- metadata: |
|
| 11 |
- name: git |
|
| 12 |
- labels: |
|
| 13 |
- app: git |
|
| 14 |
- spec: |
|
| 15 |
- replicas: 1 # the git server is not HA and should not be scaled past 1 |
|
| 16 |
- selector: |
|
| 17 |
- run-container: git |
|
| 18 |
- template: |
|
| 19 |
- metadata: |
|
| 20 |
- labels: |
|
| 21 |
- run-container: git |
|
| 22 |
- spec: |
|
| 23 |
- serviceAccountName: git |
|
| 24 |
- containers: |
|
| 25 |
- - name: git |
|
| 26 |
- image: openshift/origin-gitserver:latest |
|
| 27 |
- ports: |
|
| 28 |
- - containerPort: 8080 |
|
| 29 |
- |
|
| 30 |
- env: |
|
| 31 |
- # Each environment variable matching GIT_INITIAL_CLONE_* will |
|
| 32 |
- # be cloned when the process starts; failures will be logged. |
|
| 33 |
- # <name> must be [A-Z0-9_\-\.], the cloned directory name will |
|
| 34 |
- # be lowercased. If the name is invalid the pod will halt. If |
|
| 35 |
- # the repository already exists on disk, it will be updated |
|
| 36 |
- # from the remote. |
|
| 37 |
- # |
|
| 38 |
- #- name: GIT_INITIAL_CLONE_1 |
|
| 39 |
- # value: <url>[;<name>] |
|
| 40 |
- |
|
| 41 |
- |
|
| 42 |
- # The namespace of the pod is required for implicit config |
|
| 43 |
- # (passing '-' to AUTOLINK_KUBECONFIG or REQUIRE_SERVER_AUTH) |
|
| 44 |
- # and can also be used to target a specific namespace. |
|
| 45 |
- - name: POD_NAMESPACE |
|
| 46 |
- valueFrom: |
|
| 47 |
- fieldRef: |
|
| 48 |
- fieldPath: metadata.namespace |
|
| 49 |
- |
|
| 50 |
- # The URL that builds must use to access the Git repositories |
|
| 51 |
- # stored in this app. |
|
| 52 |
- # TOOD: support HTTPS |
|
| 53 |
- - name: PUBLIC_URL |
|
| 54 |
- value: http://git.$(POD_NAMESPACE).svc.cluster.local:8080 |
|
| 55 |
- # If INTERNAL_URL is specified, then it's used to point |
|
| 56 |
- # BuildConfigs to the internal service address of the git |
|
| 57 |
- # server |
|
| 58 |
- - name: INTERNAL_URL |
|
| 59 |
- value: http://git:8080 |
|
| 60 |
- |
|
| 61 |
- # The directory to store Git repositories in. If not backed |
|
| 62 |
- # by a persistent volume, repositories will be lost when |
|
| 63 |
- # deployments occur. Use INITIAL_GIT_CLONE and AUTOLINK_* |
|
| 64 |
- # to remove the need to use a persistent volume. |
|
| 65 |
- - name: GIT_HOME |
|
| 66 |
- value: /var/lib/git |
|
| 67 |
- |
|
| 68 |
- # The directory to use as the default hook directory for any |
|
| 69 |
- # cloned or autolinked directories. |
|
| 70 |
- - name: HOOK_PATH |
|
| 71 |
- value: /var/lib/git-hooks |
|
| 72 |
- |
|
| 73 |
- # If 'true' new-app will be invoked on push for repositories |
|
| 74 |
- # for which a matching BuildConfig is not found. |
|
| 75 |
- - name: GENERATE_ARTIFACTS |
|
| 76 |
- value: "true" |
|
| 77 |
- |
|
| 78 |
- # The script to use for custom language detection on a |
|
| 79 |
- # repository. See hooks/detect-language for an example. |
|
| 80 |
- # To use new-app's default detection, leave this variable |
|
| 81 |
- # blank. |
|
| 82 |
- - name: DETECTION_SCRIPT |
|
| 83 |
- # value: detect-language |
|
| 84 |
- |
|
| 85 |
- # Authentication and authorization |
|
| 86 |
- |
|
| 87 |
- # If 'true', clients may push to the server with git push. |
|
| 88 |
- - name: ALLOW_GIT_PUSH |
|
| 89 |
- value: "true" |
|
| 90 |
- # If 'true', clients may set hooks via the API. However, unless |
|
| 91 |
- # the Git home is backed by a persistent volume, any deployment |
|
| 92 |
- # will result in the hooks being lost. |
|
| 93 |
- - name: ALLOW_GIT_HOOKS |
|
| 94 |
- value: "true" |
|
| 95 |
- # If 'true', clients can create new git repositories on demand |
|
| 96 |
- # by pushing. If the data on disk is not backed by a persistent |
|
| 97 |
- # volume, the Git repo will be deleted if the deployment is |
|
| 98 |
- # updated. |
|
| 99 |
- - name: ALLOW_LAZY_CREATE |
|
| 100 |
- value: "true" |
|
| 101 |
- # If 'true', clients can pull without being authenticated. |
|
| 102 |
- - name: ALLOW_ANON_GIT_PULL |
|
| 103 |
- value: "true" |
|
| 104 |
- |
|
| 105 |
- # Provides the path to a kubeconfig file in the image that |
|
| 106 |
- # should be used to authorize against the server. The value |
|
| 107 |
- # '-' will use the pod's service account. |
|
| 108 |
- # May not be used in combination with REQUIRE_GIT_AUTH |
|
| 109 |
- - name: REQUIRE_SERVER_AUTH |
|
| 110 |
- value: "-" |
|
| 111 |
- # The namespace to check authorization against when |
|
| 112 |
- # REQUIRE_SERVICE_AUTH is used. Users must have 'get' on |
|
| 113 |
- # 'pods' to pull and 'create' on 'pods' to push. |
|
| 114 |
- - name: AUTH_NAMESPACE |
|
| 115 |
- value: $(POD_NAMESPACE) |
|
| 116 |
- # Require BASIC authentication with a username and password |
|
| 117 |
- # to push or pull. |
|
| 118 |
- # May not be used in combination with REQUIRE_SERVER_AUTH |
|
| 119 |
- - name: REQUIRE_GIT_AUTH |
|
| 120 |
- # value: <username>:<password> |
|
| 121 |
- |
|
| 122 |
- # Autolinking: |
|
| 123 |
- # |
|
| 124 |
- # The git server can automatically clone Git repositories |
|
| 125 |
- # associated with a build config and replace the URL with |
|
| 126 |
- # a link to the repo on PUBLIC_URL. The default post-receive |
|
| 127 |
- # hook on the cloned repo will then trigger a build. You |
|
| 128 |
- # may customize the hook with AUTOLINK_HOOK (path to hook). |
|
| 129 |
- # To autolink, the account the pod runs under must have 'edit' |
|
| 130 |
- # on the AUTOLINK_NAMESPACE: |
|
| 131 |
- # |
|
| 132 |
- # oc policy add-role-to-user -z git edit |
|
| 133 |
- # |
|
| 134 |
- # Links are checked every time the pod starts. |
|
| 135 |
- |
|
| 136 |
- # The location to read auth configuration from for autolinking. |
|
| 137 |
- # If '-', use the service account token to link. The account |
|
| 138 |
- # represented by this config must have the edit role on the |
|
| 139 |
- # namespace. |
|
| 140 |
- - name: AUTOLINK_KUBECONFIG |
|
| 141 |
- value: "-" |
|
| 142 |
- |
|
| 143 |
- # The namespace to autolink |
|
| 144 |
- - name: AUTOLINK_NAMESPACE |
|
| 145 |
- value: $(POD_NAMESPACE) |
|
| 146 |
- |
|
| 147 |
- # The path to a script in the image to use as the default |
|
| 148 |
- # post-receive hook - only set during link, so has no effect |
|
| 149 |
- # on cloned repositories. See the "hooks" directory in the |
|
| 150 |
- # image for examples. |
|
| 151 |
- - name: AUTOLINK_HOOK |
|
| 152 |
- |
|
| 153 |
- volumeMounts: |
|
| 154 |
- - mountPath: /var/lib/git/ |
|
| 155 |
- name: git |
|
| 156 |
- volumes: |
|
| 157 |
- - name: git |
|
| 158 |
- emptyDir: {}
|
|
| 159 |
- triggers: |
|
| 160 |
- - type: ConfigChange |
|
| 161 |
- |
|
| 162 |
-# The git server service is required for DNS resolution |
|
| 163 |
-- apiVersion: v1 |
|
| 164 |
- kind: Service |
|
| 165 |
- metadata: |
|
| 166 |
- name: git |
|
| 167 |
- labels: |
|
| 168 |
- app: git |
|
| 169 |
- spec: |
|
| 170 |
- ports: |
|
| 171 |
- - port: 8080 |
|
| 172 |
- targetPort: 8080 |
|
| 173 |
- selector: |
|
| 174 |
- run-container: git |
|
| 175 |
- |
|
| 176 |
-# The service account for the git server must be granted the view role to |
|
| 177 |
-# automatically start builds, edit role to create objects and autolink |
|
| 178 |
-- apiVersion: v1 |
|
| 179 |
- kind: ServiceAccount |
|
| 180 |
- metadata: |
|
| 181 |
- name: git |
|
| 182 |
- labels: |
|
| 183 |
- app: git |
|
| 184 |
- |
|
| 185 |
-# Default route for git service |
|
| 186 |
-- apiVersion: v1 |
|
| 187 |
- kind: Route |
|
| 188 |
- metadata: |
|
| 189 |
- labels: |
|
| 190 |
- app: git |
|
| 191 |
- name: git |
|
| 192 |
- spec: |
|
| 193 |
- to: |
|
| 194 |
- name: git |
| ... | ... |
@@ -84,6 +84,7 @@ ln_or_cp "${imagedir}/pod" images/pod/bin
|
| 84 | 84 |
ln_or_cp "${imagedir}/hello-openshift" examples/hello-openshift/bin
|
| 85 | 85 |
ln_or_cp "${imagedir}/deployment" examples/deployment/bin
|
| 86 | 86 |
ln_or_cp "${imagedir}/gitserver" examples/gitserver/bin
|
| 87 |
+ln_or_cp "${imagedir}/oc" examples/gitserver/bin
|
|
| 87 | 88 |
ln_or_cp "${imagedir}/dockerregistry" images/dockerregistry/bin
|
| 88 | 89 |
|
| 89 | 90 |
# Copy SDN scripts into images/node |
| ... | ... |
@@ -113,11 +114,11 @@ image openshift/origin-haproxy-router images/router/haproxy |
| 113 | 113 |
image openshift/origin-keepalived-ipfailover images/ipfailover/keepalived |
| 114 | 114 |
image openshift/origin-docker-registry images/dockerregistry |
| 115 | 115 |
image openshift/origin-egress-router images/router/egress |
| 116 |
+image openshift/origin-gitserver examples/gitserver |
|
| 116 | 117 |
# images that depend on openshift/origin |
| 117 | 118 |
image openshift/origin-deployer images/deployer |
| 118 | 119 |
image openshift/origin-recycler images/recycler |
| 119 | 120 |
image openshift/origin-docker-builder images/builder/docker/docker-builder |
| 120 |
-image openshift/origin-gitserver examples/gitserver |
|
| 121 | 121 |
image openshift/origin-sti-builder images/builder/docker/sti-builder |
| 122 | 122 |
image openshift/origin-f5-router images/router/f5 |
| 123 | 123 |
image openshift/node images/node |