Skip to content

Commit

Permalink
Merge pull request #257 from redhat-marketplace/hotfix/2.3.3
Browse files Browse the repository at this point in the history
Release 2.3.3
  • Loading branch information
zach-source authored Oct 6, 2021
2 parents 683ea22 + 86327c4 commit 158b888
Show file tree
Hide file tree
Showing 17 changed files with 455 additions and 334 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
run:
shell: bash
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body,
'/push') }}
'/push-images') }}
steps:
- name: Check if user has write access
uses: lannonbr/[email protected]
Expand Down Expand Up @@ -255,7 +255,7 @@ jobs:
run:
shell: bash
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body,
'/publish')}}
'/publish-images')}}
steps:
- name: Check if user has write access
uses: lannonbr/[email protected]
Expand Down Expand Up @@ -548,13 +548,11 @@ jobs:
uses: actions/checkout@v2
- name: Copy Manifest
run: |-
echo "::group::Push scan.connect.redhat.com/ospid-64f06656-d9d4-43ef-a227-3b9c198800a1/redhat-marketplace-operator-manifest:$TARGET_TAG"
skopeo --override-os=linux inspect docker://scan.connect.redhat.com/ospid-64f06656-d9d4-43ef-a227-3b9c198800a1/redhat-marketplace-operator-manifest:$TARGET_TAG --creds ${{secrets['pcUser']}}:${{secrets['pcPasswordOperatorManifest']}} > /dev/null
([[ $? == 0 ]] && echo "exists=true" || skopeo copy docker://quay.io/rh-marketplace/redhat-marketplace-operator-manifest:$TAG docker://scan.connect.redhat.com/ospid-64f06656-d9d4-43ef-a227-3b9c198800a1/redhat-marketplace-operator-manifest:$TARGET_TAG --dest-creds ${{secrets['pcUser']}}:${{secrets['pcPasswordOperatorManifest']}})
echo "::group::Push scan.connect.redhat.com/ospid-64f06656-d9d4-43ef-a227-3b9c198800a1/redhat-marketplace-operator-manifest:$TAG"
skopeo --override-os=linux inspect docker://scan.connect.redhat.com/ospid-64f06656-d9d4-43ef-a227-3b9c198800a1/redhat-marketplace-operator-manifest:$TAG --creds ${{secrets['pcUser']}}:${{secrets['pcPasswordOperatorManifest']}} > /dev/null
([[ $? == 0 ]] && echo "exists=true" || skopeo copy docker://quay.io/rh-marketplace/redhat-marketplace-operator-manifest:$TAG docker://scan.connect.redhat.com/ospid-64f06656-d9d4-43ef-a227-3b9c198800a1/redhat-marketplace-operator-manifest:$TAG --dest-creds ${{secrets['pcUser']}}:${{secrets['pcPasswordOperatorManifest']}})
echo "::endgroup::"
shell: bash {0}
env:
TARGET_TAG: ${{ env.TAG }}-${{ env.GITHUB_RUN_ID }}
- uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{github.event.comment.id}}
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ save-licenses: golicense
done

cicd:
go generate ./gen.go
cd .github/workflows && go generate ./gen.go

export GO_LICENSES
Expand Down
17 changes: 0 additions & 17 deletions gen.go

This file was deleted.

13 changes: 0 additions & 13 deletions internal/bootstrap/ci_tool.cue
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,3 @@ command: vendorgithubschema: {
cmd: "go run cuelang.org/go/cmd/cue import -f -p github -l #Workflow: jsonschema: - --outfile pkg/github.com/SchemaStore/schemastore/src/schemas/json/github/github-workflow.cue"
}
}

command: vendortravisschema: {
get: http.Get & {
request: body: ""

// Tip link: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/github-workflow.json
url: "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/travis.json"
}
convert: exec.Run & {
stdin: get.response.body
cmd: "go run cuelang.org/go/cmd/cue import -f -p travis -l #Travis: jsonschema: - --outfile pkg/github.com/SchemaStore/schemastore/src/schemas/json/travis/travis.cue"
}
}
13 changes: 0 additions & 13 deletions internal/ci/ci_tool.cue
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,3 @@ command: genscripts: task: {
}
}
}

command: gentravis: task: {
for w in travis {
"\(w.file)": file.Create & {
filename: w.file
contents: """
# Generated by internal/ci/ci_tool.cue; do not edit
\(yaml.Marshal(w.schema))
"""
}
}
}
87 changes: 0 additions & 87 deletions internal/ci/travis.cue

This file was deleted.

20 changes: 8 additions & 12 deletions internal/ci/workflows.cue
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ workflows: [
file: "release_status.yml"
schema: release_status
},
{
file: "sync_branches.yml"
schema: sync_branches
},
// {
// file: "sync_branches.yml"
// schema: sync_branches
// },
]
varPresetGitTag: "${{ needs.preset.outputs.tag }}"
varPresetVersion: "${{ needs.preset.outputs.version }}"
Expand Down Expand Up @@ -198,7 +198,7 @@ publish: _#bashWorkflow & {
jobs: {
push: _#job & {
name: "Push Images to PC"
if: "${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/push') }}"
if: "${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/push-images') }}"
"runs-on": _#linuxMachine
steps: [
_#hasWriteAccess,
Expand Down Expand Up @@ -230,7 +230,7 @@ publish: _#bashWorkflow & {
}
publish: _#job & {
name: "Publish Images"
if: "${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/publish')}}"
if: "${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/publish-images')}}"
"runs-on": _#linuxMachine
steps: [
_#hasWriteAccess,
Expand Down Expand Up @@ -290,11 +290,7 @@ publish: _#bashWorkflow & {
_#getBundleRunID,
_#redhatConnectLogin,
_#checkoutCode,
_#retagManifestCommand & {
env: {
TARGET_TAG: "${{ env.TAG }}-${{ env.GITHUB_RUN_ID }}"
}
},
_#retagManifestCommand,
_#addRocketToComment,
]
}
Expand Down Expand Up @@ -1075,7 +1071,7 @@ _#retagManifestCommand: _#step & {
fromTo: [ for k, v in [_#manifest] {
pword: "\(v.pword)"
from: "\(_#registry)/\(v.name):$TAG"
to: "\(_#registryRHScan)/\(v.ospid)/\(v.name):$TARGET_TAG"
to: "\(_#registryRHScan)/\(v.ospid)/\(v.name):$TAG"
}]
manifestCopyCommandList: [ for k, v in #args.fromTo {(_#copyImage & {#args: v}).res}]
}
Expand Down
34 changes: 22 additions & 12 deletions v2/controllers/marketplace/meterbase_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ const (
)

var (
ErrRetentionTime = errors.New("retention time must be at least 168h")
ErrInsufficientStorageConfiguration = errors.New("must allocate at least 40GiB of disk space")
ErrParseUserWorkloadConfiguration = errors.New("could not parse user workload configuration from user-workload-monitoring-config cm")
ErrUserWorkloadMonitoringConfigNotFound = errors.New("user-workload-monitoring-config config map not found on cluster")
ErrRetentionTime = errors.New("retention time must be at least 168h")
ErrInsufficientStorageConfiguration = errors.New("must allocate at least 40GiB of disk space")
ErrParseUserWorkloadConfiguration = errors.New("could not parse user workload configuration from user-workload-monitoring-config cm")
ErrUserWorkloadMonitoringConfigNotFound = errors.New("user-workload-monitoring-config config map not found on cluster")
)

// blank assignment to verify that ReconcileMeterBase implements reconcile.Reconciler
Expand Down Expand Up @@ -443,7 +443,6 @@ func (r *MeterBaseReconciler) Reconcile(request reconcile.Request) (reconcile.Re
if userWorkloadMonitoringEnabled {
// Openshift provides Prometheus
if result, _ := cc.Do(context.TODO(),
Do(r.createTokenSecret(instance)...),
Do(r.installPrometheusServingCertsCABundle()...),
Do(r.installMetricStateDeployment(instance, userWorkloadMonitoringEnabled)...),
Do(r.installUserWorkloadMonitoring(instance)...),
Expand Down Expand Up @@ -472,7 +471,6 @@ func (r *MeterBaseReconciler) Reconcile(request reconcile.Request) (reconcile.Re

prometheus := &monitoringv1.Prometheus{}
if result, _ := cc.Do(context.TODO(),
Do(r.createTokenSecret(instance)...),
Do(r.installPrometheusServingCertsCABundle()...),
Do(r.reconcilePrometheusOperator(instance)...),
Do(r.installMetricStateDeployment(instance, userWorkloadMonitoringEnabled)...),
Expand Down Expand Up @@ -952,8 +950,9 @@ func (r *MeterBaseReconciler) installMetricStateDeployment(
instance *marketplacev1alpha1.MeterBase,
userWorkoadMonitoring bool,
) []ClientAction {
secretName := tokenSecretName
var secretName *string

pod := &corev1.Pod{}
metricStateDeployment := &appsv1.Deployment{}
metricStateService := &corev1.Service{}
metricStateServiceMonitor := &monitoringv1.ServiceMonitor{}
Expand All @@ -967,6 +966,12 @@ func (r *MeterBaseReconciler) installMetricStateDeployment(
}

actions := []ClientAction{
HandleResult(
GetAction(
types.NamespacedName{Namespace: r.cfg.DeployedNamespace, Name: r.cfg.DeployedPodName},
pod,
),
OnNotFound(ReturnWithError(errors.New("pod not found")))),
manifests.CreateOrUpdateFactoryItemAction(
metricStateDeployment,
func() (runtime.Object, error) {
Expand All @@ -985,7 +990,12 @@ func (r *MeterBaseReconciler) installMetricStateDeployment(
manifests.CreateOrUpdateFactoryItemAction(
metricStateServiceMonitor,
func() (runtime.Object, error) {
return r.factory.MetricStateServiceMonitor(&secretName)
for _, volume := range pod.Spec.Volumes {
if volume.Secret != nil && strings.HasPrefix(volume.Secret.SecretName, "redhat-marketplace-operator-token-") {
secretName = &volume.Secret.SecretName
}
}
return r.factory.MetricStateServiceMonitor(secretName)
},
args,
),
Expand Down Expand Up @@ -1020,21 +1030,21 @@ func (r *MeterBaseReconciler) installMetricStateDeployment(
manifests.CreateOrUpdateFactoryItemAction(
kubeStateMetricsServiceMonitor,
func() (runtime.Object, error) {
return r.factory.KubeStateMetricsServiceMonitor(&secretName)
return r.factory.KubeStateMetricsServiceMonitor(secretName)
},
args,
),
manifests.CreateOrUpdateFactoryItemAction(
kubeletServiceMonitor,
func() (runtime.Object, error) {
return r.factory.KubeletServiceMonitor(&secretName)
return r.factory.KubeletServiceMonitor(secretName)
},
args,
),
)
} else {
kubeStateMetricsServiceMonitor, _ = r.factory.KubeStateMetricsServiceMonitor(&secretName)
kubeletServiceMonitor, _ = r.factory.KubeletServiceMonitor(&secretName)
kubeStateMetricsServiceMonitor, _ = r.factory.KubeStateMetricsServiceMonitor(secretName)
kubeletServiceMonitor, _ = r.factory.KubeletServiceMonitor(secretName)

actions = append(actions,
HandleResult(
Expand Down
2 changes: 1 addition & 1 deletion v2/controllers/marketplace/meterreport_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (r *MeterReportReconciler) SetupWithManager(mgr manager.Manager) error {
Complete(r)
}

const rerunTime = 12 * 24 * time.Hour //12 days
const rerunTime = 1 * 24 * time.Hour // 1 day - reducing rerun time

// Reconcile reads that state of the cluster for a MeterReport object and makes changes based on the state read
// and what is in the MeterReport.Spec
Expand Down
Loading

0 comments on commit 158b888

Please sign in to comment.