Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common automatic update #228

Merged

Conversation

mbaldessari
Copy link
Contributor

  • Add initial multi-source support
  • Add changelog entry and add an explicit property entry to the schema
  • Drop vault.ui.serviceType: "LoadBalancer"
  • Release clustergroup chart version 0.0.2
  • Update crd in common
  • Add support for passing EXTRA_HELM_OPTS
  • Disable kubeconform for the time being
  • Add support for deploying multi source via CLI
  • Upgrade ESO to v0.9.4
  • Release 0.0.2 golang-external-secrets
  • Simplify the passing of KUBECONFIG
  • Update CRD for the operator
  • Expose UUID
  • Move to newly released checkout action version
  • Update URLs to new github org
  • Add ~/.config/validated-patterns in the secret search path
  • Add support for ~/.config/validated-patterns/pattern-uuid
  • Simplify the code around UUID variable definition
  • Fix up common/ tests
  • Move to new checkout action version and disable kubeconform for now

This change adds initial multiSource support to patterns' applications.
The way this works is that nothing changes for applications defined in
values-*.yaml by default. So all patterns will work as usual.

What can change with this patch is that applications can slowly migrate
towards using multi source by changing an app definition from:

    acm:
      name: acm
      path: common/acm

To:

    acm:
      name: acm
      chart: acm
      chartVersion: 0.0.*

So any time we have a `chart` field with a `chartVersion` and no
`repoURL` defined, the clustergroup chart will create a multisource
application with the values files taken from the patterns git repo
and the helm chart from https://charts.validatedpatterns.io/ using
the `chartVersion` defined in the application.

For example the above acm app would prodice the following:

    project: hub
    sources:
    - ref: patternref
      repoURL: https://github.com/mbaldessari/multicloud-gitops
      targetRevision: multisource-test2
    - chart: acm
      helm:
        ignoreMissingValueFiles: true
        parameters:
        - name: global.repoURL
          value: $ARGOCD_APP_SOURCE_REPO_URL
        - name: global.targetRevision
          value: $ARGOCD_APP_SOURCE_TARGET_REVISION
        - name: global.namespace
          value: $ARGOCD_APP_NAMESPACE
        - name: global.pattern
          value: pattern-sample
        - name: global.clusterDomain
          value: mcg-hub.blueprints.rhecoeng.com
        - name: global.clusterVersion
          value: "4.13"
        - name: global.clusterPlatform
          value: AWS
        - name: global.hubClusterDomain
          value: apps.mcg-hub.blueprints.rhecoeng.com
        - name: global.localClusterDomain
          value: apps.mcg-hub.blueprints.rhecoeng.com
        valueFiles:
        - $patternref/values-global.yaml
        - $patternref/values-hub.yaml
        - $patternref/values-AWS.yaml
        - $patternref/values-AWS-4.13.yaml
        - $patternref/values-AWS-hub.yaml
        - $patternref/values-4.13-hub.yaml
      repoURL: https://charts.validatedpatterns.io/
      targetRevision: 0.0.*

Note that this depends on the operator supporting multiSource
applications (version > 0.0.17).
It is not needed and it adds a requirement to the cluster to have a
proper LadBalancer which is not always the case.

The default in the helm chart is "ClusterIP", so let's leave that
default.

Tested this on an OCP 4.13 SNO cluster (without LB) and the UI is
correctly accessible.
Drop vault.ui.serviceType: "LoadBalancer"
Release clustergroup chart version 0.0.2
This is needed if we want to support multisource installations from the
CLI
Currently a user can set additional helm params via the
EXTRA_HELM_OPTS environment variable in order to tweak a value at `make
install` time.

This does not work correctly when we run things from our utility
container, that is because that variable is never passed from the host
to the container.

According to `man podman run` if we simply pass `-e EXTRA_HELM_OPTS` to
the podman invocation: "If an environment variable is spec‐
ified without a value, Podman checks the host environment for a value
and set the variable only if it is set on the host"

* Without setting EXTRA_HELM_OPTS:

    unset EXTRA_HELM_OPTS; ./pattern.sh make install
    make -f common/Makefile operator-deploy
    make[1]: Entering directory '/home/michele/Engineering/cloud-patterns/multicloud-gitops'
    Checking prerequisites:
      Check for 'git helm oc ansible': OK
      Check for python-kubernetes: OK
      Check for kubernetes.core collection: OK
    Checking repository:
      https://github.com/mbaldessari/multicloud-gitops.git - branch main: Running inside a container: Skipping git ssh checks
    + oc get crds patterns.gitops.hybrid-cloud-patterns.io
    + echo 'Running helm:'
    Running helm:
    + helm upgrade --install multicloud-gitops common/operator-install/ -f values-global.yaml --set main.git.repoURL=https://github.com/mbaldessari/multicloud-gitops.git --set main.git.revision=main

* With EXTRA_HELM_OPTS set:

    export EXTRA_HELM_OPTS="--set main.multiSourceConfig.enabled=true"; ./pattern.sh make install
    make -f common/Makefile operator-deploy
    make[1]: Entering directory '/home/michele/Engineering/cloud-patterns/multicloud-gitops'
    Checking prerequisites:
      Check for 'git helm oc ansible': OK
      Check for python-kubernetes: OK
      Check for kubernetes.core collection: OK
    Checking repository:
      https://github.com/mbaldessari/multicloud-gitops.git - branch main: Running inside a container: Skipping git ssh checks
    + oc get crds patterns.gitops.hybrid-cloud-patterns.io
    + echo 'Running helm:'
    Running helm:
    + helm upgrade --install multicloud-gitops common/operator-install/ -f values-global.yaml --set main.git.repoURL=https://github.com/mbaldessari/multicloud-gitops.git --set main.git.revision=main --set main.multiSourceConfig.enabled=true

(Briefly added set -x to see the exact commands during testing)
Via:
```
export EXTRA_HELM_OPTS="--set main.multiSourceConfig.enabled=true"
./pattern.sh make install
```

one can now deploy a pattern with the experimental multisource support
enabled.

Tested with the above command and correctly deployed a multi-source
based pattern.
Add support for deploying multi source via CLI
According to `man podman run` if we simply pass `-e KUBECONFIG` to
the podman invocation: "If an environment variable is spec‐
ified without a value, Podman checks the host environment for a value
and set the variable only if it is set on the host"

So let's just do that and drop the current more complex fragile logic.

Tested with:

* No KUBECONFIG set
unset KUBECONFIG; ./pattern.sh make install
make -f common/Makefile operator-deploy
make[1]: Entering directory '/home/michele/Engineering/cloud-patterns/multicloud-gitops'
Checking prerequisites:
  Check for 'git helm oc ansible': OK
  Check for python-kubernetes: OK
  Check for kubernetes.core collection: OK
Checking repository:
  https://github.com/mbaldessari/multicloud-gitops.git - branch script-fix: Running inside a container: Skipping git ssh checks
Running helm:
Error: Kubernetes cluster unreachable: Get "https://localhos:6443/version"

* With KUBECONFIG set
export KUBECONFIG=~/sno1-kubeconfig
./pattern.sh make install
make -f common/Makefile operator-deploy
make[1]: Entering directory '/home/michele/Engineering/cloud-patterns/multicloud-gitops'
Checking prerequisites:
  Check for 'git helm oc ansible': OK
  Check for python-kubernetes: OK
  Check for kubernetes.core collection: OK
Checking repository:
  https://github.com/mbaldessari/multicloud-gitops.git - branch script-fix: Running inside a container: Skipping git ssh checks
Running helm:
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/michele/sno1-kubeconfig
Release "multicloud-gitops" does not exist. Installing it now.
NAME: multicloud-gitops
LAST DEPLOYED: Mon Sep  4 07:04:16 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
make[1]: Leaving directory '/home/michele/Engineering/cloud-patterns/multicloud-gitops'
make load-secrets
make[1]: Entering directory '/home/michele/Engineering/cloud-patterns/multicloud-gitops'
make -f common/Makefile load-secrets
...
Tested as:
$ helm template .  > /tmp/a; helm template . --set 'main.analyticsUUID=foo' > /tmp/b; diff -u /tmp/a /tmp/b
--- /tmp/a      2023-09-04 15:49:51.160607725 +0200
+++ /tmp/b      2023-09-04 15:49:51.177607813 +0200
@@ -15,6 +15,7 @@
     operatorSource: redhat-operators
   multiSourceConfig:
     enabled: false
+  analyticsUUID: foo
* Pristine environment:
$ make show
helm template common/operator-install/ --name-template common -f values-global.yaml --set main.git.repoURL="https://github.com/hybrid-cloud-patterns/common.git" --set main.git.revision=vp-paths
---
apiVersion: gitops.hybrid-cloud-patterns.io/v1alpha1
kind: Pattern
metadata:
  name: common
  namespace: openshift-operators
spec:
  clusterGroupName: example
  gitSpec:
    targetRepo: https://github.com/hybrid-cloud-patterns/common.git
    targetRevision: vp-paths
  gitOpsSpec:
    operatorChannel: gitops-1.8
    operatorSource: redhat-operators
  multiSourceConfig:
    enabled: false
...

* Add UUID to the environment

$ echo "vp-team-bandini" >> ~/.config/validated-patterns/pattern-uuid
$ make show
helm template common/operator-install/ --name-template common -f values-global.yaml --set main.git.repoURL="https://github.com/hybrid-cloud-patterns/common.git" --set main.git.revision=vp-paths  --set main.analyticsUUID=vp-team-bandini
---
apiVersion: gitops.hybrid-cloud-patterns.io/v1alpha1
kind: Pattern
metadata:
  name: common
  namespace: openshift-operators
spec:
  clusterGroupName: example
  gitSpec:
    targetRepo: https://github.com/hybrid-cloud-patterns/common.git
    targetRevision: vp-paths
  gitOpsSpec:
    operatorChannel: gitops-1.8
    operatorSource: redhat-operators
  multiSourceConfig:
    enabled: false
  analyticsUUID: vp-team-bandini

...
Add support for ~/.config/validated-patterns/pattern-uuid
@mbaldessari mbaldessari merged commit 7fad512 into validatedpatterns:main Sep 6, 2023
2 checks passed
mamurak pushed a commit to mamurak/industrial-edge that referenced this pull request Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant