Skip to content

Commit 3fe67e6

Browse files
committed
Initial import from projectriff/bindings
Signed-off-by: Scott Andrews <[email protected]>
1 parent 7d2966f commit 3fe67e6

File tree

3,782 files changed

+1094864
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,782 files changed

+1094864
-19
lines changed

.github/workflows/ci.yaml

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
- '!dependabot/**'
8+
pull_request: {}
9+
10+
jobs:
11+
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-go@v2-beta
17+
with:
18+
go-version: 1.14.x
19+
- name: Test
20+
run: go test ./...
21+
22+
stage:
23+
needs: test
24+
if: github.event_name == 'push' && startsWith(github.repository, 'vmware-labs/')
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: actions/setup-go@v2-beta
29+
with:
30+
go-version: 1.14.x
31+
- name: Install ko
32+
run: |
33+
go get github.com/google/ko/cmd/ko
34+
echo "##[add-path]$(go env GOPATH)/bin"
35+
env:
36+
GO111MODULE: "off"
37+
- name: gcloud auth
38+
run: |
39+
gcloud config set disable_prompts True
40+
gcloud auth activate-service-account --key-file <(echo $GCLOUD_CLIENT_SECRET | base64 --decode)
41+
gcloud auth configure-docker
42+
env:
43+
GCLOUD_CLIENT_SECRET: ${{ secrets.GCLOUD_CLIENT_SECRET }}
44+
- name: Stage
45+
run: |
46+
set -o errexit
47+
set -o nounset
48+
set -o pipefail
49+
50+
readonly version=$(cat VERSION)
51+
readonly git_sha=$(git rev-parse HEAD)
52+
readonly git_timestamp=$(TZ=UTC git show --quiet --date='format-local:%Y%m%d%H%M%S' --format="%cd")
53+
readonly slug=${version}-${git_timestamp}-${git_sha:0:16}
54+
55+
ko resolve -t ${slug} --strict -f config > service-bindings.yaml
56+
gsutil cp service-bindings.yaml gs://projectriff/service-bindings/snapshots/${slug}/service-bindings.yaml
57+
env:
58+
KO_DOCKER_REPO: gcr.io/projectriff/service-bindings
59+
60+
# TODO add acceptance tests
61+
# acceptance: {}
62+
63+
publish:
64+
# TODO restore once we have acceptance tests
65+
# needs: acceptance
66+
needs: stage
67+
if: |
68+
github.event_name == 'push' && startsWith(github.repository, 'vmware-labs/') && (
69+
github.ref == 'refs/heads/main' || (
70+
startsWith(github.ref, 'refs/heads/v') && endsWith(github.ref, 'x')
71+
)
72+
)
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v2
76+
- name: gcloud auth
77+
run: |
78+
gcloud config set disable_prompts True
79+
gcloud auth activate-service-account --key-file <(echo $GCLOUD_CLIENT_SECRET | base64 --decode)
80+
env:
81+
GCLOUD_CLIENT_SECRET: ${{ secrets.GCLOUD_CLIENT_SECRET }}
82+
- name: Publish artifacts
83+
run: |
84+
set -o errexit
85+
set -o nounset
86+
set -o pipefail
87+
88+
readonly version=$(cat VERSION)
89+
readonly git_sha=$(git rev-parse HEAD)
90+
readonly git_branch=${GITHUB_REF#refs/heads/}
91+
readonly git_timestamp=$(TZ=UTC git show --quiet --date='format-local:%Y%m%d%H%M%S' --format="%cd")
92+
readonly slug=${version}-${git_timestamp}-${git_sha:0:16}
93+
94+
readonly bucket=gs://projectriff/service-bindings
95+
96+
cache_control='Cache-Control: public'
97+
if echo $version | grep -iqF snapshot; then
98+
cache_control="${cache_control}, max-age=60"
99+
else
100+
cache_control="${cache_control}, max-age=3600"
101+
fi
102+
103+
echo "Promote artifacts"
104+
gsutil -h "${cache_control}" rsync -d ${bucket}/snapshots/${slug}/ ${bucket}/${slug}/
105+
if [[ ${version} != *"-snapshot" ]] ; then
106+
gsutil -h "${cache_control}" rsync -d ${bucket}/snapshots/${slug}/ ${bucket}/${version}/
107+
fi
108+
109+
echo "Capture snapshot slug"
110+
gsutil -h 'Content-Type: text/plain' -h 'Cache-Control: private' cp <(echo "${slug}") gs://projectriff/service-bindings/versions/builds/${git_branch}
111+
gsutil -h 'Content-Type: text/plain' -h 'Cache-Control: private' cp <(echo "${slug}") gs://projectriff/service-bindings/versions/builds/${version}
112+
if [[ ${version} != *"-snapshot" ]] ; then
113+
gsutil -h 'Content-Type: text/plain' -h 'Cache-Control: private' cp <(echo "${slug}") gs://projectriff/service-bindings/versions/releases/${git_branch}
114+
# avoids overwriting existing values
115+
gsutil -h 'Content-Type: text/plain' -h 'Cache-Control: private' cp -n <(echo "${slug}") gs://projectriff/service-bindings/versions/releases/${version}
116+
fi

.ko.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
defaultBaseImage: cloudfoundry/run:tiny

CONTRIBUTING.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11

22
# Contributing to service-bindings
33

4-
The service-bindings project team welcomes contributions from the community. Before you start working with service-bindings, please
5-
read our [Developer Certificate of Origin](https://cla.vmware.com/dco). All contributions to this repository must be
6-
signed as described on that page. Your signature certifies that you wrote the patch or have the right to pass it on
7-
as an open-source patch.
4+
The Service Bindings for Kubernetes project team welcomes contributions from the community. If you wish to contribute code and you have not signed our contributor license agreement (CLA), our bot will update the issue when you open a Pull Request. For any questions about the CLA process, please refer to our [FAQ](https://cla.vmware.com/faq). For more detailed information, refer to [CONTRIBUTING.md](CONTRIBUTING.md).
85

96
## Contribution Flow
107

LICENSE

+179
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
service-bindings-for-kubernetes
2+
Copyright 2020 VMware, Inc.
3+
4+
The Apache 2.0 license (the "License") set forth below applies to all parts of the service-bindings-for-kubernetes project. You may not use this file except in compliance with the License.
5+
6+
Apache License
7+
8+
Version 2.0, January 2004
9+
http://www.apache.org/licenses/
10+
11+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
12+
13+
1. Definitions.
14+
15+
"License" shall mean the terms and conditions for use, reproduction,
16+
and distribution as defined by Sections 1 through 9 of this document.
17+
18+
"Licensor" shall mean the copyright owner or entity authorized by the
19+
copyright owner that is granting the License.
20+
21+
"Legal Entity" shall mean the union of the acting entity and all other
22+
entities that control, are controlled by, or are under common control
23+
with that entity. For the purposes of this definition, "control" means
24+
(i) the power, direct or indirect, to cause the direction or management
25+
of such entity, whether by contract or otherwise, or (ii) ownership
26+
of fifty percent (50%) or more of the outstanding shares, or (iii)
27+
beneficial ownership of such entity.
28+
29+
"You" (or "Your") shall mean an individual or Legal Entity exercising
30+
permissions granted by this License.
31+
32+
"Source" form shall mean the preferred form for making modifications,
33+
including but not limited to software source code, documentation source,
34+
and configuration files.
35+
36+
"Object" form shall mean any form resulting from mechanical transformation
37+
or translation of a Source form, including but not limited to compiled
38+
object code, generated documentation, and conversions to other media
39+
types.
40+
41+
"Work" shall mean the work of authorship, whether in Source or
42+
Object form, made available under the License, as indicated by a copyright
43+
notice that is included in or attached to the work (an example is provided
44+
in the Appendix below).
45+
46+
"Derivative Works" shall mean any work, whether in Source or Object form,
47+
that is based on (or derived from) the Work and for which the editorial
48+
revisions, annotations, elaborations, or other modifications represent,
49+
as a whole, an original work of authorship. For the purposes of this
50+
License, Derivative Works shall not include works that remain separable
51+
from, or merely link (or bind by name) to the interfaces of, the Work
52+
and Derivative Works thereof.
53+
54+
"Contribution" shall mean any work of authorship, including the
55+
original version of the Work and any modifications or additions to
56+
that Work or Derivative Works thereof, that is intentionally submitted
57+
to Licensor for inclusion in the Work by the copyright owner or by an
58+
individual or Legal Entity authorized to submit on behalf of the copyright
59+
owner. For the purposes of this definition, "submitted" means any form of
60+
electronic, verbal, or written communication sent to the Licensor or its
61+
representatives, including but not limited to communication on electronic
62+
mailing lists, source code control systems, and issue tracking systems
63+
that are managed by, or on behalf of, the Licensor for the purpose of
64+
discussing and improving the Work, but excluding communication that is
65+
conspicuously marked or otherwise designated in writing by the copyright
66+
owner as "Not a Contribution."
67+
68+
"Contributor" shall mean Licensor and any individual or Legal Entity
69+
on behalf of whom a Contribution has been received by Licensor and
70+
subsequently incorporated within the Work.
71+
72+
2. Grant of Copyright License.
73+
Subject to the terms and conditions of this License, each Contributor
74+
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
75+
royalty-free, irrevocable copyright license to reproduce, prepare
76+
Derivative Works of, publicly display, publicly perform, sublicense, and
77+
distribute the Work and such Derivative Works in Source or Object form.
78+
79+
3. Grant of Patent License.
80+
Subject to the terms and conditions of this License, each Contributor
81+
hereby grants to You a perpetual, worldwide, non-exclusive, no-charge,
82+
royalty- free, irrevocable (except as stated in this section) patent
83+
license to make, have made, use, offer to sell, sell, import, and
84+
otherwise transfer the Work, where such license applies only to those
85+
patent claims licensable by such Contributor that are necessarily
86+
infringed by their Contribution(s) alone or by combination of
87+
their Contribution(s) with the Work to which such Contribution(s)
88+
was submitted. If You institute patent litigation against any entity
89+
(including a cross-claim or counterclaim in a lawsuit) alleging that the
90+
Work or a Contribution incorporated within the Work constitutes direct
91+
or contributory patent infringement, then any patent licenses granted
92+
to You under this License for that Work shall terminate as of the date
93+
such litigation is filed.
94+
95+
4. Redistribution.
96+
You may reproduce and distribute copies of the Work or Derivative Works
97+
thereof in any medium, with or without modifications, and in Source or
98+
Object form, provided that You meet the following conditions:
99+
100+
a. You must give any other recipients of the Work or Derivative Works
101+
a copy of this License; and
102+
103+
b. You must cause any modified files to carry prominent notices stating
104+
that You changed the files; and
105+
106+
c. You must retain, in the Source form of any Derivative Works that
107+
You distribute, all copyright, patent, trademark, and attribution
108+
notices from the Source form of the Work, excluding those notices
109+
that do not pertain to any part of the Derivative Works; and
110+
111+
d. If the Work includes a "NOTICE" text file as part of its
112+
distribution, then any Derivative Works that You distribute must
113+
include a readable copy of the attribution notices contained
114+
within such NOTICE file, excluding those notices that do not
115+
pertain to any part of the Derivative Works, in at least one of
116+
the following places: within a NOTICE text file distributed as part
117+
of the Derivative Works; within the Source form or documentation,
118+
if provided along with the Derivative Works; or, within a display
119+
generated by the Derivative Works, if and wherever such third-party
120+
notices normally appear. The contents of the NOTICE file are for
121+
informational purposes only and do not modify the License. You
122+
may add Your own attribution notices within Derivative Works that
123+
You distribute, alongside or as an addendum to the NOTICE text
124+
from the Work, provided that such additional attribution notices
125+
cannot be construed as modifying the License. You may add Your own
126+
copyright statement to Your modifications and may provide additional
127+
or different license terms and conditions for use, reproduction, or
128+
distribution of Your modifications, or for any such Derivative Works
129+
as a whole, provided Your use, reproduction, and distribution of the
130+
Work otherwise complies with the conditions stated in this License.
131+
132+
5. Submission of Contributions.
133+
Unless You explicitly state otherwise, any Contribution intentionally
134+
submitted for inclusion in the Work by You to the Licensor shall be
135+
under the terms and conditions of this License, without any additional
136+
terms or conditions. Notwithstanding the above, nothing herein shall
137+
supersede or modify the terms of any separate license agreement you may
138+
have executed with Licensor regarding such Contributions.
139+
140+
6. Trademarks.
141+
This License does not grant permission to use the trade names, trademarks,
142+
service marks, or product names of the Licensor, except as required for
143+
reasonable and customary use in describing the origin of the Work and
144+
reproducing the content of the NOTICE file.
145+
146+
7. Disclaimer of Warranty.
147+
Unless required by applicable law or agreed to in writing, Licensor
148+
provides the Work (and each Contributor provides its Contributions) on
149+
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
150+
express or implied, including, without limitation, any warranties or
151+
conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR
152+
A PARTICULAR PURPOSE. You are solely responsible for determining the
153+
appropriateness of using or redistributing the Work and assume any risks
154+
associated with Your exercise of permissions under this License.
155+
156+
8. Limitation of Liability.
157+
In no event and under no legal theory, whether in tort (including
158+
negligence), contract, or otherwise, unless required by applicable law
159+
(such as deliberate and grossly negligent acts) or agreed to in writing,
160+
shall any Contributor be liable to You for damages, including any direct,
161+
indirect, special, incidental, or consequential damages of any character
162+
arising as a result of this License or out of the use or inability to
163+
use the Work (including but not limited to damages for loss of goodwill,
164+
work stoppage, computer failure or malfunction, or any and all other
165+
commercial damages or losses), even if such Contributor has been advised
166+
of the possibility of such damages.
167+
168+
9. Accepting Warranty or Additional Liability.
169+
While redistributing the Work or Derivative Works thereof, You may
170+
choose to offer, and charge a fee for, acceptance of support, warranty,
171+
indemnity, or other liability obligations and/or rights consistent with
172+
this License. However, in accepting such obligations, You may act only
173+
on Your own behalf and on Your sole responsibility, not on behalf of
174+
any other Contributor, and only if You agree to indemnify, defend, and
175+
hold each Contributor harmless for any liability incurred by, or claims
176+
asserted against, such Contributor by reason of your accepting any such
177+
warranty or additional liability.
178+
179+
END OF TERMS AND CONDITIONS

NOTICE

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
service-bindings-for-kubernetes
2+
Copyright 2020 VMware, Inc.
3+
4+
This product is licensed to you under the Apache 2.0 license (the "License"). You may not use this product except in compliance with the Apache 2.0 License.
5+
6+
This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file.

README.md

+38-15
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,52 @@
11

2-
# service-bindings
2+
# Service Bindings for Kubernetes
33

4-
## Overview
4+
Service Bindings for Kubernetes implements the [Service Binding Specification for Kubernetes](https://github.com/k8s-service-bindings/spec). We are tracking changes to the spec as it approaches a stable release, starting with v1alpha2 (RC2 release). Backwards and forwards compatibility should not be expected for alpha versioned resources.
55

66
## Try it out
77

8-
### Prerequisites
8+
We use [`ko`](https://github.com/google/ko) to build and deploy the CRD and reconciler.
99

10-
* Prereq 1
11-
* Prereq 2
12-
* Prereq 3
10+
From within the cloned directory for this project, run:
1311

14-
### Build & Run
12+
```
13+
ko apply --strict -f config
14+
```
1515

16-
1. Step 1
17-
2. Step 2
18-
3. Step 3
16+
## Resources
1917

20-
## Documentation
18+
### ServiceBinding (service.bindings/v1alpha2)
19+
20+
The `ServiceBinding` resource shape and behavior is defined upstream. In addition to the [core specification](https://github.com/k8s-service-bindings/spec#service-binding), the [Role-Based Access Control (RBAC) extension](https://github.com/k8s-service-bindings/spec#role-based-access-control-rbac) is also supported by this implementation.
21+
22+
### ProvisionedService (bindings.labs.vmware.com/v1alpha1)
23+
24+
The `ProvisionedService` exposes a resource `Secret` by implementing the upstream [Provisioned Service duck type](https://github.com/k8s-service-bindings/spec#provisioned-service), and may be the target of the `.spec.service` reference for a `ServiceBinding`. It is intended for compatibility with existing services that do not directly implement the duck type.
25+
26+
For example to expose a service with an existing `Secret` named `account-db-service`:
27+
28+
```
29+
apiVersion: bindings.labs.vmware.com/v1alpha1
30+
kind: ProvisionedService
31+
metadata:
32+
name: account-db
33+
spec:
34+
binding:
35+
name: account-db-service
36+
```
37+
38+
The controller writes the resource's status to implement the duck type.
2139

2240
## Contributing
2341

24-
The service-bindings project team welcomes contributions from the community. Before you start working with service-bindings, please
25-
read our [Developer Certificate of Origin](https://cla.vmware.com/dco). All contributions to this repository must be
26-
signed as described on that page. Your signature certifies that you wrote the patch or have the right to pass it on
27-
as an open-source patch. For more detailed information, refer to [CONTRIBUTING.md](CONTRIBUTING.md).
42+
The Service Bindings for Kubernetes project team welcomes contributions from the community. If you wish to contribute code and you have not signed our contributor license agreement (CLA), our bot will update the issue when you open a Pull Request. For any questions about the CLA process, please refer to our [FAQ](https://cla.vmware.com/faq). For more detailed information, refer to [CONTRIBUTING.md](CONTRIBUTING.md).
43+
44+
## Acknowledgements
45+
46+
Service Bindings for Kubernetes is an implementation of the [Service Binding Specification for Kubernetes](https://github.com/k8s-service-bindings/spec). Thanks to [Arthur De Magalhaes](https://github.com/arthurdm) and [Ben Hale](https://github.com/nebhale) for leading the spec effort.
47+
48+
The initial implementation was conceived in [`projectriff/bindings`](https://github.com/projectriff/bindings/) by [Scott Andrews](https://github.com/scothis), [Emily Casey](https://github.com/ekcasey) and the [riff community](https://github.com/orgs/projectriff/people) at large, drawing inspiration from [mattmoor/bindings](https://github.com/mattmoor/bindings) and [Knative](https://knative.dev) duck type reconcilers.
2849

2950
## License
51+
52+
Apache License v2.0: see [LICENSE](./LICENSE) for details.

VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0-snapshot

0 commit comments

Comments
 (0)