Skip to content

Commit

Permalink
Merge branch 'main' into running_deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
xek authored Aug 10, 2023
2 parents 87d2790 + 23b0317 commit b67baed
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 55 deletions.
18 changes: 18 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
linters:
# Enable specific linter
# https://golangci-lint.run/usage/linters/#enabled-by-default
enable:
- errorlint
- revive
- ginkgolinter
- gofmt
- govet
linters-settings:
revive:
rules:
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unused-parameter
- name: unused-parameter
severity: warning
disabled: true
run:
timeout: 5m
62 changes: 62 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
repos:
- repo: local
hooks:
- id: gotidy
name: gotidy
language: system
entry: make
args: ["tidy"]
pass_filenames: false
- id: make-manifests
name: make-manifests
language: system
entry: make
args: ['manifests']
pass_filenames: false
- id: make-generate
name: make-generate
language: system
entry: make
args: ['generate']
pass_filenames: false
- id: make-operator-lint
name: make-operator-lint
language: system
entry: make
args: ['operator-lint']
pass_filenames: false

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-executables-have-shebangs
exclude: ^vendor
- id: check-shebang-scripts-are-executable
exclude: ^vendor
- id: check-merge-conflict
- id: check-symlinks
- id: destroyed-symlinks
- id: check-yaml
args: [-m]
- id: check-json
- id: detect-private-key
- id: end-of-file-fixer
exclude: ^vendor
- id: no-commit-to-branch
- id: trailing-whitespace
exclude: ^vendor

- repo: https://github.com/openstack/bashate.git
rev: 2.1.1
hooks:
- id: bashate
entry: bashate --error . --ignore=E006,E040,E011,E020,E012

- repo: https://github.com/golangci/golangci-lint
rev: v1.52.2
hooks:
- id: golangci-lint
args: ["-v"]
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,3 @@ 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.

8 changes: 0 additions & 8 deletions api/v1beta1/barbican_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,6 @@ type BarbicanStatus struct {
// Conditions
Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"`

// API endpoints
// TODO(dmendiza): This thing is hideous. Why do we need it?
APIEndpoints map[string]map[string]string `json:"apiEndpoints,omitempty"`

// ServiceIDs
// TODO(dmendiza): This thing is hideous. Why do we need it?
ServiceIDs map[string]string `json:"serviceIDs,omitempty"`

// ReadyCount of Barbican API instances
BarbicanAPIReadyCount int32 `json:"barbicanAPIReadyCount,omitempty"`

Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type BarbicanComponentTemplate struct {
// +kubebuilder:validation:Maximum=32
// +kubebuilder:validation:Minimum=0
// Replicas of Barbican API to run
Replicas int32 `json:"replicas"`
Replicas *int32 `json:"replicas"`

// +kubebuilder:validation:Optional
// CustomServiceConfig - customize the service config using this parameter to change service defaults,
Expand Down
29 changes: 5 additions & 24 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions config/crd/bases/barbican.openstack.org_barbicans.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,6 @@ spec:
status:
description: BarbicanStatus defines the observed state of Barbican
properties:
apiEndpoints:
additionalProperties:
additionalProperties:
type: string
type: object
description: 'API endpoints TODO(dmendiza): This thing is hideous. Why
do we need it?'
type: object
barbicanAPIReadyCount:
description: ReadyCount of Barbican API instances
format: int32
Expand Down Expand Up @@ -354,12 +346,6 @@ spec:
type: string
description: Map of hashes to track e.g. job status
type: object
serviceIDs:
additionalProperties:
type: string
description: 'ServiceIDs TODO(dmendiza): This thing is hideous. Why
do we need it?'
type: object
transportURLSecret:
description: TransportURLSecret - Secret containing RabbitMQ transportURL
type: string
Expand Down
2 changes: 0 additions & 2 deletions config/samples/barbican_v1beta1_barbican.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ spec:
containerImage: quay.io/podified-antelope-centos9/openstack-barbican-api:current-podified
nodeSelector:
optional_override: here
replicas: 1
customServiceConfig: |
[optional]
overrides = True
Expand All @@ -47,7 +46,6 @@ spec:
containerImage: quay.io/podified-antelope-centos9/openstack-barbican-worker:current-podified
nodeSelector:
optional_override: here
replicas: 1
customServiceConfig: |
[optional]
overrides = True
Expand Down
7 changes: 4 additions & 3 deletions controllers/barbican_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"github.com/openstack-k8s-operators/lib-common/modules/common/secret"
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
"github.com/openstack-k8s-operators/lib-common/modules/database"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
k8s_errors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -138,9 +139,6 @@ func (r *BarbicanReconciler) Reconcile(ctx context.Context, req ctrl.Request) (r
if instance.Status.Hash == nil {
instance.Status.Hash = map[string]string{}
}
if instance.Status.APIEndpoints == nil {
instance.Status.APIEndpoints = map[string]map[string]string{}
}

// Handle service delete
if !instance.DeletionTimestamp.IsZero() {
Expand Down Expand Up @@ -282,6 +280,9 @@ func (r *BarbicanReconciler) reconcileDelete(ctx context.Context, instance *barb
func (r *BarbicanReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&barbicanv1beta1.Barbican{}).
Owns(&corev1.ServiceAccount{}).
Owns(&rbacv1.Role{}).
Owns(&rbacv1.RoleBinding{}).
Complete(r)
}

Expand Down
2 changes: 1 addition & 1 deletion hack/boilerplate.go.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ 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.
*/
*/
2 changes: 1 addition & 1 deletion templates/common/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ function merge_config_dir {
cp -f ${conf} /var/lib/config-data/merged/
fi
done
}
}

0 comments on commit b67baed

Please sign in to comment.