Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into define-crd
Browse files Browse the repository at this point in the history
  • Loading branch information
akgalwas committed Sep 13, 2023
2 parents 726c03a + cd242b9 commit 3859d91
Show file tree
Hide file tree
Showing 32 changed files with 118 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
path: |
~/.cache/go-build
~/go/pkg/mod
/home/runner/work/cluster-inventory/cluster-inventory/bin
/home/runner/work/infrastructure-manager/infrastructure-manager/bin
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
Expand Down
8 changes: 4 additions & 4 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
domain: kyma-project.io
layout:
- go.kubebuilder.io/v4
projectName: cluster-inventory
repo: github.com/kyma-project/cluster-inventory
projectName: infrastructure-manager
repo: github.com/kyma-project/infrastructure-manager
resources:
- api:
crdVersion: v1
namespaced: false
controller: true
domain: kyma-project.io
group: clusterinventory
group: infrastructuremanager
kind: Cluster
path: github.com/kyma-project/cluster-inventory/api/v1
path: github.com/kyma-project/infrastructure-manager/api/v1
version: v1
version: "3"
25 changes: 7 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
[![REUSE status](https://api.reuse.software/badge/github.com/kyma-project/cluster-inventory)](https://api.reuse.software/info/github.com/kyma-project/cluster-inventory)
[![REUSE status](https://api.reuse.software/badge/github.com/kyma-project/infrastructure-manager)](https://api.reuse.software/info/github.com/kyma-project/infrastructure-manager)

> **NOTE:** This is a general template that can be used for a project README.md, example README.md, or any other README.md type in all Kyma repositories in the Kyma organization. Except for the mandatory sections, use only those sections that suit your use case but keep the proposed section order.
>
> Mandatory sections:
> - `Overview`
> - `Prerequisites`, if there are any requirements regarding hard- or software
> - `Contributing` - do not change this!
> - `Code of Conduct` - do not change this!
> - `Licensing` - do not change this!
# Cluster Inventory
# Infrastructure manager

## Overview
<!--- mandatory section --->

This project **will be** responsible for managing [Kyma](https://kyma-project.io/#/) clusters infrastructure. Buil using [kubebuilder framework](https://github.com/kubernetes-sigs/kubebuilder)
It's main responsibilities **will be**:
- Provisioning and deprovisioning Kyma clusters
- Generating dynamic kubeconfigs


## Prerequisites

- Access to a k8s cluster.
Expand All @@ -32,14 +21,14 @@ It's main responsibilities **will be**:
1. Clone the project.

```bash
git clone https://github.com/kyma-project/cluster-inventory.git && cd cluster-inventory/
git clone https://github.com/kyma-project/infrastructure-manager.git && cd infrastructure-manager/
```

2. Set the `cluster-inventory` image name.
2. Set the `infrastructure-manager` image name.

```bash
export IMG=custom-cluster-inventory:0.0.1
export K3D_CLUSTER_NAME=cluster-inventory-demo
export IMG=custom-infrastructure-manager:0.0.1
export K3D_CLUSTER_NAME=infrastructure-manager-demo
```

3. Build the project.
Expand All @@ -56,7 +45,7 @@ make docker-build

5. Push the image to the registry.

<div tabs name="Push image" group="cluster-inventory-installation">
<div tabs name="Push image" group="infrastructure-manager-installation">
<details>
<summary label="k3d">
k3d
Expand Down
6 changes: 3 additions & 3 deletions api/v1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Package v1 contains API Schema definitions for the clusterinventory v1 API group
// Package v1 contains API Schema definitions for the infrastructuremanager v1 API group
// +kubebuilder:object:generate=true
// +groupName=clusterinventory.kyma-project.io
// +groupName=infrastructuremanager.kyma-project.io
package v1

import (
Expand All @@ -26,7 +26,7 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "clusterinventory.kyma-project.io", Version: "v1"} //nolint:gochecknoglobals
GroupVersion = schema.GroupVersion{Group: "infrastructuremanager.kyma-project.io", Version: "v1"} //nolint:gochecknoglobals

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} //nolint:gochecknoglobals
Expand Down
6 changes: 3 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"flag"
"os"

clusterinventoryv1 "github.com/kyma-project/cluster-inventory/api/v1"
"github.com/kyma-project/cluster-inventory/internal/controller"
infrastructuremanagerv1 "github.com/kyma-project/infrastructure-manager/api/v1"
"github.com/kyma-project/infrastructure-manager/internal/controller"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
Expand All @@ -41,7 +41,7 @@ var (
func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))

utilruntime.Must(clusterinventoryv1.AddToScheme(scheme))
utilruntime.Must(infrastructuremanagerv1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}

Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
name: clusters.infrastructuremanager.kyma-project.io
spec:
group: infrastructuremanager.kyma-project.io
names:
kind: Cluster
listKind: ClusterList
plural: clusters
singular: cluster
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: Cluster is the Schema for the clusters API
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/sig-architecture/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/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: ClusterSpec defines the desired state of Cluster
properties:
foo:
description: Foo is an example field of Cluster. Edit cluster_types.go
to remove/update
type: string
type: object
status:
description: ClusterStatus defines the observed state of Cluster
type: object
type: object
served: true
storage: true
subresources:
status: {}
2 changes: 1 addition & 1 deletion config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# since it depends on service name and namespace that are out of this kustomize package.
# It should be run by config/default
resources:
- bases/clusterinventory.kyma-project.io_gardenerclusters.yaml
- bases/infrastructuremanager.kyma-project.io_gardenerclusters.yaml
#+kubebuilder:scaffold:crdkustomizeresource

patches:
Expand Down
2 changes: 1 addition & 1 deletion config/crd/patches/cainjection_in_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME
name: gardenerclusters.clusterinventory.kyma-project.io
name: gardenerclusters.infrastructuremanager.kyma-project.io
2 changes: 1 addition & 1 deletion config/crd/patches/webhook_in_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: gardenerclusters.clusterinventory.kyma-project.io
name: gardenerclusters.infrastructuremanager.kyma-project.io
spec:
conversion:
strategy: Webhook
Expand Down
4 changes: 2 additions & 2 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Adds namespace to all resources.
namespace: cluster-inventory-system
namespace: infrastructure-manager-system

# Value of this field is prepended to the
# names of all resources, e.g. a deployment named
# "wordpress" becomes "alices-wordpress".
# Note that it should also match with the prefix (text before '-') of the namespace
# field above.
namePrefix: cluster-inventory-
namePrefix: infrastructure-manager-

# Labels to add to all resources and selectors.
#labels:
Expand Down
4 changes: 2 additions & 2 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: controller
newTag: latest
newName: infrastructure-manager
newTag: 0.0.1
8 changes: 4 additions & 4 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ metadata:
app.kubernetes.io/name: namespace
app.kubernetes.io/instance: system
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: cluster-inventory
app.kubernetes.io/part-of: cluster-inventory
app.kubernetes.io/created-by: infrastructure-manager
app.kubernetes.io/part-of: infrastructure-manager
app.kubernetes.io/managed-by: kustomize
name: system
---
Expand All @@ -21,8 +21,8 @@ metadata:
app.kubernetes.io/name: deployment
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: cluster-inventory
app.kubernetes.io/part-of: cluster-inventory
app.kubernetes.io/created-by: infrastructure-manager
app.kubernetes.io/part-of: infrastructure-manager
app.kubernetes.io/managed-by: kustomize
spec:
selector:
Expand Down
4 changes: 2 additions & 2 deletions config/prometheus/monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ metadata:
app.kubernetes.io/name: servicemonitor
app.kubernetes.io/instance: controller-manager-metrics-monitor
app.kubernetes.io/component: metrics
app.kubernetes.io/created-by: cluster-inventory
app.kubernetes.io/part-of: cluster-inventory
app.kubernetes.io/created-by: infrastructure-manager
app.kubernetes.io/part-of: infrastructure-manager
app.kubernetes.io/managed-by: kustomize
name: controller-manager-metrics-monitor
namespace: system
Expand Down
4 changes: 2 additions & 2 deletions config/rbac/auth_proxy_client_clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ metadata:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: metrics-reader
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: cluster-inventory
app.kubernetes.io/part-of: cluster-inventory
app.kubernetes.io/created-by: infrastructure-manager
app.kubernetes.io/part-of: infrastructure-manager
app.kubernetes.io/managed-by: kustomize
name: metrics-reader
rules:
Expand Down
4 changes: 2 additions & 2 deletions config/rbac/auth_proxy_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ metadata:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: proxy-role
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: cluster-inventory
app.kubernetes.io/part-of: cluster-inventory
app.kubernetes.io/created-by: infrastructure-manager
app.kubernetes.io/part-of: infrastructure-manager
app.kubernetes.io/managed-by: kustomize
name: proxy-role
rules:
Expand Down
4 changes: 2 additions & 2 deletions config/rbac/auth_proxy_role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ metadata:
app.kubernetes.io/name: clusterrolebinding
app.kubernetes.io/instance: proxy-rolebinding
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: cluster-inventory
app.kubernetes.io/part-of: cluster-inventory
app.kubernetes.io/created-by: infrastructure-manager
app.kubernetes.io/part-of: infrastructure-manager
app.kubernetes.io/managed-by: kustomize
name: proxy-rolebinding
roleRef:
Expand Down
4 changes: 2 additions & 2 deletions config/rbac/auth_proxy_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ metadata:
app.kubernetes.io/name: service
app.kubernetes.io/instance: controller-manager-metrics-service
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: cluster-inventory
app.kubernetes.io/part-of: cluster-inventory
app.kubernetes.io/created-by: infrastructure-manager
app.kubernetes.io/part-of: infrastructure-manager
app.kubernetes.io/managed-by: kustomize
name: controller-manager-metrics-service
namespace: system
Expand Down
8 changes: 4 additions & 4 deletions config/rbac/cluster_editor_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ metadata:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: cluster-editor-role
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: cluster-inventory
app.kubernetes.io/part-of: cluster-inventory
app.kubernetes.io/created-by: infrastructure-manager
app.kubernetes.io/part-of: infrastructure-manager
app.kubernetes.io/managed-by: kustomize
name: cluster-editor-role
rules:
- apiGroups:
- clusterinventory.kyma-project.io
- infrastructuremanager.kyma-project.io
resources:
- gardenerclusters
verbs:
Expand All @@ -24,7 +24,7 @@ rules:
- update
- watch
- apiGroups:
- clusterinventory.kyma-project.io
- infrastructuremanager.kyma-project.io
resources:
- gardenerclusters/status
verbs:
Expand Down
8 changes: 4 additions & 4 deletions config/rbac/cluster_viewer_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ metadata:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: cluster-viewer-role
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: cluster-inventory
app.kubernetes.io/part-of: cluster-inventory
app.kubernetes.io/created-by: infrastructure-manager
app.kubernetes.io/part-of: infrastructure-manager
app.kubernetes.io/managed-by: kustomize
name: cluster-viewer-role
rules:
- apiGroups:
- clusterinventory.kyma-project.io
- infrastructuremanager.kyma-project.io
resources:
- gardenerclusters
verbs:
- get
- list
- watch
- apiGroups:
- clusterinventory.kyma-project.io
- infrastructuremanager.kyma-project.io
resources:
- gardenerclusters/status
verbs:
Expand Down
4 changes: 2 additions & 2 deletions config/rbac/leader_election_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ metadata:
app.kubernetes.io/name: role
app.kubernetes.io/instance: leader-election-role
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: cluster-inventory
app.kubernetes.io/part-of: cluster-inventory
app.kubernetes.io/created-by: infrastructure-manager
app.kubernetes.io/part-of: infrastructure-manager
app.kubernetes.io/managed-by: kustomize
name: leader-election-role
rules:
Expand Down
4 changes: 2 additions & 2 deletions config/rbac/leader_election_role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ metadata:
app.kubernetes.io/name: rolebinding
app.kubernetes.io/instance: leader-election-rolebinding
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: cluster-inventory
app.kubernetes.io/part-of: cluster-inventory
app.kubernetes.io/created-by: infrastructure-manager
app.kubernetes.io/part-of: infrastructure-manager
app.kubernetes.io/managed-by: kustomize
name: leader-election-rolebinding
roleRef:
Expand Down
6 changes: 3 additions & 3 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: manager-role
rules:
- apiGroups:
- clusterinventory.kyma-project.io
- infrastructuremanager.kyma-project.io
resources:
- clusters
verbs:
Expand All @@ -17,13 +17,13 @@ rules:
- update
- watch
- apiGroups:
- clusterinventory.kyma-project.io
- infrastructuremanager.kyma-project.io
resources:
- clusters/finalizers
verbs:
- update
- apiGroups:
- clusterinventory.kyma-project.io
- infrastructuremanager.kyma-project.io
resources:
- clusters/status
verbs:
Expand Down
Loading

0 comments on commit 3859d91

Please sign in to comment.