Skip to content

Commit ea82b99

Browse files
committed
Squashed commit of all the changes since we forked Kf.
Refer to https://cloud.google.com/migrate/kf/docs/2.9/resources/release-notes for details about the changes.
1 parent 48ad607 commit ea82b99

File tree

2,496 files changed

+235591
-97973
lines changed

Some content is hidden

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

2,496 files changed

+235591
-97973
lines changed

Diff for: .gcloudignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
!.git
2+
bin

Diff for: .gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
bin
2-
vendor
2+
/vendor
3+
operator/vendor
4+
.idea

Diff for: .gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "docs/kf.dev/themes/themes/docsy"]
2-
path = docs/kf.dev/themes/docsy
3-
url = https://github.com/google/docsy.git

Diff for: CHANGELOG.md

-48
This file was deleted.

Diff for: CONTRIBUTING.md

-28
This file was deleted.

Diff for: README.md

+18-33
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,41 @@
11
# Kf
22

3-
[![knative.slack.com][slack-badge]][kf-slack]
3+
See go/kf for details.
44

5-
`kf` provides a `cf`-like experience on top of Knative.
5+
## Getting started the manual way
66

7-
![](./docs/images/helloworld.gif)
7+
Follow the install instructions at go/kf-docs to create a GKE cluster,
8+
install Kf into it, and deploy an app with the `kf` CLI.
89

9-
`kf` aims to be fully compatible with CF applications and lifecycle. It supports
10-
logs, buildpacks, app manifests, routing, service brokers, and injected services.
10+
## Deploy a local Kf install to a new cluster
1111

12-
At the same time, it aims to improve the operational experience by supporting
13-
git-ops, self-healing infrastructure, containers, a service mesh, autoscaling,
14-
scale-to-zero, improved quota management and does it all on Kubernetes using
15-
industry-standard OSS tools including Knative, Istio, and Tekton.
12+
If you need to set up a new development cluster run the following command:
1613

17-
## Getting started
18-
19-
Follow the [install instructions](docs/install.md) to create a GKE cluster, install Kf into it, and deploy an app with the `kf` CLI.
20-
21-
## How to build
22-
23-
**Requirements:**
14+
```sh
15+
./hack/deploy-dev-release.sh
16+
```
2417

25-
- Golang `1.12` ([go mod](https://github.com/golang/go/wiki/Modules#quick-start)
26-
is used and required for dependencies)
18+
It will fetch all your local sources and kick off a Cloud Build that builds
19+
a version of Kf, creates a GKE cluster and installs the Kf version onto it.
2720

21+
## Iterative development
2822

29-
**Building:**
23+
**Building the CLI:**
3024

3125
```sh
3226
$ ./hack/build.sh
3327
```
3428

35-
**Notes:**
36-
37-
- The `kf` CLI must be built outside of the `$GOPATH` folder unless
38-
you explicitly use `export GO111MODULE=on`.
39-
40-
## Development and releasing
29+
**Installing Kf server-side components:**
4130

4231
We use [ko](https://github.com/google/ko) for rapid development
4332
and during the release process to build a full set of `kf` images
44-
and installation YAML.
45-
46-
To update your cluster while developing run `ko apply`:
33+
and installation YAML. Run the following to stage local changes on
34+
a targeted cluster:
4735

48-
```
49-
KO_DOCKER_REPO=gcr.io/my-repo ko apply -f config
36+
```sh
37+
$ ./hack/ko-apply.sh
5038
```
5139

5240
This will build any images required by `config/`, upload them to the provided
5341
registry, and apply the resulting configuration to the current cluster.
54-
55-
[slack-badge]: https://img.shields.io/badge/slack-knative/kf-purple.svg
56-
[kf-slack]: https://knative.slack.com/archives/kf

Diff for: SECURITY.md

-31
This file was deleted.

Diff for: ci/cloudbuild/scheduled/reap-gke-clusters/Dockerfile

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
FROM gcr.io/google.com/cloudsdktool/cloud-sdk:alpine
16+
WORKDIR /scripts
17+
COPY delete_dm_deployments.py .
18+
COPY delete_gke_clusters.py .
19+
COPY cleanup_load_balancers.py .
20+
COPY cleanup_firewall_rules.py .
21+
COPY delete_disks.py .
22+
COPY reap_gcr_containers.py .
23+
COPY reap_ar_repos.py .
24+
COPY reap_iam_bindings.py .
25+
COPY reap_hub_memberships.py .
26+
COPY reap_service_keys.py .

Diff for: ci/cloudbuild/scheduled/reap-gke-clusters/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Reap GKE Clusters
2+
=================
3+
4+
This Cloud Build template creates and publishes a new container used by the
5+
reapers.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the License);
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an AS IS BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import subprocess
16+
import json
17+
import argparse
18+
19+
20+
def execute(command):
21+
call = subprocess.run(command.split(), stdout=subprocess.PIPE, check=True)
22+
return call.stdout.decode("utf-8")
23+
24+
25+
def list_compute_instances(project_id):
26+
"""Lists the compute instances in the given project."""
27+
return json.loads(execute("gcloud --project {} compute instances list --format='json'".format(project_id)))
28+
29+
30+
def list_compue_instance_tags(project_id):
31+
"""Returns a set of compute instance tags that are applied to any
32+
instance.
33+
"""
34+
tags = set([])
35+
36+
for instance in list_compute_instances(project_id):
37+
if 'tags' in instance:
38+
instance_tags = instance['tags']
39+
if 'items' in instance_tags:
40+
tags.update(instance_tags['items'])
41+
42+
return tags
43+
44+
45+
def list_compute_firewall_rules(project_id):
46+
"""Returns a list of all firewall rules."""
47+
return json.loads(execute("gcloud --project {} compute firewall-rules list --format='json'".format(project_id)))
48+
49+
50+
def list_abandoned_firewall_rules(project_id):
51+
"""Returns a list of all firewall rules that don't target any known GCE
52+
instance.
53+
"""
54+
tags = list_compue_instance_tags(project_id)
55+
firewall_rules = list_compute_firewall_rules(project_id)
56+
57+
abandoned = []
58+
for rule in firewall_rules:
59+
# don't catch anything without tags
60+
if 'targetTags' in rule:
61+
target_tags = set(rule['targetTags'])
62+
if len(target_tags) == 0:
63+
# just in case there is an empty targetTags, which is against
64+
# the API, but they could change in the future.
65+
print("rule {} targets all resources".format(rule['name']))
66+
elif tags.isdisjoint(target_tags):
67+
abandoned.append(rule)
68+
else:
69+
print("rule {} is in-use".format(rule['name']))
70+
else:
71+
print("rule {} targets all resources".format(rule['name']))
72+
73+
return abandoned
74+
75+
76+
def delete_abandoned_firewall_rules(project_id, dry_run=False):
77+
"""Deletes each of the abandoned firewall rules returned by
78+
list_abandoned_firewall_rules.
79+
"""
80+
abandoned = list_abandoned_firewall_rules(project_id)
81+
for rule in abandoned:
82+
name = rule['name']
83+
print('delete firewall-rule {}'.format(name))
84+
if dry_run:
85+
continue
86+
print(execute('gcloud --quiet --project {} compute firewall-rules delete {}'.format(project_id, name)))
87+
88+
89+
if __name__ == '__main__':
90+
parser = argparse.ArgumentParser(description='Delete abandoned firewall rules')
91+
parser.add_argument('project_id', metavar="PROJECT_ID", type=str)
92+
parser.add_argument('--dry-run', action='store_true')
93+
94+
args = parser.parse_args()
95+
96+
delete_abandoned_firewall_rules(args.project_id, dry_run=args.dry_run)

0 commit comments

Comments
 (0)