Skip to content

Commit

Permalink
Migrate project from go v3 layout to v4
Browse files Browse the repository at this point in the history
Signed-off-by: Niraj Yadav <[email protected]>
  • Loading branch information
black-dragon74 authored and mergify[bot] committed Jul 11, 2024
1 parent 60ec25a commit 90c23d2
Show file tree
Hide file tree
Showing 265 changed files with 26,648 additions and 8,497 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ help: ## Display this help.

.PHONY: manifests
manifests: controller-gen kustomize ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="{./apis/...,./cmd/...,./controllers/...,./internal/...,./sidecar/...}" output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="{./api/...,./cmd/...,./internal/controller/...,./internal/...,./sidecar/...}" output:crd:artifacts:config=config/crd/bases
cd config/manager && $(KUSTOMIZE) edit set image controller=${CONTROLLER_IMG} rbac-proxy=${RBAC_PROXY_IMG}
$(KUSTOMIZE) build config/crd > deploy/controller/crds.yaml
$(KUSTOMIZE) build config/rbac > deploy/controller/rbac.yaml
Expand All @@ -136,7 +136,7 @@ bundle: gen-csv-base manifests operator-sdk

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./apis/..."
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./api/..."

.PHONY: generate-protobuf
generate-protobuf: protoc-gen-go protoc-gen-go-grpc
Expand Down Expand Up @@ -219,7 +219,7 @@ uninstall: manifests ## Uninstall CRDs from the K8s cluster specified in ~/.kube

.PHONY: deploy
deploy: manifests ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd deploy/controller && kubectl apply -f crds.yaml -f rbac.yaml -f setup-controller.yaml
cd deploy/controller && kubectl apply -f setup-controller.yaml -f crds.yaml -f rbac.yaml

.PHONY: undeploy
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
Expand Down
20 changes: 10 additions & 10 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: openshift.io
layout:
- go.kubebuilder.io/v3
- go.kubebuilder.io/v4
multigroup: true
projectName: kubernetes-csi-addons
repo: github.com/csi-addons/kubernetes-csi-addons
Expand All @@ -16,7 +16,7 @@ resources:
domain: openshift.io
group: csiaddons
kind: CSIAddonsNode
path: github.com/csi-addons/kubernetes-csi-addons/apis/csiaddons/v1alpha1
path: github.com/csi-addons/kubernetes-csi-addons/api/csiaddons/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
Expand All @@ -25,21 +25,21 @@ resources:
domain: openshift.io
group: csiaddons
kind: ReclaimSpaceJob
path: github.com/csi-addons/kubernetes-csi-addons/apis/csiaddons/v1alpha1
path: github.com/csi-addons/kubernetes-csi-addons/api/csiaddons/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
controller: true
domain: openshift.io
group: csiaddons
kind: NetworkFence
path: github.com/csi-addons/kubernetes-csi-addons/apis/csiaddons/v1alpha1
path: github.com/csi-addons/kubernetes-csi-addons/api/csiaddons/v1alpha1
version: v1alpha1
- controller: true
domain: openshift.io
group: csiaddons
kind: ReclaimSpaceCronJob
path: github.com/csi-addons/kubernetes-csi-addons/apis/csiaddons/v1alpha1
path: github.com/csi-addons/kubernetes-csi-addons/api/csiaddons/v1alpha1
version: v1alpha1
- controller: true
group: core
Expand All @@ -52,23 +52,23 @@ resources:
domain: openshift.io
group: replication.storage
kind: VolumeReplication
path: github.com/csi-addons/kubernetes-csi-addons/apis/replication.storage/v1alpha1
path: github.com/csi-addons/kubernetes-csi-addons/api/replication.storage/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
domain: openshift.io
group: replication.storage
kind: VolumeReplicationClass
path: github.com/csi-addons/kubernetes-csi-addons/apis/replication.storage/v1alpha1
path: github.com/csi-addons/kubernetes-csi-addons/api/replication.storage/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
controller: true
domain: openshift.io
group: replication.storage
kind: VolumeGroupReplicationClass
path: github.com/csi-addons/kubernetes-csi-addons/apis/replication.storage/v1alpha1
path: github.com/csi-addons/kubernetes-csi-addons/api/replication.storage/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
Expand All @@ -77,14 +77,14 @@ resources:
domain: openshift.io
group: replication.storage
kind: VolumeGroupReplication
path: github.com/csi-addons/kubernetes-csi-addons/apis/replication.storage/v1alpha1
path: github.com/csi-addons/kubernetes-csi-addons/api/replication.storage/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
controller: true
domain: openshift.io
group: replication.storage
kind: VolumeGroupReplicationContent
path: github.com/csi-addons/kubernetes-csi-addons/apis/replication.storage/v1alpha1
path: github.com/csi-addons/kubernetes-csi-addons/api/replication.storage/v1alpha1
version: v1alpha1
version: "3"
2 changes: 1 addition & 1 deletion cmd/csi-addons/replicationClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"context"

replicationv1alpha1 "github.com/csi-addons/kubernetes-csi-addons/apis/replication.storage/v1alpha1"
replicationv1alpha1 "github.com/csi-addons/kubernetes-csi-addons/api/replication.storage/v1alpha1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/serializer"
Expand Down
8 changes: 4 additions & 4 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (
"os"
"time"

csiaddonsv1alpha1 "github.com/csi-addons/kubernetes-csi-addons/apis/csiaddons/v1alpha1"
replicationstoragev1alpha1 "github.com/csi-addons/kubernetes-csi-addons/apis/replication.storage/v1alpha1"
controllers "github.com/csi-addons/kubernetes-csi-addons/controllers/csiaddons"
replicationController "github.com/csi-addons/kubernetes-csi-addons/controllers/replication.storage"
csiaddonsv1alpha1 "github.com/csi-addons/kubernetes-csi-addons/api/csiaddons/v1alpha1"
replicationstoragev1alpha1 "github.com/csi-addons/kubernetes-csi-addons/api/replication.storage/v1alpha1"
"github.com/csi-addons/kubernetes-csi-addons/internal/connection"
controllers "github.com/csi-addons/kubernetes-csi-addons/internal/controller/csiaddons"
replicationController "github.com/csi-addons/kubernetes-csi-addons/internal/controller/replication.storage"
"github.com/csi-addons/kubernetes-csi-addons/internal/util"
"github.com/csi-addons/kubernetes-csi-addons/internal/version"

Expand Down
56 changes: 28 additions & 28 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,41 @@
# since it depends on service name and namespace that are out of this kustomize package.
# It should be run by config/default
resources:
- bases/csiaddons.openshift.io_csiaddonsnodes.yaml
- bases/csiaddons.openshift.io_reclaimspacecronjobs.yaml
- bases/csiaddons.openshift.io_reclaimspacejobs.yaml
- bases/csiaddons.openshift.io_networkfences.yaml
- bases/replication.storage.openshift.io_volumereplications.yaml
- bases/replication.storage.openshift.io_volumereplicationclasses.yaml
- bases/replication.storage.openshift.io_volumegroupreplicationclasses.yaml
- bases/replication.storage.openshift.io_volumegroupreplications.yaml
- bases/replication.storage.openshift.io_volumegroupreplicationcontents.yaml
- bases/csiaddons.openshift.io_csiaddonsnodes.yaml
- bases/csiaddons.openshift.io_reclaimspacecronjobs.yaml
- bases/csiaddons.openshift.io_reclaimspacejobs.yaml
- bases/csiaddons.openshift.io_networkfences.yaml
- bases/replication.storage.openshift.io_volumereplications.yaml
- bases/replication.storage.openshift.io_volumereplicationclasses.yaml
- bases/replication.storage.openshift.io_volumegroupreplicationclasses.yaml
- bases/replication.storage.openshift.io_volumegroupreplications.yaml
- bases/replication.storage.openshift.io_volumegroupreplicationcontents.yaml
# yamllint disable-line rule:comments
#+kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_csiaddonsnodes.yaml
#- patches/webhook_in_reclaimspacejobs.yaml
#- patches/webhook_in_volumereplications.yaml
#- patches/webhook_in_volumereplicationclasses.yaml
#- patches/webhook_in_volumegroupreplicationclasses.yaml
#- patches/webhook_in_volumegroupreplications.yaml
#- patches/webhook_in_volumegroupreplicationcontents.yaml
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_csiaddonsnodes.yaml
#- patches/webhook_in_reclaimspacejobs.yaml
#- patches/webhook_in_volumereplications.yaml
#- patches/webhook_in_volumereplicationclasses.yaml
#- patches/webhook_in_volumegroupreplicationclasses.yaml
#- patches/webhook_in_volumegroupreplications.yaml
#- patches/webhook_in_volumegroupreplicationcontents.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- patches/cainjection_in_csiaddonsnodes.yaml
#- patches/cainjection_in_reclaimspacejobs.yaml
#- patches/cainjection_in_volumereplications.yaml
#- patches/cainjection_in_volumereplicationclasses.yaml
#- patches/cainjection_in_volumegroupreplicationclasses.yaml
#- patches/cainjection_in_volumegroupreplications.yaml
#- patches/cainjection_in_volumegroupreplicationcontents.yaml
# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- patches/cainjection_in_csiaddonsnodes.yaml
#- patches/cainjection_in_reclaimspacejobs.yaml
#- patches/cainjection_in_volumereplications.yaml
#- patches/cainjection_in_volumereplicationclasses.yaml
#- patches/cainjection_in_volumegroupreplicationclasses.yaml
#- patches/cainjection_in_volumegroupreplications.yaml
#- patches/cainjection_in_volumegroupreplicationcontents.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
configurations:
- kustomizeconfig.yaml
- kustomizeconfig.yaml
157 changes: 119 additions & 38 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,66 +1,147 @@
---
# yamllint disable rule:comments rule:comments-indentation
#
# Adds namespace to all resources.
namespace: csi-addons-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: csi-addons-

# Labels to add to all resources and selectors.
#commonLabels:
# someName: someValue
#labels:
#- includeSelectors: true
# pairs:
# someName: someValue

# bases:
resources:
- ../crd
- ../rbac
- ../manager
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
#- ../webhook
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
#- ../certmanager
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
#- ../prometheus
# [METRICS] To enable the controller manager metrics service, uncomment the following line.
#- metrics_service.yaml

# patchesStrategicMerge:
# Mount the controller config file for loading manager configurations
# through a ComponentConfig type
#- manager_config_patch.yaml
# Uncomment the patches line if you enable Metrics, and/or are using webhooks and cert-manager
#patches:
# [METRICS] The following patch will enable the metrics endpoint. Ensure that you also protect this endpoint.
# More info: https://book.kubebuilder.io/reference/metrics
# If you want to expose the metric endpoint of your controller-manager uncomment the following line.
#- path: manager_metrics_patch.yaml
# target:
# kind: Deployment

# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
#- manager_webhook_patch.yaml
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
#- path: manager_webhook_patch.yaml

# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
# 'CERTMANAGER' needs to be enabled to use ca injection
#- webhookcainjection_patch.yaml
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
# 'CERTMANAGER' needs to be enabled to use ca injection
#- path: webhookcainjection_patch.yaml

# the following config is for teaching kustomize how to do var substitution
#vars:
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
# - name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
# objref:
# Uncomment the following replacements to add the cert-manager CA injection annotations
#replacements:
# - source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs
# kind: Certificate
# group: cert-manager.io
# version: v1
# name: serving-cert # this name should match the one in certificate.yaml
# fieldref:
# fieldpath: metadata.namespace
# - name: CERTIFICATE_NAME
# objref:
# fieldPath: .metadata.namespace # namespace of the certificate CR
# targets:
# - select:
# kind: ValidatingWebhookConfiguration
# fieldPaths:
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
# options:
# delimiter: '/'
# index: 0
# create: true
# - select:
# kind: MutatingWebhookConfiguration
# fieldPaths:
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
# options:
# delimiter: '/'
# index: 0
# create: true
# - select:
# kind: CustomResourceDefinition
# fieldPaths:
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
# options:
# delimiter: '/'
# index: 0
# create: true
# - source:
# kind: Certificate
# group: cert-manager.io
# version: v1
# name: serving-cert # this name should match the one in certificate.yaml
# - name: SERVICE_NAMESPACE # namespace of the service
# objref:
# fieldPath: .metadata.name
# targets:
# - select:
# kind: ValidatingWebhookConfiguration
# fieldPaths:
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
# options:
# delimiter: '/'
# index: 1
# create: true
# - select:
# kind: MutatingWebhookConfiguration
# fieldPaths:
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
# options:
# delimiter: '/'
# index: 1
# create: true
# - select:
# kind: CustomResourceDefinition
# fieldPaths:
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
# options:
# delimiter: '/'
# index: 1
# create: true
# - source: # Add cert-manager annotation to the webhook Service
# kind: Service
# version: v1
# name: webhook-service
# fieldref:
# fieldpath: metadata.namespace
# - name: SERVICE_NAME
# objref:
# fieldPath: .metadata.name # namespace of the service
# targets:
# - select:
# kind: Certificate
# group: cert-manager.io
# version: v1
# fieldPaths:
# - .spec.dnsNames.0
# - .spec.dnsNames.1
# options:
# delimiter: '.'
# index: 0
# create: true
# - source:
# kind: Service
# version: v1
# name: webhook-service

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../crd
- ../rbac
- ../manager
# fieldPath: .metadata.namespace # namespace of the service
# targets:
# - select:
# kind: Certificate
# group: cert-manager.io
# version: v1
# fieldPaths:
# - .spec.dnsNames.0
# - .spec.dnsNames.1
# options:
# delimiter: '.'
# index: 1
# create: true
Loading

0 comments on commit 90c23d2

Please sign in to comment.