Skip to content

Commit e631034

Browse files
committed
Resolved issues and made improvements to the operator
1 parent eee1f05 commit e631034

10 files changed

+100
-48
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ testbin/*
1111
bundle
1212
bundle.Dockerfile
1313

14+
#Packagemanifests
15+
packagemanifests
16+
1417
# Binaries for programs and plugins
1518
*.exe
1619
*.exe~

Makefile

+18
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
2828
endif
2929
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
3030

31+
# Options for "packagemanifests".
32+
ifneq ($(origin FROM_VERSION), undefined)
33+
PKG_FROM_VERSION := --from-version=$(FROM_VERSION)
34+
endif
35+
ifneq ($(origin CHANNEL), undefined)
36+
PKG_CHANNELS := --channel=$(CHANNEL)
37+
endif
38+
ifeq ($(IS_CHANNEL_DEFAULT), 1)
39+
PKG_IS_DEFAULT_CHANNEL := --default-channel
40+
endif
41+
PKG_MAN_OPTS ?= $(FROM_VERSION) $(PKG_CHANNELS) $(PKG_IS_DEFAULT_CHANNEL)
42+
3143
# Image URL to use all building/pushing image targets
3244
IMG ?= quay.io/redhat-cop/group-sync-operator:$(VERSION)
3345
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
@@ -150,3 +162,9 @@ bundle: manifests
150162
.PHONY: bundle-build
151163
bundle-build:
152164
docker build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
165+
166+
# Generate package manifests.
167+
packagemanifests: kustomize manifests
168+
$(OPERATOR_SDK) generate kustomize manifests -q
169+
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
170+
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate packagemanifests -q --version $(VERSION) $(PKG_MAN_OPTS)

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Synchronizes groups from external providers into OpenShift
88

99
## Overview
1010

11-
The OpenShift Container Platform contains functionality to synchronize groups found in external identity providers into the platform. Currently, this functionality is limited to LDAP only. This operator is designed to integrate with external providers in order to provide new solutions.
11+
The OpenShift Container Platform contains functionality to synchronize groups found in external identity providers into the platform. Currently, the functionality that is included in OpenShift to limited to synchronizing LDAP only. This operator is designed to integrate with external providers in order to provide new solutions.
1212

1313
Group Synchronization is facilitated by creating a `GroupSync` resource. The following describes the high level schema for this resource:
1414

@@ -448,6 +448,6 @@ go mod vendor
448448
Using the [operator-sdk](https://github.com/operator-framework/operator-sdk), run the operator locally:
449449

450450
```shell
451-
oc apply -f deploy/crds/redhatcop.redhat.io_groupsyncs_crd.yaml
452-
OPERATOR_NAME='group-sync-operator' operator-sdk run --local --watch-namespace ""
451+
make install
452+
OPERATOR_NAME='group-sync-operator' make run ENABLE_WEBHOOKS=false
453453
```

config/crd/bases/redhatcop.redhat.io_groupsyncs.yaml

+2-40
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1beta1
22
kind: CustomResourceDefinition
33
metadata:
44
annotations:
5-
controller-gen.kubebuilder.io/version: v0.3.0
5+
controller-gen.kubebuilder.io/version: v0.4.0
66
creationTimestamp: null
77
name: groupsyncs.redhatcop.redhat.io
88
spec:
@@ -696,45 +696,7 @@ spec:
696696
description: GroupSyncStatus defines the observed state of GroupSync
697697
properties:
698698
conditions:
699-
description: Conditions is a set of Condition instances.
700-
items:
701-
description: "Condition represents an observation of an object's state.
702-
Conditions are an extension mechanism intended to be used when the
703-
details of an observation are not a priori known or would not apply
704-
to all instances of a given Kind. \n Conditions should be added
705-
to explicitly convey properties that users and components care about
706-
rather than requiring those properties to be inferred from other
707-
observations. Once defined, the meaning of a Condition can not be
708-
changed arbitrarily - it becomes part of the API, and has the same
709-
backwards- and forwards-compatibility concerns of any other part
710-
of the API."
711-
properties:
712-
lastTransitionTime:
713-
format: date-time
714-
type: string
715-
message:
716-
type: string
717-
reason:
718-
description: ConditionReason is intended to be a one-word, CamelCase
719-
representation of the category of cause of the current status.
720-
It is intended to be used in concise output, such as one-line
721-
kubectl get output, and in summarizing occurrences of causes.
722-
type: string
723-
status:
724-
type: string
725-
type:
726-
description: "ConditionType is the type of the condition and is
727-
typically a CamelCased word or short phrase. \n Condition types
728-
should indicate state in the \"abnormal-true\" polarity. For
729-
example, if the condition indicates when a policy is invalid,
730-
the \"is valid\" case is probably the norm, so the condition
731-
should be called \"Invalid\"."
732-
type: string
733-
required:
734-
- status
735-
- type
736-
type: object
737-
type: array
699+
type: Any
738700
lastSyncSuccessTime:
739701
description: LastSyncSuccessTime represents the time last synchronization
740702
completed successfully

config/default/kustomization.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ bases:
1616
- ../crd
1717
- ../rbac
1818
- ../manager
19+
- serviceaccount.yaml
1920
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
2021
# crd/kustomization.yaml
2122
#- ../webhook
@@ -29,6 +30,7 @@ patchesStrategicMerge:
2930
# If you want your controller-manager to expose the /metrics
3031
# endpoint w/o any authn/z, please comment the following line.
3132
- manager_auth_proxy_patch.yaml
33+
- serviceaccount_patch.yaml
3234

3335
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
3436
# crd/kustomization.yaml

config/default/serviceaccount.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: controller-manager
5+
namespace: system
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: controller-manager
5+
namespace: system
6+
spec:
7+
template:
8+
spec:
9+
serviceAccountName: controller-manager

config/manager/kustomization.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ kind: Kustomization
55
images:
66
- name: controller
77
newName: quay.io/redhat-cop/group-sync-operator
8-
newTag: v0.0.7
8+
newTag: v0.0.8

config/manifests/bases/group-sync-operator.clusterserviceversion.yaml

+56-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ kind: ClusterServiceVersion
33
metadata:
44
annotations:
55
alm-examples: '[]'
6-
capabilities: Basic Install
6+
capabilities: Full Lifecycle
7+
categories: Security
8+
certified: "false"
9+
containerImage: quay.io/redhat-cop/group-sync-operator:latest
10+
createdAt: "2020-12-17T13:26:12Z"
11+
description: Synchronize groups and users from external providers
712
operators.operatorframework.io/builder: operator-sdk-v1.2.0
813
operators.operatorframework.io/project_layout: go.kubebuilder.io/v2
14+
repository: https://github.com/redhat-cop/group-sync-operator
15+
support: Red Hat Community of Practice
916
name: group-sync-operator.vX.Y.Z
1017
namespace: placeholder
1118
spec:
@@ -389,7 +396,7 @@ spec:
389396
390397
## Overview
391398
392-
The OpenShift Container Platform contains functionality to synchronize groups found in external identity providers into the platform. Currently, this functionality is limited to LDAP only. This operator is designed to integrate with external providers in order to provide new solutions.
399+
The OpenShift Container Platform contains functionality to synchronize groups found in external identity providers into the platform. Currently, the functionality that is included in OpenShift to limited to synchronizing LDAP only. This operator is designed to integrate with external providers in order to provide new solutions.
393400
394401
Group Synchronization is facilitated by creating a `GroupSync` resource. The following describes the high level schema for this resource:
395402
@@ -809,6 +816,53 @@ spec:
809816
mediatype: image/png
810817
install:
811818
spec:
819+
clusterPermissions:
820+
- rules:
821+
- apiGroups:
822+
- ""
823+
resources:
824+
- events
825+
verbs:
826+
- get
827+
- list
828+
- watch
829+
- create
830+
- patch
831+
- apiGroups:
832+
- ""
833+
resources:
834+
- secrets
835+
verbs:
836+
- get
837+
- list
838+
- watch
839+
- apiGroups:
840+
- user.openshift.io
841+
resources:
842+
- groups
843+
verbs:
844+
- create
845+
- delete
846+
- get
847+
- list
848+
- patch
849+
- update
850+
- watch
851+
- apiGroups:
852+
- redhatcop.redhat.io
853+
resources:
854+
- groupsyncs
855+
- groupsyncs/status
856+
- groupsyncs/finalizers
857+
verbs:
858+
- create
859+
- delete
860+
- get
861+
- list
862+
- patch
863+
- update
864+
- watch
865+
serviceAccountName: controller-manager
812866
deployments: null
813867
strategy: ""
814868
installModes:
@@ -834,6 +888,5 @@ spec:
834888
maturity: alpha
835889
provider:
836890
name: Red Hat Community of Practice
837-
url: https://redhat-cop.github.io/
838891
replaces: 0.0.6
839892
version: 0.0.0

config/rbac/role_binding.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ roleRef:
88
name: manager-role
99
subjects:
1010
- kind: ServiceAccount
11-
name: default
11+
name: controller-manager
1212
namespace: system

0 commit comments

Comments
 (0)