Initial v1.0.0 commit

This commit is contained in:
Jakub Vavřík
2021-01-28 17:37:47 +01:00
commit 1481d27782
4164 changed files with 1264675 additions and 0 deletions

86
.ci/component_descriptor Executable file
View File

@@ -0,0 +1,86 @@
#!/usr/bin/env python3
import dataclasses
import os
import yaml
import ci.util
import gci.componentmodel
import util
component_descriptor_base_path = os.path.abspath(util.check_env('BASE_DEFINITION_PATH'))
component_descriptor_path = os.path.abspath(util.check_env('COMPONENT_DESCRIPTOR_PATH'))
repo_path = os.path.abspath(util.check_env('MAIN_REPO_DIR'))
def parse_component_descriptor():
component_descriptor_v2 = gci.componentmodel.ComponentDescriptor.from_dict(
ci.util.parse_yaml_file(component_descriptor_base_path)
)
return component_descriptor_v2
def add_image_dependency(component, image_name, image_reference, image_version):
resource_access = gci.componentmodel.OciAccess(
type=gci.componentmodel.AccessType.OCI_REGISTRY,
imageReference=image_reference,
)
component.resources.append(
gci.componentmodel.Resource(
name=image_name,
version=image_version,
type=gci.componentmodel.ResourceType.OCI_IMAGE,
access=resource_access,
),
)
def add_component_dependency(component, dependency_name, dependency_version):
component.componentReferences.append(
gci.componentmodel.ComponentReference(
name=dependency_name,
componentName=dependency_name,
version=dependency_version,
labels=[],
)
)
component_descriptor = parse_component_descriptor()
own_component = component_descriptor.component
images_list_path = os.path.join(repo_path, 'charts', 'images.yaml')
with open(images_list_path, 'r') as f:
images_list_contents = yaml.safe_load(f)
for image in images_list_contents.get('images', []):
# use same heuristics as before: if the image's repository starts with
# 'eu.gcr.io/gardener-project' assume it's one of our components ...
# NOTE: Usually that is 'eu.gcr.io/gardener-project/gardener', but for this
# component (or rather: its' dependencies) the image repository is
# different.
if image['repository'].startswith('eu.gcr.io/gardener-project'):
add_component_dependency(
component=own_component,
dependency_name=image['sourceRepository'],
dependency_version=image['tag'],
)
# ... otherwise assume it's an image dependency
else:
add_image_dependency(
component=own_component,
image_name=image['name'],
image_reference=image['repository'],
image_version=image['tag'],
)
# write generated component descriptor back out
with open(component_descriptor_path, 'w') as f:
yaml.dump(
data=dataclasses.asdict(component_descriptor),
Dumper=gci.componentmodel.EnumValueYamlDumper,
stream=f,
)

46
.ci/pipeline_definitions Normal file
View File

@@ -0,0 +1,46 @@
gardener-extension-shoot-fleet-agent:
template: 'default'
base_definition:
repo: ~
traits:
version:
preprocess: 'inject-commit-hash'
publish:
dockerimages:
gardener-extension-shoot-fleet-agent:
registry: 'gcr-readwrite'
image: 'eu.gcr.io/gardener-project/gardener/extensions/shoot-fleet-agent'
dockerfile: 'Dockerfile'
target: gardener-extension-shoot-fleet-agent
jobs:
head-update:
traits:
component_descriptor: ~
draft_release: ~
options:
public_build_logs: true
pull-request:
traits:
pull-request: ~
component_descriptor: ~
options:
public_build_logs: true
release:
traits:
version:
preprocess: 'finalize'
release:
nextversion: 'bump_minor'
next_version_callback: '.ci/prepare_release'
release_callback: '.ci/prepare_release'
slack:
default_channel: 'internal_scp_workspace'
channel_cfgs:
internal_scp_workspace:
channel_name: 'C9CEBQPGE' #sap-tech-gardener
slack_cfg_name: 'scp_workspace'
component_descriptor: ~
publish:
dockerimages:
gardener-extension-shoot-fleet-agent:
tag_as_latest: true

3
.ci/prepare_release Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
"$(dirname $0)"/../vendor/github.com/gardener/gardener/hack/.ci/prepare_release "$(dirname $0)"/.. github.com/gardener gardener-extension-shoot-fleet-agent

3
.ci/set_dependency_version Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
"$(dirname $0)"/../vendor/github.com/gardener/gardener/hack/.ci/set_dependency_version

17
.ci/verify Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
cd "$(dirname $0)/.."
git config --global user.email "gardener@sap.com"
git config --global user.name "Gardener CI/CD"
# Required due to https://github.com/kubernetes/kubernetes/issues/86753 - can be removed once the issue is fixed.
mkdir -p /go/src/github.com/gardener/gardener-extension-shoot-fleet-agent
cp -r . /go/src/github.com/gardener/gardener-extension-shoot-fleet-agent
cd /go/src/github.com/gardener/gardener-extension-shoot-fleet-agent
make verify-extended

39
.circleci/config.yaml Normal file
View File

@@ -0,0 +1,39 @@
version: 2
jobs:
build:
docker: # run the steps with Docker
- image: circleci/golang:1.15
auth:
username: javamachr
password: $DOCKERHUB_PASSWORD
steps:
- checkout # check out source code to working directory
- restore_cache:
keys:
- go-mod-v4-{{ checksum "go.sum" }}
- run:
name: Install requirements
command: make install-requirements
- run:
name: Generate sources
command: make generate
- run:
name: Docker login
command: make docker-login
- run:
name: Build docker images
command: make docker-images
- run:
name: Build docker images
command: make docker-images
- run:
name: Push docker images
command: make docker-push

22
.dockerignore Normal file
View File

@@ -0,0 +1,22 @@
# Ignore everything
**
# Exclude folders relevant for build
!charts/
!cmd/
!docs/
!example/
!hack/
!pkg/
!test/
!tools/
!vendor/
!.gitignore
!.golangci.yaml
!go.mod
!go.sum
!VERSION
!Makefile

39
.github/ISSUE_TEMPLATE/bug.md vendored Normal file
View File

@@ -0,0 +1,39 @@
---
name: Bug Report
about: Report a bug encountered while working with this Gardener extension
labels: kind/bug
---
**How to categorize this issue?**
<!--
Please select area, kind, and priority for this issue. This helps the community categorizing it.
Replace below TODOs or exchange the existing identifiers with those that fit best in your opinion.
If multiple identifiers make sense you can also state the commands multiple times, e.g.
/area control-plane
/area auto-scaling
...
"/area" identifiers: audit-logging|auto-scaling|backup|certification|control-plane-migration|control-plane|cost|delivery|dev-productivity|disaster-recovery|documentation|high-availability|logging|metering|monitoring|networking|open-source|operations|ops-productivity|os|performance|quality|robustness|scalability|security|storage|testing|usability|user-management
"/kind" identifiers: api-change|bug|cleanup|discussion|enhancement|epic|impediment|poc|post-mortem|question|regression|task|technical-debt|test
"/priority" identifiers: normal|critical|blocker
-->
/area TODO
/kind bug
/priority normal
**What happened**:
**What you expected to happen**:
**How to reproduce it (as minimally and precisely as possible)**:
**Anything else we need to know?**:
**Environment**:
- Gardener version (if relevant):
- Extension version:
- Kubernetes version (use `kubectl version`):
- Cloud provider or hardware configuration:
- Others:

27
.github/ISSUE_TEMPLATE/feature.md vendored Normal file
View File

@@ -0,0 +1,27 @@
---
name: Enhancement Request
about: Suggest an enhancement for this extension
labels: kind/enhancement
---
**How to categorize this issue?**
<!--
Please select area, kind, and priority for this issue. This helps the community categorizing it.
Replace below TODOs or exchange the existing identifiers with those that fit best in your opinion.
If multiple identifiers make sense you can also state the commands multiple times, e.g.
/area control-plane
/area auto-scaling
...
"/area" identifiers: audit-logging|auto-scaling|backup|certification|control-plane-migration|control-plane|cost|delivery|dev-productivity|disaster-recovery|documentation|high-availability|logging|metering|monitoring|networking|open-source|operations|ops-productivity|os|performance|quality|robustness|scalability|security|storage|testing|usability|user-management
"/kind" identifiers: api-change|bug|cleanup|discussion|enhancement|epic|impediment|poc|post-mortem|question|regression|task|technical-debt|test
"/priority" identifiers: normal|critical|blocker
-->
/area TODO
/kind enhancement
/priority normal
**What would you like to be added**:
**Why is this needed**:

35
.github/ISSUE_TEMPLATE/flaking-test.md vendored Normal file
View File

@@ -0,0 +1,35 @@
---
name: Flaking Test
about: Report flaky tests or jobs in Gardener CI
title: "[Flaky Test] FLAKING TEST/SUITE"
labels: kind/flake
---
<!-- Please only use this template for submitting reports about flaky tests or jobs (pass or fail with no underlying change in code) in Gardener CI -->
**How to categorize this issue?**
<!--
Please select area, kind, and priority for this issue. This helps the community categorizing it.
Replace below TODOs or exchange the existing identifiers with those that fit best in your opinion.
If multiple identifiers make sense you can also state the commands multiple times, e.g.
/area control-plane
/area auto-scaling
...
"/area" identifiers: audit-logging|auto-scaling|backup|certification|control-plane-migration|control-plane|cost|delivery|dev-productivity|disaster-recovery|documentation|high-availability|logging|metering|monitoring|networking|open-source|operations|ops-productivity|os|performance|quality|robustness|scalability|security|storage|testing|usability|user-management
"/kind" identifiers: api-change|bug|cleanup|discussion|enhancement|epic|impediment|poc|post-mortem|question|regression|task|technical-debt|test
"/priority" identifiers: normal|critical|blocker
-->
/area testing
/kind flake
/priority normal
**Which test(s)/suite(s) are flaking**:
**CI link**:
**Reason for failure**:
**Anything else we need to know**:

14
.github/ISSUE_TEMPLATE/support.md vendored Normal file
View File

@@ -0,0 +1,14 @@
---
name: Support Request
about: Support request or question relating to this extension
labels: kind/question
---
<!--
STOP -- PLEASE READ!
GitHub is not the right place for support requests.
If you're looking for help, please post your question on the [Kubernetes Slack](http://slack.k8s.io/) ([#gardener](https://kubernetes.slack.com/messages/gardener) channel) or join our [weekly meetings](https://github.com/gardener/documentation/blob/master/CONTRIBUTING.md#weekly-meeting).
-->

40
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,40 @@
**How to categorize this PR?**
<!--
Please select area, kind, and priority for this pull request. This helps the community categorizing it.
Replace below TODOs or exchange the existing identifiers with those that fit best in your opinion.
If multiple identifiers make sense you can also state the commands multiple times, e.g.
/area control-plane
/area auto-scaling
...
"/area" identifiers: audit-logging|auto-scaling|backup|certification|control-plane-migration|control-plane|cost|delivery|dev-productivity|disaster-recovery|documentation|high-availability|logging|metering|monitoring|networking|open-source|ops-productivity|os|performance|quality|robustness|scalability|security|storage|testing|usability|user-management
"/kind" identifiers: api-change|bug|cleanup|discussion|enhancement|epic|impediment|poc|post-mortem|question|regression|task|technical-debt|test
"/priority" identifiers: normal|critical|blocker
For Gardener Enhancement Proposals (GEPs), please check the following [documentation](https://github.com/gardener/gardener/tree/master/docs/proposals/README.md) before submitting this pull request.
-->
/area TODO
/kind TODO
/priority normal
**What this PR does / why we need it**:
**Which issue(s) this PR fixes**:
Fixes #
**Special notes for your reviewer**:
**Release note**:
<!--
Write your release note:
1. Enter your release note in the below block.
2. If no release note is required, just write "NONE" within the block.
Format of block header: <category> <target_group>
Possible values:
- category: breaking|feature|bugfix|doc|other
- target_group: user|operator|developer|dependency
-->
```other operator
```

23
.gitignore vendored Normal file
View File

@@ -0,0 +1,23 @@
/.kube-secrets
/tmp
/dev
./dev
/local
**/dev
/bin
*.coverprofile
*.html
.vscode
.idea
.DS_Store
*~
TODO
# Virtual go & fuse
.virtualgo
.fuse_hidden*
# Packr generated files
*-packr.go

7
.golangci.yaml Normal file
View File

@@ -0,0 +1,7 @@
run:
concurrency: 4
deadline: 10m
linters:
disable:
- unused

13
Dockerfile Normal file
View File

@@ -0,0 +1,13 @@
############# builder
FROM eu.gcr.io/gardener-project/3rd/golang:1.15.5 AS builder
WORKDIR /go/src/github.com/gardener/gardener-extension-shoot-fleet-agent
COPY . .
RUN make install
############# gardener-extension-shoot-fleet-agent
FROM eu.gcr.io/gardener-project/3rd/alpine:3.12.3 AS gardener-extension-shoot-fleet-agent
COPY charts /charts
COPY --from=builder /go/bin/gardener-extension-shoot-fleet-agent /gardener-extension-shoot-fleet-agent
ENTRYPOINT ["/gardener-extension-shoot-fleet-agent"]

288
LICENSE.md Normal file
View File

@@ -0,0 +1,288 @@
```
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
## APIs
This project may include APIs to SAP or third party products or services. The use of these APIs, products and services may be subject to additional agreements. In no event shall the application of the Apache Software License, v.2 to this project grant any rights in or to these APIs, products or services that would alter, expand, be inconsistent with, or supersede any terms of these additional agreements. API means application programming interfaces, as well as their respective specifications and implementing code that allows other software products to communicate with or call on SAP or third party products or services (for example, SAP Enterprise Services, BAPIs, Idocs, RFCs and ABAP calls or other user exits) and may be made available through SAP or third party products, SDKs, documentation or other media.
## Subcomponents
This project includes the following subcomponents that are subject to separate license terms.
Your use of these subcomponents is subject to the separate license terms applicable to
each subcomponent.
Gardener.
https://github.com/gardener/gardener.
Copyright (c) 2019 SAP SE or an SAP affiliate company.
Apache 2 license (https://github.com/gardener/gardener/blob/master/LICENSE.md).
controller-runtime.
https://sigs.k8s.io/controller-runtime.
Copyright 2019 The Kubernetes Authors.
Apache 2 license (https://sigs.k8s.io/controller-runtime/LICENSE).
API.
https://git.k8s.io/api.
Copyright 2019 The Kubernetes Authors.
Apache 2 license (https://git.k8s.io/api/LICENSE).
APIMachinery.
https://git.k8s.io/apimachinery.
Copyright 2019 The Kubernetes Authors.
Apache 2 license (https://git.k8s.io/apimachinery/LICENSE).
Client-Go.
https://git.k8s.io/client-go.
Copyright 2017 The Kubernetes Authors.
Apache 2 license (https://git.k8s.io/client-go/LICENSE).
YAML marshaling and unmarshalling support for Go.
gopkg.in/yaml.v2.
Copyright 2011-2016 Canonical Ltd.
Apache 2 license (https://github.com/go-yaml/yaml/blob/v2/LICENSE)
Packr.
https://github.com/gobuffalo/packr
Copyright (c) 2016 Mark Bates.
MIT license (https://github.com/gobuffalo/packr/blob/master/LICENSE.txt)
Cobra.
https://github.com/spf13/cobra
Copyright 2019 Steve Francia.
Apache 2 license (https://github.com/spf13/cobra/blob/master/LICENSE.txt)
Ginkgo.
https://github.com/onsi/ginkgo.
Copyright (c) 2013-2014 Onsi Fakhouri.
MIT license (https://github.com/onsi/ginkgo/blob/master/LICENSE)
Gomega.
github.com/onsi/gomega.
Copyright (c) 2013-2014 Onsi Fakhouri.
MIT license (https://github.com/onsi/gomega/blob/master/LICENSE)
------
## MIT License
The MIT License (MIT)
Copyright (c) <year> <owner>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

120
Makefile Normal file
View File

@@ -0,0 +1,120 @@
# Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
EXTENSION_PREFIX := gardener-extension
NAME := shoot-fleet-agent
REGISTRY := javamachr
IMAGE_PREFIX := $(REGISTRY)/gardener-extension
REPO_ROOT := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
HACK_DIR := $(REPO_ROOT)/hack
VERSION := $(shell cat "$(REPO_ROOT)/VERSION")
LD_FLAGS := "-w -X github.com/javamachr/$(EXTENSION_PREFIX)-$(NAME)/pkg/version.Version=$(IMAGE_TAG)"
LEADER_ELECTION := false
IGNORE_OPERATION_ANNOTATION := true
#########################################
# Rules for local development scenarios #
#########################################
.PHONY: start
start:
@LEADER_ELECTION_NAMESPACE=garden GO111MODULE=on go run \
-mod=vendor \
-ldflags $(LD_FLAGS) \
./cmd/$(EXTENSION_PREFIX)-$(NAME) \
--ignore-operation-annotation=$(IGNORE_OPERATION_ANNOTATION) \
--leader-election=$(LEADER_ELECTION) \
--kubeconfig ./dev/kubeconfig \
--config=./example/00-config.yaml
#################################################################
# Rules related to binary build, Docker image build and release #
#################################################################
.PHONY: install
install:
@LD_FLAGS="-w -X github.com/gardener/$(EXTENSION_PREFIX)-$(NAME)/pkg/version.Version=$(VERSION)" \
$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/install.sh ./...
.PHONY: docker-login
docker-login:
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin
.PHONY: docker-images
docker-images:
@docker build -t $(IMAGE_PREFIX)-$(NAME):$(VERSION) -t $(IMAGE_PREFIX)-$(NAME):latest -f Dockerfile -m 6g --target $(EXTENSION_PREFIX)-$(NAME) .
.PHONY: docker-push
docker-push:
@docker push $(IMAGE_PREFIX)-$(NAME):$(VERSION)
#####################################################################
# Rules for verification, formatting, linting, testing and cleaning #
#####################################################################
.PHONY: install-requirements
install-requirements:
@go install -mod=vendor $(REPO_ROOT)/vendor/github.com/ahmetb/gen-crd-api-reference-docs
@go install -mod=vendor $(REPO_ROOT)/vendor/github.com/gobuffalo/packr/v2/packr2
@go install -mod=vendor $(REPO_ROOT)/vendor/github.com/golang/mock/mockgen
@go install -mod=vendor $(REPO_ROOT)/vendor/github.com/onsi/ginkgo/ginkgo
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/install-requirements.sh
.PHONY: revendor
revendor:
@GO111MODULE=on go mod vendor
@GO111MODULE=on go mod tidy
@chmod +x $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/*
@chmod +x $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/.ci/*
@$(REPO_ROOT)/hack/update-github-templates.sh
.PHONY: clean
clean:
@$(shell find ./example -type f -name "controller-registration.yaml" -exec rm '{}' \;)
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/clean.sh ./cmd/... ./pkg/... ./test/...
.PHONY: check-generate
check-generate:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/check-generate.sh $(REPO_ROOT)
.PHONY: check
check:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/check.sh --golangci-lint-config=./.golangci.yaml ./cmd/... ./pkg/... ./test/...
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/check-charts.sh ./charts
.PHONY: generate
generate:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/generate.sh ./charts/... ./cmd/... ./pkg/... ./test/...
@rm -rf ./pkg/client/fleet/clientset/internalversion;
.PHONY: format
format:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/format.sh ./cmd ./pkg ./test
.PHONY: test
test:
@SKIP_FETCH_TOOLS=1 $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test.sh ./cmd/... ./pkg/...
.PHONY: test-cov
test-cov:
@SKIP_FETCH_TOOLS=1 $(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test-cover.sh ./cmd/... ./pkg/...
.PHONY: test-clean
test-clean:
@$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/test-cover-clean.sh
.PHONY: verify
verify: check format test
.PHONY: verify-extended
verify-extended: install-requirements check-generate check format test-cov test-clean

15
NOTICE.md Normal file
View File

@@ -0,0 +1,15 @@
## Gardener Extensions
Copyright (c) 2017-2019 SAP SE or an SAP affiliate company. All rights reserved.
## Seed Source
The source code of this component was seeded based on a copy of the following files from [github.com/kubernetes-sigs](github.com/kubernetes-sigs):
controller-runtime.
https://sigs.k8s.io/controller-runtime.
Copyright 2018 The Kubernetes Authors.
Apache 2 license (https://sigs.k8s.io/controller-runtime/LICENSE).
Version: 0.1.9.
Commit-ID: f6f0bc9611363b43664d08fb097ab13243ef621d
Commit-Message: Merge pull request #263 from DirectXMan12/release/v0.1.9

59
README.md Normal file
View File

@@ -0,0 +1,59 @@
# [Gardener Extension for Fleet agent installation](https://gardener.cloud)
[![CI Build status](https://concourse.ci.gardener.cloud/api/v1/teams/gardener/pipelines/gardener-extension-shoot-fleet-agent-master/jobs/master-head-update-job/badge)](https://concourse.ci.gardener.cloud/teams/gardener/pipelines/gardener-extension-shoot-fleet-agent-master/jobs/master-head-update-job)
[![Go Report Card](https://goreportcard.com/badge/github.com/javamachr/gardener-extension-shoot-fleet-agent)](https://goreportcard.com/report/github.com/javamachr/gardener-extension-shoot-fleet-agent)
Project Gardener implements the automated management and operation of [Kubernetes](https://kubernetes.io/) clusters as a service. Its main principle is to leverage Kubernetes concepts for all of its tasks.
Recently, most of the vendor specific logic has been developed [in-tree](https://github.com/gardener/gardener). However, the project has grown to a size where it is very hard to extend, maintain, and test. With [GEP-1](https://github.com/gardener/gardener/blob/master/docs/proposals/01-extensibility.md) we have proposed how the architecture can be changed in a way to support external controllers that contain their very own vendor specifics. This way, we can keep Gardener core clean and independent.
## Configuration
Example configuration for this extension controller:
```yaml
apiVersion: shoot-fleet-agent-service.extensions.config.gardener.cloud/v1alpha1
kind: Configuration
clientConnection:
kubeconfig: #base64encoded kubeconfig of cluster running Fleet manager
labels: #extra labels to apply to Cluster registration
env: dev
```
## Extension-Resources
Example extension resource:
```yaml
apiVersion: extensions.gardener.cloud/v1alpha1
kind: Extension
metadata:
name: "extension-shoot-fleet-agent"
namespace: shoot--project--abc
spec:
type: shoot-fleet-agent
```
When an extension resource is reconciled, the extension controller will register Shoot cluster in Fleet management cluster(configured in kubeconfig in Configuration object above.
Please note, this extension controller relies on existing properly configured [Fleet multi-cluster deployment](https://fleet.rancher.io/multi-cluster-install/) configured above.
## How to start using or developing this extension controller locally
You can run the controller locally on your machine by executing `make start`. Please make sure to have the kubeconfig to the cluster you want to connect to ready in the `./dev/kubeconfig` file.
Static code checks and tests can be executed by running `VERIFY=true make all`. We are using Go modules for Golang package dependency management and [Ginkgo](https://github.com/onsi/ginkgo)/[Gomega](https://github.com/onsi/gomega) for testing.
## Feedback and Support
Feedback and contributions are always welcome. Please report bugs or suggestions as [GitHub issues](https://github.com/javamachr/gardener-extension-shoot-fleet-agent/issues) or join our [Slack channel #gardener](https://kubernetes.slack.com/messages/gardener) (please invite yourself to the Kubernetes workspace [here](http://slack.k8s.io)).
## Learn more!
Please find further resources about out project here:
* [Our landing page gardener.cloud](https://gardener.cloud/)
* ["Gardener, the Kubernetes Botanist" blog on kubernetes.io](https://kubernetes.io/blog/2018/05/17/gardener/)
* ["Gardener Project Update" blog on kubernetes.io](https://kubernetes.io/blog/2019/12/02/gardener-project-update/)
* [Gardener Extensions Golang library](https://godoc.org/github.com/gardener/gardener/extensions/pkg)
* [GEP-1 (Gardener Enhancement Proposal) on extensibility](https://github.com/gardener/gardener/blob/master/docs/proposals/01-extensibility.md)
* [Extensibility API documentation](https://github.com/gardener/gardener/tree/master/docs/extensions)

1
VERSION Normal file
View File

@@ -0,0 +1 @@
v1.0.0-dev

View File

@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

View File

@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for the Gardener Shoot Fleet Agent extension.
name: gardener-extension-shoot-fleet-agent
version: 0.1.0

View File

@@ -0,0 +1,18 @@
// Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:generate ../../vendor/github.com/gardener/gardener/hack/generate-controller-registration.sh extension-shoot-fleet-agent . ../../VERSION ../../example/controller-registration.yaml Extension:shoot-fleet-agent
// Package chart enables go:generate support for generating the correct controller registration.
package chart

View File

@@ -0,0 +1,36 @@
{{- define "name" -}}
gardener-extension-shoot-fleet-agent
{{- end -}}
{{- define "agentconfig" -}}
---
apiVersion: shoot-fleet-agent-service.extensions.config.gardener.cloud/v1alpha1
kind: FleetAgentConfig
clientConnection:
kubeconfig: {{ .Values.fleetManager.kubeconfig }}
{{- if .Values.fleetManager.labels }}
labels: {{ .Values.fleetManager.labels | toYaml }}
{{- end }}
{{- end }}
{{- define "image" -}}
{{- if hasPrefix "sha256:" .Values.image.tag }}
{{- printf "%s@%s" .Values.image.repository .Values.image.tag }}
{{- else }}
{{- printf "%s:%s" .Values.image.repository .Values.image.tag }}
{{- end }}
{{- end }}
{{- define "priorityclassversion" -}}
{{- if semverCompare ">= 1.14-0" .Capabilities.KubeVersion.GitVersion -}}
scheduling.k8s.io/v1
{{- else if semverCompare ">= 1.11-0" .Capabilities.KubeVersion.GitVersion -}}
scheduling.k8s.io/v1beta1
{{- else -}}
scheduling.k8s.io/v1alpha1
{{- end -}}
{{- end -}}
{{- define "leaderelectionid" -}}
extension-shoot-fleet-agent-leader-election
{{- end -}}

View File

@@ -0,0 +1,13 @@
{{- if .Values.imageVectorOverwrite }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "name" . }}-imagevector-overwrite
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ include "name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
data:
images_overwrite.yaml: |
{{ .Values.imageVectorOverwrite | indent 4 }}
{{- end }}

View File

@@ -0,0 +1,74 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gardener-extension-shoot-fleet-agent
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: gardener-extension-shoot-fleet-agent
helm.sh/chart: gardener-extension-shoot-fleet-agent
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
revisionHistoryLimit: 0
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: gardener-extension-shoot-fleet-agent
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
annotations:
checksum/secret-fleet-service-config: {{ include "agentconfig" . | sha256sum }}
{{- if .Values.imageVectorOverwrite }}
checksum/configmap-extension-imagevector-overwrite: {{ include (print $.Template.BasePath "/configmap-imagevector-overwrite.yaml") . | sha256sum }}
{{- end }}
labels:
app.kubernetes.io/name: gardener-extension-shoot-fleet-agent
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
priorityClassName: gardener-extension-shoot-fleet-agent
serviceAccountName: gardener-extension-shoot-fleet-agent
containers:
- name: gardener-extension-shoot-fleet-agent
image: {{ include "image" . }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- /gardener-extension-shoot-fleet-agent
- --config=/etc/fleet-service/config.yaml
- --max-concurrent-reconciles={{ .Values.controllers.concurrentSyncs }}
- --healthcheck-max-concurrent-reconciles={{ .Values.controllers.healthcheck.concurrentSyncs }}
- --disable-controllers={{ .Values.disableControllers | join "," }}
- --ignore-operation-annotation={{ .Values.controllers.ignoreOperationAnnotation }}
- --leader-election-id={{ include "leaderelectionid" . }}
env:
- name: LEADER_ELECTION_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- if .Values.imageVectorOverwrite }}
- name: IMAGEVECTOR_OVERWRITE
value: /charts_overwrite/images_overwrite.yaml
{{- end }}
{{- if .Values.resources }}
resources:
{{ toYaml .Values.resources | trim | indent 10 }}
{{- end }}
volumeMounts:
- name: fleet-service-config
mountPath: /etc/fleet-service
readOnly: true
{{- if .Values.imageVectorOverwrite }}
- name: extension-imagevector-overwrite
mountPath: /charts_overwrite/
readOnly: true
{{- end }}
volumes:
- name: fleet-service-config
secret:
secretName: extension-shoot-fleet-agent-service.config
{{- if .Values.imageVectorOverwrite }}
- name: extension-imagevector-overwrite
configMap:
name: {{ include "name" .}}-imagevector-overwrite
defaultMode: 420
{{- end }}

View File

@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: extension-shoot-fleet-agent-service.config
namespace: {{ .Release.Namespace }}
data:
config.yaml: {{ include "agentconfig" . | b64enc | trim }}

View File

@@ -0,0 +1,7 @@
apiVersion: {{ include "priorityclassversion" . }}
kind: PriorityClass
metadata:
name: gardener-extension-shoot-fleet-agent
value: 1000000000
globalDefault: true
description: "Priority class for the Gardener extension: shoot-fleet-agent."

View File

@@ -0,0 +1,16 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: extensions.gardener.cloud:extension-shoot-fleet-agent
labels:
app.kubernetes.io/name: gardener-extension-shoot-fleet-agent
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
rules:
- apiGroups:
- ""
resources:
- "secrets"
verbs:
- "*"

View File

@@ -0,0 +1,113 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: gardener-extension-shoot-fleet-agent
labels:
app.kubernetes.io/name: gardener-extension-shoot-fleet-agent
helm.sh/chart: gardener-extension-shoot-fleet-agent
app.kubernetes.io/instance: {{ .Release.Name }}
rules:
- apiGroups:
- extensions.gardener.cloud
resources:
- clusters
verbs:
- get
- list
- watch
- apiGroups:
- extensions.gardener.cloud
resources:
- extensions
- extensions/status
verbs:
- get
- list
- watch
- patch
- update
- apiGroups:
- ""
resources:
- namespaces
verbs:
- get
- list
- watch
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- get
- create
- update
- patch
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterroles
- clusterrolebindings
- roles
- rolebindings
verbs:
- get
- create
- update
- patch
- delete
- apiGroups:
- ""
resources:
- "configmaps"
- "secrets"
- "events"
- "services"
- "pods"
- "serviceaccounts"
verbs:
- "*"
- apiGroups:
- "apps"
resources:
- "deployments"
verbs:
- get
- create
- update
- patch
- delete
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- create
- apiGroups:
- coordination.k8s.io
resources:
- leases
resourceNames:
- {{ include "leaderelectionid" . }}
verbs:
- update
- get
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: gardener-extension-shoot-fleet-agent
labels:
app.kubernetes.io/name: gardener-extension-shoot-fleet-agent
helm.sh/chart: gardener-extension-shoot-fleet-agent
app.kubernetes.io/instance: {{ .Release.Name }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: gardener-extension-shoot-fleet-agent
subjects:
- kind: ServiceAccount
name: gardener-extension-shoot-fleet-agent
namespace: {{ .Release.Namespace }}

View File

@@ -0,0 +1,10 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: gardener-extension-shoot-fleet-agent
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: gardener-extension-shoot-fleet-agent
helm.sh/chart: gardener-extension-shoot-fleet-agent
app.kubernetes.io/instance: {{ .Release.Name }}

View File

@@ -0,0 +1,22 @@
{{- if .Values.vpa.enabled}}
apiVersion: "autoscaling.k8s.io/v1beta2"
kind: VerticalPodAutoscaler
metadata:
name: gardener-extension-shoot-fleet-agent-vpa
namespace: {{ .Release.Namespace }}
spec:
{{- if .Values.vpa.resourcePolicy }}
resourcePolicy:
containerPolicies:
- containerName: '*'
minAllowed:
cpu: {{ required ".Values.vpa.resourcePolicy.minAllowed.cpu is required" .Values.vpa.resourcePolicy.minAllowed.cpu }}
memory: {{ required ".Values.vpa.resourcePolicy.minAllowed.memory is required" .Values.vpa.resourcePolicy.minAllowed.memory }}
{{- end }}
targetRef:
apiVersion: apps/v1
kind: Deployment
name: gardener-extension-shoot-fleet-agent
updatePolicy:
updateMode: {{ .Values.vpa.updatePolicy.updateMode }}
{{- end }}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,95 @@
// Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package app
import (
"context"
"fmt"
"github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/controller"
"github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/controller/healthcheck"
extensionscontroller "github.com/gardener/gardener/extensions/pkg/controller"
"github.com/gardener/gardener/extensions/pkg/util"
"github.com/spf13/cobra"
corev1 "k8s.io/api/core/v1"
componentbaseconfig "k8s.io/component-base/config"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager"
)
// NewServiceControllerCommand creates a new command that is used to start the Fleet Service controller.
func NewServiceControllerCommand() *cobra.Command {
options := NewOptions()
cmd := &cobra.Command{
Use: "shoot-fleet-agent-controller-manager",
Short: "Shoot Fleet Service Controller manages components which register Cluster in Fleet.",
SilenceErrors: true,
RunE: func(cmd *cobra.Command, args []string) error {
if err := options.optionAggregator.Complete(); err != nil {
return fmt.Errorf("error completing options: %s", err)
}
cmd.SilenceUsage = true
return options.run(cmd.Context())
},
}
options.optionAggregator.AddFlags(cmd.Flags())
return cmd
}
func (o *Options) run(ctx context.Context) error {
// TODO: Make these flags configurable via command line parameters or component config file.
util.ApplyClientConnectionConfigurationToRESTConfig(&componentbaseconfig.ClientConnectionConfiguration{
QPS: 100.0,
Burst: 130,
}, o.restOptions.Completed().Config)
mgrOpts := o.managerOptions.Completed().Options()
mgrOpts.ClientDisableCacheFor = []client.Object{
&corev1.Secret{}, // applied for ManagedResources
&corev1.ConfigMap{}, // applied for monitoring config
}
mgr, err := manager.New(o.restOptions.Completed().Config, mgrOpts)
if err != nil {
return fmt.Errorf("could not instantiate controller-manager: %s", err)
}
if err := extensionscontroller.AddToScheme(mgr.GetScheme()); err != nil {
return fmt.Errorf("could not update manager scheme: %s", err)
}
ctrlConfig := o.fleetOptions.Completed()
ctrlConfig.Apply(&controller.DefaultAddOptions.ServiceConfig)
o.controllerOptions.Completed().Apply(&controller.DefaultAddOptions.ControllerOptions)
o.healthOptions.Completed().Apply(&healthcheck.DefaultAddOptions.Controller)
o.reconcileOptions.Completed().Apply(&controller.DefaultAddOptions.IgnoreOperationAnnotation)
if err := o.controllerSwitches.Completed().AddToManager(mgr); err != nil {
return fmt.Errorf("could not add controllers to manager: %s", err)
}
if err := mgr.Start(ctx); err != nil {
return fmt.Errorf("error running manager: %s", err)
}
return nil
}

View File

@@ -0,0 +1,74 @@
// Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package app
import (
"os"
fleetagentservicecmd "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/cmd"
controllercmd "github.com/gardener/gardener/extensions/pkg/controller/cmd"
)
// ExtensionName is the name of the extension.
const ExtensionName = "extension-shoot-fleet-agent"
// Options holds configuration passed to the Fleet Service controller.
type Options struct {
fleetOptions *fleetagentservicecmd.FleetServiceOptions
restOptions *controllercmd.RESTOptions
managerOptions *controllercmd.ManagerOptions
controllerOptions *controllercmd.ControllerOptions
healthOptions *controllercmd.ControllerOptions
controllerSwitches *controllercmd.SwitchOptions
reconcileOptions *controllercmd.ReconcilerOptions
optionAggregator controllercmd.OptionAggregator
}
// NewOptions creates a new Options instance.
func NewOptions() *Options {
options := &Options{
fleetOptions: &fleetagentservicecmd.FleetServiceOptions{},
restOptions: &controllercmd.RESTOptions{},
managerOptions: &controllercmd.ManagerOptions{
// These are default values.
LeaderElection: true,
LeaderElectionID: controllercmd.LeaderElectionNameID(ExtensionName),
LeaderElectionNamespace: os.Getenv("LEADER_ELECTION_NAMESPACE"),
},
controllerOptions: &controllercmd.ControllerOptions{
// This is a default value.
MaxConcurrentReconciles: 5,
},
healthOptions: &controllercmd.ControllerOptions{
// This is a default value.
MaxConcurrentReconciles: 5,
},
controllerSwitches: fleetagentservicecmd.ControllerSwitches(),
reconcileOptions: &controllercmd.ReconcilerOptions{},
}
options.optionAggregator = controllercmd.NewOptionAggregator(
options.restOptions,
options.managerOptions,
options.controllerOptions,
options.fleetOptions,
controllercmd.PrefixOption("healthcheck-", options.healthOptions),
options.controllerSwitches,
options.reconcileOptions,
)
return options
}

View File

@@ -0,0 +1,33 @@
// Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (
"github.com/javamachr/gardener-extension-shoot-fleet-agent/cmd/gardener-extension-shoot-fleet-agent/app"
controllercmd "github.com/gardener/gardener/extensions/pkg/controller/cmd"
"github.com/gardener/gardener/extensions/pkg/log"
runtimelog "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
)
func main() {
runtimelog.SetLogger(log.ZapLogger(false))
ctx := signals.SetupSignalHandler()
if err := app.NewServiceControllerCommand().ExecuteContext(ctx); err != nil {
controllercmd.LogErrAndExit(err, "error executing the main controller command")
}
}

View File

@@ -0,0 +1,79 @@
# Gardener Fleet agent management
## Introduction
Gardener comes with an extension that enables shoot owners to register their cluster in Fleet.
## Extension Installation
The `shoot-fleet-agent` extension can be deployed and configured via Gardener's native resource [ControllerRegistration](https://github.com/gardener/gardener/blob/master/docs/extensions/controllerregistration.md).
### Prerequisites
To let the `shoot-fleet-agent` operate properly, you need to have:
- a working cluster with Fleet multicluster setup enabled
- have kubeconfig with read/write access to cluster.fleet.cattle.io and secret resrouces in some namespace
### ControllerRegistration
An example of a `ControllerRegistration` for the `shoot-fleet-agent` can be found here: https://github.com/javamachr/gardener-extension-shoot-fleet-agent/blob/master/example/controller-registration.yaml
### Configuration
The `ControllerRegistration` contains a Helm chart which eventually deploy the `shoot-fleet-agent` to seed clusters.
```yaml
apiVersion: core.gardener.cloud/v1beta1
kind: ControllerRegistration
...
values:
clientConnection:
kubeconfig: abcd
labels:
```
If the `shoot-fleet-agent` should be enabled for every shoot cluster in your Gardener managed environment, you need to globally enable it in the `ControllerRegistration`:
```yaml
apiVersion: core.gardener.cloud/v1beta1
kind: ControllerRegistration
...
resources:
- globallyEnabled: true
kind: Extension
type: shoot-fleet-agent
```
Alternatively, you're given the option to only enable the service for certain shoots:
```yaml
kind: Shoot
apiVersion: core.gardener.cloud/v1beta1
...
spec:
extensions:
- type: shoot-fleet-agent
...
```
<style>
#body-inner blockquote {
border: 0;
padding: 10px;
margin-top: 40px;
margin-bottom: 40px;
border-radius: 4px;
background-color: rgba(0,0,0,0.05);
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
position:relative;
padding-left:60px;
}
#body-inner blockquote:before {
content: "!";
font-weight: bold;
position: absolute;
top: 0;
bottom: 0;
left: 0;
background-color: #00a273;
color: white;
vertical-align: middle;
margin: auto;
width: 36px;
font-size: 30px;
text-align: center;
}
</style>

View File

@@ -0,0 +1,51 @@
# Register Shoot cluster in Fleet manager
## Introduction
Gardener takes care of provisioning clusters. It doesn't install anything into created clusters.
This extension enables App instalation via [Fleet](https://fleet.rancher.io) by registering newly created Shoot clusters into Fleet manager.
### Service Scope
This service enables users to register Shoot cluster in Fleet.
```yaml
kind: Shoot
...
spec:
extensions:
- type: shoot-fleet-agent
providerConfig:
apiVersion: service.fleet-agent.extensions.gardener.cloud/v1alpha1
kind:
clientConnection:
kubeconfig: base64 encoded kubeconfig
labels:
env: test
```
<style>
#body-inner blockquote {
border: 0;
padding: 10px;
margin-top: 40px;
margin-bottom: 40px;
border-radius: 4px;
background-color: rgba(0,0,0,0.05);
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
position:relative;
padding-left:60px;
}
#body-inner blockquote:before {
content: "!";
font-weight: bold;
position: absolute;
top: 0;
bottom: 0;
left: 0;
background-color: #00a273;
color: white;
vertical-align: middle;
margin: auto;
width: 36px;
font-size: 30px;
text-align: center;
}
</style>

5
example/00-config.yaml Normal file
View File

@@ -0,0 +1,5 @@
apiVersion: shoot-fleet-agent-service.extensions.config.gardener.cloud/v1alpha1
kind: FleetAgentConfig
clientConnection:
kubeconfig: #base64 encoded kubeconfig
namespace: clusters #namespace to register clusters in fleet manager cluster

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,23 @@
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: clusters.extensions.gardener.cloud
spec:
group: extensions.gardener.cloud
versions:
- name: v1alpha1
served: true
storage: true
version: v1alpha1
scope: Cluster
names:
plural: clusters
singular: cluster
kind: Cluster
additionalPrinterColumns:
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
subresources:
status: {}

View File

@@ -0,0 +1,120 @@
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: extensions.extensions.gardener.cloud
spec:
group: extensions.gardener.cloud
versions:
- name: v1alpha1
served: true
storage: true
version: v1alpha1
scope: Namespaced
names:
plural: extensions
singular: extension
kind: Extension
shortNames:
- ext
additionalPrinterColumns:
- name: Type
type: string
description: The type of the Extension resource.
JSONPath: .spec.type
- name: State
type: string
JSONPath: .status.lastOperation.state
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
properties:
type:
description: Type contains the instance of the resource's kind.
type: string
providerConfig:
description: ProviderConfig holds the configuration for the acting extension controller.
type: object
required:
- type
status:
properties:
lastError:
description: LastError holds information about the last occurred error
during an operation.
properties:
codes:
description: Well-defined error codes of the last error(s).
items:
type: string
type: array
description:
description: A human readable message indicating details about the
last error.
type: string
required:
- description
type: object
lastOperation:
description: LastOperation holds information about the last operation
on the resource.
properties:
description:
description: A human readable message indicating details about the
last operation.
type: string
lastUpdateTime:
description: Last time the operation state transitioned from one
to another.
format: date-time
type: string
progress:
description: The progress in percentage (0-100) of the last operation.
format: int64
type: integer
state:
description: Status of the last operation, one of Aborted, Processing,
Succeeded, Error, Failed.
type: string
type:
description: Type of the last operation, one of Create, Reconcile,
Delete.
type: string
required:
- description
- lastUpdateTime
- progress
- state
- type
type: object
observedGeneration:
description: ObservedGeneration is the most recent generation observed
for this resource.
format: int64
type: integer
state:
description: State can be filled by the operating controller with what
ever data it needs.
type: string
providerStatus:
description: Provider-specific output for this control plane
type: object
type: object

View File

@@ -0,0 +1,45 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: issuers.cert.gardener.cloud
labels:
app.kubernetes.io/name: gardener-extension-shoot-fleet-agent
spec:
additionalPrinterColumns:
- JSONPath: .spec.acme.server
description: ACME Server
name: SERVER
type: string
- JSONPath: .spec.acme.email
description: ACME Registration email
name: EMAIL
type: string
- JSONPath: .status.state
description: Status of registration
name: STATUS
type: string
- JSONPath: .status.type
description: Issuer type
name: TYPE
type: string
- JSONPath: .metadata.creationTimestamp
name: AGE
type: date
conversion:
strategy: None
group: cert.gardener.cloud
names:
kind: Issuer
listKind: IssuerList
plural: issuers
shortNames:
- issuer
singular: issuer
scope: Namespaced
subresources:
status: {}
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true

View File

@@ -0,0 +1,36 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: managedresources.resources.gardener.cloud
spec:
group: resources.gardener.cloud
versions:
- name: v1alpha1
served: true
storage: true
version: v1alpha1
scope: Namespaced
names:
plural: managedresources
singular: managedresource
kind: ManagedResource
shortNames:
- mr
additionalPrinterColumns:
- name: Class
type: string
description: The class identifies which resource manager is responsible for this ManagedResource.
JSONPath: .spec.class
- name: Applied
type: string
description: Indicates whether all resources have been applied.
JSONPath: .status.conditions[?(@.type=="ResourcesApplied")].status
- name: Healthy
type: string
description: Indicates whether all resources are healthy.
JSONPath: .status.conditions[?(@.type=="ResourcesHealthy")].status
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
subresources:
status: {}

23
example/25-rbac.yaml Normal file
View File

@@ -0,0 +1,23 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: gardener-extension-shoot-fleet-agent
labels:
app.kubernetes.io/name: gardener-extension-shoot-fleet-agent
rules:
- apiGroups:
- ""
resources:
- configmaps
resourceNames:
- gardener-extension-shoot-fleet-agent
verbs:
- get
- update
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create

28
example/30-cluster.yaml Normal file
View File

@@ -0,0 +1,28 @@
---
apiVersion: extensions.gardener.cloud/v1alpha1
kind: Cluster
metadata:
name: shoot--foo--bar
spec:
cloudProfile:
apiVersion: core.gardener.cloud/v1beta1
kind: CloudProfile
seed:
apiVersion: core.gardener.cloud/v1beta1
kind: Seed
shoot:
apiVersion: core.gardener.cloud/v1beta1
kind: Shoot
metadata:
generation: 1
name: shoot--foo--bar
spec:
dns:
domain: foo.bar.example.com
kubernetes:
version: 1.18.2
status:
lastOperation:
state: Succeeded
observedGeneration: 1

11
example/30-extension.yaml Normal file
View File

@@ -0,0 +1,11 @@
---
apiVersion: extensions.gardener.cloud/v1alpha1
kind: Extension
metadata:
name: certificate-service
namespace: shoot--foo--bar
spec:
type: shoot-fleet-agent
providerConfig:
apiVersion: service.cert.extensions.gardener.cloud/v1alpha1
kind: CertConfig

File diff suppressed because one or more lines are too long

46
go.mod Normal file
View File

@@ -0,0 +1,46 @@
module github.com/javamachr/gardener-extension-shoot-fleet-agent
go 1.15
require (
github.com/ahmetb/gen-crd-api-reference-docs v0.2.0
github.com/gardener/etcd-druid v0.3.0 // indirect
github.com/gardener/gardener v1.15.1-0.20210115062544-6dc08568692a
github.com/go-logr/logr v0.3.0
github.com/gobuffalo/packr/v2 v2.8.1
github.com/golang/mock v1.4.4-0.20200731163441-8734ec565a4d
github.com/karrick/godirwalk v1.16.1 // indirect
github.com/nwaples/rardecode v1.1.0 // indirect
github.com/onsi/ginkgo v1.14.1
github.com/onsi/gomega v1.10.2 // indirect
github.com/pierrec/lz4 v2.5.2+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rancher/fleet/pkg/apis v0.0.0-20200909045814-3675caaa7070
github.com/rogpeppe/go-internal v1.7.0 // indirect
github.com/sirupsen/logrus v1.7.0 // indirect
github.com/spf13/cobra v1.1.1
github.com/spf13/pflag v1.0.5
github.com/ulikunitz/xz v0.5.7 // indirect
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a // indirect
golang.org/x/sys v0.0.0-20210123111255-9b0068b26619 // indirect
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf // indirect
golang.org/x/tools v0.1.0 // indirect
k8s.io/api v0.19.6
k8s.io/apimachinery v0.19.6
k8s.io/client-go v11.0.1-0.20190409021438-1a26190bd76a+incompatible
k8s.io/code-generator v0.19.6
k8s.io/component-base v0.19.6
k8s.io/utils v0.0.0-20200912215256-4140de9c8800 // indirect
sigs.k8s.io/controller-runtime v0.7.1
)
replace (
k8s.io/api => k8s.io/api v0.19.6
k8s.io/apimachinery => k8s.io/apimachinery v0.19.6
k8s.io/apiserver => k8s.io/apiserver v0.19.6
k8s.io/client-go => k8s.io/client-go v0.19.6
k8s.io/code-generator => k8s.io/code-generator v0.19.6
k8s.io/component-base => k8s.io/component-base v0.19.6
k8s.io/helm => k8s.io/helm v2.13.1+incompatible
)

1695
go.sum Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
{
"hideMemberFields": [
"TypeMeta"
],
"hideTypePatterns": [
"ParseError$",
"List$"
],
"externalPackages": [
{
"typeMatchPrefix": "^k8s\\.io/(api|apimachinery/pkg/apis)/",
"docsURLTemplate": "https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.15/#{{lower .TypeIdentifier}}-{{arrIndex .PackageSegments -1}}-{{arrIndex .PackageSegments -2}}"
},
{
"typeMatchPrefix": "github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config",
"docsURLTemplate": "https://github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config"
}
],
"typeDisplayNamePrefixOverrides": {
"k8s.io/api/": "Kubernetes ",
"k8s.io/apimachinery/pkg/apis/": "Kubernetes "
},
"markdownDisabled": false
}

View File

@@ -0,0 +1,97 @@
<p>Packages:</p>
<ul>
<li>
<a href="#shoot-fleet-agent-service.extensions.config.gardener.cloud%2fv1alpha1">shoot-fleet-agent-service.extensions.config.gardener.cloud/v1alpha1</a>
</li>
</ul>
<h2 id="shoot-fleet-agent-service.extensions.config.gardener.cloud/v1alpha1">shoot-fleet-agent-service.extensions.config.gardener.cloud/v1alpha1</h2>
<p>
<p>Package v1alpha1 contains the Azure provider configuration API resources.</p>
</p>
Resource Types:
<ul><li>
<a href="#shoot-fleet-agent-service.extensions.config.gardener.cloud/v1alpha1.FleetAgentConfig">FleetAgentConfig</a>
</li></ul>
<h3 id="shoot-fleet-agent-service.extensions.config.gardener.cloud/v1alpha1.FleetAgentConfig">FleetAgentConfig
</h3>
<p>
<p>FleetAgentConfig configuration resource</p>
</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>apiVersion</code></br>
string</td>
<td>
<code>
shoot-fleet-agent-service.extensions.config.gardener.cloud/v1alpha1
</code>
</td>
</tr>
<tr>
<td>
<code>kind</code></br>
string
</td>
<td><code>FleetAgentConfig</code></td>
</tr>
<tr>
<td>
<code>clientConnection</code></br>
<em>
k8s.io/component-base/config/v1alpha1.ClientConnectionConfiguration
</em>
</td>
<td>
<em>(Optional)</em>
<p>ClientConnection specifies the kubeconfig file and client connection
settings for the proxy server to use when communicating with the apiserver.</p>
</td>
</tr>
<tr>
<td>
<code>labels</code></br>
<em>
map[string]string
</em>
</td>
<td>
<p>labels to use in Fleet Cluster registration</p>
</td>
</tr>
<tr>
<td>
<code>namespace</code></br>
<em>
string
</em>
</td>
<td>
<p>namespace to store clusters registrations in Fleet managers cluster</p>
</td>
</tr>
<tr>
<td>
<code>healthCheckConfig</code></br>
<em>
<a href="https://github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config">
github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config.HealthCheckConfig
</a>
</em>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<hr/>
<p><em>
Generated with <a href="https://github.com/ahmetb/gen-crd-api-reference-docs">gen-crd-api-reference-docs</a>
</em></p>

57
hack/component_descriptor Executable file
View File

@@ -0,0 +1,57 @@
#!/usr/bin/env bash
# taken from github.com/gardener and modified slightly to acommodate changed image-repository for this repository
set -e
repo_root_dir="$1"
repo_name="${2:-github.com/gardener/gardener}"
descriptor_out_file="${COMPONENT_DESCRIPTOR_PATH}"
echo "enriching creating component descriptor from ${BASE_DEFINITION_PATH}"
if [[ -f "$repo_root_dir/charts/images.yaml" ]]; then
images="$(yaml2json < "$repo_root_dir/charts/images.yaml")"
eval "$(jq -r ".images |
map(select(.sourceRepository != \"$repo_name\") |
if (.name == \"hyperkube\" or .name == \"kube-apiserver\" or .name == \"kube-controller-manager\" or .name == \"kube-scheduler\" or .name == \"kube-proxy\" or .repository == \"k8s.gcr.io/hyperkube\") then
\"--generic-dependencies '{\\\"name\\\": \\\"\" + .name + \"\\\", \\\"version\\\": \\\"\" + .tag + \"\\\"}'\"
elif (.repository | startswith(\"eu.gcr.io/gardener-project/cert-controller-manager\")) then
\"--component-dependencies '{\\\"name\\\": \\\"\" + .sourceRepository + \"\\\", \\\"version\\\": \\\"\" + .tag + \"\\\"}'\"
else
\"--container-image-dependencies '{\\\"name\\\": \\\"\" + .name + \"\\\", \\\"image_reference\\\": \\\"\" + .repository + \":\" + .tag + \"\\\", \\\"version\\\": \\\"\" + .tag + \"\\\"}'\"
end) |
\"${ADD_DEPENDENCIES_CMD} \\\\\n\" +
join(\" \\\\\n\")" <<< "$images")"
fi
if [[ -d "$repo_root_dir/charts/" ]]; then
for image_tpl_path in "$repo_root_dir/charts/"*"/templates/_images.tpl"; do
if [[ ! -f "$image_tpl_path" ]]; then
continue
fi
outputFile=$(sed 's/{{-//' $image_tpl_path | sed 's/}}//' | sed 's/define//' | sed 's/-//' | sed 's/end//' | sed 's/"//' | sed 's/"//' |sed 's/image.//' | sed -e 's/^[ \t]*//' | awk -v RS= '{for (i=1; i<=NF; i++) printf "%s%s", $i, (i==NF?"\n":" ")}')
echo "enriching creating component descriptor from ${image_tpl_path}"
while read p; do
line="$(echo -e "$p")"
IFS=' ' read -r -a array <<< "$line"
IFS=': ' read -r -a imageAndTag <<< ${array[1]}
NAME=${array[0]}
REPOSITORY=${imageAndTag[0]}
TAG=${imageAndTag[1]}
gardener="eu.gcr.io/gardener-project/gardener"
if [[ "$NAME" == "hyperkube" ]]; then
${ADD_DEPENDENCIES_CMD} --generic-dependencies "{\"name\": \"$NAME\", \"version\": \"$TAG\"}"
elif [[ $REPOSITORY =~ "eu.gcr.io/gardener-project/gardener"* ]]; then
${ADD_DEPENDENCIES_CMD} --generic-dependencies "{\"name\": \"$NAME\", \"version\": \"$TAG\"}"
else
${ADD_DEPENDENCIES_CMD} --container-image-dependencies "{\"name\": \"${NAME}\", \"image_reference\": \"${REPOSITORY}:${TAG}\", \"version\": \"$TAG\"}"
fi
done < <(echo "$outputFile")
done
fi
cp "${BASE_DEFINITION_PATH}" "${descriptor_out_file}"

32
hack/tools.go Normal file
View File

@@ -0,0 +1,32 @@
// +build tools
// Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// This package imports things required by build scripts, to force `go mod` to see them as dependencies
package tools
import (
_ "github.com/gardener/gardener/.github"
_ "github.com/gardener/gardener/.github/ISSUE_TEMPLATE"
_ "github.com/gardener/gardener/hack"
_ "github.com/gardener/gardener/hack/.ci"
_ "github.com/gardener/gardener/hack/api-reference/template"
_ "github.com/ahmetb/gen-crd-api-reference-docs"
_ "github.com/gobuffalo/packr/v2/packr2"
_ "github.com/golang/mock/mockgen"
_ "github.com/onsi/ginkgo/ginkgo"
_ "k8s.io/code-generator"
)

49
hack/update-codegen.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/bash
#
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
rm -f $GOPATH/bin/*-gen
PROJECT_ROOT=$(dirname $0)/..
bash "${PROJECT_ROOT}"/vendor/k8s.io/code-generator/generate-internal-groups.sh \
deepcopy,defaulter \
github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/componentconfig \
github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis \
github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis \
"config:v1alpha1" \
--go-header-file "${PROJECT_ROOT}/vendor/github.com/gardener/gardener/hack/LICENSE_BOILERPLATE.txt"
bash "${PROJECT_ROOT}"/vendor/k8s.io/code-generator/generate-internal-groups.sh \
conversion \
github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/componentconfig \
github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis \
github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis \
"config:v1alpha1" \
--extra-peer-dirs=github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config,github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config/v1alpha1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/conversion,k8s.io/apimachinery/pkg/runtime, github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config/v1alpha1 \
--go-header-file "${PROJECT_ROOT}/vendor/github.com/gardener/gardener/hack/LICENSE_BOILERPLATE.txt"
bash "${PROJECT_ROOT}"/vendor/k8s.io/code-generator/generate-internal-groups.sh \
conversion,client \
github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet \
github.com/rancher/fleet/pkg/apis \
github.com/rancher/fleet/pkg/apis \
"fleet.cattle.io:v1alpha1" \
--go-header-file "${PROJECT_ROOT}/vendor/github.com/gardener/gardener/hack/LICENSE_BOILERPLATE.txt"
#--extra-peer-dirs=github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config,github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config/v1alpha1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/conversion,k8s.io/apimachinery/pkg/runtime, github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config/v1alpha1

30
hack/update-github-templates.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/bash
#
# Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -o errexit
set -o nounset
set -o pipefail
mkdir -p "$(dirname $0)/../.github" "$(dirname $0)/../.github/ISSUE_TEMPLATE"
for file in `find "$(dirname $0)"/../vendor/github.com/gardener/gardener/.github -name '*.md'`; do
cat "$file" |\
sed 's/operating Gardener/working with this Gardener extension/g' |\
sed 's/to the Gardener project/for this extension/g' |\
sed 's/to Gardener/to this extension/g' |\
sed 's/- Gardener version:/- Gardener version (if relevant):\n- Extension version:/g' \
> "$(dirname $0)/../.github/${file#*.github/}"
done

5
pkg/apis/config/doc.go Normal file
View File

@@ -0,0 +1,5 @@
// +k8s:deepcopy-gen=package
// +groupName="shoot-fleet-agent-service.extensions.config.gardener.cloud"
//go:generate ../../../hack/update-codegen.sh
package config

View File

@@ -0,0 +1,31 @@
package install
import (
"github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config"
v1alpha1 "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config/v1alpha1"
v1alpha1fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
)
var (
schemeBuilder = runtime.NewSchemeBuilder(
v1alpha1.AddToScheme,
v1alpha1fleet.AddToScheme,
config.AddToScheme,
setVersionPriority,
)
// AddToScheme adds all APIs to the scheme.
AddToScheme = schemeBuilder.AddToScheme
)
func setVersionPriority(scheme *runtime.Scheme) error {
return scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion)
}
// Install installs all APIs in the scheme.
func Install(scheme *runtime.Scheme) {
utilruntime.Must(AddToScheme(scheme))
}

View File

@@ -0,0 +1,58 @@
package loader
import (
"io/ioutil"
"github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config"
"github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config/install"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer/json"
"k8s.io/apimachinery/pkg/runtime/serializer/versioning"
)
var (
Codec runtime.Codec
Scheme *runtime.Scheme
)
func init() {
Scheme = runtime.NewScheme()
install.Install(Scheme)
yamlSerializer := json.NewYAMLSerializer(json.DefaultMetaFactory, Scheme, Scheme)
Codec = versioning.NewDefaultingCodecForScheme(
Scheme,
yamlSerializer,
yamlSerializer,
schema.GroupVersion{Version: "v1alpha1"},
runtime.InternalGroupVersioner,
)
}
// LoadFromFile takes a filename and de-serializes the contents into FleetAgentConfig object.
func LoadFromFile(filename string) (*config.FleetAgentConfig, error) {
bytes, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
return Load(bytes)
}
// Load takes a byte slice and de-serializes the contents into FleetAgentConfig object.
// Encapsulates de-serialization without assuming the source is a file.
func Load(data []byte) (*config.FleetAgentConfig, error) {
cfg := &config.FleetAgentConfig{}
if len(data) == 0 {
return cfg, nil
}
decoded, _, err := Codec.Decode(data, &schema.GroupVersionKind{Version: "v1alpha1", Kind: "Config"}, cfg)
if err != nil {
return nil, err
}
return decoded.(*config.FleetAgentConfig), nil
}

View File

@@ -0,0 +1,37 @@
package config
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// GroupName is the group name use in this package
const GroupName = "shoot-fleet-agent-service.extensions.config.gardener.cloud"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
// schemeBuilder used to register the Shoot resource.
schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
// AddToScheme is a pointer to schemeBuilder.AddToScheme.
AddToScheme = schemeBuilder.AddToScheme
)
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&FleetAgentConfig{},
)
return nil
}

26
pkg/apis/config/types.go Normal file
View File

@@ -0,0 +1,26 @@
package config
import (
healthcheckconfig "github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
componentbaseconfig "k8s.io/component-base/config"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// FleetAgentConfig configuration resource
type FleetAgentConfig struct {
metav1.TypeMeta
// ClientConnection specifies the kubeconfig file and client connection
// settings for the proxy server to use when communicating with the apiserver.
ClientConnection *componentbaseconfig.ClientConnectionConfiguration
// labels to use in Fleet Cluster registration
Labels map[string]string
//namespace to store clusters registrations in Fleet managers cluster
Namespace string
HealthCheckConfig *healthcheckconfig.HealthCheckConfig
}

View File

@@ -0,0 +1,9 @@
package v1alpha1
import (
"k8s.io/apimachinery/pkg/runtime"
)
func addDefaultingFuncs(scheme *runtime.Scheme) error {
return RegisterDefaults(scheme)
}

View File

@@ -0,0 +1,10 @@
// +k8s:deepcopy-gen=package
// +k8s:conversion-gen=github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config
// +k8s:openapi-gen=true
// +k8s:defaulter-gen=TypeMeta
//go:generate gen-crd-api-reference-docs -api-dir . -config ../../../../hack/api-reference/config.json -template-dir ../../../../vendor/github.com/gardener/gardener/hack/api-reference/template -out-file ../../../../hack/api-reference/config.md
// Package v1alpha1 contains the Azure provider configuration API resources.
// +groupName=shoot-fleet-agent-service.extensions.config.gardener.cloud
package v1alpha1

View File

@@ -0,0 +1,40 @@
package v1alpha1
import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// GroupName is the group name use in this package
const GroupName = "shoot-fleet-agent-service.extensions.config.gardener.cloud"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
// SchemeBuilder used to register the Shoot resource.
SchemeBuilder runtime.SchemeBuilder
localSchemeBuilder = &SchemeBuilder
// AddToScheme is a pointer to SchemeBuilder.AddToScheme.
AddToScheme = localSchemeBuilder.AddToScheme
)
func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(addDefaultingFuncs, addKnownTypes)
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&FleetAgentConfig{},
)
return nil
}

View File

@@ -0,0 +1,28 @@
package v1alpha1
import (
healthcheckconfig "github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
componentbaseconfigv1alpha1 "k8s.io/component-base/config/v1alpha1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// FleetAgentConfig configuration resource
type FleetAgentConfig struct {
metav1.TypeMeta `json:",inline"`
// ClientConnection specifies the kubeconfig file and client connection
// settings for the proxy server to use when communicating with the apiserver.
// +optional
ClientConnection *componentbaseconfigv1alpha1.ClientConnectionConfiguration `json:"clientConnection,omitempty"`
// labels to use in Fleet Cluster registration
Labels map[string]string `json:"labels,omitempty"`
//namespace to store clusters registrations in Fleet managers cluster
Namespace string `json:"namespace,omitempty"`
HealthCheckConfig *healthcheckconfig.HealthCheckConfig `json:"healthCheckConfig,omitempty"`
}

View File

@@ -0,0 +1,78 @@
// +build !ignore_autogenerated
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by conversion-gen. DO NOT EDIT.
package v1alpha1
import (
unsafe "unsafe"
healthcheckconfig "github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config"
config "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/apis/config"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
componentbaseconfig "k8s.io/component-base/config"
configv1alpha1 "k8s.io/component-base/config/v1alpha1"
)
func init() {
localSchemeBuilder.Register(RegisterConversions)
}
// RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes.
func RegisterConversions(s *runtime.Scheme) error {
if err := s.AddGeneratedConversionFunc((*FleetAgentConfig)(nil), (*config.FleetAgentConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_FleetAgentConfig_To_config_FleetAgentConfig(a.(*FleetAgentConfig), b.(*config.FleetAgentConfig), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*config.FleetAgentConfig)(nil), (*FleetAgentConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_config_FleetAgentConfig_To_v1alpha1_FleetAgentConfig(a.(*config.FleetAgentConfig), b.(*FleetAgentConfig), scope)
}); err != nil {
return err
}
return nil
}
func autoConvert_v1alpha1_FleetAgentConfig_To_config_FleetAgentConfig(in *FleetAgentConfig, out *config.FleetAgentConfig, s conversion.Scope) error {
out.ClientConnection = (*componentbaseconfig.ClientConnectionConfiguration)(unsafe.Pointer(in.ClientConnection))
out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels))
out.Namespace = in.Namespace
out.HealthCheckConfig = (*healthcheckconfig.HealthCheckConfig)(unsafe.Pointer(in.HealthCheckConfig))
return nil
}
// Convert_v1alpha1_FleetAgentConfig_To_config_FleetAgentConfig is an autogenerated conversion function.
func Convert_v1alpha1_FleetAgentConfig_To_config_FleetAgentConfig(in *FleetAgentConfig, out *config.FleetAgentConfig, s conversion.Scope) error {
return autoConvert_v1alpha1_FleetAgentConfig_To_config_FleetAgentConfig(in, out, s)
}
func autoConvert_config_FleetAgentConfig_To_v1alpha1_FleetAgentConfig(in *config.FleetAgentConfig, out *FleetAgentConfig, s conversion.Scope) error {
out.ClientConnection = (*configv1alpha1.ClientConnectionConfiguration)(unsafe.Pointer(in.ClientConnection))
out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels))
out.Namespace = in.Namespace
out.HealthCheckConfig = (*healthcheckconfig.HealthCheckConfig)(unsafe.Pointer(in.HealthCheckConfig))
return nil
}
// Convert_config_FleetAgentConfig_To_v1alpha1_FleetAgentConfig is an autogenerated conversion function.
func Convert_config_FleetAgentConfig_To_v1alpha1_FleetAgentConfig(in *config.FleetAgentConfig, out *FleetAgentConfig, s conversion.Scope) error {
return autoConvert_config_FleetAgentConfig_To_v1alpha1_FleetAgentConfig(in, out, s)
}

View File

@@ -0,0 +1,69 @@
// +build !ignore_autogenerated
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by deepcopy-gen. DO NOT EDIT.
package v1alpha1
import (
config "github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config"
runtime "k8s.io/apimachinery/pkg/runtime"
configv1alpha1 "k8s.io/component-base/config/v1alpha1"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FleetAgentConfig) DeepCopyInto(out *FleetAgentConfig) {
*out = *in
out.TypeMeta = in.TypeMeta
if in.ClientConnection != nil {
in, out := &in.ClientConnection, &out.ClientConnection
*out = new(configv1alpha1.ClientConnectionConfiguration)
**out = **in
}
if in.Labels != nil {
in, out := &in.Labels, &out.Labels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.HealthCheckConfig != nil {
in, out := &in.HealthCheckConfig, &out.HealthCheckConfig
*out = new(config.HealthCheckConfig)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FleetAgentConfig.
func (in *FleetAgentConfig) DeepCopy() *FleetAgentConfig {
if in == nil {
return nil
}
out := new(FleetAgentConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *FleetAgentConfig) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}

View File

@@ -0,0 +1,32 @@
// +build !ignore_autogenerated
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by defaulter-gen. DO NOT EDIT.
package v1alpha1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
return nil
}

View File

@@ -0,0 +1,69 @@
// +build !ignore_autogenerated
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by deepcopy-gen. DO NOT EDIT.
package config
import (
healthcheckconfig "github.com/gardener/gardener/extensions/pkg/controller/healthcheck/config"
runtime "k8s.io/apimachinery/pkg/runtime"
componentbaseconfig "k8s.io/component-base/config"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FleetAgentConfig) DeepCopyInto(out *FleetAgentConfig) {
*out = *in
out.TypeMeta = in.TypeMeta
if in.ClientConnection != nil {
in, out := &in.ClientConnection, &out.ClientConnection
*out = new(componentbaseconfig.ClientConnectionConfiguration)
**out = **in
}
if in.Labels != nil {
in, out := &in.Labels, &out.Labels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.HealthCheckConfig != nil {
in, out := &in.HealthCheckConfig, &out.HealthCheckConfig
*out = new(healthcheckconfig.HealthCheckConfig)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FleetAgentConfig.
func (in *FleetAgentConfig) DeepCopy() *FleetAgentConfig {
if in == nil {
return nil
}
out := new(FleetAgentConfig)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *FleetAgentConfig) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}

View File

@@ -0,0 +1,97 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package versioned
import (
"fmt"
fleetv1alpha1 "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/typed/fleet.cattle.io/v1alpha1"
discovery "k8s.io/client-go/discovery"
rest "k8s.io/client-go/rest"
flowcontrol "k8s.io/client-go/util/flowcontrol"
)
type Interface interface {
Discovery() discovery.DiscoveryInterface
FleetV1alpha1() fleetv1alpha1.FleetV1alpha1Interface
}
// Clientset contains the clients for groups. Each group has exactly one
// version included in a Clientset.
type Clientset struct {
*discovery.DiscoveryClient
fleetV1alpha1 *fleetv1alpha1.FleetV1alpha1Client
}
// FleetV1alpha1 retrieves the FleetV1alpha1Client
func (c *Clientset) FleetV1alpha1() fleetv1alpha1.FleetV1alpha1Interface {
return c.fleetV1alpha1
}
// Discovery retrieves the DiscoveryClient
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
if c == nil {
return nil
}
return c.DiscoveryClient
}
// NewForConfig creates a new Clientset for the given config.
// If config's RateLimiter is not set and QPS and Burst are acceptable,
// NewForConfig will generate a rate-limiter in configShallowCopy.
func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
if configShallowCopy.Burst <= 0 {
return nil, fmt.Errorf("burst is required to be greater than 0 when RateLimiter is not set and QPS is set to greater than 0")
}
configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
}
var cs Clientset
var err error
cs.fleetV1alpha1, err = fleetv1alpha1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
return &cs, nil
}
// NewForConfigOrDie creates a new Clientset for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *Clientset {
var cs Clientset
cs.fleetV1alpha1 = fleetv1alpha1.NewForConfigOrDie(c)
cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
return &cs
}
// New creates a new Clientset for the given RESTClient.
func New(c rest.Interface) *Clientset {
var cs Clientset
cs.fleetV1alpha1 = fleetv1alpha1.New(c)
cs.DiscoveryClient = discovery.NewDiscoveryClient(c)
return &cs
}

View File

@@ -0,0 +1,20 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated clientset.
package versioned

View File

@@ -0,0 +1,82 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
clientset "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned"
fleetv1alpha1 "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/typed/fleet.cattle.io/v1alpha1"
fakefleetv1alpha1 "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/typed/fleet.cattle.io/v1alpha1/fake"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/discovery"
fakediscovery "k8s.io/client-go/discovery/fake"
"k8s.io/client-go/testing"
)
// NewSimpleClientset returns a clientset that will respond with the provided objects.
// It's backed by a very simple object tracker that processes creates, updates and deletions as-is,
// without applying any validations and/or defaults. It shouldn't be considered a replacement
// for a real clientset and is mostly useful in simple unit tests.
func NewSimpleClientset(objects ...runtime.Object) *Clientset {
o := testing.NewObjectTracker(scheme, codecs.UniversalDecoder())
for _, obj := range objects {
if err := o.Add(obj); err != nil {
panic(err)
}
}
cs := &Clientset{tracker: o}
cs.discovery = &fakediscovery.FakeDiscovery{Fake: &cs.Fake}
cs.AddReactor("*", "*", testing.ObjectReaction(o))
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
gvr := action.GetResource()
ns := action.GetNamespace()
watch, err := o.Watch(gvr, ns)
if err != nil {
return false, nil, err
}
return true, watch, nil
})
return cs
}
// Clientset implements clientset.Interface. Meant to be embedded into a
// struct to get a default implementation. This makes faking out just the method
// you want to test easier.
type Clientset struct {
testing.Fake
discovery *fakediscovery.FakeDiscovery
tracker testing.ObjectTracker
}
func (c *Clientset) Discovery() discovery.DiscoveryInterface {
return c.discovery
}
func (c *Clientset) Tracker() testing.ObjectTracker {
return c.tracker
}
var _ clientset.Interface = &Clientset{}
// FleetV1alpha1 retrieves the FleetV1alpha1Client
func (c *Clientset) FleetV1alpha1() fleetv1alpha1.FleetV1alpha1Interface {
return &fakefleetv1alpha1.FakeFleetV1alpha1{Fake: &c.Fake}
}

View File

@@ -0,0 +1,20 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated fake clientset.
package fake

View File

@@ -0,0 +1,56 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
fleetv1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
)
var scheme = runtime.NewScheme()
var codecs = serializer.NewCodecFactory(scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
fleetv1alpha1.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
// of clientsets, like in:
//
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
var AddToScheme = localSchemeBuilder.AddToScheme
func init() {
v1.AddToGroupVersion(scheme, schema.GroupVersion{Version: "v1"})
utilruntime.Must(AddToScheme(scheme))
}

View File

@@ -0,0 +1,20 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package contains the scheme of the automatically generated clientset.
package scheme

View File

@@ -0,0 +1,56 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package scheme
import (
fleetv1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
)
var Scheme = runtime.NewScheme()
var Codecs = serializer.NewCodecFactory(Scheme)
var ParameterCodec = runtime.NewParameterCodec(Scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
fleetv1alpha1.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
// of clientsets, like in:
//
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
var AddToScheme = localSchemeBuilder.AddToScheme
func init() {
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
utilruntime.Must(AddToScheme(Scheme))
}

View File

@@ -0,0 +1,195 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// BundlesGetter has a method to return a BundleInterface.
// A group's client should implement this interface.
type BundlesGetter interface {
Bundles(namespace string) BundleInterface
}
// BundleInterface has methods to work with Bundle resources.
type BundleInterface interface {
Create(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.CreateOptions) (*v1alpha1.Bundle, error)
Update(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.UpdateOptions) (*v1alpha1.Bundle, error)
UpdateStatus(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.UpdateOptions) (*v1alpha1.Bundle, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Bundle, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.BundleList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Bundle, err error)
BundleExpansion
}
// bundles implements BundleInterface
type bundles struct {
client rest.Interface
ns string
}
// newBundles returns a Bundles
func newBundles(c *FleetV1alpha1Client, namespace string) *bundles {
return &bundles{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the bundle, and returns the corresponding bundle object, and an error if there is any.
func (c *bundles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Bundle, err error) {
result = &v1alpha1.Bundle{}
err = c.client.Get().
Namespace(c.ns).
Resource("bundles").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Bundles that match those selectors.
func (c *bundles) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BundleList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.BundleList{}
err = c.client.Get().
Namespace(c.ns).
Resource("bundles").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested bundles.
func (c *bundles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("bundles").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a bundle and creates it. Returns the server's representation of the bundle, and an error, if there is any.
func (c *bundles) Create(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.CreateOptions) (result *v1alpha1.Bundle, err error) {
result = &v1alpha1.Bundle{}
err = c.client.Post().
Namespace(c.ns).
Resource("bundles").
VersionedParams(&opts, scheme.ParameterCodec).
Body(bundle).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a bundle and updates it. Returns the server's representation of the bundle, and an error, if there is any.
func (c *bundles) Update(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.UpdateOptions) (result *v1alpha1.Bundle, err error) {
result = &v1alpha1.Bundle{}
err = c.client.Put().
Namespace(c.ns).
Resource("bundles").
Name(bundle.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(bundle).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *bundles) UpdateStatus(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.UpdateOptions) (result *v1alpha1.Bundle, err error) {
result = &v1alpha1.Bundle{}
err = c.client.Put().
Namespace(c.ns).
Resource("bundles").
Name(bundle.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(bundle).
Do(ctx).
Into(result)
return
}
// Delete takes name of the bundle and deletes it. Returns an error if one occurs.
func (c *bundles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("bundles").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *bundles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("bundles").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched bundle.
func (c *bundles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Bundle, err error) {
result = &v1alpha1.Bundle{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("bundles").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@@ -0,0 +1,195 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// BundleDeploymentsGetter has a method to return a BundleDeploymentInterface.
// A group's client should implement this interface.
type BundleDeploymentsGetter interface {
BundleDeployments(namespace string) BundleDeploymentInterface
}
// BundleDeploymentInterface has methods to work with BundleDeployment resources.
type BundleDeploymentInterface interface {
Create(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.CreateOptions) (*v1alpha1.BundleDeployment, error)
Update(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.UpdateOptions) (*v1alpha1.BundleDeployment, error)
UpdateStatus(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.UpdateOptions) (*v1alpha1.BundleDeployment, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.BundleDeployment, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.BundleDeploymentList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BundleDeployment, err error)
BundleDeploymentExpansion
}
// bundleDeployments implements BundleDeploymentInterface
type bundleDeployments struct {
client rest.Interface
ns string
}
// newBundleDeployments returns a BundleDeployments
func newBundleDeployments(c *FleetV1alpha1Client, namespace string) *bundleDeployments {
return &bundleDeployments{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the bundleDeployment, and returns the corresponding bundleDeployment object, and an error if there is any.
func (c *bundleDeployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BundleDeployment, err error) {
result = &v1alpha1.BundleDeployment{}
err = c.client.Get().
Namespace(c.ns).
Resource("bundledeployments").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of BundleDeployments that match those selectors.
func (c *bundleDeployments) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BundleDeploymentList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.BundleDeploymentList{}
err = c.client.Get().
Namespace(c.ns).
Resource("bundledeployments").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested bundleDeployments.
func (c *bundleDeployments) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("bundledeployments").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a bundleDeployment and creates it. Returns the server's representation of the bundleDeployment, and an error, if there is any.
func (c *bundleDeployments) Create(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.CreateOptions) (result *v1alpha1.BundleDeployment, err error) {
result = &v1alpha1.BundleDeployment{}
err = c.client.Post().
Namespace(c.ns).
Resource("bundledeployments").
VersionedParams(&opts, scheme.ParameterCodec).
Body(bundleDeployment).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a bundleDeployment and updates it. Returns the server's representation of the bundleDeployment, and an error, if there is any.
func (c *bundleDeployments) Update(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.UpdateOptions) (result *v1alpha1.BundleDeployment, err error) {
result = &v1alpha1.BundleDeployment{}
err = c.client.Put().
Namespace(c.ns).
Resource("bundledeployments").
Name(bundleDeployment.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(bundleDeployment).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *bundleDeployments) UpdateStatus(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.UpdateOptions) (result *v1alpha1.BundleDeployment, err error) {
result = &v1alpha1.BundleDeployment{}
err = c.client.Put().
Namespace(c.ns).
Resource("bundledeployments").
Name(bundleDeployment.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(bundleDeployment).
Do(ctx).
Into(result)
return
}
// Delete takes name of the bundleDeployment and deletes it. Returns an error if one occurs.
func (c *bundleDeployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("bundledeployments").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *bundleDeployments) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("bundledeployments").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched bundleDeployment.
func (c *bundleDeployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BundleDeployment, err error) {
result = &v1alpha1.BundleDeployment{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("bundledeployments").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@@ -0,0 +1,178 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// BundleNamespaceMappingsGetter has a method to return a BundleNamespaceMappingInterface.
// A group's client should implement this interface.
type BundleNamespaceMappingsGetter interface {
BundleNamespaceMappings(namespace string) BundleNamespaceMappingInterface
}
// BundleNamespaceMappingInterface has methods to work with BundleNamespaceMapping resources.
type BundleNamespaceMappingInterface interface {
Create(ctx context.Context, bundleNamespaceMapping *v1alpha1.BundleNamespaceMapping, opts v1.CreateOptions) (*v1alpha1.BundleNamespaceMapping, error)
Update(ctx context.Context, bundleNamespaceMapping *v1alpha1.BundleNamespaceMapping, opts v1.UpdateOptions) (*v1alpha1.BundleNamespaceMapping, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.BundleNamespaceMapping, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.BundleNamespaceMappingList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BundleNamespaceMapping, err error)
BundleNamespaceMappingExpansion
}
// bundleNamespaceMappings implements BundleNamespaceMappingInterface
type bundleNamespaceMappings struct {
client rest.Interface
ns string
}
// newBundleNamespaceMappings returns a BundleNamespaceMappings
func newBundleNamespaceMappings(c *FleetV1alpha1Client, namespace string) *bundleNamespaceMappings {
return &bundleNamespaceMappings{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the bundleNamespaceMapping, and returns the corresponding bundleNamespaceMapping object, and an error if there is any.
func (c *bundleNamespaceMappings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BundleNamespaceMapping, err error) {
result = &v1alpha1.BundleNamespaceMapping{}
err = c.client.Get().
Namespace(c.ns).
Resource("bundlenamespacemappings").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of BundleNamespaceMappings that match those selectors.
func (c *bundleNamespaceMappings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BundleNamespaceMappingList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.BundleNamespaceMappingList{}
err = c.client.Get().
Namespace(c.ns).
Resource("bundlenamespacemappings").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested bundleNamespaceMappings.
func (c *bundleNamespaceMappings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("bundlenamespacemappings").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a bundleNamespaceMapping and creates it. Returns the server's representation of the bundleNamespaceMapping, and an error, if there is any.
func (c *bundleNamespaceMappings) Create(ctx context.Context, bundleNamespaceMapping *v1alpha1.BundleNamespaceMapping, opts v1.CreateOptions) (result *v1alpha1.BundleNamespaceMapping, err error) {
result = &v1alpha1.BundleNamespaceMapping{}
err = c.client.Post().
Namespace(c.ns).
Resource("bundlenamespacemappings").
VersionedParams(&opts, scheme.ParameterCodec).
Body(bundleNamespaceMapping).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a bundleNamespaceMapping and updates it. Returns the server's representation of the bundleNamespaceMapping, and an error, if there is any.
func (c *bundleNamespaceMappings) Update(ctx context.Context, bundleNamespaceMapping *v1alpha1.BundleNamespaceMapping, opts v1.UpdateOptions) (result *v1alpha1.BundleNamespaceMapping, err error) {
result = &v1alpha1.BundleNamespaceMapping{}
err = c.client.Put().
Namespace(c.ns).
Resource("bundlenamespacemappings").
Name(bundleNamespaceMapping.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(bundleNamespaceMapping).
Do(ctx).
Into(result)
return
}
// Delete takes name of the bundleNamespaceMapping and deletes it. Returns an error if one occurs.
func (c *bundleNamespaceMappings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("bundlenamespacemappings").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *bundleNamespaceMappings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("bundlenamespacemappings").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched bundleNamespaceMapping.
func (c *bundleNamespaceMappings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BundleNamespaceMapping, err error) {
result = &v1alpha1.BundleNamespaceMapping{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("bundlenamespacemappings").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@@ -0,0 +1,195 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// ClustersGetter has a method to return a ClusterInterface.
// A group's client should implement this interface.
type ClustersGetter interface {
Clusters(namespace string) ClusterInterface
}
// ClusterInterface has methods to work with Cluster resources.
type ClusterInterface interface {
Create(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.CreateOptions) (*v1alpha1.Cluster, error)
Update(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (*v1alpha1.Cluster, error)
UpdateStatus(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (*v1alpha1.Cluster, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Cluster, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Cluster, err error)
ClusterExpansion
}
// clusters implements ClusterInterface
type clusters struct {
client rest.Interface
ns string
}
// newClusters returns a Clusters
func newClusters(c *FleetV1alpha1Client, namespace string) *clusters {
return &clusters{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
func (c *clusters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) {
result = &v1alpha1.Cluster{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusters").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
func (c *clusters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.ClusterList{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *clusters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Create(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.CreateOptions) (result *v1alpha1.Cluster, err error) {
result = &v1alpha1.Cluster{}
err = c.client.Post().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&opts, scheme.ParameterCodec).
Body(cluster).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *clusters) Update(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (result *v1alpha1.Cluster, err error) {
result = &v1alpha1.Cluster{}
err = c.client.Put().
Namespace(c.ns).
Resource("clusters").
Name(cluster.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(cluster).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *clusters) UpdateStatus(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (result *v1alpha1.Cluster, err error) {
result = &v1alpha1.Cluster{}
err = c.client.Put().
Namespace(c.ns).
Resource("clusters").
Name(cluster.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(cluster).
Do(ctx).
Into(result)
return
}
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
func (c *clusters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusters").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *clusters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("clusters").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched cluster.
func (c *clusters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Cluster, err error) {
result = &v1alpha1.Cluster{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("clusters").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@@ -0,0 +1,195 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// ClusterGroupsGetter has a method to return a ClusterGroupInterface.
// A group's client should implement this interface.
type ClusterGroupsGetter interface {
ClusterGroups(namespace string) ClusterGroupInterface
}
// ClusterGroupInterface has methods to work with ClusterGroup resources.
type ClusterGroupInterface interface {
Create(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.CreateOptions) (*v1alpha1.ClusterGroup, error)
Update(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.UpdateOptions) (*v1alpha1.ClusterGroup, error)
UpdateStatus(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.UpdateOptions) (*v1alpha1.ClusterGroup, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ClusterGroup, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterGroupList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterGroup, err error)
ClusterGroupExpansion
}
// clusterGroups implements ClusterGroupInterface
type clusterGroups struct {
client rest.Interface
ns string
}
// newClusterGroups returns a ClusterGroups
func newClusterGroups(c *FleetV1alpha1Client, namespace string) *clusterGroups {
return &clusterGroups{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the clusterGroup, and returns the corresponding clusterGroup object, and an error if there is any.
func (c *clusterGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterGroup, err error) {
result = &v1alpha1.ClusterGroup{}
err = c.client.Get().
Namespace(c.ns).
Resource("clustergroups").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ClusterGroups that match those selectors.
func (c *clusterGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterGroupList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.ClusterGroupList{}
err = c.client.Get().
Namespace(c.ns).
Resource("clustergroups").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusterGroups.
func (c *clusterGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("clustergroups").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a clusterGroup and creates it. Returns the server's representation of the clusterGroup, and an error, if there is any.
func (c *clusterGroups) Create(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.CreateOptions) (result *v1alpha1.ClusterGroup, err error) {
result = &v1alpha1.ClusterGroup{}
err = c.client.Post().
Namespace(c.ns).
Resource("clustergroups").
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterGroup).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a clusterGroup and updates it. Returns the server's representation of the clusterGroup, and an error, if there is any.
func (c *clusterGroups) Update(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.UpdateOptions) (result *v1alpha1.ClusterGroup, err error) {
result = &v1alpha1.ClusterGroup{}
err = c.client.Put().
Namespace(c.ns).
Resource("clustergroups").
Name(clusterGroup.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterGroup).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *clusterGroups) UpdateStatus(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.UpdateOptions) (result *v1alpha1.ClusterGroup, err error) {
result = &v1alpha1.ClusterGroup{}
err = c.client.Put().
Namespace(c.ns).
Resource("clustergroups").
Name(clusterGroup.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterGroup).
Do(ctx).
Into(result)
return
}
// Delete takes name of the clusterGroup and deletes it. Returns an error if one occurs.
func (c *clusterGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clustergroups").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *clusterGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("clustergroups").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched clusterGroup.
func (c *clusterGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterGroup, err error) {
result = &v1alpha1.ClusterGroup{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("clustergroups").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@@ -0,0 +1,195 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// ClusterRegistrationsGetter has a method to return a ClusterRegistrationInterface.
// A group's client should implement this interface.
type ClusterRegistrationsGetter interface {
ClusterRegistrations(namespace string) ClusterRegistrationInterface
}
// ClusterRegistrationInterface has methods to work with ClusterRegistration resources.
type ClusterRegistrationInterface interface {
Create(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.CreateOptions) (*v1alpha1.ClusterRegistration, error)
Update(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.UpdateOptions) (*v1alpha1.ClusterRegistration, error)
UpdateStatus(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.UpdateOptions) (*v1alpha1.ClusterRegistration, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ClusterRegistration, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterRegistrationList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterRegistration, err error)
ClusterRegistrationExpansion
}
// clusterRegistrations implements ClusterRegistrationInterface
type clusterRegistrations struct {
client rest.Interface
ns string
}
// newClusterRegistrations returns a ClusterRegistrations
func newClusterRegistrations(c *FleetV1alpha1Client, namespace string) *clusterRegistrations {
return &clusterRegistrations{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the clusterRegistration, and returns the corresponding clusterRegistration object, and an error if there is any.
func (c *clusterRegistrations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterRegistration, err error) {
result = &v1alpha1.ClusterRegistration{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusterregistrations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ClusterRegistrations that match those selectors.
func (c *clusterRegistrations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterRegistrationList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.ClusterRegistrationList{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusterregistrations").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusterRegistrations.
func (c *clusterRegistrations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("clusterregistrations").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a clusterRegistration and creates it. Returns the server's representation of the clusterRegistration, and an error, if there is any.
func (c *clusterRegistrations) Create(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.CreateOptions) (result *v1alpha1.ClusterRegistration, err error) {
result = &v1alpha1.ClusterRegistration{}
err = c.client.Post().
Namespace(c.ns).
Resource("clusterregistrations").
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterRegistration).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a clusterRegistration and updates it. Returns the server's representation of the clusterRegistration, and an error, if there is any.
func (c *clusterRegistrations) Update(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.UpdateOptions) (result *v1alpha1.ClusterRegistration, err error) {
result = &v1alpha1.ClusterRegistration{}
err = c.client.Put().
Namespace(c.ns).
Resource("clusterregistrations").
Name(clusterRegistration.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterRegistration).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *clusterRegistrations) UpdateStatus(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.UpdateOptions) (result *v1alpha1.ClusterRegistration, err error) {
result = &v1alpha1.ClusterRegistration{}
err = c.client.Put().
Namespace(c.ns).
Resource("clusterregistrations").
Name(clusterRegistration.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterRegistration).
Do(ctx).
Into(result)
return
}
// Delete takes name of the clusterRegistration and deletes it. Returns an error if one occurs.
func (c *clusterRegistrations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusterregistrations").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *clusterRegistrations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("clusterregistrations").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched clusterRegistration.
func (c *clusterRegistrations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterRegistration, err error) {
result = &v1alpha1.ClusterRegistration{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("clusterregistrations").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@@ -0,0 +1,195 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// ClusterRegistrationTokensGetter has a method to return a ClusterRegistrationTokenInterface.
// A group's client should implement this interface.
type ClusterRegistrationTokensGetter interface {
ClusterRegistrationTokens(namespace string) ClusterRegistrationTokenInterface
}
// ClusterRegistrationTokenInterface has methods to work with ClusterRegistrationToken resources.
type ClusterRegistrationTokenInterface interface {
Create(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.CreateOptions) (*v1alpha1.ClusterRegistrationToken, error)
Update(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.UpdateOptions) (*v1alpha1.ClusterRegistrationToken, error)
UpdateStatus(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.UpdateOptions) (*v1alpha1.ClusterRegistrationToken, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ClusterRegistrationToken, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ClusterRegistrationTokenList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterRegistrationToken, err error)
ClusterRegistrationTokenExpansion
}
// clusterRegistrationTokens implements ClusterRegistrationTokenInterface
type clusterRegistrationTokens struct {
client rest.Interface
ns string
}
// newClusterRegistrationTokens returns a ClusterRegistrationTokens
func newClusterRegistrationTokens(c *FleetV1alpha1Client, namespace string) *clusterRegistrationTokens {
return &clusterRegistrationTokens{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the clusterRegistrationToken, and returns the corresponding clusterRegistrationToken object, and an error if there is any.
func (c *clusterRegistrationTokens) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterRegistrationToken, err error) {
result = &v1alpha1.ClusterRegistrationToken{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusterregistrationtokens").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ClusterRegistrationTokens that match those selectors.
func (c *clusterRegistrationTokens) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterRegistrationTokenList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.ClusterRegistrationTokenList{}
err = c.client.Get().
Namespace(c.ns).
Resource("clusterregistrationtokens").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested clusterRegistrationTokens.
func (c *clusterRegistrationTokens) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("clusterregistrationtokens").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a clusterRegistrationToken and creates it. Returns the server's representation of the clusterRegistrationToken, and an error, if there is any.
func (c *clusterRegistrationTokens) Create(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.CreateOptions) (result *v1alpha1.ClusterRegistrationToken, err error) {
result = &v1alpha1.ClusterRegistrationToken{}
err = c.client.Post().
Namespace(c.ns).
Resource("clusterregistrationtokens").
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterRegistrationToken).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a clusterRegistrationToken and updates it. Returns the server's representation of the clusterRegistrationToken, and an error, if there is any.
func (c *clusterRegistrationTokens) Update(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.UpdateOptions) (result *v1alpha1.ClusterRegistrationToken, err error) {
result = &v1alpha1.ClusterRegistrationToken{}
err = c.client.Put().
Namespace(c.ns).
Resource("clusterregistrationtokens").
Name(clusterRegistrationToken.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterRegistrationToken).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *clusterRegistrationTokens) UpdateStatus(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.UpdateOptions) (result *v1alpha1.ClusterRegistrationToken, err error) {
result = &v1alpha1.ClusterRegistrationToken{}
err = c.client.Put().
Namespace(c.ns).
Resource("clusterregistrationtokens").
Name(clusterRegistrationToken.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(clusterRegistrationToken).
Do(ctx).
Into(result)
return
}
// Delete takes name of the clusterRegistrationToken and deletes it. Returns an error if one occurs.
func (c *clusterRegistrationTokens) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("clusterregistrationtokens").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *clusterRegistrationTokens) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("clusterregistrationtokens").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched clusterRegistrationToken.
func (c *clusterRegistrationTokens) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterRegistrationToken, err error) {
result = &v1alpha1.ClusterRegistrationToken{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("clusterregistrationtokens").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@@ -0,0 +1,168 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// ContentsGetter has a method to return a ContentInterface.
// A group's client should implement this interface.
type ContentsGetter interface {
Contents() ContentInterface
}
// ContentInterface has methods to work with Content resources.
type ContentInterface interface {
Create(ctx context.Context, content *v1alpha1.Content, opts v1.CreateOptions) (*v1alpha1.Content, error)
Update(ctx context.Context, content *v1alpha1.Content, opts v1.UpdateOptions) (*v1alpha1.Content, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.Content, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ContentList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Content, err error)
ContentExpansion
}
// contents implements ContentInterface
type contents struct {
client rest.Interface
}
// newContents returns a Contents
func newContents(c *FleetV1alpha1Client) *contents {
return &contents{
client: c.RESTClient(),
}
}
// Get takes name of the content, and returns the corresponding content object, and an error if there is any.
func (c *contents) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Content, err error) {
result = &v1alpha1.Content{}
err = c.client.Get().
Resource("contents").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of Contents that match those selectors.
func (c *contents) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ContentList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.ContentList{}
err = c.client.Get().
Resource("contents").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested contents.
func (c *contents) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Resource("contents").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a content and creates it. Returns the server's representation of the content, and an error, if there is any.
func (c *contents) Create(ctx context.Context, content *v1alpha1.Content, opts v1.CreateOptions) (result *v1alpha1.Content, err error) {
result = &v1alpha1.Content{}
err = c.client.Post().
Resource("contents").
VersionedParams(&opts, scheme.ParameterCodec).
Body(content).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a content and updates it. Returns the server's representation of the content, and an error, if there is any.
func (c *contents) Update(ctx context.Context, content *v1alpha1.Content, opts v1.UpdateOptions) (result *v1alpha1.Content, err error) {
result = &v1alpha1.Content{}
err = c.client.Put().
Resource("contents").
Name(content.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(content).
Do(ctx).
Into(result)
return
}
// Delete takes name of the content and deletes it. Returns an error if one occurs.
func (c *contents) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Resource("contents").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *contents) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Resource("contents").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched content.
func (c *contents) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Content, err error) {
result = &v1alpha1.Content{}
err = c.client.Patch(pt).
Resource("contents").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@@ -0,0 +1,20 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1alpha1

View File

@@ -0,0 +1,20 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// Package fake has the automatically generated clients.
package fake

View File

@@ -0,0 +1,142 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeBundles implements BundleInterface
type FakeBundles struct {
Fake *FakeFleetV1alpha1
ns string
}
var bundlesResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "bundles"}
var bundlesKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "Bundle"}
// Get takes name of the bundle, and returns the corresponding bundle object, and an error if there is any.
func (c *FakeBundles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Bundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(bundlesResource, c.ns, name), &v1alpha1.Bundle{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Bundle), err
}
// List takes label and field selectors, and returns the list of Bundles that match those selectors.
func (c *FakeBundles) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BundleList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(bundlesResource, bundlesKind, c.ns, opts), &v1alpha1.BundleList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.BundleList{ListMeta: obj.(*v1alpha1.BundleList).ListMeta}
for _, item := range obj.(*v1alpha1.BundleList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested bundles.
func (c *FakeBundles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(bundlesResource, c.ns, opts))
}
// Create takes the representation of a bundle and creates it. Returns the server's representation of the bundle, and an error, if there is any.
func (c *FakeBundles) Create(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.CreateOptions) (result *v1alpha1.Bundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(bundlesResource, c.ns, bundle), &v1alpha1.Bundle{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Bundle), err
}
// Update takes the representation of a bundle and updates it. Returns the server's representation of the bundle, and an error, if there is any.
func (c *FakeBundles) Update(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.UpdateOptions) (result *v1alpha1.Bundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(bundlesResource, c.ns, bundle), &v1alpha1.Bundle{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Bundle), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeBundles) UpdateStatus(ctx context.Context, bundle *v1alpha1.Bundle, opts v1.UpdateOptions) (*v1alpha1.Bundle, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(bundlesResource, "status", c.ns, bundle), &v1alpha1.Bundle{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Bundle), err
}
// Delete takes name of the bundle and deletes it. Returns an error if one occurs.
func (c *FakeBundles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(bundlesResource, c.ns, name), &v1alpha1.Bundle{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeBundles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(bundlesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.BundleList{})
return err
}
// Patch applies the patch and returns the patched bundle.
func (c *FakeBundles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Bundle, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(bundlesResource, c.ns, name, pt, data, subresources...), &v1alpha1.Bundle{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Bundle), err
}

View File

@@ -0,0 +1,142 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeBundleDeployments implements BundleDeploymentInterface
type FakeBundleDeployments struct {
Fake *FakeFleetV1alpha1
ns string
}
var bundledeploymentsResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "bundledeployments"}
var bundledeploymentsKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "BundleDeployment"}
// Get takes name of the bundleDeployment, and returns the corresponding bundleDeployment object, and an error if there is any.
func (c *FakeBundleDeployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BundleDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(bundledeploymentsResource, c.ns, name), &v1alpha1.BundleDeployment{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.BundleDeployment), err
}
// List takes label and field selectors, and returns the list of BundleDeployments that match those selectors.
func (c *FakeBundleDeployments) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BundleDeploymentList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(bundledeploymentsResource, bundledeploymentsKind, c.ns, opts), &v1alpha1.BundleDeploymentList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.BundleDeploymentList{ListMeta: obj.(*v1alpha1.BundleDeploymentList).ListMeta}
for _, item := range obj.(*v1alpha1.BundleDeploymentList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested bundleDeployments.
func (c *FakeBundleDeployments) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(bundledeploymentsResource, c.ns, opts))
}
// Create takes the representation of a bundleDeployment and creates it. Returns the server's representation of the bundleDeployment, and an error, if there is any.
func (c *FakeBundleDeployments) Create(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.CreateOptions) (result *v1alpha1.BundleDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(bundledeploymentsResource, c.ns, bundleDeployment), &v1alpha1.BundleDeployment{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.BundleDeployment), err
}
// Update takes the representation of a bundleDeployment and updates it. Returns the server's representation of the bundleDeployment, and an error, if there is any.
func (c *FakeBundleDeployments) Update(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.UpdateOptions) (result *v1alpha1.BundleDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(bundledeploymentsResource, c.ns, bundleDeployment), &v1alpha1.BundleDeployment{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.BundleDeployment), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeBundleDeployments) UpdateStatus(ctx context.Context, bundleDeployment *v1alpha1.BundleDeployment, opts v1.UpdateOptions) (*v1alpha1.BundleDeployment, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(bundledeploymentsResource, "status", c.ns, bundleDeployment), &v1alpha1.BundleDeployment{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.BundleDeployment), err
}
// Delete takes name of the bundleDeployment and deletes it. Returns an error if one occurs.
func (c *FakeBundleDeployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(bundledeploymentsResource, c.ns, name), &v1alpha1.BundleDeployment{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeBundleDeployments) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(bundledeploymentsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.BundleDeploymentList{})
return err
}
// Patch applies the patch and returns the patched bundleDeployment.
func (c *FakeBundleDeployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BundleDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(bundledeploymentsResource, c.ns, name, pt, data, subresources...), &v1alpha1.BundleDeployment{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.BundleDeployment), err
}

View File

@@ -0,0 +1,130 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeBundleNamespaceMappings implements BundleNamespaceMappingInterface
type FakeBundleNamespaceMappings struct {
Fake *FakeFleetV1alpha1
ns string
}
var bundlenamespacemappingsResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "bundlenamespacemappings"}
var bundlenamespacemappingsKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "BundleNamespaceMapping"}
// Get takes name of the bundleNamespaceMapping, and returns the corresponding bundleNamespaceMapping object, and an error if there is any.
func (c *FakeBundleNamespaceMappings) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.BundleNamespaceMapping, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(bundlenamespacemappingsResource, c.ns, name), &v1alpha1.BundleNamespaceMapping{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.BundleNamespaceMapping), err
}
// List takes label and field selectors, and returns the list of BundleNamespaceMappings that match those selectors.
func (c *FakeBundleNamespaceMappings) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.BundleNamespaceMappingList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(bundlenamespacemappingsResource, bundlenamespacemappingsKind, c.ns, opts), &v1alpha1.BundleNamespaceMappingList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.BundleNamespaceMappingList{ListMeta: obj.(*v1alpha1.BundleNamespaceMappingList).ListMeta}
for _, item := range obj.(*v1alpha1.BundleNamespaceMappingList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested bundleNamespaceMappings.
func (c *FakeBundleNamespaceMappings) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(bundlenamespacemappingsResource, c.ns, opts))
}
// Create takes the representation of a bundleNamespaceMapping and creates it. Returns the server's representation of the bundleNamespaceMapping, and an error, if there is any.
func (c *FakeBundleNamespaceMappings) Create(ctx context.Context, bundleNamespaceMapping *v1alpha1.BundleNamespaceMapping, opts v1.CreateOptions) (result *v1alpha1.BundleNamespaceMapping, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(bundlenamespacemappingsResource, c.ns, bundleNamespaceMapping), &v1alpha1.BundleNamespaceMapping{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.BundleNamespaceMapping), err
}
// Update takes the representation of a bundleNamespaceMapping and updates it. Returns the server's representation of the bundleNamespaceMapping, and an error, if there is any.
func (c *FakeBundleNamespaceMappings) Update(ctx context.Context, bundleNamespaceMapping *v1alpha1.BundleNamespaceMapping, opts v1.UpdateOptions) (result *v1alpha1.BundleNamespaceMapping, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(bundlenamespacemappingsResource, c.ns, bundleNamespaceMapping), &v1alpha1.BundleNamespaceMapping{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.BundleNamespaceMapping), err
}
// Delete takes name of the bundleNamespaceMapping and deletes it. Returns an error if one occurs.
func (c *FakeBundleNamespaceMappings) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(bundlenamespacemappingsResource, c.ns, name), &v1alpha1.BundleNamespaceMapping{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeBundleNamespaceMappings) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(bundlenamespacemappingsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.BundleNamespaceMappingList{})
return err
}
// Patch applies the patch and returns the patched bundleNamespaceMapping.
func (c *FakeBundleNamespaceMappings) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.BundleNamespaceMapping, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(bundlenamespacemappingsResource, c.ns, name, pt, data, subresources...), &v1alpha1.BundleNamespaceMapping{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.BundleNamespaceMapping), err
}

View File

@@ -0,0 +1,142 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeClusters implements ClusterInterface
type FakeClusters struct {
Fake *FakeFleetV1alpha1
ns string
}
var clustersResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "clusters"}
var clustersKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "Cluster"}
// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any.
func (c *FakeClusters) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(clustersResource, c.ns, name), &v1alpha1.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Cluster), err
}
// List takes label and field selectors, and returns the list of Clusters that match those selectors.
func (c *FakeClusters) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(clustersResource, clustersKind, c.ns, opts), &v1alpha1.ClusterList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ClusterList{ListMeta: obj.(*v1alpha1.ClusterList).ListMeta}
for _, item := range obj.(*v1alpha1.ClusterList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested clusters.
func (c *FakeClusters) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(clustersResource, c.ns, opts))
}
// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *FakeClusters) Create(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.CreateOptions) (result *v1alpha1.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(clustersResource, c.ns, cluster), &v1alpha1.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Cluster), err
}
// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any.
func (c *FakeClusters) Update(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (result *v1alpha1.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(clustersResource, c.ns, cluster), &v1alpha1.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Cluster), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeClusters) UpdateStatus(ctx context.Context, cluster *v1alpha1.Cluster, opts v1.UpdateOptions) (*v1alpha1.Cluster, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(clustersResource, "status", c.ns, cluster), &v1alpha1.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Cluster), err
}
// Delete takes name of the cluster and deletes it. Returns an error if one occurs.
func (c *FakeClusters) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(clustersResource, c.ns, name), &v1alpha1.Cluster{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeClusters) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(clustersResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterList{})
return err
}
// Patch applies the patch and returns the patched cluster.
func (c *FakeClusters) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Cluster, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(clustersResource, c.ns, name, pt, data, subresources...), &v1alpha1.Cluster{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Cluster), err
}

View File

@@ -0,0 +1,142 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeClusterGroups implements ClusterGroupInterface
type FakeClusterGroups struct {
Fake *FakeFleetV1alpha1
ns string
}
var clustergroupsResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "clustergroups"}
var clustergroupsKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "ClusterGroup"}
// Get takes name of the clusterGroup, and returns the corresponding clusterGroup object, and an error if there is any.
func (c *FakeClusterGroups) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(clustergroupsResource, c.ns, name), &v1alpha1.ClusterGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterGroup), err
}
// List takes label and field selectors, and returns the list of ClusterGroups that match those selectors.
func (c *FakeClusterGroups) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterGroupList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(clustergroupsResource, clustergroupsKind, c.ns, opts), &v1alpha1.ClusterGroupList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ClusterGroupList{ListMeta: obj.(*v1alpha1.ClusterGroupList).ListMeta}
for _, item := range obj.(*v1alpha1.ClusterGroupList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested clusterGroups.
func (c *FakeClusterGroups) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(clustergroupsResource, c.ns, opts))
}
// Create takes the representation of a clusterGroup and creates it. Returns the server's representation of the clusterGroup, and an error, if there is any.
func (c *FakeClusterGroups) Create(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.CreateOptions) (result *v1alpha1.ClusterGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(clustergroupsResource, c.ns, clusterGroup), &v1alpha1.ClusterGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterGroup), err
}
// Update takes the representation of a clusterGroup and updates it. Returns the server's representation of the clusterGroup, and an error, if there is any.
func (c *FakeClusterGroups) Update(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.UpdateOptions) (result *v1alpha1.ClusterGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(clustergroupsResource, c.ns, clusterGroup), &v1alpha1.ClusterGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterGroup), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeClusterGroups) UpdateStatus(ctx context.Context, clusterGroup *v1alpha1.ClusterGroup, opts v1.UpdateOptions) (*v1alpha1.ClusterGroup, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(clustergroupsResource, "status", c.ns, clusterGroup), &v1alpha1.ClusterGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterGroup), err
}
// Delete takes name of the clusterGroup and deletes it. Returns an error if one occurs.
func (c *FakeClusterGroups) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(clustergroupsResource, c.ns, name), &v1alpha1.ClusterGroup{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeClusterGroups) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(clustergroupsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterGroupList{})
return err
}
// Patch applies the patch and returns the patched clusterGroup.
func (c *FakeClusterGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterGroup, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(clustergroupsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ClusterGroup{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterGroup), err
}

View File

@@ -0,0 +1,142 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeClusterRegistrations implements ClusterRegistrationInterface
type FakeClusterRegistrations struct {
Fake *FakeFleetV1alpha1
ns string
}
var clusterregistrationsResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "clusterregistrations"}
var clusterregistrationsKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "ClusterRegistration"}
// Get takes name of the clusterRegistration, and returns the corresponding clusterRegistration object, and an error if there is any.
func (c *FakeClusterRegistrations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterRegistration, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(clusterregistrationsResource, c.ns, name), &v1alpha1.ClusterRegistration{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterRegistration), err
}
// List takes label and field selectors, and returns the list of ClusterRegistrations that match those selectors.
func (c *FakeClusterRegistrations) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterRegistrationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(clusterregistrationsResource, clusterregistrationsKind, c.ns, opts), &v1alpha1.ClusterRegistrationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ClusterRegistrationList{ListMeta: obj.(*v1alpha1.ClusterRegistrationList).ListMeta}
for _, item := range obj.(*v1alpha1.ClusterRegistrationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested clusterRegistrations.
func (c *FakeClusterRegistrations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(clusterregistrationsResource, c.ns, opts))
}
// Create takes the representation of a clusterRegistration and creates it. Returns the server's representation of the clusterRegistration, and an error, if there is any.
func (c *FakeClusterRegistrations) Create(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.CreateOptions) (result *v1alpha1.ClusterRegistration, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(clusterregistrationsResource, c.ns, clusterRegistration), &v1alpha1.ClusterRegistration{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterRegistration), err
}
// Update takes the representation of a clusterRegistration and updates it. Returns the server's representation of the clusterRegistration, and an error, if there is any.
func (c *FakeClusterRegistrations) Update(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.UpdateOptions) (result *v1alpha1.ClusterRegistration, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(clusterregistrationsResource, c.ns, clusterRegistration), &v1alpha1.ClusterRegistration{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterRegistration), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeClusterRegistrations) UpdateStatus(ctx context.Context, clusterRegistration *v1alpha1.ClusterRegistration, opts v1.UpdateOptions) (*v1alpha1.ClusterRegistration, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(clusterregistrationsResource, "status", c.ns, clusterRegistration), &v1alpha1.ClusterRegistration{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterRegistration), err
}
// Delete takes name of the clusterRegistration and deletes it. Returns an error if one occurs.
func (c *FakeClusterRegistrations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(clusterregistrationsResource, c.ns, name), &v1alpha1.ClusterRegistration{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeClusterRegistrations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(clusterregistrationsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterRegistrationList{})
return err
}
// Patch applies the patch and returns the patched clusterRegistration.
func (c *FakeClusterRegistrations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterRegistration, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(clusterregistrationsResource, c.ns, name, pt, data, subresources...), &v1alpha1.ClusterRegistration{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterRegistration), err
}

View File

@@ -0,0 +1,142 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeClusterRegistrationTokens implements ClusterRegistrationTokenInterface
type FakeClusterRegistrationTokens struct {
Fake *FakeFleetV1alpha1
ns string
}
var clusterregistrationtokensResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "clusterregistrationtokens"}
var clusterregistrationtokensKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "ClusterRegistrationToken"}
// Get takes name of the clusterRegistrationToken, and returns the corresponding clusterRegistrationToken object, and an error if there is any.
func (c *FakeClusterRegistrationTokens) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ClusterRegistrationToken, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(clusterregistrationtokensResource, c.ns, name), &v1alpha1.ClusterRegistrationToken{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterRegistrationToken), err
}
// List takes label and field selectors, and returns the list of ClusterRegistrationTokens that match those selectors.
func (c *FakeClusterRegistrationTokens) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ClusterRegistrationTokenList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(clusterregistrationtokensResource, clusterregistrationtokensKind, c.ns, opts), &v1alpha1.ClusterRegistrationTokenList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ClusterRegistrationTokenList{ListMeta: obj.(*v1alpha1.ClusterRegistrationTokenList).ListMeta}
for _, item := range obj.(*v1alpha1.ClusterRegistrationTokenList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested clusterRegistrationTokens.
func (c *FakeClusterRegistrationTokens) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(clusterregistrationtokensResource, c.ns, opts))
}
// Create takes the representation of a clusterRegistrationToken and creates it. Returns the server's representation of the clusterRegistrationToken, and an error, if there is any.
func (c *FakeClusterRegistrationTokens) Create(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.CreateOptions) (result *v1alpha1.ClusterRegistrationToken, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(clusterregistrationtokensResource, c.ns, clusterRegistrationToken), &v1alpha1.ClusterRegistrationToken{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterRegistrationToken), err
}
// Update takes the representation of a clusterRegistrationToken and updates it. Returns the server's representation of the clusterRegistrationToken, and an error, if there is any.
func (c *FakeClusterRegistrationTokens) Update(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.UpdateOptions) (result *v1alpha1.ClusterRegistrationToken, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(clusterregistrationtokensResource, c.ns, clusterRegistrationToken), &v1alpha1.ClusterRegistrationToken{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterRegistrationToken), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeClusterRegistrationTokens) UpdateStatus(ctx context.Context, clusterRegistrationToken *v1alpha1.ClusterRegistrationToken, opts v1.UpdateOptions) (*v1alpha1.ClusterRegistrationToken, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(clusterregistrationtokensResource, "status", c.ns, clusterRegistrationToken), &v1alpha1.ClusterRegistrationToken{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterRegistrationToken), err
}
// Delete takes name of the clusterRegistrationToken and deletes it. Returns an error if one occurs.
func (c *FakeClusterRegistrationTokens) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(clusterregistrationtokensResource, c.ns, name), &v1alpha1.ClusterRegistrationToken{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeClusterRegistrationTokens) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(clusterregistrationtokensResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.ClusterRegistrationTokenList{})
return err
}
// Patch applies the patch and returns the patched clusterRegistrationToken.
func (c *FakeClusterRegistrationTokens) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ClusterRegistrationToken, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(clusterregistrationtokensResource, c.ns, name, pt, data, subresources...), &v1alpha1.ClusterRegistrationToken{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ClusterRegistrationToken), err
}

View File

@@ -0,0 +1,122 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeContents implements ContentInterface
type FakeContents struct {
Fake *FakeFleetV1alpha1
}
var contentsResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "contents"}
var contentsKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "Content"}
// Get takes name of the content, and returns the corresponding content object, and an error if there is any.
func (c *FakeContents) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.Content, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(contentsResource, name), &v1alpha1.Content{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Content), err
}
// List takes label and field selectors, and returns the list of Contents that match those selectors.
func (c *FakeContents) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ContentList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(contentsResource, contentsKind, opts), &v1alpha1.ContentList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ContentList{ListMeta: obj.(*v1alpha1.ContentList).ListMeta}
for _, item := range obj.(*v1alpha1.ContentList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested contents.
func (c *FakeContents) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(contentsResource, opts))
}
// Create takes the representation of a content and creates it. Returns the server's representation of the content, and an error, if there is any.
func (c *FakeContents) Create(ctx context.Context, content *v1alpha1.Content, opts v1.CreateOptions) (result *v1alpha1.Content, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(contentsResource, content), &v1alpha1.Content{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Content), err
}
// Update takes the representation of a content and updates it. Returns the server's representation of the content, and an error, if there is any.
func (c *FakeContents) Update(ctx context.Context, content *v1alpha1.Content, opts v1.UpdateOptions) (result *v1alpha1.Content, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(contentsResource, content), &v1alpha1.Content{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Content), err
}
// Delete takes name of the content and deletes it. Returns an error if one occurs.
func (c *FakeContents) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteAction(contentsResource, name), &v1alpha1.Content{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeContents) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(contentsResource, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.ContentList{})
return err
}
// Patch applies the patch and returns the patched content.
func (c *FakeContents) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.Content, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(contentsResource, name, pt, data, subresources...), &v1alpha1.Content{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Content), err
}

View File

@@ -0,0 +1,76 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v1alpha1 "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/typed/fleet.cattle.io/v1alpha1"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
type FakeFleetV1alpha1 struct {
*testing.Fake
}
func (c *FakeFleetV1alpha1) Bundles(namespace string) v1alpha1.BundleInterface {
return &FakeBundles{c, namespace}
}
func (c *FakeFleetV1alpha1) BundleDeployments(namespace string) v1alpha1.BundleDeploymentInterface {
return &FakeBundleDeployments{c, namespace}
}
func (c *FakeFleetV1alpha1) BundleNamespaceMappings(namespace string) v1alpha1.BundleNamespaceMappingInterface {
return &FakeBundleNamespaceMappings{c, namespace}
}
func (c *FakeFleetV1alpha1) Clusters(namespace string) v1alpha1.ClusterInterface {
return &FakeClusters{c, namespace}
}
func (c *FakeFleetV1alpha1) ClusterGroups(namespace string) v1alpha1.ClusterGroupInterface {
return &FakeClusterGroups{c, namespace}
}
func (c *FakeFleetV1alpha1) ClusterRegistrations(namespace string) v1alpha1.ClusterRegistrationInterface {
return &FakeClusterRegistrations{c, namespace}
}
func (c *FakeFleetV1alpha1) ClusterRegistrationTokens(namespace string) v1alpha1.ClusterRegistrationTokenInterface {
return &FakeClusterRegistrationTokens{c, namespace}
}
func (c *FakeFleetV1alpha1) Contents() v1alpha1.ContentInterface {
return &FakeContents{c}
}
func (c *FakeFleetV1alpha1) GitRepos(namespace string) v1alpha1.GitRepoInterface {
return &FakeGitRepos{c, namespace}
}
func (c *FakeFleetV1alpha1) GitRepoRestrictions(namespace string) v1alpha1.GitRepoRestrictionInterface {
return &FakeGitRepoRestrictions{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeFleetV1alpha1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@@ -0,0 +1,142 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeGitRepos implements GitRepoInterface
type FakeGitRepos struct {
Fake *FakeFleetV1alpha1
ns string
}
var gitreposResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "gitrepos"}
var gitreposKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "GitRepo"}
// Get takes name of the gitRepo, and returns the corresponding gitRepo object, and an error if there is any.
func (c *FakeGitRepos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GitRepo, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(gitreposResource, c.ns, name), &v1alpha1.GitRepo{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.GitRepo), err
}
// List takes label and field selectors, and returns the list of GitRepos that match those selectors.
func (c *FakeGitRepos) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GitRepoList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(gitreposResource, gitreposKind, c.ns, opts), &v1alpha1.GitRepoList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.GitRepoList{ListMeta: obj.(*v1alpha1.GitRepoList).ListMeta}
for _, item := range obj.(*v1alpha1.GitRepoList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested gitRepos.
func (c *FakeGitRepos) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(gitreposResource, c.ns, opts))
}
// Create takes the representation of a gitRepo and creates it. Returns the server's representation of the gitRepo, and an error, if there is any.
func (c *FakeGitRepos) Create(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.CreateOptions) (result *v1alpha1.GitRepo, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(gitreposResource, c.ns, gitRepo), &v1alpha1.GitRepo{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.GitRepo), err
}
// Update takes the representation of a gitRepo and updates it. Returns the server's representation of the gitRepo, and an error, if there is any.
func (c *FakeGitRepos) Update(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.UpdateOptions) (result *v1alpha1.GitRepo, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(gitreposResource, c.ns, gitRepo), &v1alpha1.GitRepo{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.GitRepo), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeGitRepos) UpdateStatus(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.UpdateOptions) (*v1alpha1.GitRepo, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(gitreposResource, "status", c.ns, gitRepo), &v1alpha1.GitRepo{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.GitRepo), err
}
// Delete takes name of the gitRepo and deletes it. Returns an error if one occurs.
func (c *FakeGitRepos) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(gitreposResource, c.ns, name), &v1alpha1.GitRepo{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeGitRepos) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(gitreposResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.GitRepoList{})
return err
}
// Patch applies the patch and returns the patched gitRepo.
func (c *FakeGitRepos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GitRepo, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(gitreposResource, c.ns, name, pt, data, subresources...), &v1alpha1.GitRepo{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.GitRepo), err
}

View File

@@ -0,0 +1,130 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeGitRepoRestrictions implements GitRepoRestrictionInterface
type FakeGitRepoRestrictions struct {
Fake *FakeFleetV1alpha1
ns string
}
var gitreporestrictionsResource = schema.GroupVersionResource{Group: "fleet.cattle.io", Version: "v1alpha1", Resource: "gitreporestrictions"}
var gitreporestrictionsKind = schema.GroupVersionKind{Group: "fleet.cattle.io", Version: "v1alpha1", Kind: "GitRepoRestriction"}
// Get takes name of the gitRepoRestriction, and returns the corresponding gitRepoRestriction object, and an error if there is any.
func (c *FakeGitRepoRestrictions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GitRepoRestriction, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(gitreporestrictionsResource, c.ns, name), &v1alpha1.GitRepoRestriction{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.GitRepoRestriction), err
}
// List takes label and field selectors, and returns the list of GitRepoRestrictions that match those selectors.
func (c *FakeGitRepoRestrictions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GitRepoRestrictionList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(gitreporestrictionsResource, gitreporestrictionsKind, c.ns, opts), &v1alpha1.GitRepoRestrictionList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.GitRepoRestrictionList{ListMeta: obj.(*v1alpha1.GitRepoRestrictionList).ListMeta}
for _, item := range obj.(*v1alpha1.GitRepoRestrictionList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested gitRepoRestrictions.
func (c *FakeGitRepoRestrictions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(gitreporestrictionsResource, c.ns, opts))
}
// Create takes the representation of a gitRepoRestriction and creates it. Returns the server's representation of the gitRepoRestriction, and an error, if there is any.
func (c *FakeGitRepoRestrictions) Create(ctx context.Context, gitRepoRestriction *v1alpha1.GitRepoRestriction, opts v1.CreateOptions) (result *v1alpha1.GitRepoRestriction, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(gitreporestrictionsResource, c.ns, gitRepoRestriction), &v1alpha1.GitRepoRestriction{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.GitRepoRestriction), err
}
// Update takes the representation of a gitRepoRestriction and updates it. Returns the server's representation of the gitRepoRestriction, and an error, if there is any.
func (c *FakeGitRepoRestrictions) Update(ctx context.Context, gitRepoRestriction *v1alpha1.GitRepoRestriction, opts v1.UpdateOptions) (result *v1alpha1.GitRepoRestriction, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(gitreporestrictionsResource, c.ns, gitRepoRestriction), &v1alpha1.GitRepoRestriction{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.GitRepoRestriction), err
}
// Delete takes name of the gitRepoRestriction and deletes it. Returns an error if one occurs.
func (c *FakeGitRepoRestrictions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(gitreporestrictionsResource, c.ns, name), &v1alpha1.GitRepoRestriction{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeGitRepoRestrictions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(gitreporestrictionsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.GitRepoRestrictionList{})
return err
}
// Patch applies the patch and returns the patched gitRepoRestriction.
func (c *FakeGitRepoRestrictions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GitRepoRestriction, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(gitreporestrictionsResource, c.ns, name, pt, data, subresources...), &v1alpha1.GitRepoRestriction{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.GitRepoRestriction), err
}

View File

@@ -0,0 +1,134 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
rest "k8s.io/client-go/rest"
)
type FleetV1alpha1Interface interface {
RESTClient() rest.Interface
BundlesGetter
BundleDeploymentsGetter
BundleNamespaceMappingsGetter
ClustersGetter
ClusterGroupsGetter
ClusterRegistrationsGetter
ClusterRegistrationTokensGetter
ContentsGetter
GitReposGetter
GitRepoRestrictionsGetter
}
// FleetV1alpha1Client is used to interact with features provided by the fleet.cattle.io group.
type FleetV1alpha1Client struct {
restClient rest.Interface
}
func (c *FleetV1alpha1Client) Bundles(namespace string) BundleInterface {
return newBundles(c, namespace)
}
func (c *FleetV1alpha1Client) BundleDeployments(namespace string) BundleDeploymentInterface {
return newBundleDeployments(c, namespace)
}
func (c *FleetV1alpha1Client) BundleNamespaceMappings(namespace string) BundleNamespaceMappingInterface {
return newBundleNamespaceMappings(c, namespace)
}
func (c *FleetV1alpha1Client) Clusters(namespace string) ClusterInterface {
return newClusters(c, namespace)
}
func (c *FleetV1alpha1Client) ClusterGroups(namespace string) ClusterGroupInterface {
return newClusterGroups(c, namespace)
}
func (c *FleetV1alpha1Client) ClusterRegistrations(namespace string) ClusterRegistrationInterface {
return newClusterRegistrations(c, namespace)
}
func (c *FleetV1alpha1Client) ClusterRegistrationTokens(namespace string) ClusterRegistrationTokenInterface {
return newClusterRegistrationTokens(c, namespace)
}
func (c *FleetV1alpha1Client) Contents() ContentInterface {
return newContents(c)
}
func (c *FleetV1alpha1Client) GitRepos(namespace string) GitRepoInterface {
return newGitRepos(c, namespace)
}
func (c *FleetV1alpha1Client) GitRepoRestrictions(namespace string) GitRepoRestrictionInterface {
return newGitRepoRestrictions(c, namespace)
}
// NewForConfig creates a new FleetV1alpha1Client for the given config.
func NewForConfig(c *rest.Config) (*FleetV1alpha1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &FleetV1alpha1Client{client}, nil
}
// NewForConfigOrDie creates a new FleetV1alpha1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *FleetV1alpha1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new FleetV1alpha1Client for the given RESTClient.
func New(c rest.Interface) *FleetV1alpha1Client {
return &FleetV1alpha1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1alpha1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FleetV1alpha1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@@ -0,0 +1,39 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
type BundleExpansion interface{}
type BundleDeploymentExpansion interface{}
type BundleNamespaceMappingExpansion interface{}
type ClusterExpansion interface{}
type ClusterGroupExpansion interface{}
type ClusterRegistrationExpansion interface{}
type ClusterRegistrationTokenExpansion interface{}
type ContentExpansion interface{}
type GitRepoExpansion interface{}
type GitRepoRestrictionExpansion interface{}

View File

@@ -0,0 +1,195 @@
/*
Copyright (c) 2021 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
scheme "github.com/javamachr/gardener-extension-shoot-fleet-agent/pkg/client/fleet/clientset/versioned/scheme"
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// GitReposGetter has a method to return a GitRepoInterface.
// A group's client should implement this interface.
type GitReposGetter interface {
GitRepos(namespace string) GitRepoInterface
}
// GitRepoInterface has methods to work with GitRepo resources.
type GitRepoInterface interface {
Create(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.CreateOptions) (*v1alpha1.GitRepo, error)
Update(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.UpdateOptions) (*v1alpha1.GitRepo, error)
UpdateStatus(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.UpdateOptions) (*v1alpha1.GitRepo, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.GitRepo, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.GitRepoList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GitRepo, err error)
GitRepoExpansion
}
// gitRepos implements GitRepoInterface
type gitRepos struct {
client rest.Interface
ns string
}
// newGitRepos returns a GitRepos
func newGitRepos(c *FleetV1alpha1Client, namespace string) *gitRepos {
return &gitRepos{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the gitRepo, and returns the corresponding gitRepo object, and an error if there is any.
func (c *gitRepos) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GitRepo, err error) {
result = &v1alpha1.GitRepo{}
err = c.client.Get().
Namespace(c.ns).
Resource("gitrepos").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of GitRepos that match those selectors.
func (c *gitRepos) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GitRepoList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.GitRepoList{}
err = c.client.Get().
Namespace(c.ns).
Resource("gitrepos").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested gitRepos.
func (c *gitRepos) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("gitrepos").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a gitRepo and creates it. Returns the server's representation of the gitRepo, and an error, if there is any.
func (c *gitRepos) Create(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.CreateOptions) (result *v1alpha1.GitRepo, err error) {
result = &v1alpha1.GitRepo{}
err = c.client.Post().
Namespace(c.ns).
Resource("gitrepos").
VersionedParams(&opts, scheme.ParameterCodec).
Body(gitRepo).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a gitRepo and updates it. Returns the server's representation of the gitRepo, and an error, if there is any.
func (c *gitRepos) Update(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.UpdateOptions) (result *v1alpha1.GitRepo, err error) {
result = &v1alpha1.GitRepo{}
err = c.client.Put().
Namespace(c.ns).
Resource("gitrepos").
Name(gitRepo.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(gitRepo).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *gitRepos) UpdateStatus(ctx context.Context, gitRepo *v1alpha1.GitRepo, opts v1.UpdateOptions) (result *v1alpha1.GitRepo, err error) {
result = &v1alpha1.GitRepo{}
err = c.client.Put().
Namespace(c.ns).
Resource("gitrepos").
Name(gitRepo.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(gitRepo).
Do(ctx).
Into(result)
return
}
// Delete takes name of the gitRepo and deletes it. Returns an error if one occurs.
func (c *gitRepos) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("gitrepos").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *gitRepos) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("gitrepos").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched gitRepo.
func (c *gitRepos) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GitRepo, err error) {
result = &v1alpha1.GitRepo{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("gitrepos").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

Some files were not shown because too many files have changed in this diff Show More