Skip to content

Commit

Permalink
Adopt for public usage and remove unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
mrMigles committed Nov 28, 2024
1 parent b095af8 commit c5098b5
Show file tree
Hide file tree
Showing 25 changed files with 59 additions and 58 deletions.
10 changes: 5 additions & 5 deletions consul-acl-configurator-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
# This variable is used to construct full image tags for bundle and catalog images.
#
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
# netcracker.com/consul-acl-configurator-operator-bundle:$VERSION and netcracker.com/consul-acl-configurator-operator-catalog:$VERSION.
IMAGE_TAG_BASE ?= netcracker.com/consul-acl-configurator-operator
# qubership.org/consul-acl-configurator-operator-bundle:$VERSION and qubership.org/consul-acl-configurator-operator-catalog:$VERSION.
IMAGE_TAG_BASE ?= qubership.org/consul-acl-configurator-operator

# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
Expand Down Expand Up @@ -80,13 +80,13 @@ help: ## Display this help.
.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:maxDescLen=0 webhook paths="./..." output:crd:artifacts:config=config/crd/bases
sed -i "/annotations:/a\ crd.netcracker.com\/version: $(CRD_VERSION)" config/crd/bases/netcracker.com_consulacls.yaml
sed -i "/annotations:/a\ crd\/version: $(CRD_VERSION)" config/crd/bases/qubership.org_consulacls.yaml
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:crdVersions=v1beta1,maxDescLen=0 webhook paths="./..." output:crd:artifacts:config=config/crd/old
sed -i "/annotations:/a\ crd.netcracker.com\/version: $(CRD_VERSION)" config/crd/old/netcracker.com_consulacls.yaml
sed -i "/annotations:/a\ crd\/version: $(CRD_VERSION)" config/crd/old/qubership.org_consulacls.yaml

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

.PHONY: fmt
fmt: ## Run go fmt against code.
Expand Down
8 changes: 4 additions & 4 deletions consul-acl-configurator-operator/PROJECT
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
domain: netcracker.com
domain: qubership.org
layout:
- go.kubebuilder.io/v3
plugins:
manifests.sdk.operatorframework.io/v2: {}
scorecard.sdk.operatorframework.io/v2: {}
projectName: consul-acl-configurator-operator
repo: git.netcracker.com/PROD.Platform.Streaming/consul-acl-configurator/consul-acl-configurator-operator
repo: github.com/Netcracker/consul-acl-configurator/consul-acl-configurator-operator
resources:
- api:
crdVersion: v1
namespaced: true
controller: true
domain: netcracker.com
domain: qubership.org
kind: ConsulACL
path: git.netcracker.com/PROD.Platform.Streaming/consul-acl-configurator/consul-acl-configurator-operator/api/v1
path: github.com/Netcracker/consul-acl-configurator/consul-acl-configurator-operator/api/v1
version: v1
version: "3"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//+kubebuilder:object:generate=true
//+groupName=netcracker.com
// +kubebuilder:object:generate=true
// +groupName=qubership.org
package v1alpha1

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

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "netcracker.com", Version: "v1alpha1"}
GroupVersion = schema.GroupVersion{Group: "qubership.org", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
crd.netcracker.com/version: 0.0.18
crd.qubership.org/version: 0.0.18
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: consulacls.netcracker.com
name: consulacls.qubership.org
spec:
group: netcracker.com
group: qubership.org
names:
kind: ConsulACL
listKind: ConsulACLList
Expand Down
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/netcracker.com_consulacls.yaml
- bases/qubership.org_consulacls.yaml
#+kubebuilder:scaffold:crdkustomizeresource

patchesStrategicMerge:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
crd.netcracker.com/version: 0.0.18
crd.qubership.org/version: 0.0.18
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: consulacls.netcracker.com
name: consulacls.qubership.org
spec:
group: netcracker.com
group: qubership.org
names:
kind: ConsulACL
listKind: ConsulACLList
Expand Down
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: consulacls.netcracker.com
name: consulacls.qubership.org
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: consulacls.netcracker.com
name: consulacls.qubership.org
spec:
conversion:
strategy: Webhook
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ webhook:
port: 9443
leaderElection:
leaderElect: true
resourceName: 466927a6.netcracker.com
resourceName: 466927a6.qubership.org
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: consulacl-editor-role
rules:
- apiGroups:
- netcracker.com
- qubership.org
resources:
- consulacls
verbs:
Expand All @@ -17,7 +17,7 @@ rules:
- update
- watch
- apiGroups:
- netcracker.com
- qubership.org
resources:
- consulacls/status
verbs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ metadata:
name: consulacl-viewer-role
rules:
- apiGroups:
- netcracker.com
- qubership.org
resources:
- consulacls
verbs:
- get
- list
- watch
- apiGroups:
- netcracker.com
- qubership.org
resources:
- consulacls/status
verbs:
Expand Down
6 changes: 3 additions & 3 deletions consul-acl-configurator-operator/config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
name: manager-role
rules:
- apiGroups:
- netcracker.com
- qubership.org
resources:
- consulacls
verbs:
Expand All @@ -19,13 +19,13 @@ rules:
- update
- watch
- apiGroups:
- netcracker.com
- qubership.org
resources:
- consulacls/finalizers
verbs:
- update
- apiGroups:
- netcracker.com
- qubership.org
resources:
- consulacls/status
verbs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Append samples you want in your CSV to this file as resources ##
resources:
- netcracker.com_v1_consulacl.yaml
- qubership.org_v1_consulacl.yaml
#+kubebuilder:scaffold:manifestskustomizesamples
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: netcracker.com/v1
apiVersion: qubership.org/v1
kind: ConsulACL
metadata:
name: consulacl-sample
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"git.netcracker.com/PROD.Platform.Streaming/consul-acl-configurator/consul-acl-configurator-operator/util"
"github.com/Netcracker/consul-acl-configurator/consul-acl-configurator-operator/util"
consulApi "github.com/hashicorp/consul/api"
"k8s.io/apimachinery/pkg/api/errors"
"net"
Expand All @@ -23,11 +23,11 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
logf "sigs.k8s.io/controller-runtime/pkg/log"

consulacl "git.netcracker.com/PROD.Platform.Streaming/consul-acl-configurator/consul-acl-configurator-operator/api/v1alpha1"
consulacl "github.com/Netcracker/consul-acl-configurator/consul-acl-configurator-operator/api/v1alpha1"
)

const (
consulAclFinalizer = "netcracker.com/consulaclconfigurator-controller"
consulAclFinalizer = "qubership.org/consulaclconfigurator-controller"
errNotFound = "ACL not found"
)

Expand All @@ -48,9 +48,9 @@ type ConsulACLReconciler struct {
ResourceVersions map[string]string
}

//+kubebuilder:rbac:groups=netcracker.com,resources=consulacls,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=netcracker.com,resources=consulacls/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=netcracker.com,resources=consulacls/finalizers,verbs=update
//+kubebuilder:rbac:groups=qubership.org,resources=consulacls,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=qubership.org,resources=consulacls/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=qubership.org,resources=consulacls/finalizers,verbs=update

func (r *ConsulACLReconciler) Reconcile(ctx context.Context, request ctrl.Request) (ctrl.Result, error) {
reqLogger := log.WithValues("Request.Namespace", request.Namespace, "Request.Name", request.Name)
Expand Down
2 changes: 1 addition & 1 deletion consul-acl-configurator-operator/controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

netcrackercomv1 "git.netcracker.com/PROD.Platform.Streaming/consul-acl-configurator/consul-acl-configurator-operator/api/v1alpha1"
netcrackercomv1 "github.com/Netcracker/consul-acl-configurator/consul-acl-configurator-operator/api/v1alpha1"
//+kubebuilder:scaffold:imports
)

Expand Down
2 changes: 1 addition & 1 deletion consul-acl-configurator-operator/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module git.netcracker.com/PROD.Platform.Streaming/consul-acl-configurator/consul-acl-configurator-operator
module github.com/Netcracker/consul-acl-configurator/consul-acl-configurator-operator

go 1.22

Expand Down
1 change: 1 addition & 0 deletions consul-acl-configurator-operator/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,7 @@ golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
22 changes: 11 additions & 11 deletions consul-acl-configurator-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"flag"
"fmt"
"git.netcracker.com/PROD.Platform.Streaming/consul-acl-configurator/consul-acl-configurator-operator/util"
"github.com/Netcracker/consul-acl-configurator/consul-acl-configurator-operator/util"
"os"
"sigs.k8s.io/controller-runtime/pkg/cache"
"strings"
Expand All @@ -19,8 +19,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

netcrackercomv1 "git.netcracker.com/PROD.Platform.Streaming/consul-acl-configurator/consul-acl-configurator-operator/api/v1alpha1"
"git.netcracker.com/PROD.Platform.Streaming/consul-acl-configurator/consul-acl-configurator-operator/controllers"
netcrackercomv1 "github.com/Netcracker/consul-acl-configurator/consul-acl-configurator-operator/api/v1alpha1"
"github.com/Netcracker/consul-acl-configurator/consul-acl-configurator-operator/controllers"
//+kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -65,12 +65,12 @@ func main() {
}

mgrOptions := ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: fmt.Sprintf("consulacls.%s.netcracker.com", ownNamespace),
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: fmt.Sprintf("consulacls.%s.qubership.org", ownNamespace),
LeaderElectionNamespace: ownNamespace,
}

Expand All @@ -83,8 +83,8 @@ func main() {
}

if err = (&controllers.ConsulACLReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
ResourceVersions: map[string]string{},
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "ConsulACL")
Expand Down
2 changes: 1 addition & 1 deletion consul-acl-configurator-operator/util/cr_updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package util

import (
"context"
consulacl "git.netcracker.com/PROD.Platform.Streaming/consul-acl-configurator/consul-acl-configurator-operator/api/v1alpha1"
consulacl "github.com/Netcracker/consul-acl-configurator/consul-acl-configurator-operator/api/v1alpha1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/util/retry"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
6 changes: 3 additions & 3 deletions documentation/installation-guide/installation-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The chart installs Consul ACL configurator deployment and service in OpenShift/K

# Deployment

Consul ACL configurator installation bases on Helm Chart. Helm Chart places in [consul-service](https://git.netcracker.com/PROD.Platform.Streaming/consul-service/-/tree/master/charts/helm/consul-service/templates/consul_acl_configurator)
Consul ACL configurator installation bases on Helm Chart. Helm Chart places in [consul-service](https://github.com/Netcracker/consul-service/-/tree/master/charts/helm/consul-service/templates/consul_acl_configurator)
directory.

## Configuration
Expand Down Expand Up @@ -114,11 +114,11 @@ Custom Resource Definition (CRD) created by this chart does not remove by defaul
* OpenShift

```
oc delete crd consulacls.netcracker.com
oc delete crd consulacls.qubership.org
```
* Kubernetes
```
kubectl delete crd consulacls.netcracker.com
kubectl delete crd consulacls.qubership.org
```
4 changes: 2 additions & 2 deletions documentation/maintenance-guide/development-guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This section describes a contract between a client service and Consul ACL Config
To create/update Consul ACL policy, role or rule binding a client service should implement "consulacls" Kubernetes custom resource
For example,
```yaml
apiVersion: netcracker.com/v1alpha1
apiVersion: qubership.org/v1alpha1
kind: ConsulACL
metadata:
name: example-consul-acl-config
Expand Down Expand Up @@ -47,7 +47,7 @@ spec:
}
```
There are some required yaml fields
- `apiVersion` (netcracker.com/v1alpha1),
- `apiVersion` (qubership.org/v1alpha1),
- `kind` (ConsulACL),
- `metadata.name` (any name but it should be unique for namespace "consulacls" CRs),
- `spec.acl.name` (any name),
Expand Down
2 changes: 1 addition & 1 deletion rest-acl-configurator/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

var deploymentRes = schema.GroupVersionResource{
Group: "netcracker.com",
Group: "qubership.org",
Version: "v1alpha1",
Resource: "consulacls"}

Expand Down
2 changes: 1 addition & 1 deletion rest-acl-configurator/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module git.netcracker.com/PROD.Platform.Streaming/consul-acl-configurator/rest-acl-configurator
module github.com/Netcracker/consul-acl-configurator/rest-acl-configurator

go 1.22

Expand Down

0 comments on commit c5098b5

Please sign in to comment.