https://rancher.com/ logo
Title
h

hundreds-sugar-37524

04/28/2023, 4:25 PM
Hey, I'm trying to deploy a basic app using raw manifests and fleet. One manifest is the namespace and the other one is my deployment. Is there a way to tell fleet to create the namespace first ? Is it a bad idea to manage the namespace with fleet ?
s

square-farmer-68052

04/28/2023, 5:34 PM
you could combine both manifests into one with namespace at the top.
h

hundreds-sugar-37524

05/03/2023, 6:47 AM
Thanks for your answer. I guess it works for my example but what if my app is more complex, like a custom configmap per environment, in different overlays/env folders ? I can't combine all manifest into one yaml file
s

square-farmer-68052

05/03/2023, 6:31 PM
then you need to use the
dependsOn
functionality in the fleet.yaml
­čĹŹ 1
# dependsOn allows you to configure dependencies to other bundles. The current bundle
# will only be deployed, after all dependencies are deployed and in a Ready state.
dependsOn:
  # Format: <GITREPO-NAME>-<BUNDLE_PATH> with all path separators replaced by "-"
  # Example: GitRepo name "one", Bundle path "/multi-cluster/hello-world" => "one-multi-cluster-hello-world"
  - name: one-multi-cluster-hello-world
  # Select bundles to depend on based on their label.
  - selector:
      matchLabels:
        app: weak-monkey
thats how you can get different bundles to be applied in a specific order
h

hundreds-sugar-37524

05/03/2023, 6:43 PM
I managed to split my app into two bundles so I can create the namespace first but I'm facing this issue: https://github.com/rancher/fleet/issues/1484. My second bundle is a helm chart and the namespace requires PSA annotations
s

square-farmer-68052

05/03/2023, 6:49 PM
can you add the annotations to the namespace manifest?
h

hundreds-sugar-37524

05/03/2023, 6:52 PM
I can but the second bundle tries to create the namespace while deploying the helm chart and fails as some annotations on the namespace are referring to the first bundle
s

square-farmer-68052

05/03/2023, 7:07 PM
doh
yeah that might need an RFE
hrmm
what about an overlay that patches the namespace?
# If using raw YAML these are names that map to overlays/{name} that will be used
  # to replace or patch a resource. If you wish to customize the file ./subdir/resource.yaml
  # then a file ./overlays/myoverlay/subdir/resource.yaml will replace the base file.
  # A file named ./overlays/myoverlay/subdir/resource_patch.yaml will patch the base file.
  # A patch can in JSON Patch or JSON Merge format or a strategic merge patch for builtin
  # Kubernetes types. Refer to "Raw YAML Resource Customization" below for more information.
  yaml:
    overlays:
    - custom2
    - custom3
so namespace.yaml and namespace_patch.yaml in the overlay that has the annotations it needs.
h

hundreds-sugar-37524

05/03/2023, 7:15 PM
i'm gonna try but I think the main issue is "When we install apps via fleet using the helm install way - this automatically creates the namespace for it" (From the issue linked above) and there is no way to disable or customize the namespace.