Skip to content
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

Remove kubernetes #3140

Merged
merged 10 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ gem 'httpclient'
gem 'json-diff'
gem 'json-schema'
gem 'json_pure'
gem 'kubeclient'
gem 'loggregator_emitter', '~> 5.0'
gem 'membrane', '~> 1.0'
gem 'mime-types', '~> 3.4'
Expand Down
8 changes: 0 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -271,18 +271,11 @@ GEM
json-schema (4.0.0)
addressable (>= 2.8)
json_pure (2.6.3)
jsonpath (1.1.2)
multi_json
jwt (2.7.1)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
kubeclient (4.11.0)
http (>= 3.0, < 6.0)
jsonpath (~> 1.0)
recursive-open-struct (~> 1.1, >= 1.1.1)
rest-client (~> 2.0)
language_server-protocol (3.17.0.3)
libhoney (2.2.0)
addressable (~> 2.0)
Expand Down Expand Up @@ -581,7 +574,6 @@ DEPENDENCIES
json-diff
json-schema
json_pure
kubeclient
listen
loggregator_emitter (~> 5.0)
machinist (~> 1.0.6)
Expand Down
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
* [Continuous Integration Pipelines](https://ci.cake.capi.land/)
* [Notes on V3 Architecture](https://github.com/cloudfoundry/cloud_controller_ng/wiki/Notes-on-V3-Architecture)
* [capi-release](https://github.com/cloudfoundry/capi-release) - The bosh release used to deploy cloud controller
* [cf-for-k8s](https://github.com/cloudfoundry/cf-for-k8s) - How Cloud Foundry (including Cloud Controller) is deployed against Kubernetes
* [capi-k8s-release](https://github.com/cloudfoundry/capi-k8s-release) - The parts of cf-for-k8s that are specific to CF API (including Cloud Controller)

## Components

Expand Down Expand Up @@ -51,12 +49,6 @@ Cloud Controller currently supports [webdav](http://www.webdav.org/) and the fol
The Cloud Controller on VMs uses [Diego](https://github.com/cloudfoundry/diego-release) to stage and run apps and tasks.
See [Diego Design Notes](https://github.com/cloudfoundry/diego-design-notes) for more details.

When deployed on Kubernetes, Cloud Controller uses
[kpack](https://github.com/pivotal/kpack) to build images from source with
[Cloud Native Buildpacks](https://buildpacks.io) and
[Eirini](https://github.com/cloudfoundry-incubator/eirini) to run apps directly on the Kubernetes cluster.


## Contributing

Please read the [contributors' guide](https://github.com/cloudfoundry/cloud_controller_ng/blob/main/CONTRIBUTING.md) and the [Cloud Foundry Code of Conduct](https://cloudfoundry.org/code-of-conduct/)
Expand Down
17 changes: 0 additions & 17 deletions app/actions/app_delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,6 @@ def delete(apps, record_event: true)
app.destroy
end
logger.info("Deleted app: #{app.guid}")

if VCAP::CloudController::Config.kubernetes_api_configured?
# an app CRD could simplify this garbage collection
logger.info("Deleting kpack resources associated with app #{app.guid}")
k8s_api_client.delete_image(
app.guid,
VCAP::CloudController::Config.config.kpack_builder_namespace,
)
k8s_api_client.delete_builder(
"app-#{app.guid}",
VCAP::CloudController::Config.config.kpack_builder_namespace,
)
end
end
end

Expand All @@ -72,10 +59,6 @@ def delete_without_event(apps)

private

def k8s_api_client
CloudController::DependencyLocator.instance.k8s_api_client
end

def record_audit_event(app)
Repositories::AppEventRepository.new.record_app_delete_request(
app,
Expand Down
1 change: 0 additions & 1 deletion app/actions/build_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def create_and_stage(package:, lifecycle:, metadata: nil, start_after_staging: f

def requested_buildpacks_disabled!(lifecycle)
return if lifecycle.type == Lifecycles::DOCKER
return if lifecycle.type == Lifecycles::KPACK

admin_buildpack_records = lifecycle.buildpack_infos.map(&:buildpack_record).compact
disabled_buildpacks = admin_buildpack_records.reject(&:enabled)
Expand Down
14 changes: 0 additions & 14 deletions app/actions/droplet_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,6 @@ def create_buildpack_droplet(build)
droplet
end

def create_kpack_droplet(build)
droplet = droplet_from_build(build)

DropletModel.db.transaction do
droplet.save
droplet.kpack_lifecycle_data = build.kpack_lifecycle_data
end

droplet.reload
Steno.logger('build_completed').info("droplet created: #{droplet.guid}")
record_audit_event(droplet, build.package, user_audit_info_from_build(build))
droplet
end

private

def droplet_from_build(build)
Expand Down
2 changes: 1 addition & 1 deletion app/actions/droplet_update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def update(droplet, message)

if message.requested?(:image)
raise InvalidDroplet.new('Droplet image can only be updated on staged droplets') unless droplet.staged?
raise InvalidDroplet.new('Images can only be updated for docker droplets') unless droplet.has_docker_image?
raise InvalidDroplet.new('Images can only be updated for docker droplets') unless droplet.docker?

droplet.docker_receipt_image = message.image
end
Expand Down
2 changes: 1 addition & 1 deletion app/actions/package_delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def delete(packages)
def create_package_source_deletion_job(package)
return Jobs::Runtime::BlobstoreDelete.new(package.guid, :package_blobstore) unless package_registry_configured?

package.bits? ? Jobs::Kubernetes::RegistryDelete.new(package.bits_image_reference) : nil
nil
end

def package_registry_configured?
Expand Down
11 changes: 0 additions & 11 deletions app/actions/route_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def initialize(user_audit_info)

def create(message:, space:, domain:, manifest_triggered: false)
validate_tcp_route!(domain, message)
validate_internal_kubernetes_domain!(domain)

route = Route.new(
host: message.host || '',
Expand All @@ -32,10 +31,6 @@ def create(message:, space:, domain:, manifest_triggered: false)
manifest_triggered: manifest_triggered,
)

if VCAP::CloudController::Config.kubernetes_api_configured?
route_resource_manager.create_route(route)
end

route
rescue Sequel::ValidationFailed => e
validation_error!(e, route.host, route.path, route.port, space, domain)
Expand All @@ -52,12 +47,6 @@ def validate_tcp_route!(domain, message)
end
end

def validate_internal_kubernetes_domain!(domain)
if domain.internal? && VCAP::CloudController::Config.config.kubernetes_api_configured?
error!('Internal domains are currently not supported on Kubernetes')
end
end

def port(message, domain)
generated_port = if !message.requested?(:port) && domain.protocols.include?('tcp')
PortGenerator.generate_port(domain.guid, router_group(domain).reservable_ports)
Expand Down
4 changes: 0 additions & 4 deletions app/actions/route_mapping_delete.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ def delete(route_mappings)
route_handlers.each do |handler|
handler.update_route_information(perform_validation: false)
end

if VCAP::CloudController::Config.kubernetes_api_configured?
route_resource_manager.update_destinations(route_mapping.route.reload)
end
end
end
end
Expand Down
4 changes: 0 additions & 4 deletions app/actions/update_route_destinations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ def update(route, to_add, to_delete, user_audit_info, manifest_triggered)

route.reload

if VCAP::CloudController::Config.kubernetes_api_configured?
route_resource_manager.update_destinations(route)
end

route
end

Expand Down
3 changes: 0 additions & 3 deletions app/actions/v2/app_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ def create_lifecycle(app, request_attrs)
data: docker_data
})
PackageCreate.create_without_event(create_message)
elsif Config.config.get(:default_app_lifecycle) == VCAP::CloudController::Lifecycles::KPACK
KpackLifecycleDataModel.create(app: app)
app.kpack_lifecycle_data(reload: true)
else
# it is important to create the lifecycle model with the app instead of doing app.buildpack_lifecycle_data_model = x
# because mysql will deadlock when requests happen concurrently otherwise.
Expand Down
4 changes: 0 additions & 4 deletions app/actions/v2/route_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ def create_route(route_hash:)
r
end

if VCAP::CloudController::Config.kubernetes_api_configured?
route_resource_manager.create_route(route)
end

route
end

Expand Down
4 changes: 0 additions & 4 deletions app/actions/v2/route_mapping_create.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ def add
)
end

if VCAP::CloudController::Config.kubernetes_api_configured?
route_resource_manager.update_destinations(route_mapping.route)
end

route_mapping
rescue Sequel::ValidationFailed => e
if e.errors && e.errors.on([:app_guid, :route_guid, :process_type, :app_port]) && e.errors.on([:app_guid, :route_guid, :process_type, :app_port]).include?(:unique)
Expand Down
1 change: 0 additions & 1 deletion app/controllers/v3/apps_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def create
unprocessable_space! unless space && permission_queryer.can_read_from_space?(space.id, space.organization_id)
unauthorized! unless permission_queryer.can_write_to_active_space?(space.id)
suspended! unless permission_queryer.is_space_active?(space.id)
# TODO: only fail if also not `kpack` app lifecycle
if message.lifecycle_type == VCAP::CloudController::PackageModel::DOCKER_TYPE
FeatureFlag.raise_unless_enabled!(:diego_docker)
end
Expand Down
26 changes: 7 additions & 19 deletions app/controllers/v3/buildpacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require 'messages/buildpacks_list_message'
require 'messages/buildpack_update_message'
require 'messages/buildpack_upload_message'
require 'fetchers/kpack_buildpack_list_fetcher'
require 'fetchers/buildpack_list_fetcher'
require 'actions/buildpack_create'
require 'actions/buildpack_delete'
Expand All @@ -14,24 +13,13 @@ class BuildpacksController < ApplicationController
def index
message = BuildpacksListMessage.from_params(query_params)
invalid_param!(message.errors.full_messages) unless message.valid?

if VCAP::CloudController::Config.kubernetes_api_configured?
dataset = KpackBuildpackListFetcher.new.fetch_all(message)
render status: :ok, json: Presenters::V3::PaginatedListPresenter.new(
presenter: Presenters::V3::BuildpackPresenter,
paginated_result: ListPaginator.new.get_page(dataset, message.try(:pagination_options)),
path: '/v3/buildpacks',
message: message
)
else
dataset = BuildpackListFetcher.fetch_all(message, eager_loaded_associations: Presenters::V3::BuildpackPresenter.associated_resources)
render status: :ok, json: Presenters::V3::PaginatedListPresenter.new(
presenter: Presenters::V3::BuildpackPresenter,
paginated_result: SequelPaginator.new.get_page(dataset, message.try(:pagination_options)),
path: '/v3/buildpacks',
message: message
)
end
dataset = BuildpackListFetcher.fetch_all(message, eager_loaded_associations: Presenters::V3::BuildpackPresenter.associated_resources)
render status: :ok, json: Presenters::V3::PaginatedListPresenter.new(
presenter: Presenters::V3::BuildpackPresenter,
paginated_result: SequelPaginator.new.get_page(dataset, message.try(:pagination_options)),
path: '/v3/buildpacks',
message: message
)
end

def show
Expand Down
88 changes: 0 additions & 88 deletions app/fetchers/kpack_buildpack_list_fetcher.rb

This file was deleted.

22 changes: 0 additions & 22 deletions app/jobs/kubernetes/registry_delete.rb

This file was deleted.

3 changes: 1 addition & 2 deletions app/jobs/runtime/delete_expired_package_blob.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
require 'jobs/kubernetes/registry_delete'
require 'jobs/runtime/blobstore_delete'

module VCAP::CloudController
Expand Down Expand Up @@ -42,7 +41,7 @@ def package_registry_configured?
def create_package_source_deletion_job(package)
return Jobs::Runtime::BlobstoreDelete.new(package.guid, :package_blobstore) unless package_registry_configured?

package.bits? ? Jobs::Kubernetes::RegistryDelete.new(package.bits_image_reference) : nil
nil
end
end
end
Expand Down
Loading